problem
stringlengths
26
131k
labels
class label
2 classes
SyntaxError: multiple statements found while compiling a single statement [Real Python Rookie] : <pre><code>i=9 while i&gt;0: for j in range(1,i+1): print(str(i)+"*"+str(j)+"="+str(i*j),end=" ") print("\n") i-- </code></pre> <p>SyntaxError: multiple statements found while compiling a single statement [Real Python Rookie]</p>
0debug
What are access modifiers : <p>Is their a difference between modifiers and specifiers. I want to clarify and make sure their is no difference between the 3. I have looked for answers everywhere but haven't had any luck with finding the answer. </p>
0debug
WebView loading blank screen in devices but working fine in emulator : <p>Enabled these two options for mywebview,</p> <pre><code>webV.getSettings().setJavaScriptEnabled(true); webV.getSettings().setDomStorageEnabled(true); </code></pre>
0debug
Jest transformIgnorePatterns not working : <p>I have spent a long time looking at other questions about this and looking at other projects on Github but none of the answers seem to work for me.</p> <p>I am loading a third party library in my project, and when running Jest tests I get the error</p> <pre><code>export default portalCommunication; ^^^^^^ SyntaxError: Unexpected token export &gt; 1 | import portalCommunication from 'mathletics-portal-communication-service'; </code></pre> <p>I have tried updating my Jest config in many ways to get it to transpile this library but I always get the same error.</p> <p>This is my current jest.config.js file:</p> <pre><code>module.exports = { moduleNameMapper: { '\\.(css|scss)$': 'identity-obj-proxy', '\\.svg$': '&lt;rootDir&gt;/test/mocks/svg-mock.js' }, setupFiles: ['./test/test-setup.js'], transformIgnorePatterns: [ '&lt;rootDir&gt;/node_modules/(?!mathletics-portal-communication-service)' ] }; </code></pre> <p>I have also tried adding the transform property to run babel-jest against this mathletics-portal-communication-service directory.</p> <p>Please help!</p>
0debug
static void qpci_pc_config_writeb(QPCIBus *bus, int devfn, uint8_t offset, uint8_t value) { outl(0xcf8, (1 << 31) | (devfn << 8) | offset); outb(0xcfc, value); }
1threat
troubles with arrays, index out of bounds exception : <p>So i've been at this problem for awhile, It's a piece of code that is suppose to display the data that has already been collected and sorted from the user. First ill post the code than ill post the error.</p> <pre><code>import java.util.Scanner; import java.util.*; public class project3 { private static double[] payrate; private static String[] names; public static void SortData(double payrate[]) { int first; int temp; int i; int j; for(i = payrate.length - 1; i &gt; 0; i--) { first = 0; for(j = 1; j&lt;=i;j++) { if(payrate[j]&lt;payrate[first]) first = j; } temp = (int)payrate[first]; payrate[first] = payrate[i]; payrate[i] = temp; } } public static void GetData() { Scanner input = new Scanner(System.in); System.out.println("How many names do you want to enter?"); String strNum = input.nextLine(); int num = Integer.parseInt(strNum); int array[] = new int[num]; for (int i = 0 ; i &lt; array.length ; i++ ) { names = new String[num]; System.out.println("enter employee's name: "); names[i] = input.nextLine(); //while(names[i].length &lt; 2) //{ //System.out.println("enter valid employee's name: "); //names[i] = input.nextLine(); //} } for(int j = 0; j &lt; array.length;j++) { payrate = new double[num]; System.out.println("enter employee's payrate: "); payrate[j] = input.nextDouble(); while(payrate[j] &gt; 100 || payrate[j] &lt; 0) { System.out.println("enter valid employee's payrate: "); payrate[j] = input.nextDouble(); } } } public static void DisplayData(double payrate[], String names[]) { int locationsum = 0; for (int l=1; l&lt;=names.length; l++) { locationsum = 0; locationsum+=payrate[l]; } for(int i=0;i&lt;names.length;i++) { System.out.print(names[i]); System.out.printf("%6d\n", locationsum); } } public static void main(String[] args) { GetData(); SortData(payrate); DisplayData(payrate,names); } } </code></pre> <p>I can't figure out a way to print out all of the stuff from the arrays, and with this way it keeps giving me this. The error I'm getting is : </p> <pre><code>Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 at project3.DisplayData(project3.java:77) at project3.main(project3.java:94) </code></pre>
0debug
def bitwise_xor(test_tup1, test_tup2): res = tuple(ele1 ^ ele2 for ele1, ele2 in zip(test_tup1, test_tup2)) return (res)
0debug
Remove specific element from array of specifc object : <p>I need to modify a nested array. In this example I would like to remove <code>content 2</code> from the target array of the object with the id <code>ZFrNsQKSY6ywSzYps</code></p> <pre><code>var array = [ { _id: "QKSY6ywSzYpsZFrNs", target: ["content 1"]} { _id: "ZFrNsQKSY6ywSzYps", target: ["content 1", "content 2"]} { _id: "SzYpsZFrNQKSY6yws", target: ["content 1"]} ] </code></pre> <p>I tried to use <code>find()</code> but with that I do not update the array. So this seems not to be the correct approach.</p>
0debug
def word_len(s): s = s.split(' ') for word in s: if len(word)%2!=0: return True else: return False
0debug
int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s) { char buf1[32], tuple_type[32]; int h, w, depth, maxval; pnm_get(s, buf1, sizeof(buf1)); s->type= buf1[1]-'0'; if(buf1[0] != 'P') return -1; if (s->type==1 || s->type==4) { avctx->pix_fmt = PIX_FMT_MONOWHITE; } else if (s->type==2 || s->type==5) { if (avctx->codec_id == CODEC_ID_PGMYUV) avctx->pix_fmt = PIX_FMT_YUV420P; else avctx->pix_fmt = PIX_FMT_GRAY8; } else if (s->type==3 || s->type==6) { avctx->pix_fmt = PIX_FMT_RGB24; } else if (s->type==7) { w = -1; h = -1; maxval = -1; depth = -1; tuple_type[0] = '\0'; for (;;) { pnm_get(s, buf1, sizeof(buf1)); if (!strcmp(buf1, "WIDTH")) { pnm_get(s, buf1, sizeof(buf1)); w = strtol(buf1, NULL, 10); } else if (!strcmp(buf1, "HEIGHT")) { pnm_get(s, buf1, sizeof(buf1)); h = strtol(buf1, NULL, 10); } else if (!strcmp(buf1, "DEPTH")) { pnm_get(s, buf1, sizeof(buf1)); depth = strtol(buf1, NULL, 10); } else if (!strcmp(buf1, "MAXVAL")) { pnm_get(s, buf1, sizeof(buf1)); maxval = strtol(buf1, NULL, 10); } else if (!strcmp(buf1, "TUPLTYPE") || !strcmp(buf1, "TUPLETYPE")) { pnm_get(s, tuple_type, sizeof(tuple_type)); } else if (!strcmp(buf1, "ENDHDR")) { break; } else { return -1; } } if (w <= 0 || h <= 0 || maxval <= 0 || depth <= 0 || tuple_type[0] == '\0' || av_image_check_size(w, h, 0, avctx)) return -1; avctx->width = w; avctx->height = h; if (depth == 1) { if (maxval == 1) avctx->pix_fmt = PIX_FMT_MONOWHITE; else avctx->pix_fmt = PIX_FMT_GRAY8; } else if (depth == 3) { if (maxval < 256) { avctx->pix_fmt = PIX_FMT_RGB24; } else { av_log(avctx, AV_LOG_ERROR, "16-bit components are only supported for grayscale\n"); avctx->pix_fmt = PIX_FMT_NONE; return -1; } } else if (depth == 4) { avctx->pix_fmt = PIX_FMT_RGB32; } else { return -1; } return 0; } else { return -1; } pnm_get(s, buf1, sizeof(buf1)); avctx->width = atoi(buf1); if (avctx->width <= 0) return -1; pnm_get(s, buf1, sizeof(buf1)); avctx->height = atoi(buf1); if(avctx->height <= 0 || av_image_check_size(avctx->width, avctx->height, 0, avctx)) return -1; if (avctx->pix_fmt != PIX_FMT_MONOWHITE) { pnm_get(s, buf1, sizeof(buf1)); s->maxval = atoi(buf1); if (s->maxval <= 0) { av_log(avctx, AV_LOG_ERROR, "Invalid maxval: %d\n", s->maxval); s->maxval = 255; } if (s->maxval >= 256) { if (avctx->pix_fmt == PIX_FMT_GRAY8) { avctx->pix_fmt = PIX_FMT_GRAY16BE; if (s->maxval != 65535) avctx->pix_fmt = PIX_FMT_GRAY16; } else if (avctx->pix_fmt == PIX_FMT_RGB24) { if (s->maxval > 255) avctx->pix_fmt = PIX_FMT_RGB48BE; } else { av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format\n"); avctx->pix_fmt = PIX_FMT_NONE; return -1; } } }else s->maxval=1; if (avctx->pix_fmt == PIX_FMT_YUV420P) { if ((avctx->width & 1) != 0) return -1; h = (avctx->height * 2); if ((h % 3) != 0) return -1; h /= 3; avctx->height = h; } return 0; }
1threat
Increment double pointer by 1 : I'm learning c pointers. There i have incremented double pointer by 1. then i could get as follows current ptr_double =0x0128 then i incremented it by 1 so ptr_double plus 8 bytes , That is 0x0128+8 which gives `0x0130` , But i'm unable to understand how `0x0130` comes. Please be kind enough to explain me. I know its stupid question. But i couldn't understand so far.
0debug
how to add extensions to vendor manually in yii2 : <p>i want to add <a href="https://github.com/postaddictme/instagram-php-scraper" rel="nofollow noreferrer">https://github.com/postaddictme/instagram-php-scraper</a> in yii2 .</p> <p>i copyed vendor from instagram-php-scraper project to yii2's vendor</p> <p>this is my error : </p> <blockquote> <p>Class 'InstagramScraper\Instagram' not found</p> </blockquote> <p>project extensions(instagram-php-scraper) is not developed for yii2 .</p> <p>What other changes should I do?</p>
0debug
Angular 2 Focus on first invalid input after Click/Event : <p>I have an odd requirement and was hoping for some help.</p> <p>I need to focus on the first found invalid input of a form after clicking a button (not submit). The form is rather large, and so the screen needs to scroll to the first invalid input.</p> <p>This AngularJS answer would be what I would need, but didn't know if a directive like this would be the way to go in Angular 2:</p> <p><a href="https://stackoverflow.com/questions/20365121/set-focus-on-first-invalid-input-in-angularjs-form">Set focus on first invalid input in AngularJs form</a></p> <p>What would be the Angular 2 way to do this? Thanks for all the help!</p>
0debug
Error in Swift code : first time playing about with Xcode. I get an error when trying to run my project, the error is as follows. Type CGFLoat has no member "random" var randomPosition = CGFloat.random (min: -200, max: 200) wallPair.position.y = wallPair.position.y + randomPosition wallPair.addChild(scoreNode) thanks in advanced
0debug
Javascript: Sort Object by value : <p>I have the following object: </p> <pre><code>{1234: "3.05", 1235: "2.03", 1236: "3.05"} </code></pre> <p>I would like to sort them by <strong>value</strong> to get something like this:</p> <pre><code>{1235: "2.03", 1234: "3.05", 1236: "3.05"} </code></pre> <p>I tried:</p> <pre><code>const sortedList = _.orderBy(myList, (value, key) =&gt; { return value; }, ['asc']); </code></pre> <p>The values get sorted but it is only a list of values:</p> <pre><code>{0: "2.03", 1: "3.05", 2: "3.05"} </code></pre> <p>How can I retain the keys?</p>
0debug
How to reset the use/password of jenkins on windows? : <p>Maybe a fool question, I installed jenkins on windows by default, have set no user/password, it worked at first, no need to login. But when launch the 8080 webpage now, it hangs the login page, I've tried some normal user/password combinations, none could pass. Also searched the resolution on website, only find some about linux, no about windows, so need help. <a href="http://i.stack.imgur.com/Y1MUM.png" rel="noreferrer">jenkins login page</a></p>
0debug
How can I receive an uploaded file using a Golang net/http server? : <p>I'm playing around with <a href="https://github.com/gorilla/mux" rel="noreferrer">Mux</a> and <code>net/http</code>. Lately, I'm trying to get a simple server with one endpoint to accept a file upload.</p> <p>Here's the code I've got so far:</p> <p><strong>server.go</strong></p> <pre><code>package main import ( "fmt" "github.com/gorilla/mux" "log" "net/http" ) func main() { router := mux.NewRouter() router. Path("/upload"). Methods("POST"). HandlerFunc(UploadCsv) fmt.Println("Starting") log.Fatal(http.ListenAndServe(":8080", router)) } </code></pre> <p><strong>endpoint.go</strong></p> <pre><code>package main import ( "fmt" "net/http" ) func UploadFile(w http.ResponseWriter, r *http.Request) { err := r.ParseMultipartForm(5 * 1024 * 1024) if err != nil { panic(err) } fmt.Println(r.FormValue("fileupload")) } </code></pre> <p>I think I've narrowed the issue down to actually retrieving the body from the request inside <code>UploadFile</code>. When I run this cURL command:</p> <pre><code>curl http://localhost:8080/upload -F "fileupload=@test.txt" -vvv </code></pre> <p>I get an empty response (as expected; I'm not printing to the <code>ResponseWriter</code>), but I just get a new (empty) line printed at the prompt where I'm running the server, instead of the request body.</p> <p>I'm sending the file as multipart (AFAIK, implied by using <code>-F</code> rather than <code>-d</code> in cURL), and cURL's verbose output is showing 502 bytes sent:</p> <pre><code>$ curl http://localhost:8080/upload -F "fileupload=@test.txt" -vvv * Trying ::1... * TCP_NODELAY set * Connected to localhost (::1) port 8080 (#0) &gt; POST /upload HTTP/1.1 &gt; Host: localhost:8080 &gt; User-Agent: curl/7.51.0 &gt; Accept: */* &gt; Content-Length: 520 &gt; Expect: 100-continue &gt; Content-Type: multipart/form-data; boundary=------------------------b578878d86779dc5 &gt; &lt; HTTP/1.1 100 Continue &lt; HTTP/1.1 200 OK &lt; Date: Fri, 18 Nov 2016 19:01:50 GMT &lt; Content-Length: 0 &lt; Content-Type: text/plain; charset=utf-8 &lt; * Curl_http_done: called premature == 0 * Connection #0 to host localhost left intact </code></pre> <p>What's the proper way to receive files uploaded as multipart form data using a <code>net/http</code> server in Go?</p>
0debug
Configure Apache with multiple ProxyPass : <p>i am trying to configure my apache server as proxy to serve two internal services , one listening on 8080 and should receive traffic on specific URL and the other listening on 8077 and should receive all other http traffic</p> <p>I deployed and configured apache on the same server where these two services running and it is listening to 443 along with all SSL configuration and it is working fine</p> <p>also I enabled the proxy_module, proxy_http_module and proxy_http2_module</p> <p>What I want to achieve </p> <p>if the requested URL is /webhook1 --> pass it to EP1 <a href="http://localhost:8080" rel="noreferrer">http://localhost:8080</a> and any other requested URL should be passed to EP2 <a href="http://localhost:8077" rel="noreferrer">http://localhost:8077</a></p> <p>My Current Configuration towards the first service </p> <pre><code>ProxyPass /webhook1 http://localhost:8080 ProxyPassReverse /webhook1 http://localhost:8080 </code></pre> <p>Now I want to define another proxy pass to be something like</p> <pre><code>ProxyPass / http://localhost:8077 ProxyPassReverse / http://localhost:8077 </code></pre> <p>putting both configuration together is not working , appreciate your help in how to configure apache to achieve my requirement</p> <p>Thank you in advance</p>
0debug
C program to convert decimal to binary using AND bitwise operator : <p>I have seen this code to convert decimal to binary using AND bitwise operator,and put the resulting binary number in an array to iterate over it later .since I'm new to C , I couldn't visualize the code </p> <p>For example if we have number (13) in decimal, which equals (1101) in binary ... what exactly happens inside this for loop ?!</p> <p><a href="https://i.stack.imgur.com/NXxLG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NXxLG.png" alt="C program to convert decimal to binary using AND bitwise operator"></a></p>
0debug
static void read_sbr_single_channel_element(AACContext *ac, SpectralBandReplication *sbr, GetBitContext *gb) { if (get_bits1(gb)) skip_bits(gb, 4); read_sbr_grid(ac, sbr, gb, &sbr->data[0]); read_sbr_dtdf(sbr, gb, &sbr->data[0]); read_sbr_invf(sbr, gb, &sbr->data[0]); read_sbr_envelope(sbr, gb, &sbr->data[0], 0); read_sbr_noise(sbr, gb, &sbr->data[0], 0); if ((sbr->data[0].bs_add_harmonic_flag = get_bits1(gb))) get_bits1_vector(gb, sbr->data[0].bs_add_harmonic, sbr->n[1]); }
1threat
Make SLE 5542 Smart Cards Read Only After Binary Write Using APDU : <p>Excited to ask my first question over here... so here goes.. </p> <p>I am Currently working with the Composite Smart Cards (one with both the NFC MIFARE 1k And Chip Encode ) SLE 5542,</p> <p>So far i have managed to perform the following task with the MIFARE</p> <ol> <li><p>Read write of values in Blocks of the sector </p></li> <li><p>changing the access bits and authentication key A and B for the sector trails so as manage the access control of the sector of the block in which i have written so that i can make my values read only.</p></li> </ol> <p>As for the Chip Encode i have managed to .</p> <p>Performing read write in the Contact Chip using READ BINARY AND WRITE BINARY APDU commands.</p> <p>But Now i am stuck in the process of making the values written in the chip to be readonly , </p> <p>I found a <a href="http://www.acs.com.hk/download-manual/6009/TDS_SLE5542.pdf" rel="nofollow">document</a> over the internet in which under the Circuit Description it is telling about the need of PSC And Protection Memory for the read protection of the Data Memory</p> <p>But can not find the exact APDU Commands and the right way of the read write protection of the data memory.</p> <p>P.S Let me know if you need any further clarifications</p>
0debug
Logical help to get arranged data from python lists? : <p>I have an problem to solve but i am getting confused on how to resolve it I have two list with some data corresponding to each other.</p> <pre><code>For ex: A a1 A a2 A a3 B b1 B b2 B a1 A c1 A c2 C c1 C c2 C c3 C c4 D b1 </code></pre> <p>I want to solve above problem like :-</p> <pre><code>ID Count Data A 3 a1,a2,a3 B 2 b1 b2 B 1 a1 A 1 c1 A 1 c1 C 4 c1, c2, c3, c4 D 1 b1 </code></pre>
0debug
Get from string with regular expression : <p>I need to extract from string </p> <blockquote> <p><code>userAllowedCrud['create']</code> the part that is inside <code>[]</code>.</p> </blockquote> <p>i think using regular expression is the better way to do it. Am i wrong?</p>
0debug
open Source REST API monitoring tool for Web Services : <p>I am looking for an Open Source API monitoring tool for RESTful Web service. Like whether the API is live, down, the performance of the API, Alert by email or phone call when a REST API is down.</p> <p>I have seen many licensed API monitoring tools. But I am looking for free opensource product and a good one.</p>
0debug
void qemu_co_rwlock_rdlock(CoRwlock *lock) { while (lock->writer) { qemu_co_queue_wait(&lock->queue); } lock->reader++; }
1threat
static coroutine_fn int hdev_co_write_zeroes(BlockDriverState *bs, int64_t sector_num, int nb_sectors, BdrvRequestFlags flags) { BDRVRawState *s = bs->opaque; int rc; rc = fd_open(bs); if (rc < 0) { return rc; } if (!(flags & BDRV_REQ_MAY_UNMAP)) { return -ENOTSUP; } if (!s->discard_zeroes) { return -ENOTSUP; } return paio_submit_co(bs, s->fd, sector_num, NULL, nb_sectors, QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV); }
1threat
Angular 2: No provider for (injected) service : <p>I have two services in my app - MainService and RightClickService. Only MainService is accessible globally in the application, and RightClickService is injected to MainService. Therefore, I defined the following files as: </p> <p><strong>app.module.ts</strong></p> <pre><code>@NgModule({ declarations: [ AppComponent, ... ], imports: [ BrowserModule, FormsModule, HttpModule ], providers: [MainService], bootstrap: [AppComponent] }) export class AppModule { } </code></pre> <p>RightClickService is not mentioned in app.module.ts.</p> <p><strong>service.ts</strong></p> <pre><code> @Injectable() export class MainService { constructor(private rightClickService: RightClickService) { console.log("Constructor is init"); } } </code></pre> <p>RightClickService exists only in one component named inside the big application RightClickComponent. </p> <p><strong>right-click.component.ts:</strong></p> <pre><code>@Component({ selector: 'right-click', template: ` ... `, styleUrls: ['...'], providers: [RightClickService] }) export class RightClickComponent implements OnInit { constructor(private rightClickService: RightClickService) {} } </code></pre> <p>Still, I get the error:</p> <pre><code>EXCEPTION: No provider for RightClickService! </code></pre> <p>Do you know what I'm doing wrong? </p>
0debug
tensorflow: Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob` : <p>I get this warning most of the time when i define a model using Keras. It seems to somehow come from tensorflow though:</p> <pre><code>WARNING:tensorflow:From C:\Users\lenik\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\backend\tensorflow_backend.py:3445: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version. Instructions for updating: Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`. </code></pre> <p>Is this warning something to worry about? If yes, how do i solve this problem?</p>
0debug
VirtIODevice *virtio_net_init(DeviceState *dev) { VirtIONet *n; static int virtio_net_id; n = (VirtIONet *)virtio_common_init("virtio-net", VIRTIO_ID_NET, sizeof(struct virtio_net_config), sizeof(VirtIONet)); n->vdev.get_config = virtio_net_get_config; n->vdev.set_config = virtio_net_set_config; n->vdev.get_features = virtio_net_get_features; n->vdev.set_features = virtio_net_set_features; n->vdev.bad_features = virtio_net_bad_features; n->vdev.reset = virtio_net_reset; n->rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx); n->tx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_tx); n->ctrl_vq = virtio_add_queue(&n->vdev, 16, virtio_net_handle_ctrl); qdev_get_macaddr(dev, n->mac); n->status = VIRTIO_NET_S_LINK_UP; n->vc = qdev_get_vlan_client(dev, virtio_net_can_receive, virtio_net_receive, NULL, virtio_net_cleanup, n); n->vc->link_status_changed = virtio_net_set_link_status; qemu_format_nic_info_str(n->vc, n->mac); n->tx_timer = qemu_new_timer(vm_clock, virtio_net_tx_timer, n); n->tx_timer_active = 0; n->mergeable_rx_bufs = 0; n->promisc = 1; n->mac_table.macs = qemu_mallocz(MAC_TABLE_ENTRIES * ETH_ALEN); n->vlans = qemu_mallocz(MAX_VLAN >> 3); register_savevm("virtio-net", virtio_net_id++, VIRTIO_NET_VM_VERSION, virtio_net_save, virtio_net_load, n); return &n->vdev; }
1threat
How does `git checkout .` work : <p>I've used <code>git checkout .</code> to delete local changes from my working index. </p> <p>Does anyone know what <code>git</code> is doing under the hood™?</p>
0debug
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
static void xilinx_axidma_init(Object *obj) { XilinxAXIDMA *s = XILINX_AXI_DMA(obj); SysBusDevice *sbd = SYS_BUS_DEVICE(obj); Error *errp = NULL; object_property_add_link(obj, "axistream-connected", TYPE_STREAM_SLAVE, (Object **) &s->tx_dev, NULL); object_initialize(&s->rx_data_dev, TYPE_XILINX_AXI_DMA_DATA_STREAM); object_property_add_child(OBJECT(s), "axistream-connected-target", (Object *)&s->rx_data_dev, &errp); assert_no_error(errp); sysbus_init_irq(sbd, &s->streams[0].irq); sysbus_init_irq(sbd, &s->streams[1].irq); memory_region_init_io(&s->iomem, &axidma_ops, s, "xlnx.axi-dma", R_MAX * 4 * 2); sysbus_init_mmio(sbd, &s->iomem); }
1threat
void helper_sysexit(CPUX86State *env, int dflag) { int cpl; cpl = env->hflags & HF_CPL_MASK; if (env->sysenter_cs == 0 || cpl != 0) { raise_exception_err(env, EXCP0D_GPF, 0); } cpu_x86_set_cpl(env, 3); #ifdef TARGET_X86_64 if (dflag == 2) { cpu_x86_load_seg_cache(env, R_CS, ((env->sysenter_cs + 32) & 0xfffc) | 3, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK | DESC_L_MASK); cpu_x86_load_seg_cache(env, R_SS, ((env->sysenter_cs + 40) & 0xfffc) | 3, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_W_MASK | DESC_A_MASK); } else #endif { cpu_x86_load_seg_cache(env, R_CS, ((env->sysenter_cs + 16) & 0xfffc) | 3, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_CS_MASK | DESC_R_MASK | DESC_A_MASK); cpu_x86_load_seg_cache(env, R_SS, ((env->sysenter_cs + 24) & 0xfffc) | 3, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | (3 << DESC_DPL_SHIFT) | DESC_W_MASK | DESC_A_MASK); } env->regs[R_ESP] = env->regs[R_ECX]; env->eip = env->regs[R_EDX]; }
1threat
How to reproduce this shape android studio? : I'm working on a recyclerview and i want to add a half line + picture +half line before it, but i have no idea of how to reproduce it. Can you please help me to get a similar shape ?[half line + pictogram + half line][1] [1]: https://i.stack.imgur.com/jaBCr.png
0debug
In echarts3, how to force axis labels to display : <p>Echarts seems to have a nice feature that automatically chooses which labels to display depending on the space provided. However, this algorithm seems to be bit too aggressive at times and does not take into account text rotate. I've gone through the chart options and there doesn't appear to be a way to disable this feature. I'm hoping it's just something I've overlooked. Help appreciated.</p>
0debug
npm install - javascript heap out of memory : <p>When running <code>npm install -g ionic</code> I get the following error:</p> <blockquote> <p>FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory</p> </blockquote> <p>Is there a way to globally increase the node.js memory limit?</p>
0debug
FAB Button using on ActionBar : <p>I have a problem. I'm working an android project and I want to using FAB button in ActionBar. Just like ActionBar item. Is it possible or impossible? I'm looking for a lot tutorial but I've never seen just like I want.. Thanks a lot.</p>
0debug
static int nbd_co_send_request(BlockDriverState *bs, NBDRequest *request, QEMUIOVector *qiov) { NBDClientSession *s = nbd_get_client_session(bs); int rc, ret, i; qemu_co_mutex_lock(&s->send_mutex); while (s->in_flight == MAX_NBD_REQUESTS) { qemu_co_queue_wait(&s->free_sema, &s->send_mutex); } s->in_flight++; for (i = 0; i < MAX_NBD_REQUESTS; i++) { if (s->recv_coroutine[i] == NULL) { s->recv_coroutine[i] = qemu_coroutine_self(); break; } } g_assert(qemu_in_coroutine()); assert(i < MAX_NBD_REQUESTS); request->handle = INDEX_TO_HANDLE(s, i); if (!s->ioc) { qemu_co_mutex_unlock(&s->send_mutex); return -EPIPE; } if (qiov) { qio_channel_set_cork(s->ioc, true); rc = nbd_send_request(s->ioc, request); if (rc >= 0) { ret = nbd_wr_syncv(s->ioc, qiov->iov, qiov->niov, request->len, false, NULL); if (ret != request->len) { rc = -EIO; } } qio_channel_set_cork(s->ioc, false); } else { rc = nbd_send_request(s->ioc, request); } qemu_co_mutex_unlock(&s->send_mutex); return rc; }
1threat
static void choose_sample_fmt(AVStream *st, AVCodec *codec) { if (codec && codec->sample_fmts) { const enum AVSampleFormat *p = codec->sample_fmts; for (; *p != -1; p++) { if (*p == st->codec->sample_fmt) break; } if (*p == -1) { av_log(NULL, AV_LOG_WARNING, "Incompatible sample format '%s' for codec '%s', auto-selecting format '%s'\n", av_get_sample_fmt_name(st->codec->sample_fmt), codec->name, av_get_sample_fmt_name(codec->sample_fmts[0])); st->codec->sample_fmt = codec->sample_fmts[0]; } } }
1threat
static int hdcd_integrate(HDCDContext *ctx, hdcd_state_t *state, int *flag, const int32_t *samples, int count, int stride) { uint32_t bits = 0; int result = FFMIN(state->readahead, count); int i; *flag = 0; for (i = result - 1; i >= 0; i--) { bits |= (*samples & 1) << i; samples += stride; } state->window = (state->window << result) | bits; state->readahead -= result; if (state->readahead > 0) return result; bits = (state->window ^ state->window >> 5 ^ state->window >> 23); if (state->arg) { if ((bits & 0x0fa00500) == 0x0fa00500) { if ((bits & 0xc8) == 0) { state->control = (bits & 255) + (bits & 7); *flag = 1; state->code_counterA++; } else { state->code_counterA_almost++; av_log(ctx->fctx, AV_LOG_VERBOSE, "hdcd error: Control A almost: 0x%02x near %d\n", bits & 0xff, ctx->sample_count); } } else if ((bits & 0xa0060000) == 0xa0060000) { if (((bits ^ (~bits >> 8 & 255)) & 0xffff00ff) == 0xa0060000) { state->control = bits >> 8 & 255; *flag = 1; state->code_counterB++; } else { state->code_counterB_checkfails++; av_log(ctx->fctx, AV_LOG_VERBOSE, "hdcd error: Control B check failed: 0x%04x (0x%02x vs 0x%02x) near %d\n", bits & 0xffff, (bits & 0xff00) >> 8, ~bits & 0xff, ctx->sample_count); } } else { state->code_counterC_unmatched++; av_log(ctx->fctx, AV_LOG_VERBOSE, "hdcd error: Unmatched code: 0x%08x near %d\n", bits, ctx->sample_count); } if (*flag) hdcd_update_info(state); state->arg = 0; } if (bits == 0x7e0fa005 || bits == 0x7e0fa006) { state->readahead = (bits & 3) * 8; state->arg = 1; state->code_counterC++; } else { if (bits) state->readahead = readaheadtab[bits & 0xff]; else state->readahead = 31; } return result; }
1threat
static void do_ext_interrupt(CPUS390XState *env) { S390CPU *cpu = s390_env_get_cpu(env); uint64_t mask, addr; LowCore *lowcore; ExtQueue *q; if (!(env->psw.mask & PSW_MASK_EXT)) { cpu_abort(CPU(cpu), "Ext int w/o ext mask\n"); } if (env->ext_index < 0 || env->ext_index > MAX_EXT_QUEUE) { cpu_abort(CPU(cpu), "Ext queue overrun: %d\n", env->ext_index); } q = &env->ext_queue[env->ext_index]; lowcore = cpu_map_lowcore(env); lowcore->ext_int_code = cpu_to_be16(q->code); lowcore->ext_params = cpu_to_be32(q->param); lowcore->ext_params2 = cpu_to_be64(q->param64); lowcore->external_old_psw.mask = cpu_to_be64(get_psw_mask(env)); lowcore->external_old_psw.addr = cpu_to_be64(env->psw.addr); lowcore->cpu_addr = cpu_to_be16(env->cpu_num | VIRTIO_SUBCODE_64); mask = be64_to_cpu(lowcore->external_new_psw.mask); addr = be64_to_cpu(lowcore->external_new_psw.addr); cpu_unmap_lowcore(lowcore); env->ext_index--; if (env->ext_index == -1) { env->pending_int &= ~INTERRUPT_EXT; } DPRINTF("%s: %" PRIx64 " %" PRIx64 "\n", __func__, env->psw.mask, env->psw.addr); load_psw(env, mask, addr); }
1threat
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
Replace with .lengthCompare warning : <p>IntelliJ keep suggesting to replace <code>.length == X</code> with <code>.lengthCompare(X) == 0</code>. Why is that better? Don't quite get it, since the suggested changes are more verbose. </p> <p><a href="https://i.stack.imgur.com/I6h7N.png" rel="noreferrer"><img src="https://i.stack.imgur.com/I6h7N.png" alt="enter image description here"></a></p>
0debug
the redirection page doesnt work proper ?in php with phpmyadmin : i have written my code in php as well as in html for my final project which is the the course registration system for the collage my problem is if i need to redirect the page for one user it works but later when i used the switch statement for redirect a different pages based on role by retrive the data from the phpmyadmin it dosent work here is my code ; ------------------------------------------------------------------------ <?php $host="localhost"; $username="root"; $password=""; $db="login"; mysql_connect($host,$username,$password); mysql_select_db($db); if(isset($_POST['username'])){ $username= $_POST['username']; $password= $_POST['password']; $sql="select * from loginform where username='$username' AND password='$password' "; $result=mysql_query($sql); $result=mysql_query($role); $role="SELECT * FROM loginform username='$username' AND password='$password'"; if(mysql_num_rows($result)==1){ session_start(); switch($role) { case 1: $_SESSION['role']='admin'; header("Location: http://localhost/test/form1.html"); break; case 2: $_SESSION['role']='faculty'; header("Location: http://localhost/test/faculty.html"); break; case 2: $_SESSION['role']='student'; header("Location: http://localhost/test/student.html"); break; } echo " You Have Successfully Logged in"; exit(); } else{ $message='Worning !!! ...Incorrect UserName or PassWord'; echo "<script type='text/javascript'>alert('$message');</script>"; exit(); header("Location: http://localhost/test/loginn.php"); } } ?>
0debug
How do we overcome the compile time and runtime gap when programming in a Dependently Typed Language? : <p>I'm told that in dependent type system, "types" and "values" is mixed, and we can treat both of them as "terms" instead.</p> <p>But there is something I can't understand: in a strongly typed programming language without Dependent Type (like Haskell), Types is decided (infered or checked) at <strong>compile time</strong>, but values is decided (computed or inputed) at <strong>runtime</strong>.</p> <p>I think there must be a gap between these two stages. Just think that if a value is interactively read from STDIN, how can we reference this value in a type which must be decided AOT?</p> <p>e.g. There is a natural number <code>n</code> and a list of natural number <code>xs</code> (which contains n elements) which I need to read from STDIN, how can I put them into a data structure <code>Vect n Nat</code>?</p>
0debug
Python 2: Get network share path from drive letter : <p>If I use the following to get the list of all connected drives:</p> <pre><code>available_drives = ['%s:' % d for d in string.ascii_uppercase if os.path.exists('%s:' % d)] </code></pre> <p>How do I get the UNC path of the connected drives?</p> <p><code>os.path</code> just returns <code>z:\</code> instead of <code>\share\that\was\mapped\to\z</code></p>
0debug
android billing how to enable enablePendingPurchases() : <p>I've moved from an old gradle of billing api, to the most recent to date, and now I've tried adding </p> <pre><code> BillingClient.Builder enablePendingPurchases = BillingClient.newBuilder(this).setListener(this); </code></pre> <p>but I can not get it to work, here's the error</p> <pre><code> Caused by: java.lang.IllegalArgumentException: Support for pending purchases must be enabled. Enable this by calling 'enablePendingPurchases()' on BillingClientBuilder. at com.android.billingclient.api.BillingClient$Builder.build(BillingClient.java:309) at com.aplicacion.vivaluganoapp.ar.ponerDineroActivity.setupBillingClient(ponerDineroActivity.java:144) at com.aplicacion.vivaluganoapp.ar.ponerDineroActivity.onCreate(ponerDineroActivity.java:125) </code></pre> <p>complete code:</p> <pre><code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_poner_dinero); recyclerProduct.setHasFixedSize(true); recyclerProduct.setLayoutManager(new LinearLayoutManager(this)); BillingClient.Builder enablePendingPurchases = BillingClient.newBuilder(this).setListener(this); enablePendingPurchases.build(); setupBillingClient(); } private void setupBillingClient() { billingClient = BillingClient.newBuilder (this).setListener(this).build(); billingClient.startConnection(new BillingClientStateListener() { @Override public void onBillingSetupFinished(BillingResult responseCode) { int maca = BillingClient.BillingResponseCode.OK; String maca2 = String.valueOf(maca); String maca3 = String.valueOf(responseCode); if (maca3 == maca2) { Toast.makeText(ponerDineroActivity.this, "WORKS", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(ponerDineroActivity.this, "ERROR", Toast.LENGTH_SHORT).show(); } } @Override public void onBillingServiceDisconnected() { Toast.makeText(ponerDineroActivity.this, "Disconnected from Billing", Toast.LENGTH_SHORT).show(); } }); } </code></pre> <p>if I place only:</p> <pre><code>BillingClient.Builder enablePendingPurchases = BillingClient.newBuilder(this); </code></pre> <p>the error is:</p> <pre><code>Caused by: java.lang.IllegalArgumentException: Please provide a valid listener for purchases updates. </code></pre> <p>any help? i'm tired of trying</p>
0debug
Using a GPU both as video card and GPGPU : <p>Where I work, we do a lot of numerical computations and we are considering buying workstations with NVIDIA video cards because of CUDA (to work with TensorFlow and Theano).</p> <p>My question is: should these computers come with another video card to handle the display and free the NVIDIA for the GPGPU?</p> <p>I would appreciate if anyone knows of hard data on using a video card for display and GPGPU at the same time.</p>
0debug
static uint64_t get_cluster_offset(BlockDriverState *bs, uint64_t offset, int allocate) { BDRVVmdkState *s = bs->opaque; unsigned int l1_index, l2_offset, l2_index; int min_index, i, j; uint32_t min_count, *l2_table, tmp; uint64_t cluster_offset; l1_index = (offset >> 9) / s->l1_entry_sectors; if (l1_index >= s->l1_size) return 0; l2_offset = s->l1_table[l1_index]; if (!l2_offset) return 0; for(i = 0; i < L2_CACHE_SIZE; i++) { if (l2_offset == s->l2_cache_offsets[i]) { if (++s->l2_cache_counts[i] == 0xffffffff) { for(j = 0; j < L2_CACHE_SIZE; j++) { s->l2_cache_counts[j] >>= 1; } } l2_table = s->l2_cache + (i * s->l2_size); goto found; } } min_index = 0; min_count = 0xffffffff; for(i = 0; i < L2_CACHE_SIZE; i++) { if (s->l2_cache_counts[i] < min_count) { min_count = s->l2_cache_counts[i]; min_index = i; } } l2_table = s->l2_cache + (min_index * s->l2_size); if (bdrv_pread(s->hd, (int64_t)l2_offset * 512, l2_table, s->l2_size * sizeof(uint32_t)) != s->l2_size * sizeof(uint32_t)) return 0; s->l2_cache_offsets[min_index] = l2_offset; s->l2_cache_counts[min_index] = 1; found: l2_index = ((offset >> 9) / s->cluster_sectors) % s->l2_size; cluster_offset = le32_to_cpu(l2_table[l2_index]); if (!cluster_offset) { struct stat file_buf; if (!allocate) return 0; stat(s->hd->filename, &file_buf); cluster_offset = file_buf.st_size; bdrv_truncate(s->hd, cluster_offset + (s->cluster_sectors << 9)); cluster_offset >>= 9; tmp = cpu_to_le32(cluster_offset); l2_table[l2_index] = tmp; if (bdrv_pwrite(s->hd, ((int64_t)l2_offset * 512) + (l2_index * sizeof(tmp)), &tmp, sizeof(tmp)) != sizeof(tmp)) return 0; if (s->l1_backup_table_offset != 0) { l2_offset = s->l1_backup_table[l1_index]; if (bdrv_pwrite(s->hd, ((int64_t)l2_offset * 512) + (l2_index * sizeof(tmp)), &tmp, sizeof(tmp)) != sizeof(tmp)) return 0; } if (get_whole_cluster(bs, cluster_offset, offset, allocate) == -1) return 0; } cluster_offset <<= 9; return cluster_offset; }
1threat
Remove navigation bar on Xamarin Forms app with Caliburn.Micro : <p>When using the <code>FormsApplication</code> base class with a brand new Xamarin.Forms app using Caliburn.Micro, I end up with an empty navigation bar at the top of my screen. I assume it's being created by Caliburn.Micro somehow, because an out-of-the-box Xamarin.Forms app doesn't have that.</p> <p>Is there any way I can use Caliburn.Micro with Xamarin.Forms without this navigation bar?</p>
0debug
how to Handle diveded by zer error in sql : cast(CAST(countAta AS float) / CAST(DATEDIFF(day,@searchDate,@EndDate)AS float) as decimal(16,2))
0debug
Nodemon - "clean exit - waiting for changes before restart" during setup : <p>I am trying to set up a RESTful API with Node and Postgres. I have run into a problem where whenever I attempt to run the server (using npm start) to test it locally, I get the following output:</p> <blockquote> <p>[nodemon] 1.14.10 [nodemon] to restart at any time, enter <code>rs</code> [nodemon] watching: <em>.</em> [nodemon] starting <code>node index.js server.js</code> [nodemon] clean exit - waiting for changes before restart</p> </blockquote> <p>After searching online for quite some time, I cannot find too many resources on what exactly "clean exit - waiting for changes before restart" exactly means, especially in this case.</p> <p>This is my queries.js file:</p> <pre><code> 1 var promise = require('bluebird'); 2 3 var options = { 4 // Initialization Options 5 promiseLib: promise 6 }; 7 8 // created an instance of pg-promise, override default pgp lib w bluebird 9 var pgp = require('pg-promise')(options); 10 var connectionString = 'postgres://localhost:3000/actions'; 11 var db = pgp(connectionString); 12 13 // add query functions 14 15 module.exports = { 16 getAllActions: getAllActions, 17 // getSingleAction: getSingleAction, 18 // createAction: createAction, 19 // updateAction: updateAction, 20 // removeAction: removeAction 21 }; 22 23 function getAllActions(req, res, next) { 24 db.any('select * from acts') 25 .then(function (data) { 26 res.status(200) 27 .json({ 28 status: 'success', 29 data: data, 30 message: 'Retrieved ALL actions' 31 }); 32 }) 33 .catch(function (err) { 34 return next(err); 35 }); 36 } </code></pre> <p>Here is my index.js file: </p> <pre><code> 3 var express = require('express'); 4 var app = express(); 5 var router = express.Router(); 6 var db = require('./queries'); 7 8 // structure: expressInstance.httpRequestMethod(PATH, HANDLER) 9 app.get('/api/actions', db.getAllActions); 10 //app.get('/api/actions/:id', db.getSingleAction); 11 //app.post('/api/actions', db.createAction); 12 //app.put('/api/actions/:id', db.updateAction); 13 //app.delete('/api/actions/:id', db.removeAction); 14 15 module.exports = router; </code></pre> <p>Any thoughts on what could be going on here? Thanks in advance.</p>
0debug
static int svq1_decode_frame(AVCodecContext *avctx, void *data, int *data_size, UINT8 *buf, int buf_size) { MpegEncContext *s=avctx->priv_data; uint8_t *current, *previous; int result, i, x, y, width, height; AVFrame *pict = data; init_get_bits(&s->gb,buf,buf_size); s->f_code = get_bits (&s->gb, 22); if ((s->f_code & ~0x70) || !(s->f_code & 0x60)) return -1; if (s->f_code != 0x20) { uint32_t *src = (uint32_t *) (buf + 4); for (i=0; i < 4; i++) { src[i] = ((src[i] << 16) | (src[i] >> 16)) ^ src[7 - i]; } } result = svq1_decode_frame_header (&s->gb, s); if (result != 0) { #ifdef DEBUG_SVQ1 printf("Error in svq1_decode_frame_header %i\n",result); #endif return result; } if(s->pict_type==B_TYPE && s->last_picture.data[0]==NULL) return buf_size; if(avctx->hurry_up && s->pict_type==B_TYPE) return buf_size; if(MPV_frame_start(s, avctx) < 0) return -1; for (i=0; i < 3; i++) { int linesize; if (i == 0) { width = (s->width+15)&~15; height = (s->height+15)&~15; linesize= s->linesize; } else { if(s->flags&CODEC_FLAG_GRAY) break; width = (s->width/4+15)&~15; height = (s->height/4+15)&~15; linesize= s->uvlinesize; } current = s->current_picture.data[i]; if(s->pict_type==B_TYPE){ previous = s->next_picture.data[i]; }else{ previous = s->last_picture.data[i]; } if (s->pict_type == I_TYPE) { for (y=0; y < height; y+=16) { for (x=0; x < width; x+=16) { result = svq1_decode_block_intra (&s->gb, &current[x], linesize); if (result != 0) { #ifdef DEBUG_SVQ1 printf("Error in svq1_decode_block %i (keyframe)\n",result); #endif return result; } } current += 16*linesize; } } else { svq1_pmv_t pmv[width/8+3]; memset (pmv, 0, ((width / 8) + 3) * sizeof(svq1_pmv_t)); for (y=0; y < height; y+=16) { for (x=0; x < width; x+=16) { result = svq1_decode_delta_block (s, &s->gb, &current[x], previous, linesize, pmv, x, y); if (result != 0) { #ifdef DEBUG_SVQ1 printf("Error in svq1_decode_delta_block %i\n",result); #endif return result; } } pmv[0].x = pmv[0].y = 0; current += 16*linesize; } } } *pict = *(AVFrame*)&s->current_picture; MPV_frame_end(s); *data_size=sizeof(AVFrame); return buf_size; }
1threat
Gettting error for invalid identifier : SELECT emp. email_01 as online_id, emp. email_02 as primary_id, dept. email_03 as secondary_id from (select distinct emp. email_01 as online_id, emp. email_02 as primary_id, dept. email_03 as secondary_id from emp, dept where emp.id=dept.id)
0debug
static void pci_device_class_init(ObjectClass *klass, void *data) { DeviceClass *k = DEVICE_CLASS(klass); k->init = pci_qdev_init; k->exit = pci_unregister_device; k->bus_type = TYPE_PCI_BUS; k->props = pci_props; }
1threat
I have Haslell Directions and how to make it Ints? : <p>I have Directions and I step 1 like that</p> <p>THis is the directions:</p> <pre><code> North (x,y) = (x,y+1) East (x,y) = (x+1,y) South (x,y) = (x, y-1) West (x,y) = (x-1, y) </code></pre> <p>How to implement like that?</p> <pre><code> f13 :: [Dir] -&gt; (Int,Int) f13 [North, North] == (0,2) f13 [North, East, South, West] == (0,0) f13 (replicate 10 East) == (10,0) </code></pre> <p>My code:</p> <pre><code>a = 0 b = 0 f13 :: [Dir] -&gt; (Int,Int) --f13 xs = (a,b+1) f13 xs | xs == North = (a,b+1) | xs == East = (a+1,b) | xs == South = (a,b-1) | xs == West = (a-1,b) | otherwise = (a,b) </code></pre>
0debug
Angular 2 event when any [routerLink] is clicked : <p>I have a simple Loader Service that hides and shows certain loaders. I'm working on something that will be used a lot with slow connections and I need to show/hide a loader between route changes. </p> <p>I can hide the loader when the new route is loaded with the following.</p> <pre><code>this._Router.subscribe(() =&gt; { this._LoaderService.hide(); }) </code></pre> <p>I'm trying to find a way that I can call my <code>this._LoaderService.show()</code> function immediately when any [routerLink] is clicked (at the start of the route change, not the end).</p> <p>I've had a look around and I tried <a href="https://angular.io/docs/ts/latest/api/router/Router-class.html" rel="noreferrer">https://angular.io/docs/ts/latest/api/router/Router-class.html</a> but I can't seem to figure it out.</p> <p>Any help appreciated</p>
0debug
QEMUFile *qemu_fopen_socket(int fd, const char *mode) { QEMUFileSocket *s; if (qemu_file_mode_is_not_valid(mode)) { return NULL; } s = g_malloc0(sizeof(QEMUFileSocket)); s->fd = fd; if (mode[0] == 'w') { qemu_set_block(s->fd); s->file = qemu_fopen_ops(s, &socket_write_ops); } else { s->file = qemu_fopen_ops(s, &socket_read_ops); } return s->file; }
1threat
Angular2: How do you mark FormGroup control dirty via `patchValue()` : <p>I am updating a Reactive <code>FormGroup</code> control value from my component via <a href="https://angular.io/docs/ts/latest/api/forms/index/FormGroup-class.html#!#patchValue" rel="noreferrer">patchValue</a>.</p> <p>Ex:</p> <pre><code>this.myForm.patchValue({incidentDate:'2016-09-12'); </code></pre> <p>This works great and triggers a <code>valueChanges</code> event, however this control's <code>dirty</code> property is still <code>false</code>.</p> <p>I need the <code>incidentDate</code> control to be <code>dirty</code> so my validation logic knows to run against this control.</p> <p>How do I update the value of a control from my component AND indicate that it is dirty?</p> <p>Here is my validation logic:</p> <pre><code>onValueChanged(data?: any) { if (!this.myForm) { return; } const form = this.myForm; for (const field in this.formErrors) { // clear previous error message (if any) this.formErrors[field] = ''; const control = form.get(field); if (control &amp;&amp; control.dirty &amp;&amp; !control.valid) { const messages: any = this.validationMessages[field]; for (const key in control.errors) { this.formErrors[field] += messages[key] + ' '; } } } } </code></pre>
0debug
static void adx_decode(ADXContext *c, int16_t *out, const uint8_t *in, int ch) { ADXChannelState *prev = &c->prev[ch]; GetBitContext gb; int scale = AV_RB16(in); int i; int s0, s1, s2, d; init_get_bits(&gb, in + 2, (18 - 2) * 8); s1 = prev->s1; s2 = prev->s2; for (i = 0; i < 32; i++) { d = get_sbits(&gb, 4); s0 = (BASEVOL * d * scale + SCALE1 * s1 - SCALE2 * s2) >> 14; s2 = s1; s1 = av_clip_int16(s0); *out = s1; out += c->channels; } prev->s1 = s1; prev->s2 = s2; }
1threat
qcrypto_tls_session_new(QCryptoTLSCreds *creds, const char *hostname, const char *aclname, QCryptoTLSCredsEndpoint endpoint, Error **errp) { QCryptoTLSSession *session; int ret; session = g_new0(QCryptoTLSSession, 1); trace_qcrypto_tls_session_new( session, creds, hostname ? hostname : "<none>", aclname ? aclname : "<none>", endpoint); if (hostname) { session->hostname = g_strdup(hostname); } if (aclname) { session->aclname = g_strdup(aclname); } session->creds = creds; object_ref(OBJECT(creds)); if (creds->endpoint != endpoint) { error_setg(errp, "Credentials endpoint doesn't match session"); goto error; } if (endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) { ret = gnutls_init(&session->handle, GNUTLS_SERVER); } else { ret = gnutls_init(&session->handle, GNUTLS_CLIENT); } if (ret < 0) { error_setg(errp, "Cannot initialize TLS session: %s", gnutls_strerror(ret)); goto error; } if (object_dynamic_cast(OBJECT(creds), TYPE_QCRYPTO_TLS_CREDS_ANON)) { QCryptoTLSCredsAnon *acreds = QCRYPTO_TLS_CREDS_ANON(creds); ret = gnutls_priority_set_direct(session->handle, "NORMAL:+ANON-DH", NULL); if (ret < 0) { error_setg(errp, "Unable to set TLS session priority: %s", gnutls_strerror(ret)); goto error; } if (creds->endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) { ret = gnutls_credentials_set(session->handle, GNUTLS_CRD_ANON, acreds->data.server); } else { ret = gnutls_credentials_set(session->handle, GNUTLS_CRD_ANON, acreds->data.client); } if (ret < 0) { error_setg(errp, "Cannot set session credentials: %s", gnutls_strerror(ret)); goto error; } } else if (object_dynamic_cast(OBJECT(creds), TYPE_QCRYPTO_TLS_CREDS_X509)) { QCryptoTLSCredsX509 *tcreds = QCRYPTO_TLS_CREDS_X509(creds); ret = gnutls_set_default_priority(session->handle); if (ret < 0) { error_setg(errp, "Cannot set default TLS session priority: %s", gnutls_strerror(ret)); goto error; } ret = gnutls_credentials_set(session->handle, GNUTLS_CRD_CERTIFICATE, tcreds->data); if (ret < 0) { error_setg(errp, "Cannot set session credentials: %s", gnutls_strerror(ret)); goto error; } if (creds->endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) { gnutls_certificate_server_set_request(session->handle, GNUTLS_CERT_REQUEST); } } else { error_setg(errp, "Unsupported TLS credentials type %s", object_get_typename(OBJECT(creds))); goto error; } gnutls_transport_set_ptr(session->handle, session); gnutls_transport_set_push_function(session->handle, qcrypto_tls_session_push); gnutls_transport_set_pull_function(session->handle, qcrypto_tls_session_pull); return session; error: qcrypto_tls_session_free(session); return NULL; }
1threat
static void mpeg4_encode_gop_header(MpegEncContext *s) { int hours, minutes, seconds; int64_t time; put_bits(&s->pb, 16, 0); put_bits(&s->pb, 16, GOP_STARTCODE); time = s->current_picture_ptr->f.pts; if (s->reordered_input_picture[1]) time = FFMIN(time, s->reordered_input_picture[1]->f.pts); time = time * s->avctx->time_base.num; seconds = time / s->avctx->time_base.den; minutes = seconds / 60; seconds %= 60; hours = minutes / 60; minutes %= 60; hours %= 24; put_bits(&s->pb, 5, hours); put_bits(&s->pb, 6, minutes); put_bits(&s->pb, 1, 1); put_bits(&s->pb, 6, seconds); put_bits(&s->pb, 1, !!(s->flags & CODEC_FLAG_CLOSED_GOP)); put_bits(&s->pb, 1, 0); s->last_time_base = time / s->avctx->time_base.den; ff_mpeg4_stuffing(&s->pb); }
1threat
void s390_program_interrupt(CPUS390XState *env, uint32_t code, int ilen, uintptr_t ra) { #ifdef CONFIG_TCG S390CPU *cpu = s390_env_get_cpu(env); if (tcg_enabled()) { cpu_restore_state(CPU(cpu), ra); } #endif program_interrupt(env, code, ilen); }
1threat
How to mock a function, that is imported within an imported method from different module : <p>I got the following function to test:</p> <p><strong>my_package.db_engine.db_functions.py:</strong> </p> <pre><code>from ..utils import execute_cmd from my_package.db_engine.db_functions import dbinfo def dbinfo(db_name): params = (cmd_cfg.DB, add_pj_suffix(db_name)) cmd = get_db_cmd_string(cmd_cfg.DBINFO, params=params) cmd_result = execute_cmd(cmd) result_dict = map_cmd_output_to_dict(cmd_result) return result_dict </code></pre> <p>This function takes the name of a database, then builds a command string from it and executes this command as <code>subprocess</code> with the <code>execute_cmd</code> method. I want to test this function without actually executing the <code>subprocess</code>. I only want to check if the command is built correctly and correctly passed to <code>execute_cmd</code>. Therefore I need to mock the <code>execute_cmd</code> method which is imported from module <code>utils</code>.</p> <p>My folder structure is the following:</p> <pre><code>my_project |_src | |_my_package | | |_db_engine | | | |_db_functions.py | | | |_ __init__.py | | |_utils.py | | |_ __init__.py | | |_ .... | |_ __init__.py |_tests |_test_db_engine.py </code></pre> <p>So for my test I tried the following in <code>test_db_engine.py</code>:</p> <pre><code>import unittest from mock import patch from my_pacakge.db_engine.db_functions import dbinfo def execute_db_info_cmd_mock(): return { 'Last Checkpoint': '1.7', 'Last Checkpoint Date': 'May 20, 2015 10:07:41 AM' } class DBEngineTestSuite(unittest.TestCase): """ Tests für DB Engine""" @patch('my_package.utils.execute_cmd') def test_dbinfo(self, test_patch): test_patch.return_value = execute_db_info_cmd_mock() db_info = dbinfo('MyDBNameHere') self.assertEqual(sandbox_info['Last Checkpoint'], '1.7') </code></pre> <p>The execution of the actual command yields <code>1.6</code> for <code>Last Checkpoint</code>. So to verify if the mock return value is used, I set it to <code>1.7</code>. But the mock for the function is not used, as the execution of the test case still yields <code>1.6</code> because it is executing the actual function that should have been patched with the mock.</p> <p>Any idea what I got wrong here?</p>
0debug
How to debug electron production binaries : <p>I can't open devtools in the built version of my electron app. Therefore i want to find another solution to log any errors that only occur in the production version.</p> <p>Is there any good way to get some console.logs from an electron application if its already built? Obviously i can debug the “development” version (running npm run dev) of my electron app by opening the chrome dev tools. But i can’t find any way to enable them inside my production application. I am using the newsest version of <a href="https://github.com/SimulatedGREG/electron-vue" rel="noreferrer">electron-vue</a></p> <p>Thanks for any help in advance.</p>
0debug
m48t59_t *m48t59_init_isa(uint32_t io_base, uint16_t size, int type) { M48t59ISAState *d; ISADevice *dev; m48t59_t *s; dev = isa_create("m48t59_isa"); qdev_prop_set_uint32(&dev->qdev, "type", type); qdev_prop_set_uint32(&dev->qdev, "size", size); qdev_prop_set_uint32(&dev->qdev, "io_base", io_base); qdev_init(&dev->qdev); d = DO_UPCAST(M48t59ISAState, busdev, dev); s = &d->state; if (io_base != 0) { register_ioport_read(io_base, 0x04, 1, NVRAM_readb, s); register_ioport_write(io_base, 0x04, 1, NVRAM_writeb, s); } return s; }
1threat
java.lang.IllegalArgumentException: Rect should intersect with child's bounds : <p>In Android Studio after starting a new project, and selecting a Tabbed Activity, after the project is build, I get this error in the Android Monitor:</p> <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.app, PID: 23581 java.lang.IllegalArgumentException: Rect should intersect with child's bounds. at android.support.design.widget.CoordinatorLayout.offsetChildByInset(CoordinatorLayout.java:1319) at android.support.design.widget.CoordinatorLayout.onChildViewsChanged(CoordinatorLayout.java:1257) at android.support.design.widget.CoordinatorLayout$OnPreDrawListener.onPreDraw(CoordinatorLayout.java:1805) at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:847) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1867) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761) at android.view.Choreographer.doCallbacks(Choreographer.java:574) at android.view.Choreographer.doFrame(Choreographer.java:544) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5001) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method) </code></pre> <p>What does this exception mean, and how to fix it? It is a completely new project, so I have <em>not</em> made any change.</p>
0debug
Devise Add Admin Role : <p>I wish to know how to create an admin role in devise gem and how to make pages that just if you are logged as admin you could access, otherwise you get a 404 page.</p>
0debug
static uint64_t m5208_timer_read(void *opaque, target_phys_addr_t addr, unsigned size) { m5208_timer_state *s = (m5208_timer_state *)opaque; switch (addr) { case 0: return s->pcsr; case 2: return s->pmr; case 4: return ptimer_get_count(s->timer); default: hw_error("m5208_timer_read: Bad offset 0x%x\n", (int)addr); return 0; } }
1threat
int kvm_log_stop(target_phys_addr_t phys_addr, ram_addr_t size) { return kvm_dirty_pages_log_change(phys_addr, size, 0, KVM_MEM_LOG_DIRTY_PAGES); }
1threat
void armv7m_nvic_set_pending(void *opaque, int irq) { NVICState *s = (NVICState *)opaque; VecInfo *vec; assert(irq > ARMV7M_EXCP_RESET && irq < s->num_irq); vec = &s->vectors[irq]; trace_nvic_set_pending(irq, vec->enabled, vec->prio); if (irq >= ARMV7M_EXCP_HARD && irq < ARMV7M_EXCP_PENDSV) { int running = nvic_exec_prio(s); bool escalate = false; if (vec->prio >= running) { trace_nvic_escalate_prio(irq, vec->prio, running); escalate = true; } else if (!vec->enabled) { trace_nvic_escalate_disabled(irq); escalate = true; } if (escalate) { if (running < 0) { cpu_abort(&s->cpu->parent_obj, "Lockup: can't escalate %d to HardFault " "(current priority %d)\n", irq, running); } irq = ARMV7M_EXCP_HARD; vec = &s->vectors[irq]; s->cpu->env.v7m.hfsr |= R_V7M_HFSR_FORCED_MASK; } } if (!vec->pending) { vec->pending = 1; nvic_irq_update(s); } }
1threat
runtime of a recursive function : Hi can anyone help me to find the time complexity of the following recursive function? I wrote T(n^(1/2)) and T(n^(1/4)) but what is the general way to get to the run time of any recursion? T(n) = n^(1/2) (T(n^(1/2)) + n
0debug
Parsing a string into multiple separate strings : <p>Hey guys I have a quick question. I am trying to parse a single string into multiple strings using a keyword. I can currently find a set of code that allows me to parse the single string but I need to store each of the new strings as a new variable/item.</p> <pre><code>string full = "Hey//Please//Help"; </code></pre> <p>parse into:</p> <p>first string- Hey</p> <p>Second string- Please</p> <p>third string- Help</p> <p>So for example I would like to manipulate the first string, Hey, by itself. Please let me know if any more explanation is necessary.</p>
0debug
char () and int () are functions in c++? : <p>after 30 min of googling I decided to ask here my doubt It maybe invalid question if I am not understanding below line of code correctly </p> <p><code>result += char(int(text[i]+s-65)%26 +65);</code></p> <p>In above code char() is a function ? If yes so I am unable to find any information about it and if no so what is this ? And same doubt for inner int() .</p> <p>Above code is copied from a C++ program.</p>
0debug
How to collect heap dump : $java -version java version "1.6.0" Java(TM) SE Runtime Environment (build pap6460sr16fp26-20160508_01(SR16 FP26)) IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 AIX ppc64-64 jvmap6460sr16fp25-20160413_299433 (JIT enabled, AOT enabled) J9VM - 20160413_299433 JIT - r9_20160328_114196 GC - GA24_Java6_SR16_20160413_1159_B299433) JCL - 20160507_01 We are using IBM JDK and are facing high heap utilization issue for OSB Weblogic managed servers. Kindly suggest how we can collect Heap dump for this JVM's using IBM JDK as we require to analyse the same and get rid of this memory/Heap issue . Regards, Ketan
0debug
C# Cannot delete folder contains PDF or DOC files : <p>I have an issue that has just happened yesterday. Before, I use <code>Directory.Delete(path, true)</code> to delete all files and subfolders and it worked correctly.</p> <p>But now, when I run my program run to this method, if the folder contains PDF or DOC files, these files cannot be deleted and even the EXE file of my program is deleted. It is so weird.</p> <p>If the folder only contains text file such as TXT or CSV, these files can be deleted.</p> <p>Now all of my old programs that I did not changed anything for a long time also have this issue.</p> <p>If the folder has less than 2 documents, these files can be deleted. If more than that, it does not work.</p> <p>Could you please help me with this issue and let me know how I can fix it ?</p> <p>Thanks,</p> <p>Tu.</p>
0debug
simple python regular ex not working : <p>Try to regex phone numbers, can't get it to work and don't see what's wrong with my regular expression. here is the code i'm running:</p> <pre><code>import re text = 'random text 058-6959503 -' cellular = re.findall(r'/^05\d([-]{0,1})\d{7}$/',text ) print(cellular) </code></pre> <p>it returns nothing. help?</p>
0debug
Convert string array into integer python : <p>I need to convert following string array into integers. How to do it in python. Those string are hex values.</p> <pre><code>['02', '01', '03', '01', '04', '01', '05', '01', '06', '01', '07', '01', '08', '01', '09', '01', '0a', '01', '0b', '01', '0c', '01', '0d', '01', '0e', '01', '0f', '01', '10', '01', '11', '01', '12', '01', '13', '01', '14', '01', '03', '02', '04', '02', '05', '02', '06', '02', '07', '02', '08', '02', '09', '02', '0a', '02', '0b', '02', '0c', '02', '0d', '02', '0e', '02', '0f', '02', '10', '02', '11', '02', '12', '02', '13', '02', '14', '02', '04', '03', '05', '03', '06', '03', '07', '03', '08', '03', '09', '03', '0a', '03', '0b', '03', '0c', '03', '0d', '03', '0e', '03', '0f', '03', '10', '03', '11', '03', '12', '03', '13', '03', '14', '03', '05', '04', '06', '04', '07', '04', '08', '04', '09', '04', '0a', '04', '0b', '04', '0c', '04', '0d', '04', '0e', '04', '0f', '04', '10', '04', '11', '04', '12', '04', '13', '04', '14', '04', '06', '05', '07', '05', '08', '05', '09', '05', '0a', '05', '0b', '05', '0c', '05', '0d', '05', '0e', '05', '0f', '05', '10', '05', '11', '05', '12', '05', '13', '05', '14', '05', '07', '06', '08', '06', '09', '06', '0a', '06', '0b', '06', '0c', '06', '0d', '06', '0e', '06', '0f', '06', '10', '06', '11', '06', '12', '06', '13', '06', '14', '06', '08', '07', '09', '07', '0a', '07', '0b', '07', '0c', '07', '0d', '07', '0e', '07', '0f', '07', '10', '07', '11', '07', '12', '07', '13', '07', '14', '07', '09', '08', '0a', '08', '0b', '08', '0c', '08', '0d', '08', '0e', '08', '0f', '08', '10', '08', '11', '08', '12', '08', '13', '08', '14', '08', '0a', '09', '0b', '09', '0c', '09', '0d', '09', '0e', '09', '0f', '09', '10', '09', '11', '09', '12', '09', '13', '09', '14', '09', '0b', '0a', '0c', '0a', '0d', '0a', '0e', '0a', '0f', '0a', '10', '0a', '11', '0a', '12', '0a', '13', '0a', '14', '0a', '0c', '0b', '0d', '0b', '0e', '0b', '0f', '0b', '10', '0b', '11', '0b', '12', '0b', '13', '0b', '14', '0b', '0d', '0c', '0e', '0c', '0f', '0c', '10', '0c', '11', '0c', '12', '0c', '13', '0c', '14', '0c', '0e', '0d', '0f', '0d', '10', '0d', '11', '0d', '12', '0d', '13', '0d', '14', '0d', '0f', '0e', '10', '0e', '11', '0e', '12', '0e', '13', '0e', '14', '0e', '10', '0f', '11', '0f', '12', '0f', '13', '0f', '14', '0f', '11', '10', '12', '10', '13', '10', '14', '10', '12', '11', '13', '11', '14', '11', '13', '12', '14', '12', '14', '13'] </code></pre>
0debug
How can i get var output data when my Return type Is IEnumarable : Here i need data from `var result = new` not from `IEnumarable` please Help me if is their any latranate solution is their please Help me public IEnumerable<Employee_Join> GetEmployees(int paginate) { int FilterdCount = 0; using (SqlConnection con = Db.Dbcontect) { var employee = new List<Employee_Join>(); con.Open(); SqlCommand cmd = new SqlCommand("SP_GetEmployees_By_Pagination", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Pagination", paginate); cmd.Parameters.AddWithValue("@Total", 5); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.HasRows == true) { while (rdr.Read()) { Employee_Join emp = new Employee_Join(); if (!Convert.IsDBNull(rdr["EmployeeId"])) { emp.Emp_Id = Convert.ToInt32(rdr["EmployeeId"]); } emp.EmpName = rdr["EmpName"].ToString(); emp.Email = rdr["Email"].ToString(); emp.Cnt_Name = rdr["CountryName"].ToString(); employee.Add(emp); } } var result = new { iTotalRecords = GetTotalEmployeeCount(), iTotalDisplayRecords = FilterdCount, aaData = employee }; return employee; } i need `var result = new` out put not employee
0debug
build.gradle: compile group vs compile, buildscript, classpath : <p>What is the difference between "compile group" and "compile"? Just another way to define a dependency?</p> <p>Ex:</p> <pre><code>compile group: 'org.slf4j', name: 'slf4j-jcl', version: '1.7.21' </code></pre> <p>And i think this also will work:</p> <pre><code>compile("org.slf4j:slf4j-jcl:1.7.21") </code></pre> <p>Why do i have the declare <code>mavenCentral()</code> again and another dependencies block inside the buildscript block?</p> <pre><code>buildscript { repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.0.RELEASE") } } </code></pre> <p>From my point of view, when you compile something it will be in your classPath?</p>
0debug
static void bdrv_do_release_matching_dirty_bitmap(BlockDriverState *bs, BdrvDirtyBitmap *bitmap, bool only_named) { BdrvDirtyBitmap *bm, *next; QLIST_FOREACH_SAFE(bm, &bs->dirty_bitmaps, list, next) { if ((!bitmap || bm == bitmap) && (!only_named || bm->name)) { assert(!bm->active_iterators); assert(!bdrv_dirty_bitmap_frozen(bm)); assert(!bm->meta); QLIST_REMOVE(bm, list); hbitmap_free(bm->bitmap); g_free(bm->name); g_free(bm); if (bitmap) { return; } } } if (bitmap) { abort(); } }
1threat
react Material-ui, How do I know I can use onClick for button? : <p>The list of properties on the doc doesn't include <code>onClick</code> (<a href="http://www.material-ui.com/#/components/icon-button" rel="noreferrer">http://www.material-ui.com/#/components/icon-button</a>)</p> <p>How do I know I need to use onClick for click handler?</p>
0debug
int64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, const char *fmt_name) { switch(nb_channels) { case 1: return AV_CH_LAYOUT_MONO; case 2: return AV_CH_LAYOUT_STEREO; case 3: return AV_CH_LAYOUT_SURROUND; case 4: return AV_CH_LAYOUT_QUAD; case 5: return AV_CH_LAYOUT_5POINT0; case 6: return AV_CH_LAYOUT_5POINT1; case 8: return AV_CH_LAYOUT_7POINT1; default: return 0; } }
1threat
ERROR_INVALID_PARAMETER in VC++ code : I have written a routine that uses the native C++ "HTTPDECLAREPUSH" method to utilize server push. I am passing the parameters as below, still getting error # 87 (ERROR_INVALID_PARAMETER) at `HttpDeclarePush(p_req_queue_handle, request_id, verb, http_path, query, headers);` const HTTPAPI_VERSION version = HTTPAPI_VERSION_2; const auto request_queue_handle = reinterpret_cast<void*>(HttpCreateRequestQueue(version, nullptr, nullptr, 0, &p_req_queue_handle)); const auto verb = HttpVerbGET; const auto http_path = reinterpret_cast<const wchar_t*>("D:\Some_Path_From_Where_Resource_File_Will_Be_Pushed_To_Client\polyfills.0d74a55d0dbab6b8c32c.js"); const auto query = "polyfills.0d74a55d0dbab6b8c32c.js"; HTTP_REQUEST_HEADERS* headers = nullptr; //pHttpContext->GetRequest()->GetHeader; //lpOutBuffer; const auto is_success = HttpDeclarePush(p_req_queue_handle, request_id, verb, http_path, query, headers); I am not getting which parameter is potentially the wrong one, any helps?
0debug
Best practices for storing a Token in iOS app : <p>I'm creating an iOS that interacts with an API using Alamofire, and requires a Token for most requests. I've built the app using the MVC pattern, and it works great, but I've encountered a problem as I've tried to integrate the API. How should I share/store the token so that it can be accessed from the view controllers/models? I've read up quite a bit and have found negative opinions on using singletons or <code>UserDefaults</code>, but I've yet to encounter a straightforward answer. I understand this is a pretty broad question that might not have a simple answer, but I am pretty new to this and was wondering if anyone can help point me in the right direction. Thanks!</p>
0debug
static int remove_mapping(BDRVVVFATState* s, int mapping_index) { mapping_t* mapping = array_get(&(s->mapping), mapping_index); mapping_t* first_mapping = array_get(&(s->mapping), 0); if (mapping->first_mapping_index < 0) free(mapping->path); array_remove(&(s->mapping), mapping_index); adjust_mapping_indices(s, mapping_index, -1); if (s->current_mapping && first_mapping != (mapping_t*)s->mapping.pointer) s->current_mapping = array_get(&(s->mapping), s->current_mapping - first_mapping); return 0; }
1threat
Why java packages do not work as a hierarchy? : <p>why java does not allow access to package restricted types that are in parents package?</p> <p>With something like :</p> <pre><code>Package a |--Class A |--Package b |--Class B </code></pre> <p>It is not possible to access class <code>A</code> from class <code>B</code> if class <code>A</code> has package visibility. I thought it make sense but apparently not.</p> <p>What is the reason for that?</p>
0debug
static int read_packet(AVFormatContext *s, AVPacket *pkt) { FilmstripDemuxContext *film = s->priv_data; AVStream *st = s->streams[0]; if (s->pb->eof_reached) return AVERROR(EIO); pkt->dts = avio_tell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4); pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4); avio_skip(s->pb, st->codec->width * film->leading * 4); if (pkt->size < 0) return pkt->size; pkt->flags |= AV_PKT_FLAG_KEY; return 0; }
1threat
Send data to the backend API Angular 6 : <p>i'm trying to send few form details to the backend API using angular6, but it doesn't work as i expected, and how do i add Observable to this, im expecting to use observable instead of promises.</p> <p><strong>login.component.html</strong></p> <pre><code>loginUser(e){ var username = e.target.elements[0].value; var password = e.target.elements[1].value; console.log(username,password); this.user.setUserLoggedIn() var body = "username=" + username + "password=" + password; this.http.post("http://localhost:8080/user/all", body).subscribe((data) =&gt; {}); this.router.navigate(['fullpage']) return false; } </code></pre> <p><strong>login.component.html</strong></p> <pre><code>&lt;form id="loginForm" novalidate="novalidate" (submit)="loginUser($event)"&gt; &lt;div class="form-group"&gt; &lt;label for="username" class="control-label"&gt;Username&lt;/label&gt; &lt;input type="text" class="form-control" id="username" name="username" value="" required="" title="Please enter you username" placeholder="example@gmail.com"&gt; &lt;span class="help-block"&gt;&lt;/span&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;label for="password" class="control-label"&gt;Password&lt;/label&gt; &lt;input type="password" class="form-control" id="password" name="password" value="" required="" title="Please enter your password" placeholder="******"&gt; &lt;span class="help-block"&gt;&lt;/span&gt; &lt;/div&gt; &lt;div id="loginErrorMsg" class="alert alert-error hide"&gt;Wrong username or password&lt;/div&gt; &lt;div class="checkbox"&gt; &lt;/div&gt; &lt;button type="submit" class="btn btn-success btn-block"&gt;Login&lt;/button&gt; &lt;/form&gt; </code></pre> <p><strong>Error:</strong></p> <blockquote> <p>ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[LogincomponentComponent -> Http]:<br> StaticInjectorError(Platform: core)[LogincomponentComponent -> Http]: NullInjectorError: No provider for Http! Error: StaticInjectorError(AppModule)[LogincomponentComponent -> Http]:<br> StaticInjectorError(Platform: core)[LogincomponentComponent -> Http]: NullInjectorError: No provider for Http!</p> </blockquote>
0debug
Find dead code in Golang monorepo : <p>My team has all our Golang code in a monorepo.</p> <ul> <li>Various package subdirectories with library code.</li> <li>Binaries/services/tools under <code>cmd</code></li> </ul> <p>We've had it for a while and are doing some cleanup. Are there any tools or techniques that can find functions not used by the binaries under <code>cmd</code>?</p> <p>I know <code>go vet</code> can find private functions that are unused in a package. However I suspect we also have exported library functions that aren't used either.</p>
0debug
Getting Error I cannot ger it : 04-20 00:40:11.688: E/AndroidRuntime(1623): FATAL EXCEPTION: AsyncTask #1 04-20 00:40:11.688: E/AndroidRuntime(1623): Process: com.clip.android, PID: 1623 04-20 00:40:11.688: E/AndroidRuntime(1623): java.lang.RuntimeException: An error occured while executing doInBackground() 04-20 00:40:11.688: E/AndroidRuntime(1623): at android.os.AsyncTask$3.done(AsyncTask.java:300) 04-20 00:40:11.688: E/AndroidRuntime(1623): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) 04-20 00:40:11.688: E/AndroidRuntime(1623): at java.util.concurrent.FutureTask.setException(FutureTask.java:222) 04-20 00:40:11.688: E/AndroidRuntime(1623): at java.util.concurrent.FutureTask.run(FutureTask.java:242) 04-20 00:40:11.688: E/AndroidRuntime(1623): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 04-20 00:40:11.688: E/AndroidRuntime(1623): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 04-20 00:40:11.688: E/AndroidRuntime(1623): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 04-20 00:40:11.688: E/AndroidRuntime(1623): at java.lang.Thread.run(Thread.java:841) 04-20 00:40:11.688: E/AndroidRuntime(1623): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() 04-20 00:40:11.688: E/AndroidRuntime(1623): at android.os.Handler.<init>(Handler.java:200) 04-20 00:40:11.688: E/AndroidRuntime(1623): at android.os.Handler.<init>(Handler.java:114) 04-20 00:40:11.688: E/AndroidRuntime(1623): at android.widget.Toast$TN.<init>(Toast.java:327) 04-20 00:40:11.688: E/AndroidRuntime(1623): at android.widget.Toast.<init>(Toast.java:92) 04-20 00:40:11.688: E/AndroidRuntime(1623): at android.widget.Toast.makeText(Toast.java:241) 04-20 00:40:11.688: E/AndroidRuntime(1623): at com.clip.android.ClaimRegisterPage$AsyncCallWS.doInBackground(ClaimRegisterPage.java:124) 04-20 00:40:11.688: E/AndroidRuntime(1623): at com.clip.android.ClaimRegisterPage$AsyncCallWS.doInBackground(ClaimRegisterPage.java:1) 04-20 00:40:11.688: E/AndroidRuntime(1623): at android.os.AsyncTask$2.call(AsyncTask.java:288) 04-20 00:40:11.688: E/AndroidRuntime(1623): at java.util.concurrent.FutureTask.run(FutureTask.java:237) 04-20 00:40:11.688: E/AndroidRuntime(1623): ... 4 more 04-20 00:40:11.788: W/EGL_emulation(1623): eglSurfaceAttrib not implemented 04-20 00:40:12.238: E/WindowManager(1623): android.view.WindowLeaked: Activity com.clip.android.ClaimRegisterPage has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{a56affd0 V.E..... R......D 0,0-571,339} that was originally added here 04-20 00:40:12.238: E/WindowManager(1623): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:346) 04-20 00:40:12.238: E/WindowManager(1623): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:248) 04-20 00:40:12.238: E/WindowManager(1623): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) 04-20 00:40:12.238: E/WindowManager(1623): at android.app.Dialog.show(Dialog.java:286) 04-20 00:40:12.238: E/WindowManager(1623): at android.app.ProgressDialog.show(ProgressDialog.java:116) 04-20 00:40:12.238: E/WindowManager(1623): at android.app.ProgressDialog.show(ProgressDialog.java:99) 04-20 00:40:12.238: E/WindowManager(1623): at android.app.ProgressDialog.show(ProgressDialog.java:94) 04-20 00:40:12.238: E/WindowManager(1623): at com.clip.android.ClaimRegisterPage$AsyncCallWS.onPreExecute(ClaimRegisterPage.java:133) 04-20 00:40:12.238: E/WindowManager(1623): at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:587) 04-20 00:40:12.238: E/WindowManager(1623): at android.os.AsyncTask.execute(AsyncTask.java:535) 04-20 00:40:12.238: E/WindowManager(1623): at com.clip.android.ClaimRegisterPage.onCreate(ClaimRegisterPage.java:93) 04-20 00:40:12.238: E/WindowManager(1623): at android.app.Activity.performCreate(Activity.java:5231) 04-20 00:40:12.238: E/WindowManager(1623): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 04-20 00:40:12.238: E/WindowManager(1623): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) 04-20 00:40:12.238: E/WindowManager(1623): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) 04-20 00:40:12.238: E/WindowManager(1623): at android.app.ActivityThread.access$800(ActivityThread.java:135) 04-20 00:40:12.238: E/WindowManager(1623): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 04-20 00:40:12.238: E/WindowManager(1623): at android.os.Handler.dispatchMessage(Handler.java:102) 04-20 00:40:12.238: E/WindowManager(1623): at android.os.Looper.loop(Looper.java:136) 04-20 00:40:12.238: E/WindowManager(1623): at android.app.ActivityThread.main(ActivityThread.java:5001) 04-20 00:40:12.238: E/WindowManager(1623): at java.lang.reflect.Method.invokeNative(Native Method) 04-20 00:40:12.238: E/WindowManager(1623): at java.lang.reflect.Method.invoke(Method.java:515) 04-20 00:40:12.238: E/WindowManager(1623): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) 04-20 00:40:12.238: E/WindowManager(1623): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) 04-20 00:40:12.238: E/WindowManager(1623): at dalvik.system.NativeStart.main(Native Method)
0debug
VB Code to Drag Formula to Visible Rows Only : I've tried searching for this but have only ended up with a non-functioning Frankenstein sub routine. I need to: -Filter Column B to Grey Cells. -In column AB on all visible rows, set formula equal to the values in Column B. If a row is filtered out, I need it to remain blank. Bonus question (because I'm a pain in the neck): I need to do some kind of loop to replicate this process in columns AC:BA as well. For example, filter Column C to grey cells, and make all visible cells in AC equal to the corresponding row in Column C. EDIT: I was also thinking to just do a Control + Find, replace any cell where the background color is no fill, and replace with a blank or 0. I can't get that to work either, however. Code that I have (currently I'm stuck at having selected the first visible cell in Column AB): Dim Last_Cell As Range Set Last_Cell = Range("A3").SpecialCells(xlLastCell) ' [Good ]Filter Column B by Color Range("$A$3", Last_Cell).AutoFilter Field:=2, Criteria1:=RGB(165,165,_ 165), Operator:=xlFilterCellColor ' [Pending ] Set all visible AB cells = same row in B Range("AB3").Offset(1, 0).Activate Do Until Selection.EntireRow.Hidden = False If Selection.EntireRow.Hidden = True Then ActiveCell.Offset(1, 0).Activate End If Loop
0debug
GetObject(, "Word.Application") Office 265 : After installing Office 365 my application code in vba is not working anymore Set wrd = GetObject(, "Word.Application") wrd.Visible = True wrd.Documents.Open "C:\My Documents\Temp.doc" Set wrd = Nothing Does someone has any ideas
0debug
Getting total number of registered users : <p>In my app I have login/registration system and need to count the total number of registered users. For example I have 2 registered users.</p> <pre><code>---------------------------------------------------- |id| email |use_name|user_pass|confirm_pass| ---------------------------------------------------- |7 | theo@gmail.com| theo | my pass | my pass | ---------------------------------------------------- |8 | test@gmail.com| test | my pass | my pass | ---------------------------------------------------- </code></pre> <p>The is a function in mysql called SUM,but it adds ints.In my case though the id is incrementing from the last deleted user. </p> <p>Thanks,</p> <p>Theo.</p>
0debug
JSF 2.2 - @Inject @ThirteenNumber throw NullPointException : I try to work with `@Injection`, so start with a simple example here : **Interface** public interface NumberGenerator { String generateNumber(); } **BookService** public class BookServices { @Inject @ThirteenNumber private NumberGenerator generator; public Book createBook(String title){ return new Book(title, generator.generateNumber()); } } **Book Object** public class Book { private String title; private String isbn; public Book() { } public Book(String title, String isbn) { this.title = title; this.isbn = isbn; } //getters and setters } **CDI** @Named(value = "injectionTest") @ViewScoped public class InjectionTest implements Serializable { public void showResult() { BookServices bookService = new BookServices(); Book book = bookService.createBook("Java book"); System.out.println(book.toString()); } //... } **ThirteenNumber Implementation** @ThirteenNumber public class IsbnGenerator implements NumberGenerator{ @Override public String generateNumber(){ return "13-84333-" + Math.abs(new Random().nextInt()); } } **Problem** When i try to call `bookService.createBook("Java book")` it throw a `java.lang.NullPointerException`, in `generator.generateNumber()` i think it not call the right `@Qualifier`, a tried to solve this problem, using this link, http://stackoverflow.com/questions/21363931/java-ee-7-cdi-injection-doesnt-work-sending-nullpointerexception i add all the dependencies but the problem still the same? Did i miss something? **Note** i know about http://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it Thank you.
0debug
Javascript: Expected Identifier : <p>I am creating an HTML document and using javascript to create an image element. Here is my code (create is already defined):</p> <pre><code>create=document.createElement("img"); create.src = 'data/1.png'; create.alt = 'image1'; create.style.magin = '1px'; eval("create.id = 'image" + count + "'"); create.class = 'block'; // line that breaks the code document.body.appendChild(create); </code></pre> <p>I don't know what's going wrong here, but it's probably something obvious. Does anyone have any ideas?</p>
0debug
address_space_translate_internal(AddressSpaceDispatch *d, hwaddr addr, hwaddr *xlat, hwaddr *plen, bool resolve_subpage) { MemoryRegionSection *section; Int128 diff, diff_page; section = address_space_lookup_region(d, addr, resolve_subpage); addr -= section->offset_within_address_space; *xlat = addr + section->offset_within_region; diff_page = int128_make64(((addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE) - addr); diff = int128_sub(section->mr->size, int128_make64(addr)); diff = int128_min(diff, diff_page); *plen = int128_get64(int128_min(diff, int128_make64(*plen))); return section; }
1threat
static inline void RENAME(yuv2yuv1)(SwsContext *c, const int16_t *lumSrc, const int16_t *chrSrc, const int16_t *alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW) { int i; #if COMPILE_TEMPLATE_MMX if(!(c->flags & SWS_BITEXACT)) { long p= 4; const uint8_t *src[4]= {alpSrc + dstW, lumSrc + dstW, chrSrc + chrDstW, chrSrc + VOFW + chrDstW}; uint8_t *dst[4]= {aDest, dest, uDest, vDest}; x86_reg counter[4]= {dstW, dstW, chrDstW, chrDstW}; if (c->flags & SWS_ACCURATE_RND) { while(p--) { if (dst[p]) { __asm__ volatile( YSCALEYUV2YV121_ACCURATE :: "r" (src[p]), "r" (dst[p] + counter[p]), "g" (-counter[p]) : "%"REG_a ); } } } else { while(p--) { if (dst[p]) { __asm__ volatile( YSCALEYUV2YV121 :: "r" (src[p]), "r" (dst[p] + counter[p]), "g" (-counter[p]) : "%"REG_a ); } } } return; } #endif for (i=0; i<dstW; i++) { int val= (lumSrc[i]+64)>>7; if (val&256) { if (val<0) val=0; else val=255; } dest[i]= val; } if (uDest) for (i=0; i<chrDstW; i++) { int u=(chrSrc[i ]+64)>>7; int v=(chrSrc[i + VOFW]+64)>>7; if ((u|v)&256) { if (u<0) u=0; else if (u>255) u=255; if (v<0) v=0; else if (v>255) v=255; } uDest[i]= u; vDest[i]= v; } if (CONFIG_SWSCALE_ALPHA && aDest) for (i=0; i<dstW; i++) { int val= (alpSrc[i]+64)>>7; aDest[i]= av_clip_uint8(val); } }
1threat
How to add custom font sizes to QuillJS editor : <p>How do you add custom font sizes to the toolbar with QuillJS? I've tried two approaches:</p> <pre><code>// Initiate the editor let toolbarOptions = [ ['bold', 'italic', 'underline', 'strike'], [{ 'align': [] }], [{ 'size': ['10px', '20px', '80px'] }], [{ 'color': ['#FFF'] }] ]; this.editor = new Quill('#executive-control-editor', { modules: { toolbar: toolbarOptions }, theme: 'snow' }); </code></pre> <p>and</p> <pre><code>&lt;div id="toolbar"&gt; &lt;span class="ql-formats"&gt; &lt;button class="ql-bold"&gt;&lt;/button&gt; &lt;button class="ql-italic"&gt;&lt;/button&gt; &lt;button class="ql-underline"&gt;&lt;/button&gt; &lt;button class="ql-strike"&gt;&lt;/button&gt; &lt;/span&gt; &lt;span class="ql-formats"&gt; &lt;select class="ql-align"&gt;&lt;/select&gt; &lt;/span&gt; &lt;span class="ql-format-group"&gt; &lt;select title="Size" class="ql-size"&gt; &lt;option value="10px"&gt;Small&lt;/option&gt; &lt;option value="13px"&gt;Normal&lt;/option&gt; &lt;option value="18px"&gt;Large&lt;/option&gt; &lt;option value="32px"&gt;Huge&lt;/option&gt; &lt;/select&gt; &lt;/span&gt; &lt;span class="ql-formats"&gt; &lt;button class="ql-image"&gt;&lt;/button&gt; &lt;/span&gt; &lt;/div&gt; </code></pre> <p>However neither of them work. Is there something I'm missing here? I've tried removing the <strong>"px"</strong> from the value as well; still nothing.</p>
0debug
What is a block means in Python 3? : guys. I am a newbie in programming and trying to learn Python from automatetheboringstuff.com. At the end of Chapter 2, the question below shows up. And even after I have go through the official answer, I still am clueless. Please help! https://pastebin.com/Hhvwm5Qb (answer included) spam = 0 if spam == 10: print('eggs') if spam > 5: print('bacon') else: print('ham') print('spam') print('spam')
0debug