problem
stringlengths
26
131k
labels
class label
2 classes
Passing an optimization flag to a Go compiler? : <p>To compile a Go program you type <code>go build myprogram.go</code>, can you pass an optimization flags along or the code is always compiled in the same way? I am talking about speed optimizations, code size optimizations or other optimizations.</p> <p>I know if you use <code>gccgo</code> you just pass <code>-O2</code> or <code>-O0</code> but my question is about an official Go compiler <code>go</code>.</p>
0debug
Is cocoapods.org not working? : <p>I am trying to get a pod for firebase,but whatever name I type in the search box returns nothing. Is the website not working or? Thanks</p> <p><a href="https://i.stack.imgur.com/pfmnD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pfmnD.png" alt="enter image description here"></a></p>
0debug
how to create website without html and css : <p>I think html and css is terrible.<br> How can I create a website without html and css? </p> <p>like android </p> <pre><code>&lt;LinearLayout&gt;something&lt;/LinearLayout&gt; </code></pre>
0debug
TypeError: only length-1 arrays can be converted to Python scalars while plot showing : <p>I have such Python code:</p> <pre><code>import numpy as np import matplotlib.pyplot as plt def f(x): return np.int(x) x = np.arange(1, 15.1, 0.1) plt.plot(x, f(x)) plt.show() </code></pre> <p>And such error:</p> <pre><code>TypeError: only length-1 arrays can be converted to Python scalars </code></pre> <p>How can I fix it?</p>
0debug
Replacing String array by another : <p><strong>When developing an Android project I have got stacked in a position</strong></p> <p><strong><em>It is so simple</em></strong></p> <pre><code>String[] subjects = {}; //It is a string array what I want transform by another String[] another = {"Physics","Chemistry"}; </code></pre> <p>How can I replace subjects with another</p>
0debug
static uint8_t virtio_scsi_do_command(QVirtIOSCSI *vs, const uint8_t *cdb, const uint8_t *data_in, size_t data_in_len, uint8_t *data_out, size_t data_out_len) { QVirtQueue *vq; QVirtIOSCSICmdReq req = { { 0 } }; QVirtIOSCSICmdResp resp = { .response = 0xff, .status = 0xff }; uint64_t req_addr, resp_addr, data_in_addr = 0, data_out_addr = 0; uint8_t response; uint32_t free_head; vq = vs->vq[2]; req.lun[0] = 1; req.lun[1] = 1; memcpy(req.cdb, cdb, CDB_SIZE); req_addr = qvirtio_scsi_alloc(vs, sizeof(req), &req); free_head = qvirtqueue_add(vq, req_addr, sizeof(req), false, true); if (data_out_len) { data_out_addr = qvirtio_scsi_alloc(vs, data_out_len, data_out); qvirtqueue_add(vq, data_out_addr, data_out_len, false, true); } resp_addr = qvirtio_scsi_alloc(vs, sizeof(resp), &resp); qvirtqueue_add(vq, resp_addr, sizeof(resp), true, !!data_in_len); if (data_in_len) { data_in_addr = qvirtio_scsi_alloc(vs, data_in_len, data_in); qvirtqueue_add(vq, data_in_addr, data_in_len, true, false); } qvirtqueue_kick(&qvirtio_pci, vs->dev, vq, free_head); qvirtio_wait_queue_isr(&qvirtio_pci, vs->dev, vq, QVIRTIO_SCSI_TIMEOUT_US); response = readb(resp_addr + offsetof(QVirtIOSCSICmdResp, response)); guest_free(vs->alloc, req_addr); guest_free(vs->alloc, resp_addr); guest_free(vs->alloc, data_in_addr); guest_free(vs->alloc, data_out_addr); return response; }
1threat
Flutter - Overlay card widget on a container : <p>In flutter, is it possible to place a part of a card on another container. In CSS, we would set margin top to a negative value or use translate property. In flutter as we cannot set negative values to margin top, is there an alternative to that?</p> <p><a href="https://i.stack.imgur.com/U8edR.png" rel="noreferrer"><img src="https://i.stack.imgur.com/U8edR.png" alt="enter image description here"></a></p>
0debug
void hmp_info_io_apic(Monitor *mon, const QDict *qdict) { if (kvm_irqchip_in_kernel()) { kvm_ioapic_dump_state(mon, qdict); } else { ioapic_dump_state(mon, qdict); } }
1threat
How to deal with very long arrays : <p>I have a <code>longArray</code> which contains other long <code>arrays</code> at the beginning of my code(think of it as a database). I'm afraid if it slows down the speed of my code. </p> <p>If I still want both <strong>execution speed</strong> and the <code>longArray</code>, What do you recommend?</p> <p>I thought if I could put my array into a function and access its data only when I need the array data it would be a solution, but it seems there is no way to do that ...</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function foo (){ var longArray = [1, 2, 3, 4, 5]; } console.log(a)</code></pre> </div> </div> </p>
0debug
Need help in deploying my python flask API in Jetty or tomcat : <p>I am fresher looking to deploy my python flask API in Jetty or tomcat.</p> <p>No idea how to do that first time to the deployment. I tested it postman wsgi server getting the output.</p> <p>No idea about how to move ahead.</p>
0debug
What are keys used for in Flutter framework? : <p>Flutter is an amazing framework straightforward and easy to use. I must see that the documentation is very good but there are some concept that are still vague to me, for instance the <code>key</code> parameter. According to the documentation <code>A Key is an identifier for Widgets, Elements and SemanticsNodes.</code> It's clear, but why do I need to identify my widgets. So far I never used keys in my coding. Is there any benefits of using keys in my code? Thanks.</p>
0debug
void bios_linker_loader_alloc(GArray *linker, const char *file, uint32_t alloc_align, bool alloc_fseg) { BiosLinkerLoaderEntry entry; memset(&entry, 0, sizeof entry); strncpy(entry.alloc.file, file, sizeof entry.alloc.file - 1); entry.command = cpu_to_le32(BIOS_LINKER_LOADER_COMMAND_ALLOCATE); entry.alloc.align = cpu_to_le32(alloc_align); entry.alloc.zone = cpu_to_le32(alloc_fseg ? BIOS_LINKER_LOADER_ALLOC_ZONE_FSEG : BIOS_LINKER_LOADER_ALLOC_ZONE_HIGH); g_array_prepend_val(linker, entry); }
1threat
How to get current tab index in Flutter : <p>In flutter implementing a tab layout is easy and straightforward. This is a simple example from the official <a href="https://flutter.io/cookbook/design/tabs/" rel="noreferrer">documentation</a>:</p> <pre><code>import 'package:flutter/material.dart'; void main() { runApp(new TabBarDemo()); } class TabBarDemo extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( home: new DefaultTabController( length: 3, child: new Scaffold( appBar: new AppBar( bottom: new TabBar( tabs: [ new Tab(icon: new Icon(Icons.directions_car)), new Tab(icon: new Icon(Icons.directions_transit)), new Tab(icon: new Icon(Icons.directions_bike)), ], ), title: new Text('Tabs Demo'), ), body: new TabBarView( children: [ new Icon(Icons.directions_car), new Icon(Icons.directions_transit), new Icon(Icons.directions_bike), ], ), ), ), ); } } </code></pre> <p>But here is the thing, I want to get the active tab index so I can apply some logic on certain tabs. I search the documentation but I wasn't able to figure it out. Can you guys help and thanks?</p>
0debug
How to write this ^C at cmd? : How to write ^C at cmd? I need this plese [In there][1] [1]: https://i.stack.imgur.com/yGwfS.png If you press CTRL+C in cmd Cmd will close
0debug
static int libopenjpeg_copy_unpacked16(AVCodecContext *avctx, const AVFrame *frame, opj_image_t *image) { int compno; int x; int y; int width; int height; int *image_line; int frame_index; const int numcomps = image->numcomps; uint16_t *frame_ptr; for (compno = 0; compno < numcomps; ++compno) { if (image->comps[compno].w > frame->linesize[compno]) { av_log(avctx, AV_LOG_ERROR, "Error: frame's linesize is too small for the image\n"); return 0; } } for (compno = 0; compno < numcomps; ++compno) { width = avctx->width / image->comps[compno].dx; height = avctx->height / image->comps[compno].dy; frame_ptr = (uint16_t *)frame->data[compno]; for (y = 0; y < height; ++y) { image_line = image->comps[compno].data + y * image->comps[compno].w; frame_index = y * (frame->linesize[compno] / 2); for (x = 0; x < width; ++x) image_line[x] = frame_ptr[frame_index++]; for (; x < image->comps[compno].w; ++x) { image_line[x] = image_line[x - 1]; } } for (; y < image->comps[compno].h; ++y) { image_line = image->comps[compno].data + y * image->comps[compno].w; for (x = 0; x < image->comps[compno].w; ++x) { image_line[x] = image_line[x - image->comps[compno].w]; } } } return 1; }
1threat
Grouping JSON array with sum : [ {t_id :"1", val1 : "1" , title:"cash to purchase", unit :"bag"}, {t_id :"1" ,val1 : "1" , title:"cash to purchase", unit :"bag"} {t_id :"1",val1 : "1" , title:"cash to purchase", unit :"bag"} {t_id :"2",val1 : "4" , title:"offload", unit :"bag"}, {t_id :"2",val1 : "5" , title:"onroad", unit :"bag"}, {t_id :"3", val1 : "5" , title:"Onroad", unit :"bag"}, {t_id :"3", val1 : "6" , title:"Onroad", unit :"bag"}, ] I want to group by t_id and find the sum of val1 according to each t_id and divide the val1 by total number of t_id .... eg: there are three t-id 1 in the array and sum is of three t_id is 3(val1)..so the val1 must be 3/total t_id( ie 3/3)... then i want out on my HTML like Title:cash to purchase bag:1 (ie(3/3) Title:Offload bag:4.5 (ie 9/2) title:onroad bag:5.5 (ie 11/2) ...were 2 is total t_id
0debug
static int flac_probe(AVProbeData *p) { uint8_t *bufptr = p->buf; uint8_t *end = p->buf + p->buf_size; if(bufptr > end-4 || memcmp(bufptr, "fLaC", 4)) return 0; else return AVPROBE_SCORE_MAX/2; }
1threat
How to keep single sql connection instance open for multiple request in c#? : I have web api which contains database insertion logic(ado.net) in c#. When multiple users(e.g. 100 users) call the web api, everytime sql connection is open and closed for multiple request. it slows down performance. How can I keep single sql connection live for multiple request? I have to keep sql connection open only once and close after some time so that during that time it should consider multiple request and insert records in database. Please suggest.
0debug
mongodb difference remove() vs findOneAndDelete() vs deleteOne() : <p>In express and mongodb I want delete document by id findOneAndDelete() Can not delete by _id, can only delete by field ! why ?</p> <pre><code>db.collection('quotes').findOneAndDelete({name: req.body.name}, (err, result) =&gt; { if (err) return res.send(500, err) }) var ObjectId = require('mongodb').ObjectId; var collection = db.collection('quotes'); collection.remove({_id: new ObjectId(req.body.id)}, function(err, result) { if (err) { console.log(err); } else { res.send('A darth vadar quote got deleted') } }); var mongodb = require('mongodb'); db.collection('quotes', function(err, collection) { collection.deleteOne({_id: new mongodb.ObjectID(req.body.id)}); }); </code></pre> <p>Difference of three functions? </p>
0debug
Android Studio - error: not well-formed (invalid token) : Java newbie using Android Studio 3.1.1, I receive an error: error: not well-formed (invalid token). Message{kind=ERROR, text=error: not well-formed (invalid token)., sources=[C:\...\MyWebFavourites\app\src\main\res\layout\activity_main.xml:20], original message=, tool name=Optional.of(AAPT) From [this answer][1], I have tried creating this code: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.mywebfavourites.MainActivity"> <EditText android:id="@+id/editText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="10" android:inputType="textPersonName" android:text="Paid WP Maintenance" tools:layout_editor_absoluteX="25dp" tools:layout_editor_absoluteY="27dp" /> <TextView textView =(TextView)findViewById(R.id.editText) textView.setClickable(true) textView.setMovementMethod(LinkMovementMethod.getInstance()) String text = "<a href='https://www.example.com/'>Example</a>" textView.setText(Html.fromHtml(text)) /> Line 20 is `textView =(TextView)findViewById(R.id.editText)`. I can't see what is not well-formed about this line. Can you help please? [1]: https://stackoverflow.com/a/9290758/667903
0debug
Read files sent with spark-submit by the driver : <p>I am sending a Spark job to run on a remote cluster by running</p> <pre><code>spark-submit ... --deploy-mode cluster --files some.properties ... </code></pre> <p>I want to read the content of the <code>some.properties</code> file by the <strong>driver</strong> code, i.e. before creating the Spark context and launching RDD tasks. The file is copied to the remote driver, but not to the driver's working directory.</p> <p>The ways around this problem that I know of are:</p> <ol> <li>Upload the file to HDFS</li> <li>Store the file in the app jar</li> </ol> <p>Both are inconvenient since this file is frequently changed on the submitting dev machine.</p> <p>Is there a way to read the file that was uploaded using the <code>--files</code> flag during the driver code main method? </p>
0debug
c# adding a string to an array : <p>i want to simply add a string to an array, like this:</p> <pre><code>string[] arrayName = new string[0]; arrayName.Add("raptor"); </code></pre> <p>But this doesn't work, can someone help me?</p>
0debug
Android Nougat requires the IDE to be running with Java 1.8 or later : <p><a href="https://i.stack.imgur.com/vGf1D.png" rel="noreferrer"><img src="https://i.stack.imgur.com/vGf1D.png" alt="enter image description here"></a><a href="https://i.stack.imgur.com/qTT96.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qTT96.png" alt="enter image description here"></a></p> <p>Inspite of having JDK 8 installed, I'm getting this error. What can the issue be?</p>
0debug
def min_product_tuple(list1): result_min = min([abs(x * y) for x, y in list1] ) return result_min
0debug
unity freezes but i cant find the answer : i am doing a collaboration with my school mates for a school project. but recently when i run unity it freezes and i cant get it to unfreeze. i have uninstalled and reimported all the assets and my group mates also said that their unity does not have this problem. welp i have searched the web for hours and i cant find a solution and im in a rush as deadline is coming soon so all help will be appreciated. the project is being done in 2d. i was testing some logic while this happened to me. i was doing kinda like a health bar test where it automatically goes down and theres a text box while follows it containing the actual number. then suddenly the next day unity decided to quit on me and not run at all.
0debug
static hwaddr ppc_hash64_pteg_search(PowerPCCPU *cpu, hwaddr hash, ppc_slb_t *slb, target_ulong ptem, ppc_hash_pte64_t *pte) { CPUPPCState *env = &cpu->env; int i; uint64_t token; target_ulong pte0, pte1; target_ulong pte_index; pte_index = (hash & env->htab_mask) * HPTES_PER_GROUP; token = ppc_hash64_start_access(cpu, pte_index); if (!token) { return -1; } for (i = 0; i < HPTES_PER_GROUP; i++) { pte0 = ppc_hash64_load_hpte0(cpu, token, i); pte1 = ppc_hash64_load_hpte1(cpu, token, i); if (HPTE64_V_COMPARE(pte0, ptem)) { unsigned pshift = hpte_page_shift(slb->sps, pte0, pte1); if (pshift == 0) { continue; } pte->pte0 = pte0; pte->pte1 = pte1; ppc_hash64_stop_access(cpu, token); return (pte_index + i) * HASH_PTE_SIZE_64; } } ppc_hash64_stop_access(cpu, token); return -1; }
1threat
Can you pls help to find the errors in the code : #!/usr/bin/env python3 import sys from http.server import BaseHTTPRequestHandler, HTTPServer from os import curdir, sep PORT_NUMBER = 8080 #This class will handles any incoming request from #the browser class myHandler_RequestHandler(BaseHTTPRequestHandler): #Handler for the GET requests def do_GET(BaseHTTPRequestHandler, self): if self.path=="/": self.path="/index.html" try: #Check the file extension required and #set the right mime type sendReply = False if self.path.endswith(".html"): mimetype='text/html' sendReply = True if self.path.endswith(".jpg"): mimetype='image/jpg' sendReply = True if self.path.endswith(".gif"): mimetype='image/gif' sendReply = True if self.path.endswith(".js"): mimetype='application/javascript' sendReply = True if self.path.endswith(".css"): mimetype='text/css' sendReply = True if sendReply == True: #Open the static file requested and send it filename = open(curdir + sep + self.path) self.wfile.write(bytes('filename',"utf8")) self.send_response(200) self.send_header('Content-type',mimetype) self.end_headers() self.wfile.write(f.read()) filename.decode("utf-8") filename.close() return except IOError: self.send_error(404,'File Not Found: %s' % self.path) try: #Create a web server and define the handler to manage the #incoming request server = HTTPServer(('', PORT_NUMBER), myHandler_RequestHandler) print ('Started httpserver on port ' , PORT_NUMBER) #Wait forever for incoming htto requests server.serve_forever() except KeyboardInterrupt: print('^C received, shutting down the web server') server.socket.close()
0debug
How to deal with double submit in Angular2 : <p>If I click fast on my submit-button the form is submitted two or more times. My thought was to prevent this with the disabled attribute, but I need variable <code>disableButon</code> in every form like this:</p> <pre><code>@Component({ selector: 'example', template: ` &lt;form (submit)="submit()" &gt; &lt;--! Some Inputs --&gt; &lt;button [disabled]="disableButton" type="submit"&gt;Submit&lt;button&gt; &lt;/form&gt; ` }) export class ExampleComponent { private disableButton: boolean = false; ....... submit(){ this.disableButton = true; /* * API call */ this.disableButton = false; } } </code></pre> <p>Am I doing this right or is there a more efficent/elegant way to do it?</p>
0debug
static int arm946_prbs_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { if (ri->crm >= 8) { return EXCP_UDEF; } env->cp15.c6_region[ri->crm] = value; return 0; }
1threat
Why does create-react-app creates both App.js and index.js? : <p>I started learning React and now I'm trying to understand what is the purpose of the <code>index.js</code> and <code>App.js</code> which are created by by running <a href="https://github.com/facebook/create-react-app" rel="noreferrer">create-react-app</a>.</p> <p>Why can't we just use, for example. <code>App.js</code>?</p> <p>I've read that App.js usually used as a main entry point to the application, but auto-generated code of <code>index.js</code> seems like a part of main entry point:</p> <pre><code>import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import registerServiceWorker from './registerServiceWorker'; ReactDOM.render(&lt;App /&gt;, document.getElementById('root')); registerServiceWorker(); </code></pre> <p>I saw a similar questions for react native but I want to know about this in react in general.</p>
0debug
golang mysql "connection refused" : I'm new in Go (Golang). Wrote a simple benchmark program to test the concurrent processing with mysql. Keep getting "dial tcp 52.55.254.165:3306: getsockopt: connection refused", "unexpected EOF" errors when I increase the number of concurrent channels. Each go routine is doing a batch insert of 1 to n number of row to a simple customer table. The program allows to set variable insert size (number of rows in a single statement) and number of parallel go routine (each go routine performs one insert above). Program works fine with small numbers row<100 and number go routines<100. But start getting Unexpected EOF errors when the numbers increase, especially the number of parallel go routines. Did search for clues. Based on them, I've set the database max connection and 'max_allowed_packet' and 'max_connections'. I've also set the go program db.db.SetMaxOpenConns(200), db.SetConnMaxLifetime(200), db.SetMaxIdleConns(10). I've experimented with big numbers and small (from 10 to 2000). Nothing seem to solve the program. Help please!
0debug
int vfio_mmap_region(Object *obj, VFIORegion *region, MemoryRegion *mem, MemoryRegion *submem, void **map, size_t size, off_t offset, const char *name) { int ret = 0; VFIODevice *vbasedev = region->vbasedev; if (vbasedev->allow_mmap && size && region->flags & VFIO_REGION_INFO_FLAG_MMAP) { int prot = 0; if (region->flags & VFIO_REGION_INFO_FLAG_READ) { prot |= PROT_READ; } if (region->flags & VFIO_REGION_INFO_FLAG_WRITE) { prot |= PROT_WRITE; } *map = mmap(NULL, size, prot, MAP_SHARED, vbasedev->fd, region->fd_offset + offset); if (*map == MAP_FAILED) { *map = NULL; ret = -errno; goto empty_region; } memory_region_init_ram_ptr(submem, obj, name, size, *map); memory_region_set_skip_dump(submem); } else { empty_region: memory_region_init(submem, obj, name, 0); } memory_region_add_subregion(mem, offset, submem); return ret; }
1threat
static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){ MpegEncContext * const s = &h->s; const int mb_x= s->mb_x; const int mb_y= s->mb_y; const int mb_xy= mb_x + mb_y*s->mb_stride; const int mb_type= s->current_picture.mb_type[mb_xy]; uint8_t *dest_y, *dest_cb, *dest_cr; int linesize, uvlinesize ; int i; int *block_offset = &h->block_offset[0]; const unsigned int bottom = mb_y & 1; const int transform_bypass = (s->qscale == 0 && h->sps.transform_bypass), is_h264 = (simple || s->codec_id == CODEC_ID_H264); void (*idct_add)(uint8_t *dst, DCTELEM *block, int stride); void (*idct_dc_add)(uint8_t *dst, DCTELEM *block, int stride); dest_y = s->current_picture.data[0] + (mb_y * 16* s->linesize ) + mb_x * 16; dest_cb = s->current_picture.data[1] + (mb_y * 8 * s->uvlinesize) + mb_x * 8; dest_cr = s->current_picture.data[2] + (mb_y * 8 * s->uvlinesize) + mb_x * 8; s->dsp.prefetch(dest_y + (s->mb_x&3)*4*s->linesize + 64, s->linesize, 4); s->dsp.prefetch(dest_cb + (s->mb_x&7)*s->uvlinesize + 64, dest_cr - dest_cb, 2); if (!simple && MB_FIELD) { linesize = h->mb_linesize = s->linesize * 2; uvlinesize = h->mb_uvlinesize = s->uvlinesize * 2; block_offset = &h->block_offset[24]; if(mb_y&1){ dest_y -= s->linesize*15; dest_cb-= s->uvlinesize*7; dest_cr-= s->uvlinesize*7; } if(FRAME_MBAFF) { int list; for(list=0; list<h->list_count; list++){ if(!USES_LIST(mb_type, list)) continue; if(IS_16X16(mb_type)){ int8_t *ref = &h->ref_cache[list][scan8[0]]; fill_rectangle(ref, 4, 4, 8, 16+*ref^(s->mb_y&1), 1); }else{ for(i=0; i<16; i+=4){ int ref = h->ref_cache[list][scan8[i]]; if(ref >= 0) fill_rectangle(&h->ref_cache[list][scan8[i]], 2, 2, 8, 16+ref^(s->mb_y&1), 1); } } } } } else { linesize = h->mb_linesize = s->linesize; uvlinesize = h->mb_uvlinesize = s->uvlinesize; } if(transform_bypass){ idct_dc_add = idct_add = IS_8x8DCT(mb_type) ? s->dsp.add_pixels8 : s->dsp.add_pixels4; }else if(IS_8x8DCT(mb_type)){ idct_dc_add = s->dsp.h264_idct8_dc_add; idct_add = s->dsp.h264_idct8_add; }else{ idct_dc_add = s->dsp.h264_idct_dc_add; idct_add = s->dsp.h264_idct_add; } if(!simple && FRAME_MBAFF && h->deblocking_filter && IS_INTRA(mb_type) && (!bottom || !IS_INTRA(s->current_picture.mb_type[mb_xy-s->mb_stride]))){ int mbt_y = mb_y&~1; uint8_t *top_y = s->current_picture.data[0] + (mbt_y * 16* s->linesize ) + mb_x * 16; uint8_t *top_cb = s->current_picture.data[1] + (mbt_y * 8 * s->uvlinesize) + mb_x * 8; uint8_t *top_cr = s->current_picture.data[2] + (mbt_y * 8 * s->uvlinesize) + mb_x * 8; xchg_pair_border(h, top_y, top_cb, top_cr, s->linesize, s->uvlinesize, 1); } if (!simple && IS_INTRA_PCM(mb_type)) { unsigned int x, y; for(i=0; i<16; i++) { for (y=0; y<4; y++) { for (x=0; x<4; x++) { *(dest_y + block_offset[i] + y*linesize + x) = h->mb[i*16+y*4+x]; } } } for(i=16; i<16+4; i++) { for (y=0; y<4; y++) { for (x=0; x<4; x++) { *(dest_cb + block_offset[i] + y*uvlinesize + x) = h->mb[i*16+y*4+x]; } } } for(i=20; i<20+4; i++) { for (y=0; y<4; y++) { for (x=0; x<4; x++) { *(dest_cr + block_offset[i] + y*uvlinesize + x) = h->mb[i*16+y*4+x]; } } } } else { if(IS_INTRA(mb_type)){ if(h->deblocking_filter && (simple || !FRAME_MBAFF)) xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 1, simple); if(simple || !(s->flags&CODEC_FLAG_GRAY)){ h->pred8x8[ h->chroma_pred_mode ](dest_cb, uvlinesize); h->pred8x8[ h->chroma_pred_mode ](dest_cr, uvlinesize); } if(IS_INTRA4x4(mb_type)){ if(simple || !s->encoding){ if(IS_8x8DCT(mb_type)){ for(i=0; i<16; i+=4){ uint8_t * const ptr= dest_y + block_offset[i]; const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ]; const int nnz = h->non_zero_count_cache[ scan8[i] ]; h->pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000, (h->topright_samples_available<<i)&0x4000, linesize); if(nnz){ if(nnz == 1 && h->mb[i*16]) idct_dc_add(ptr, h->mb + i*16, linesize); else idct_add(ptr, h->mb + i*16, linesize); } } }else for(i=0; i<16; i++){ uint8_t * const ptr= dest_y + block_offset[i]; uint8_t *topright; const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ]; int nnz, tr; if(dir == DIAG_DOWN_LEFT_PRED || dir == VERT_LEFT_PRED){ const int topright_avail= (h->topright_samples_available<<i)&0x8000; assert(mb_y || linesize <= block_offset[i]); if(!topright_avail){ tr= ptr[3 - linesize]*0x01010101; topright= (uint8_t*) &tr; }else topright= ptr + 4 - linesize; }else topright= NULL; h->pred4x4[ dir ](ptr, topright, linesize); nnz = h->non_zero_count_cache[ scan8[i] ]; if(nnz){ if(is_h264){ if(nnz == 1 && h->mb[i*16]) idct_dc_add(ptr, h->mb + i*16, linesize); else idct_add(ptr, h->mb + i*16, linesize); }else svq3_add_idct_c(ptr, h->mb + i*16, linesize, s->qscale, 0); } } } }else{ h->pred16x16[ h->intra16x16_pred_mode ](dest_y , linesize); if(is_h264){ if(!transform_bypass) h264_luma_dc_dequant_idct_c(h->mb, s->qscale, h->dequant4_coeff[IS_INTRA(mb_type) ? 0:3][s->qscale][0]); }else svq3_luma_dc_dequant_idct_c(h->mb, s->qscale); } if(h->deblocking_filter && (simple || !FRAME_MBAFF)) xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0, simple); }else if(is_h264){ hl_motion(h, dest_y, dest_cb, dest_cr, s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab, s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab, s->dsp.weight_h264_pixels_tab, s->dsp.biweight_h264_pixels_tab); } if(!IS_INTRA4x4(mb_type)){ if(is_h264){ if(IS_INTRA16x16(mb_type)){ for(i=0; i<16; i++){ if(h->non_zero_count_cache[ scan8[i] ]) idct_add(dest_y + block_offset[i], h->mb + i*16, linesize); else if(h->mb[i*16]) idct_dc_add(dest_y + block_offset[i], h->mb + i*16, linesize); } }else{ const int di = IS_8x8DCT(mb_type) ? 4 : 1; for(i=0; i<16; i+=di){ int nnz = h->non_zero_count_cache[ scan8[i] ]; if(nnz){ if(nnz==1 && h->mb[i*16]) idct_dc_add(dest_y + block_offset[i], h->mb + i*16, linesize); else idct_add(dest_y + block_offset[i], h->mb + i*16, linesize); } } } }else{ for(i=0; i<16; i++){ if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ uint8_t * const ptr= dest_y + block_offset[i]; svq3_add_idct_c(ptr, h->mb + i*16, linesize, s->qscale, IS_INTRA(mb_type) ? 1 : 0); } } } } if(simple || !(s->flags&CODEC_FLAG_GRAY)){ uint8_t *dest[2] = {dest_cb, dest_cr}; if(transform_bypass){ idct_add = idct_dc_add = s->dsp.add_pixels4; }else{ idct_add = s->dsp.h264_idct_add; idct_dc_add = s->dsp.h264_idct_dc_add; chroma_dc_dequant_idct_c(h->mb + 16*16, h->chroma_qp, h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp][0]); chroma_dc_dequant_idct_c(h->mb + 16*16+4*16, h->chroma_qp, h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp][0]); } if(is_h264){ for(i=16; i<16+8; i++){ if(h->non_zero_count_cache[ scan8[i] ]) idct_add(dest[(i&4)>>2] + block_offset[i], h->mb + i*16, uvlinesize); else if(h->mb[i*16]) idct_dc_add(dest[(i&4)>>2] + block_offset[i], h->mb + i*16, uvlinesize); } }else{ for(i=16; i<16+8; i++){ if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ uint8_t * const ptr= dest[(i&4)>>2] + block_offset[i]; svq3_add_idct_c(ptr, h->mb + i*16, uvlinesize, chroma_qp[s->qscale + 12] - 12, 2); } } } } } if(h->deblocking_filter) { if (!simple && FRAME_MBAFF) { const int mb_y = s->mb_y - 1; uint8_t *pair_dest_y, *pair_dest_cb, *pair_dest_cr; const int mb_xy= mb_x + mb_y*s->mb_stride; const int mb_type_top = s->current_picture.mb_type[mb_xy]; const int mb_type_bottom= s->current_picture.mb_type[mb_xy+s->mb_stride]; if (!bottom) return; pair_dest_y = s->current_picture.data[0] + (mb_y * 16* s->linesize ) + mb_x * 16; pair_dest_cb = s->current_picture.data[1] + (mb_y * 8 * s->uvlinesize) + mb_x * 8; pair_dest_cr = s->current_picture.data[2] + (mb_y * 8 * s->uvlinesize) + mb_x * 8; if(IS_INTRA(mb_type_top | mb_type_bottom)) xchg_pair_border(h, pair_dest_y, pair_dest_cb, pair_dest_cr, s->linesize, s->uvlinesize, 0); backup_pair_border(h, pair_dest_y, pair_dest_cb, pair_dest_cr, s->linesize, s->uvlinesize); s->mb_y--; tprintf(h->s.avctx, "call mbaff filter_mb mb_x:%d mb_y:%d pair_dest_y = %p, dest_y = %p\n", mb_x, mb_y, pair_dest_y, dest_y); fill_caches(h, mb_type_top, 1); h->chroma_qp = get_chroma_qp(h, s->current_picture.qscale_table[mb_xy]); filter_mb(h, mb_x, mb_y, pair_dest_y, pair_dest_cb, pair_dest_cr, linesize, uvlinesize); s->mb_y++; tprintf(h->s.avctx, "call mbaff filter_mb\n"); fill_caches(h, mb_type_bottom, 1); h->chroma_qp = get_chroma_qp(h, s->current_picture.qscale_table[mb_xy+s->mb_stride]); filter_mb(h, mb_x, mb_y+1, dest_y, dest_cb, dest_cr, linesize, uvlinesize); } else { tprintf(h->s.avctx, "call filter_mb\n"); backup_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, simple); fill_caches(h, mb_type, 1); filter_mb_fast(h, mb_x, mb_y, dest_y, dest_cb, dest_cr, linesize, uvlinesize); } } }
1threat
differences between new and malloc in c++ : <pre><code>#include &lt;iostream&gt; #include &lt;cstdlib&gt; using namespace std; class Box { public: Box() { cout &lt;&lt; "Constructor called!" &lt;&lt;endl; } void printer(int x) { cout&lt;&lt;x&lt;&lt;" printer"&lt;&lt;endl; } ~Box() { cout &lt;&lt; "Destructor called!" &lt;&lt;endl; } }; int main( ) { Box* myBoxArray = new Box[4]; Box* myBoxArray2 = (Box*)malloc(sizeof(Box[4])); myBoxArray2-&gt;printer(23); *myBoxArray2; *(myBoxArray2).printer(23); return 0; } </code></pre> <p>the problem simply is that when i use 'new' the constructor is printed out but when i simple derefrence the pointer to <code>myBoxArray2</code> the constructor is not printed and neither is the funtion <code>printer</code> printed. Also why is it that when i use <code>-&gt;</code> the funnction printer runs but not when i use the equivalent <code>*(myBoxArray2).printer(23)</code></p>
0debug
LocalDB is not supported on this Platform : <p>I'm trying to launch <code>.Net Core 2.0</code> application on <code>Ubuntu 17.04</code>. I developed it on Windows 10 before and it works well. The problem is that when I run <code>dotnet ef database update</code> I get the next exception:</p> <pre><code>System.PlatformNotSupportedException: LocalDB is not supported on this Platform. </code></pre> <p>Here is my <code>DbContext</code>:</p> <pre><code>public class NutritionContext : DbContext { public DbSet&lt;User&gt; Users { get; set; } public DbSet&lt;Meal&gt; Meals { get; set; } public DbSet&lt;Dish&gt; Dishes { get; set; } public DbSet&lt;Product&gt; Products { get; set; } public DbSet&lt;Plan&gt; Plans { get; set; } public DbSet&lt;MealDish&gt; MealDishes { get; set; } public DbSet&lt;Ingredient&gt; Ingredients { get; set; } public DbSet&lt;PlanDetail&gt; PlanDetails { get; set; } public DbSet&lt;UserPlan&gt; UserPlans { get; set; } public DbSet&lt;AuthUser&gt; AuthUsers { get; set; } public NutritionContext() { } public NutritionContext(DbContextOptions options) : base(options) { } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseSqlServer( "Server=(localdb)\\mssqllocaldb;Database=NutritionDatabaseNew;Trusted_Connection=True;MultipleActiveResultSets=true"); } } </code></pre> <p>Do you know what could be the reason of it?</p>
0debug
Restricting user to NOT input decimal in c# : Hi I'm new in C# i just want to ask if this is possible? How to not allow the user to input decimal in console app in c#
0debug
I don't know what i did wrong, the program returns some weird and incomplete string : I was tring to to write a function that deletes whitespaces from a string but the output is not reasonable at all. I need help fam! char * deleteSpace(char *String, int n) { int i; char *withoutSpaces; withoutSpaces = calloc(n, sizeof (char)); for (i = 0; i < n - 1; i++) { if (String[i] == ' ') withoutSpaces[i] = String[++i]; else withoutSpaces[i] = String[i]; } return withoutSpaces; }
0debug
Profiling and std::vector part of Hot Path? : <p>I'm trying to find the source of performance issues with my application. Using Visual Studio 2017 profiling tools I got this result:</p> <p><a href="https://i.stack.imgur.com/z3HPr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z3HPr.png" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/PRlsg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PRlsg.png" alt="enter image description here"></a></p> <p>I'm relatively new to C++ so I'm not sure what this <code>std::vector&lt;bool,std::allocator&lt;bool&gt; &gt;::operator[]</code> stuff is or if this is really the bottleneck in my program or not. Any help is appreciated.</p> <p>Here is my code: <a href="https://github.com/k-vekos/GameOfLife/tree/multithread" rel="nofollow noreferrer">https://github.com/k-vekos/GameOfLife/tree/multithread</a></p>
0debug
static int truemotion1_decode_header(TrueMotion1Context *s) { int i, ret; int width_shift = 0; int new_pix_fmt; struct frame_header header; uint8_t header_buffer[128] = { 0 }; const uint8_t *sel_vector_table; header.header_size = ((s->buf[0] >> 5) | (s->buf[0] << 3)) & 0x7f; if (s->buf[0] < 0x10) { av_log(s->avctx, AV_LOG_ERROR, "invalid header size (%d)\n", s->buf[0]); for (i = 1; i < header.header_size; i++) header_buffer[i - 1] = s->buf[i] ^ s->buf[i + 1]; header.compression = header_buffer[0]; header.deltaset = header_buffer[1]; header.vectable = header_buffer[2]; header.ysize = AV_RL16(&header_buffer[3]); header.xsize = AV_RL16(&header_buffer[5]); header.checksum = AV_RL16(&header_buffer[7]); header.version = header_buffer[9]; header.header_type = header_buffer[10]; header.flags = header_buffer[11]; header.control = header_buffer[12]; if (header.version >= 2) { if (header.header_type > 3) { av_log(s->avctx, AV_LOG_ERROR, "invalid header type (%d)\n", header.header_type); } else if ((header.header_type == 2) || (header.header_type == 3)) { s->flags = header.flags; if (!(s->flags & FLAG_INTERFRAME)) s->flags |= FLAG_KEYFRAME; } else s->flags = FLAG_KEYFRAME; } else s->flags = FLAG_KEYFRAME; if (s->flags & FLAG_SPRITE) { avpriv_request_sample(s->avctx, "Frame with sprite"); return AVERROR_PATCHWELCOME; } else { s->w = header.xsize; s->h = header.ysize; if (header.header_type < 2) { if ((s->w < 213) && (s->h >= 176)) { s->flags |= FLAG_INTERPOLATED; avpriv_request_sample(s->avctx, "Interpolated frame"); if (header.compression >= 17) { av_log(s->avctx, AV_LOG_ERROR, "invalid compression type (%d)\n", header.compression); if ((header.deltaset != s->last_deltaset) || (header.vectable != s->last_vectable)) select_delta_tables(s, header.deltaset); if ((header.compression & 1) && header.header_type) sel_vector_table = pc_tbl2; else { if (header.vectable > 0 && header.vectable < 4) sel_vector_table = tables[header.vectable - 1]; else { av_log(s->avctx, AV_LOG_ERROR, "invalid vector table id (%d)\n", header.vectable); if (compression_types[header.compression].algorithm == ALGO_RGB24H) { new_pix_fmt = AV_PIX_FMT_RGB32; width_shift = 1; } else new_pix_fmt = AV_PIX_FMT_RGB555; s->w >>= width_shift; if (s->w != s->avctx->width || s->h != s->avctx->height || new_pix_fmt != s->avctx->pix_fmt) { av_frame_unref(s->frame); s->avctx->sample_aspect_ratio = (AVRational){ 1 << width_shift, 1 }; s->avctx->pix_fmt = new_pix_fmt; if ((ret = ff_set_dimensions(s->avctx, s->w, s->h)) < 0) return ret; av_fast_malloc(&s->vert_pred, &s->vert_pred_size, s->avctx->width * sizeof(unsigned int)); s->mb_change_bits_row_size = ((s->avctx->width >> (2 - width_shift)) + 7) >> 3; if ((header.deltaset != s->last_deltaset) || (header.vectable != s->last_vectable)) { if (compression_types[header.compression].algorithm == ALGO_RGB24H) gen_vector_table24(s, sel_vector_table); else if (s->avctx->pix_fmt == AV_PIX_FMT_RGB555) gen_vector_table15(s, sel_vector_table); else gen_vector_table16(s, sel_vector_table); s->mb_change_bits = s->buf + header.header_size; if (s->flags & FLAG_KEYFRAME) { s->index_stream = s->mb_change_bits; } else { s->index_stream = s->mb_change_bits + (s->mb_change_bits_row_size * (s->avctx->height >> 2)); s->index_stream_size = s->size - (s->index_stream - s->buf); s->last_deltaset = header.deltaset; s->last_vectable = header.vectable; s->compression = header.compression; s->block_width = compression_types[header.compression].block_width; s->block_height = compression_types[header.compression].block_height; s->block_type = compression_types[header.compression].block_type; if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "tables: %d / %d c:%d %dx%d t:%d %s%s%s%s\n", s->last_deltaset, s->last_vectable, s->compression, s->block_width, s->block_height, s->block_type, s->flags & FLAG_KEYFRAME ? " KEY" : "", s->flags & FLAG_INTERFRAME ? " INTER" : "", s->flags & FLAG_SPRITE ? " SPRITE" : "", s->flags & FLAG_INTERPOLATED ? " INTERPOL" : ""); return header.header_size;
1threat
How to cancel DispatchQueue.main.asyncAfter(deadline: time) in Swift3? : <h2>Description:</h2> <p>I'm currently using the following code to see if the user has stopped typing in the searchBar. I would like to cancel it everytime the user immediately starts typing after <code>0.5</code> seconds. </p> <p><strong>Code:</strong></p> <pre><code>DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { // your function here } </code></pre> <h2>Question:</h2> <p>How do I cancel <code>DispatchQueue.main.asyncAfter</code> if the user starts typing again in <code>Swift3</code> ?</p> <h2>What I've tried:</h2> <p>I previously tried implementing :</p> <pre><code>NSObject.cancelPreviousPerformRequests(withTarget: self) self.perform(Selector(("searchForText:")), with: searchString, afterDelay: 0.5) </code></pre> <p>However the delay does not seem to work properly. </p> <p><strong>More code:</strong></p> <pre><code>//In class SearchViewController: UITableViewController, UISearchResultsUpdating func updateSearchResults(for searchController: UISearchController) { let searchString: String = searchController.searchBar.text! //This is what I previously tried.. which doesn't work... //NSObject.cancelPreviousPerformRequests(withTarget: self) //self.perform(Selector(("searchForText:")), with: searchString, afterDelay: 0.5) //A struct with the first example code shown above. Utils.Dispatch.delay(secondsToDelay: 1){ print("1 second has passed ! " + searchString) } } </code></pre>
0debug
Accessing page with parameter returns HTML w/o CSS : I'm implementing pagination for the first time ever right now, though I have run into an issue. When I access the website with a parameter (i.e. `mydomain.com/?page=2`) which is separated by a forward slash, it returns the page without any styling. Accessing the page without the forward slash (i.e. `mydomain.com?page=2`) returns the page with styling, as expected. However, I have read that the proper way to implement and use parameters is with the forward slash... **Why is it returning a page without styling?**
0debug
static void glib_pollfds_fill(int64_t *cur_timeout) { GMainContext *context = g_main_context_default(); int timeout = 0; int64_t timeout_ns; int n; g_main_context_prepare(context, &max_priority); glib_pollfds_idx = gpollfds->len; n = glib_n_poll_fds; do { GPollFD *pfds; glib_n_poll_fds = n; g_array_set_size(gpollfds, glib_pollfds_idx + glib_n_poll_fds); pfds = &g_array_index(gpollfds, GPollFD, glib_pollfds_idx); n = g_main_context_query(context, max_priority, &timeout, pfds, glib_n_poll_fds); } while (n != glib_n_poll_fds); if (timeout < 0) { timeout_ns = -1; } else { timeout_ns = (int64_t)timeout * (int64_t)SCALE_MS; } *cur_timeout = qemu_soonest_timeout(timeout_ns, *cur_timeout); }
1threat
static int join_request_frame(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; JoinContext *s = ctx->priv; AVFilterBufferRef *buf; JoinBufferPriv *priv; int linesize = INT_MAX; int perms = ~0; int nb_samples; int i, j, ret; for (i = 0; i < ctx->nb_inputs; i++) { AVFilterLink *inlink = ctx->inputs[i]; if (!s->input_frames[i] && (ret = ff_request_frame(inlink)) < 0) return ret; if (i == 0) { nb_samples = s->input_frames[0]->audio->nb_samples; for (j = 1; !i && j < ctx->nb_inputs; j++) ctx->inputs[j]->request_samples = nb_samples; } } for (i = 0; i < s->nb_channels; i++) { ChannelMap *ch = &s->channels[i]; AVFilterBufferRef *cur_buf = s->input_frames[ch->input]; s->data[i] = cur_buf->extended_data[ch->in_channel_idx]; linesize = FFMIN(linesize, cur_buf->linesize[0]); perms &= cur_buf->perms; } buf = avfilter_get_audio_buffer_ref_from_arrays(s->data, linesize, perms, nb_samples, outlink->format, outlink->channel_layout); if (!buf) return AVERROR(ENOMEM); buf->buf->free = join_free_buffer; buf->pts = s->input_frames[0]->pts; if (!(priv = av_mallocz(sizeof(*priv)))) goto fail; if (!(priv->in_buffers = av_mallocz(sizeof(*priv->in_buffers) * ctx->nb_inputs))) goto fail; for (i = 0; i < ctx->nb_inputs; i++) priv->in_buffers[i] = s->input_frames[i]; priv->nb_in_buffers = ctx->nb_inputs; buf->buf->priv = priv; ff_filter_samples(outlink, buf); memset(s->input_frames, 0, sizeof(*s->input_frames) * ctx->nb_inputs); return 0; fail: avfilter_unref_buffer(buf); if (priv) av_freep(&priv->in_buffers); av_freep(&priv); return AVERROR(ENOMEM); }
1threat
Getting httpServletRequest attribute with MockMvc : <p>I have a really simple controller defined in this way:</p> <pre><code>@RequestMapping(value = "/api/test", method = RequestMethod.GET, produces = "application/json") public @ResponseBody Object getObject(HttpServletRequest req, HttpServletResponse res) { Object userId = req.getAttribute("userId"); if (userId == null){ res.setStatus(HttpStatus.BAD_REQUEST.value()); } [....] } </code></pre> <p>I tried to call using MockMvc in many different way but, I'm not able to provide the attribute "userId". </p> <p>For instance, with this it doesn't work:</p> <pre><code>MockHttpSession mockHttpSession = new MockHttpSession(); mockHttpSession.setAttribute("userId", "TESTUSER"); mockMvc.perform(get("/api/test").session(mockHttpSession)).andExpect(status().is(200)).andReturn(); </code></pre> <p>I also tried this, but without success:</p> <pre><code>MvcResult result = mockMvc.perform(get("/api/test").with(new RequestPostProcessor() { public MockHttpServletRequest postProcessRequest(MockHttpServletRequest request) { request.setParameter("userId", "testUserId"); request.setRemoteUser("TESTUSER"); return request; } })).andExpect(status().is(200)).andReturn(); </code></pre> <p>In this case, I can set the RemoteUser but never the Attributes map on HttpServletRequest. </p> <p>Any clue?</p>
0debug
Cache a static file in memory forever on Nginx? : <p>I have Nginx running in a Docker container, and it serves some static files. The files will <em>never</em> change at runtime - if they actually do change, the container will be stopped, the image will be rebuilt, and a new container will be started.</p> <p>So, to improve performance, it would be perfect if Nginx would read the static files only one single time from disk and then server it from memory forever. I have found some configuration options to configure caching, but at least from what I have seen none of them provided this "forever" behavior that I'm looking for.</p> <p>Is this possible at all? If so, how do I need to configure Nginx to achieve this?</p>
0debug
altivec_packIntArrayToCharArray(int *val, uint8_t* dest, int dstW) { register int i; vector unsigned int altivec_vectorShiftInt19 = vec_add(vec_splat_u32(10),vec_splat_u32(9)); if ((unsigned long)dest % 16) { vector unsigned char perm1; vector signed int v1; for (i = 0 ; (i < dstW) && (((unsigned long)dest + i) % 16) ; i++) { int t = val[i] >> 19; dest[i] = (t < 0) ? 0 : ((t > 255) ? 255 : t); } perm1 = vec_lvsl(i << 2, val); v1 = vec_ld(i << 2, val); for ( ; i < (dstW - 15); i+=16) { int offset = i << 2; vector signed int v2 = vec_ld(offset + 16, val); vector signed int v3 = vec_ld(offset + 32, val); vector signed int v4 = vec_ld(offset + 48, val); vector signed int v5 = vec_ld(offset + 64, val); vector signed int v12 = vec_perm(v1,v2,perm1); vector signed int v23 = vec_perm(v2,v3,perm1); vector signed int v34 = vec_perm(v3,v4,perm1); vector signed int v45 = vec_perm(v4,v5,perm1); vector signed int vA = vec_sra(v12, altivec_vectorShiftInt19); vector signed int vB = vec_sra(v23, altivec_vectorShiftInt19); vector signed int vC = vec_sra(v34, altivec_vectorShiftInt19); vector signed int vD = vec_sra(v45, altivec_vectorShiftInt19); vector unsigned short vs1 = vec_packsu(vA, vB); vector unsigned short vs2 = vec_packsu(vC, vD); vector unsigned char vf = vec_packsu(vs1, vs2); vec_st(vf, i, dest); v1 = v5; } } else { for (i = 0; i < (dstW - 15); i+=16) { int offset = i << 2; vector signed int v1 = vec_ld(offset, val); vector signed int v2 = vec_ld(offset + 16, val); vector signed int v3 = vec_ld(offset + 32, val); vector signed int v4 = vec_ld(offset + 48, val); vector signed int v5 = vec_sra(v1, altivec_vectorShiftInt19); vector signed int v6 = vec_sra(v2, altivec_vectorShiftInt19); vector signed int v7 = vec_sra(v3, altivec_vectorShiftInt19); vector signed int v8 = vec_sra(v4, altivec_vectorShiftInt19); vector unsigned short vs1 = vec_packsu(v5, v6); vector unsigned short vs2 = vec_packsu(v7, v8); vector unsigned char vf = vec_packsu(vs1, vs2); vec_st(vf, i, dest); } } for ( ; i < dstW ; i++) { int t = val[i] >> 19; dest[i] = (t < 0) ? 0 : ((t > 255) ? 255 : t); } }
1threat
when website is loaded, get news from txt file : <script type="text/javascript"> $(document).ready(function() { $("body").ready(function() { $.ajax({ url : "helloworld.txt", dataType: "text", success : function (data) { $(".slider").html(data); } }); }); });</script> I want this code to get HTML code from a txt file and add it in here: <div class="slider"> <!-- News Slider --> </div> The txt file contains the following: <div class="callbacks_container"> <ul class="rslides" id="slider"> <li> <h2><a href="http://services.runescape.com/m=news/christmas--zeah?oldschool=1">Zeah</a></h2> <h3><a href="http://services.runescape.com/m=news/christmas--zeah?oldschool=1">New continent, 50% expansion</a></h3> </li> <li> <h2><a href="https://www.facebook.com">Sailing</a></h2> <h3><a href="https://www.facebook.com">Sail around the world</a></h3> </li> <li> <h2><a href="http://services.runescape.com/m=news/old-school-in-2016?oldschool=1">2016</a></h2> <h3><a href="http://services.runescape.com/m=news/old-school-in-2016?oldschool=1">Christmas event coming to an end</a></h3> </li> </ul> </div> The function above doesn't work but i cant find a way to fix this, please help! Thanks!
0debug
How to get Date and time on Json Data and set Reminders : I have a JSON object; {"Data":[{ Remaindercurdate=2017-06-22 09:48:25, Remainder=dtyhnnfg}]}
0debug
static int decode_syncpoint(NUTContext *nut){ AVFormatContext *s= nut->avf; ByteIOContext *bc = &s->pb; int64_t end; uint64_t tmp; int i; AVRational time_base; nut->last_syncpoint_pos= url_ftell(bc)-8; end= get_packetheader(nut, bc, 1); end += url_ftell(bc) - 4; tmp= get_v(bc); get_v(bc); time_base= nut->time_base[tmp % nut->time_base_count]; for(i=0; i<s->nb_streams; i++){ nut->stream[i].last_pts= av_rescale_rnd( tmp / nut->time_base_count, time_base.num * (int64_t)nut->stream[i].time_base.den, time_base.den * (int64_t)nut->stream[i].time_base.num, AV_ROUND_DOWN); } if(skip_reserved(bc, end) || check_checksum(bc)){ av_log(s, AV_LOG_ERROR, "sync point checksum mismatch\n"); return -1; } return 0; }
1threat
static void spitz_i2c_setup(PXA2xxState *cpu) { i2c_bus *bus = pxa2xx_i2c_bus(cpu->i2c[0]); #ifdef HAS_AUDIO DeviceState *wm; wm = i2c_create_slave(bus, "wm8750", 0); spitz_wm8750_addr(wm, 0, 0); pxa2xx_gpio_out_set(cpu->gpio, SPITZ_GPIO_WM, qemu_allocate_irqs(spitz_wm8750_addr, wm, 1)[0]); cpu->i2s->opaque = wm; cpu->i2s->codec_out = wm8750_dac_dat; cpu->i2s->codec_in = wm8750_adc_dat; wm8750_data_req_set(wm, cpu->i2s->data_req, cpu->i2s); #endif }
1threat
Styling a Twitter feed - CSS won't target .timeline-Tweet-text : <p>I'm bringing a Twitter feed through to my site using the following code which is described on <a href="https://publish.twitter.com/" rel="noreferrer">https://publish.twitter.com/</a></p> <pre><code>&lt;a class="twitter-timeline" href="https://twitter.com/ACCOUNT-HERE" data-tweet-limit="3"&gt;Tweets by&lt;/a&gt; &lt;script async src="//platform.twitter.com/widgets.js" charset="utf-8"&gt;&lt;/script&gt; </code></pre> <p>The feed is displayed correctly. However it uses CSS which is provided via Twitter.</p> <p>When I inspect it using Chrome dev tools I can see the following classes around the Tweets:</p> <pre><code>&lt;p class="timeline-Tweet-text" lang="en" dir="ltr"&gt; </code></pre> <p>So I thought it would be a simple case of targetting this in CSS, e.g.</p> <pre><code>.timeline-Tweet-text { } </code></pre> <p>However, this doesn't apply any styles to the Tweets. Why not?</p> <p>I have also referred to Twitters guidance on this here <a href="https://dev.twitter.com/web/overview/css" rel="noreferrer">https://dev.twitter.com/web/overview/css</a> but that also doesn't work.</p> <p>The only reason I want to do this is so the font used within the widget matches the font used by the rest of the <code>body</code> text on my website.</p>
0debug
Is it possible to search column of a table for a particular value using function in Oracle? : I know it can be done like this, but I want to do it by using functions. select * from *table_name* where *column_name* like '%*STR*%';
0debug
Jquery class based validations showing wrong output? : [enter image description here][1] [1]: https://i.stack.imgur.com/NYkGl.jpg Here I'm trying to do Jquery class based validation and it works well but it shows wrong output as well. when i click on search button in search field below fields are getting validated . I'm not getting why is it so happening ?
0debug
float64 helper_fabs_DT(float64 t0) { return float64_abs(t0); }
1threat
struct tm *brktimegm(time_t secs, struct tm *tm) { int days, y, ny, m; int md[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; days = secs / 86400; secs %= 86400; tm->tm_hour = secs / 3600; tm->tm_min = (secs % 3600) / 60; tm->tm_sec = secs % 60; y = 1970; while (days >= (ISLEAP(y)?366:365)) { ny = (y + days/366); days -= (ny - y) * 365 + LEAPS_COUNT(ny - 1) - LEAPS_COUNT(y - 1); y = ny; } md[1] = ISLEAP(y)?29:28; for (m=0; days >= md[m]; m++) days -= md[m]; tm->tm_year = y; tm->tm_mon = m+1; tm->tm_mday = days+1; return tm; }
1threat
static int fill_filter_caches(H264Context *h, int mb_type){ MpegEncContext * const s = &h->s; const int mb_xy= h->mb_xy; int top_xy, left_xy[2]; int top_type, left_type[2]; top_xy = mb_xy - (s->mb_stride << MB_FIELD); left_xy[1] = left_xy[0] = mb_xy-1; if(FRAME_MBAFF){ const int left_mb_field_flag = IS_INTERLACED(s->current_picture.mb_type[mb_xy-1]); const int curr_mb_field_flag = IS_INTERLACED(mb_type); if(s->mb_y&1){ if (left_mb_field_flag != curr_mb_field_flag) { left_xy[0] -= s->mb_stride; } }else{ if(curr_mb_field_flag){ top_xy += s->mb_stride & (((s->current_picture.mb_type[top_xy ]>>7)&1)-1); } if (left_mb_field_flag != curr_mb_field_flag) { left_xy[1] += s->mb_stride; } } } h->top_mb_xy = top_xy; h->left_mb_xy[0] = left_xy[0]; h->left_mb_xy[1] = left_xy[1]; { int qp_thresh = h->qp_thresh; int qp = s->current_picture.qscale_table[mb_xy]; if(qp <= qp_thresh && (left_xy[0]<0 || ((qp + s->current_picture.qscale_table[left_xy[0]] + 1)>>1) <= qp_thresh) && (top_xy < 0 || ((qp + s->current_picture.qscale_table[top_xy ] + 1)>>1) <= qp_thresh)){ if(!FRAME_MBAFF) return 1; if( (left_xy[0]< 0 || ((qp + s->current_picture.qscale_table[left_xy[1] ] + 1)>>1) <= qp_thresh) && (top_xy < s->mb_stride || ((qp + s->current_picture.qscale_table[top_xy -s->mb_stride] + 1)>>1) <= qp_thresh)) return 1; } } top_type = s->current_picture.mb_type[top_xy] ; left_type[0] = s->current_picture.mb_type[left_xy[0]]; left_type[1] = s->current_picture.mb_type[left_xy[1]]; if(h->deblocking_filter == 2){ if(h->slice_table[top_xy ] != h->slice_num) top_type= 0; if(h->slice_table[left_xy[0] ] != h->slice_num) left_type[0]= left_type[1]= 0; }else{ if(h->slice_table[top_xy ] == 0xFFFF) top_type= 0; if(h->slice_table[left_xy[0] ] == 0xFFFF) left_type[0]= left_type[1] =0; } h->top_type = top_type ; h->left_type[0]= left_type[0]; h->left_type[1]= left_type[1]; if(IS_INTRA(mb_type)) return 0; AV_COPY32(&h->non_zero_count_cache[4+8* 1], &h->non_zero_count[mb_xy][ 0]); AV_COPY32(&h->non_zero_count_cache[4+8* 2], &h->non_zero_count[mb_xy][ 4]); AV_COPY32(&h->non_zero_count_cache[4+8* 3], &h->non_zero_count[mb_xy][ 8]); AV_COPY32(&h->non_zero_count_cache[4+8* 4], &h->non_zero_count[mb_xy][12]); h->cbp= h->cbp_table[mb_xy]; { int list; for(list=0; list<h->list_count; list++){ int8_t *ref; int y, b_stride; int16_t (*mv_dst)[2]; int16_t (*mv_src)[2]; if(!USES_LIST(mb_type, list)){ fill_rectangle( h->mv_cache[list][scan8[0]], 4, 4, 8, pack16to32(0,0), 4); AV_WN32A(&h->ref_cache[list][scan8[ 0]], ((LIST_NOT_USED)&0xFF)*0x01010101u); AV_WN32A(&h->ref_cache[list][scan8[ 2]], ((LIST_NOT_USED)&0xFF)*0x01010101u); AV_WN32A(&h->ref_cache[list][scan8[ 8]], ((LIST_NOT_USED)&0xFF)*0x01010101u); AV_WN32A(&h->ref_cache[list][scan8[10]], ((LIST_NOT_USED)&0xFF)*0x01010101u); continue; } ref = &s->current_picture.ref_index[list][4*mb_xy]; { int (*ref2frm)[64] = h->ref2frm[ h->slice_num&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2); AV_WN32A(&h->ref_cache[list][scan8[ 0]], (pack16to32(ref2frm[list][ref[0]],ref2frm[list][ref[1]])&0x00FF00FF)*0x0101); AV_WN32A(&h->ref_cache[list][scan8[ 2]], (pack16to32(ref2frm[list][ref[0]],ref2frm[list][ref[1]])&0x00FF00FF)*0x0101); ref += 2; AV_WN32A(&h->ref_cache[list][scan8[ 8]], (pack16to32(ref2frm[list][ref[0]],ref2frm[list][ref[1]])&0x00FF00FF)*0x0101); AV_WN32A(&h->ref_cache[list][scan8[10]], (pack16to32(ref2frm[list][ref[0]],ref2frm[list][ref[1]])&0x00FF00FF)*0x0101); } b_stride = h->b_stride; mv_dst = &h->mv_cache[list][scan8[0]]; mv_src = &s->current_picture.motion_val[list][4*s->mb_x + 4*s->mb_y*b_stride]; for(y=0; y<4; y++){ AV_COPY128(mv_dst + 8*y, mv_src + y*b_stride); } } } if(top_type){ AV_COPY32(&h->non_zero_count_cache[4+8*0], &h->non_zero_count[top_xy][3*4]); } if(left_type[0]){ h->non_zero_count_cache[3+8*1]= h->non_zero_count[left_xy[0]][3+0*4]; h->non_zero_count_cache[3+8*2]= h->non_zero_count[left_xy[0]][3+1*4]; h->non_zero_count_cache[3+8*3]= h->non_zero_count[left_xy[0]][3+2*4]; h->non_zero_count_cache[3+8*4]= h->non_zero_count[left_xy[0]][3+3*4]; } if(!CABAC && h->pps.transform_8x8_mode){ if(IS_8x8DCT(top_type)){ h->non_zero_count_cache[4+8*0]= h->non_zero_count_cache[5+8*0]= (h->cbp_table[top_xy] & 0x4000) >> 12; h->non_zero_count_cache[6+8*0]= h->non_zero_count_cache[7+8*0]= (h->cbp_table[top_xy] & 0x8000) >> 12; } if(IS_8x8DCT(left_type[0])){ h->non_zero_count_cache[3+8*1]= h->non_zero_count_cache[3+8*2]= (h->cbp_table[left_xy[0]]&0x2000) >> 12; } if(IS_8x8DCT(left_type[1])){ h->non_zero_count_cache[3+8*3]= h->non_zero_count_cache[3+8*4]= (h->cbp_table[left_xy[1]]&0x8000) >> 12; } if(IS_8x8DCT(mb_type)){ h->non_zero_count_cache[scan8[0 ]]= h->non_zero_count_cache[scan8[1 ]]= h->non_zero_count_cache[scan8[2 ]]= h->non_zero_count_cache[scan8[3 ]]= (h->cbp & 0x1000) >> 12; h->non_zero_count_cache[scan8[0+ 4]]= h->non_zero_count_cache[scan8[1+ 4]]= h->non_zero_count_cache[scan8[2+ 4]]= h->non_zero_count_cache[scan8[3+ 4]]= (h->cbp & 0x2000) >> 12; h->non_zero_count_cache[scan8[0+ 8]]= h->non_zero_count_cache[scan8[1+ 8]]= h->non_zero_count_cache[scan8[2+ 8]]= h->non_zero_count_cache[scan8[3+ 8]]= (h->cbp & 0x4000) >> 12; h->non_zero_count_cache[scan8[0+12]]= h->non_zero_count_cache[scan8[1+12]]= h->non_zero_count_cache[scan8[2+12]]= h->non_zero_count_cache[scan8[3+12]]= (h->cbp & 0x8000) >> 12; } } if(IS_INTER(mb_type) || IS_DIRECT(mb_type)){ int list; for(list=0; list<h->list_count; list++){ if(USES_LIST(top_type, list)){ const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride; const int b8_xy= 4*top_xy + 2; int (*ref2frm)[64] = h->ref2frm[ h->slice_table[top_xy]&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2); AV_COPY128(h->mv_cache[list][scan8[0] + 0 - 1*8], s->current_picture.motion_val[list][b_xy + 0]); h->ref_cache[list][scan8[0] + 0 - 1*8]= h->ref_cache[list][scan8[0] + 1 - 1*8]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 0]]; h->ref_cache[list][scan8[0] + 2 - 1*8]= h->ref_cache[list][scan8[0] + 3 - 1*8]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 1]]; }else{ AV_ZERO128(h->mv_cache[list][scan8[0] + 0 - 1*8]); AV_WN32A(&h->ref_cache[list][scan8[0] + 0 - 1*8], ((LIST_NOT_USED)&0xFF)*0x01010101u); } if(!IS_INTERLACED(mb_type^left_type[0])){ if(USES_LIST(left_type[0], list)){ const int b_xy= h->mb2b_xy[left_xy[0]] + 3; const int b8_xy= 4*left_xy[0] + 1; int (*ref2frm)[64] = h->ref2frm[ h->slice_table[left_xy[0]]&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2); AV_COPY32(h->mv_cache[list][scan8[0] - 1 + 0 ], s->current_picture.motion_val[list][b_xy + h->b_stride*0]); AV_COPY32(h->mv_cache[list][scan8[0] - 1 + 8 ], s->current_picture.motion_val[list][b_xy + h->b_stride*1]); AV_COPY32(h->mv_cache[list][scan8[0] - 1 +16 ], s->current_picture.motion_val[list][b_xy + h->b_stride*2]); AV_COPY32(h->mv_cache[list][scan8[0] - 1 +24 ], s->current_picture.motion_val[list][b_xy + h->b_stride*3]); h->ref_cache[list][scan8[0] - 1 + 0 ]= h->ref_cache[list][scan8[0] - 1 + 8 ]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 2*0]]; h->ref_cache[list][scan8[0] - 1 +16 ]= h->ref_cache[list][scan8[0] - 1 +24 ]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 2*1]]; }else{ AV_ZERO32(h->mv_cache [list][scan8[0] - 1 + 0 ]); AV_ZERO32(h->mv_cache [list][scan8[0] - 1 + 8 ]); AV_ZERO32(h->mv_cache [list][scan8[0] - 1 +16 ]); AV_ZERO32(h->mv_cache [list][scan8[0] - 1 +24 ]); h->ref_cache[list][scan8[0] - 1 + 0 ]= h->ref_cache[list][scan8[0] - 1 + 8 ]= h->ref_cache[list][scan8[0] - 1 + 16 ]= h->ref_cache[list][scan8[0] - 1 + 24 ]= LIST_NOT_USED; } } } } return 0; }
1threat
i need help in outlook to delete conversation (employees) and keep original message(customer) with last reply in vba 6 : How are you doing please can u help me to make program in vba 6 for outlook that delete all conversation(employs) in forward and just keep the original message with last reply from me I hope from u to help me See attachment please [enter image description here][1] [1]: https://i.stack.imgur.com/uRaOY.jpg
0debug
sPAPRTCETable *spapr_tce_new_table(DeviceState *owner, uint32_t liobn) { sPAPRTCETable *tcet; char tmp[32]; if (spapr_tce_find_by_liobn(liobn)) { error_report("Attempted to create TCE table with duplicate" " LIOBN 0x%x", liobn); return NULL; } tcet = SPAPR_TCE_TABLE(object_new(TYPE_SPAPR_TCE_TABLE)); tcet->liobn = liobn; snprintf(tmp, sizeof(tmp), "tce-table-%x", liobn); object_property_add_child(OBJECT(owner), tmp, OBJECT(tcet), NULL); object_property_set_bool(OBJECT(tcet), true, "realized", NULL); return tcet; }
1threat
static uint64_t openpic_gbl_read(void *opaque, hwaddr addr, unsigned len) { OpenPICState *opp = opaque; uint32_t retval; DPRINTF("%s: addr " TARGET_FMT_plx "\n", __func__, addr); retval = 0xFFFFFFFF; if (addr & 0xF) return retval; switch (addr) { case 0x1000: retval = opp->frep; break; case 0x1020: retval = opp->glbc; break; case 0x1080: retval = opp->veni; break; case 0x1090: retval = 0x00000000; break; case 0x00: retval = opp->brr1; break; case 0x40: case 0x50: case 0x60: case 0x70: case 0x80: case 0x90: case 0xA0: case 0xB0: retval = openpic_cpu_read_internal(opp, addr, get_current_cpu()); break; case 0x10A0: case 0x10B0: case 0x10C0: case 0x10D0: { int idx; idx = (addr - 0x10A0) >> 4; retval = read_IRQreg_ipvp(opp, opp->irq_ipi0 + idx); } break; case 0x10E0: retval = opp->spve; break; default: break; } DPRINTF("%s: => %08x\n", __func__, retval); return retval; }
1threat
static void do_vm_stop(RunState state) { if (runstate_is_running()) { cpu_disable_ticks(); pause_all_vcpus(); runstate_set(state); vm_state_notify(0, state); qemu_aio_flush(); bdrv_flush_all(); monitor_protocol_event(QEVENT_STOP, NULL); } }
1threat
static int set_pix_fmt(AVCodecContext *avctx, struct vpx_image *img, int has_alpha_channel) { #if VPX_IMAGE_ABI_VERSION >= 3 static const enum AVColorSpace colorspaces[8] = { AVCOL_SPC_UNSPECIFIED, AVCOL_SPC_BT470BG, AVCOL_SPC_BT709, AVCOL_SPC_SMPTE170M, AVCOL_SPC_SMPTE240M, AVCOL_SPC_BT2020_NCL, AVCOL_SPC_RESERVED, AVCOL_SPC_RGB, }; #if VPX_IMAGE_ABI_VERSION >= 4 static const enum AVColorRange color_ranges[] = { AVCOL_RANGE_MPEG, AVCOL_RANGE_JPEG }; avctx->color_range = color_ranges[img->range]; #endif avctx->colorspace = colorspaces[img->cs]; #endif if (avctx->codec_id == AV_CODEC_ID_VP8 && img->fmt != VPX_IMG_FMT_I420) return AVERROR_INVALIDDATA; switch (img->fmt) { case VPX_IMG_FMT_I420: if (avctx->codec_id == AV_CODEC_ID_VP9) avctx->profile = FF_PROFILE_VP9_0; avctx->pix_fmt = has_alpha_channel ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P; return 0; #if CONFIG_LIBVPX_VP9_DECODER case VPX_IMG_FMT_I422: avctx->profile = FF_PROFILE_VP9_1; avctx->pix_fmt = AV_PIX_FMT_YUV422P; return 0; #if VPX_IMAGE_ABI_VERSION >= 3 case VPX_IMG_FMT_I440: avctx->profile = FF_PROFILE_VP9_1; avctx->pix_fmt = AV_PIX_FMT_YUV440P; return 0; #endif case VPX_IMG_FMT_I444: avctx->profile = FF_PROFILE_VP9_1; #if VPX_IMAGE_ABI_VERSION >= 3 avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ? AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P; #else avctx->pix_fmt = AV_PIX_FMT_YUV444P; #endif return 0; #ifdef VPX_IMG_FMT_HIGHBITDEPTH case VPX_IMG_FMT_I42016: avctx->profile = FF_PROFILE_VP9_2; if (img->bit_depth == 10) { avctx->pix_fmt = AV_PIX_FMT_YUV420P10; return 0; } else if (img->bit_depth == 12) { avctx->pix_fmt = AV_PIX_FMT_YUV420P12; return 0; } else { return AVERROR_INVALIDDATA; } case VPX_IMG_FMT_I42216: avctx->profile = FF_PROFILE_VP9_3; if (img->bit_depth == 10) { avctx->pix_fmt = AV_PIX_FMT_YUV422P10; return 0; } else if (img->bit_depth == 12) { avctx->pix_fmt = AV_PIX_FMT_YUV422P12; return 0; } else { return AVERROR_INVALIDDATA; } #if VPX_IMAGE_ABI_VERSION >= 3 case VPX_IMG_FMT_I44016: avctx->profile = FF_PROFILE_VP9_3; if (img->bit_depth == 10) { avctx->pix_fmt = AV_PIX_FMT_YUV440P10; return 0; } else if (img->bit_depth == 12) { avctx->pix_fmt = AV_PIX_FMT_YUV440P12; return 0; } else { return AVERROR_INVALIDDATA; } #endif case VPX_IMG_FMT_I44416: avctx->profile = FF_PROFILE_VP9_3; if (img->bit_depth == 10) { #if VPX_IMAGE_ABI_VERSION >= 3 avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ? AV_PIX_FMT_GBRP10 : AV_PIX_FMT_YUV444P10; #else avctx->pix_fmt = AV_PIX_FMT_YUV444P10; #endif return 0; } else if (img->bit_depth == 12) { #if VPX_IMAGE_ABI_VERSION >= 3 avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ? AV_PIX_FMT_GBRP12 : AV_PIX_FMT_YUV444P12; #else avctx->pix_fmt = AV_PIX_FMT_YUV444P12; #endif return 0; } else { return AVERROR_INVALIDDATA; } #endif #endif default: return AVERROR_INVALIDDATA; } }
1threat
Why strcmp() works differently in code blocks (particularly in gcc) and other compilers? : <p>I was just trying to execute this program in code blocks and i got an output of 0,1,-1 , in some other compiler i got result 0,4,-1 but according to the working of strcmp() , i should get 0,4,-32 , i am not able to understand why i am getting diferent outputs on different compilers.</p> <pre><code>#include&lt;stdio.h&gt; #include&lt;string.h&gt; int main() { char string1[]="Jerry"; char string2[]="Ferry"; int i,j,k; i=strcmp(string1,"Jerry"); j=strcmp(string1,string2); k=strcmp(string1,"Jerry boy"); printf("%d %d %d \n",i,j,k); return 0; } </code></pre>
0debug
boolean function returning true when it shouldn't C++ : <p>I have a program that searches a binary search tree using breadth first search with each type of traversal. all my functions work and run but the last traversal, postorder traversal, returns true when searching a number that is not in the tree. I have debugged the program and watched it run through the entire tree in the postorder traversal function and it never once actually returns true, but still is printing out the true output. Can anyone tell me why? </p> <pre><code>#include &lt;queue&gt; #include &lt;iostream&gt; using namespace std; struct Node { int data; Node *left, *right; }*root; Node *createNode(int data) { Node *Tnode = new Node; Tnode-&gt;left = NULL; Tnode-&gt;right = NULL; Tnode-&gt;data = data; return Tnode; } vbool breadthFirstSearch(Node *node, int item) { queue&lt;Node*&gt; q; if(root) { q.push(root); while(!q.empty()) { Node *d = q.front(); q.pop(); if(d-&gt;data == item) return true; if(d-&gt;left) q.push(d-&gt;left); if(d-&gt;right) q.push(d-&gt;right); } } return false; } bool inorderTraversal(Node *node, int item) { if(node == NULL) return false; inorderTraversal(node-&gt;left, item); if(node-&gt;data == item) return true; inorderTraversal(node-&gt;right, item); } bool preorderTraversal(Node *node, int item) { if(node == NULL) return false; if(node-&gt;data == item) return true; preorderTraversal(node-&gt;left, item); preorderTraversal(node-&gt;right, item); } bool postorderTraversal(Node *node, int item) { if(node == NULL) return false; postorderTraversal(node-&gt;left, item); postorderTraversal(node-&gt;right, item); if(node-&gt;data == item) return true; } int main() { root = createNode(20); root-&gt;left = createNode(10); root-&gt;left-&gt;left = createNode(5); root-&gt;left-&gt;right = createNode(15); root-&gt;right = createNode(30); root-&gt;right-&gt;left = createNode(25); root-&gt;right-&gt;right = createNode(35); cout&lt;&lt;"\n-----Breadth First Search Traversal-----\n"; if(breadthFirstSearch(root, 35) == true) { cout&lt;&lt; "The item 35 is in the tree\n"; } else { cout &lt;&lt; "The item 35 is not in the tree\n"; } if(breadthFirstSearch(root, 29) == true) { cout&lt;&lt; "The item 29 is in the tree\n"; } else { cout &lt;&lt; "The item 29 is not in the tree\n"; } cout&lt;&lt;"\n-----Inorder Search Traversal-----\n"; if(inorderTraversal(root, 35) == true) { cout&lt;&lt; "The item 35 is in the tree\n"; } else { cout &lt;&lt; "The item 35 is not in the tree\n"; } if(inorderTraversal(root, 29) == true) { cout&lt;&lt; "The item 29 is in the tree\n"; } else { cout &lt;&lt; "The item 29 is not in the tree\n"; } cout&lt;&lt;"\n-----Preorder Search Traversal-----\n"; if(preorderTraversal(root, 35) == true) { cout&lt;&lt; "The item 35 is in the tree\n"; } else { cout &lt;&lt; "The item 35 is not in the tree\n"; } if(preorderTraversal(root, 29) == true) { cout&lt;&lt; "The item 29 is in the tree\n"; } else { cout &lt;&lt; "The item 29 is not in the tree\n"; } cout&lt;&lt;"\n-----Postorder Search Traversal-----\n"; if(postorderTraversal(root, 35) == true) { cout&lt;&lt; "The item 35 is in the tree\n"; } else { cout &lt;&lt; "The item 35 is not in the tree\n"; } if(postorderTraversal(root, 29) == true) { cout&lt;&lt; "The item 29 is in the tree\n"; } else { cout &lt;&lt; "The item 29 is not in the tree\n"; } return 0; } </code></pre> <p>Each of the other traversals correctly prints out 35 is in the tree, 29 is not in the tree. Only post order prints that 29 is in the tree even though true is never returned when 29 is being checked. Im sure i am missing something small and silly but i just cannot seem to find it.</p>
0debug
connection.query('SELECT * FROM users WHERE username = ' + input_string)
1threat
static void init_proc_750cl (CPUPPCState *env) { gen_spr_ne_601(env); gen_spr_7xx(env); spr_register(env, SPR_L2CR, "L2CR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, NULL, 0x00000000); gen_tbl(env); spr_register(env, SPR_THRM1, "THRM1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_THRM2, "THRM2", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_THRM3, "THRM3", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_750_TDCL, "TDCL", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_750_TDCH, "TDCH", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_750_WPAR, "WPAR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_750_DMAL, "DMAL", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_750_DMAU, "DMAU", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_HID0, "HID0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_HID1, "HID1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_750CL_HID2, "HID2", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_750CL_HID4, "HID4", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_750_GQR0, "GQR0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_750_GQR1, "GQR1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_750_GQR2, "GQR2", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_750_GQR3, "GQR3", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_750_GQR4, "GQR4", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_750_GQR5, "GQR5", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_750_GQR6, "GQR6", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_750_GQR7, "GQR7", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); gen_low_BATs(env); gen_high_BATs(env); init_excp_750cl(env); env->dcache_line_size = 32; env->icache_line_size = 32; ppc6xx_irq_init(env); }
1threat
Share a dictionary of pandas dataframe across multiprocessing python : <p>I have a dictionary of python pandas dataframes. The total size of this dictionary is about 2GB. However, when I share it across 16 multiprocessing (in the subprocesses I only read the data of the dict without modifying it), it takes 32GB ram. So I would like to ask if it is possible for me to share this dictionary across multiprocessing without copying it. I tried to convert it to manager.dict(). But it seems it takes too long. What would be the most standard way to achieve this? Thank you.</p>
0debug
Python - Unusual IndentationError involving a class : When trying to develop a class, I get this error. from __future__ import division import numpy as np import scipy as sp import itertools as it from scipy.integrate import quad import astropy.cosmology from astropy import units as u class NFW: File "/Users/alexandres/Illustris/Scripts/NFWprofile2.py", line 10 ^ IndentationError: expected an indented block [Finished in 0.1s with exit code 1] [shell_cmd: python -u "/Users/alexandres/Illustris/Scripts/NFWprofile2.py"] [dir: /Users/alexandres/Illustris/Scripts] [path: /usr/bin:/bin:/usr/sbin:/sbin] How on earth is this an indentation error? regardless if i define the class as `NFW()` or `NFW(object)`, this is occurring. This is being edited through Sublime 3
0debug
How to search using wildcard in VIM : <p>Using the standard search function (/) in VIM, is there a way to search using a wildcard (match 0 or more characters)?</p> <p>Example:</p> <p>I have an array and I want to find anywhere the array's indices are assigned. </p> <pre><code>array[0] = 1; array[i] = 1; array[index]=1; </code></pre> <p>etc. </p> <p>I'm looking for something along the lines of </p> <pre><code>/array*= </code></pre> <p>if it's possible. </p>
0debug
osx truncate sd card img : <p>I have created an image of my sd card containing raspbian using the <code>dd</code> tool. This gave me a 16,09 GB big image file. The actual data on there is about 5gb, and I want to truncate it so I can store/clone it onto a 8gb sd card.</p> <p>All help results I found required Linux to do this (tools like resize2fs doesn't appear to be available for osx, at least, can't find it with homebrew).</p> <p>What tool(s) can I use to remove the 'empty' space of my .img file?</p>
0debug
static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t value) { ds1225y_t *NVRAM = opaque; int64_t pos; pos = addr - NVRAM->mem_base; if (ds1225y_set_to_mode(NVRAM, writemode, "wb")) { qemu_fseek(NVRAM->file, pos, SEEK_SET); qemu_put_byte(NVRAM->file, (int)value); } }
1threat
Write a program that prompts for the user to input a sentence. : Write a program that prompts for the user to input a sentence. Then check this sentence to make sure the first word of the sentence is capitalized and the sentence ends with a punctuation mark. If it is not properly written, fix the sentence, print the type of error, and print the fixed sentence. I was following the provided instructions for this class and keep getting an invalid syntax error for the fourth line of code. Was wondering if anyone knew why and could show me how to fix it or another way of writing this program. import string sentence = input("Enter a sentence ") class acceptSentence(): punctuationcount = lambda a,b:len(list(filter(lamdba-c: c in b,a))) numberofpunctuationcount = punctuationscount(sentence,string.punctuation) for each in sentence: if each.startswith(each.upper()): print ("Starts with Capital letter ",each) break if (numberofpunctuations >=1): print("Sentence Ends with punctuation") else: print("Error: there is no punctuation mark at end of the sentence") obj = acceptSentence() obj.calculate(sentence)
0debug
Django: Do you recommend using LTS or always keep upgrading versions? : <p>Im looking for opinions with good arguments.</p> <p>Django Framework now is at it's 1.9.2 version being 1.8.9 the LTS package.</p> <p>I'm going to write a new project template and Im asking myself if it should be good to use the LTS for this particular idea or keep up with the latest version as they ship.</p> <p>This last approach may lead to inconsistency and having to re check my code on every Django release, instead of making a project template every LTS version.</p> <p>What do you think?</p>
0debug
How to parse json rest response- NoClassDefFoundError: org/json/JSONArray : I have the following uri which returns me a json response. I have tried to parse the response of get request and access to the `steps` array but it stops in the first step. Here is the code: public void getRoute() throws Exception { String urlToRead="https://maps.googleapis.com/maps/api/directions/json?origin=41.43206,-81.38992&destination=Montreal&key=AIzaSyCM1NmrLIP1weQhVVUv7YjIRE5OKaVNtns"; DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet getRequest = new HttpGet(urlToRead); getRequest.addHeader("accept", "application/json"); HttpResponse response = httpClient.execute(getRequest); String json = IOUtils.toString(response.getEntity().getContent()); JSONArray array = new JSONArray(json); for (int i = 0; i < array.length(); i++) { JSONObject object = array.getJSONObject(i); System.out.println(object.getJSONArray("routes")); } } but it complains with: Exception in thread "main" java.lang.NoClassDefFoundError: org/json/JSONArray
0debug
how to alert when user enters nothing : i'm making a javascript and i want to alert when the user enters nothing in the prompt <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> function verifyage() { var age = prompt("enter your age:", ""); var status = (age >= 18) ? "adult" : "minor"; if(status == "minor") { alert("you are too young"); } else if (status == "adult") { alert("you're in"); } else if (status == "null") { alert("you need to enter your age"); } else { void(0); }} <!-- language: lang-html --> <button onclick="verifyage();" type="button">watch movie</button> <!-- end snippet --> what it's supposed to do: define a variable age which defines the age of user define a variable status which has two value adult and minor prompt for the age of the user alert the message you are too young when the user enter a number less than 18 alert the message you're in when user enters number greater than 18 alert the message you have to enter your age when user enters nothing but when i test it and enter nothing it says you are too young why? can you help me? i tried http://stackoverflow.com/questions/10577549/how-to-show-alert-when-user-enter-other-then-number-value-in-textfield and other but nothing plz help me
0debug
static void puv3_load_kernel(const char *kernel_filename) { int size; if (kernel_filename == NULL && qtest_enabled()) { return; } assert(kernel_filename != NULL); size = load_image_targphys(kernel_filename, KERNEL_LOAD_ADDR, KERNEL_MAX_SIZE); if (size < 0) { error_report("Load kernel error: '%s'", kernel_filename); exit(1); } graphic_console_init(NULL, 0, &no_ops, NULL); }
1threat
Scala / Spark: getting a subset of columns from a dataframe - How to pass this parameter to .select : I have a way to get a subset of a dataframe which works: This works val subset_cols = {joinCols :+ col} val df1_subset = df1.select(subset_cols.head, subset_cols.tail: _*) This doesnt work:( The code compiles but I get a run time error) val subset_cols = {joinCols :+ col} val df1_subset = df1.select(subset_cols.deep.mkString(",")) Error: Exception in thread "main" org.apache.spark.sql.AnalysisException: cannot resolve '`first_name,last_name,rank_dr`' given input columns: [model, first_name, service_date, rank_dr, id, purchase_date, dealer_id, purchase_price, age, loyalty_score, vin_num, last_name, color];; 'Project ['first_name,last_name,rank_dr]
0debug
Vba code to copy data from multiple workbooks to single work book sheet wise : I want to copy data available in multiple worksheets in multiple workbooks into another workbook but sheet wise and data should have one coloumn of workbook name(from where it has been copied). For example Workbook1 name(Raju-can be any name) having 7 sheets with different name(sheet name are same in both workbook) Workbook2 name(pappu-can be any name) having 7 sheets with different name Copy in new workbook sheet wise ..in result workbook(first sheet should have all the data from first sheet of wkb 1 and wkb 2 and same thing for second sheet)...and in all the sheet workbook name should be there that from which workbook data is copied.
0debug
How to make the title bar, minimize button and maximize button invisible on a web browser page in javascript? : I am doing a project on an online examination site. I wanted to make the title bar, minimize button and windows taskbar of the browser invisible when a candidate is clicking to attend the exam. Does anyone know how to do this ?
0debug
void vnc_jobs_consume_buffer(VncState *vs) { bool flush; vnc_lock_output(vs); if (vs->jobs_buffer.offset) { if (vs->ioc != NULL && buffer_empty(&vs->output)) { if (vs->ioc_tag) { g_source_remove(vs->ioc_tag); vs->ioc_tag = qio_channel_add_watch( vs->ioc, G_IO_IN | G_IO_OUT, vnc_client_io, vs, NULL); buffer_move(&vs->output, &vs->jobs_buffer); flush = vs->ioc != NULL && vs->abort != true; vnc_unlock_output(vs); if (flush) { vnc_flush(vs);
1threat
Image Upload Javascript : <p>My problem here is uploading images.. BUT I already know how to upload Base64 Images. Right now , i can upload Base64 Images and put them to databse. You can already see that is ridicolous as it will take tons of space and is hard to load. I was just checking if there is like this API Where you can upload and it gives you URL(And No I dont want Imgur, because it is banned a lot of places.) Or if there is a custom way to shorten Base64? Something that wont take as much space as Base64 Images do...</p>
0debug
c# adding money together removes the 0 at the end : <p>In c# when adding two decimals the program will automatically get rid of the number 0 after the decimal places. </p> <p>For example adding 0.50 to 1.20 will produce the answer of 1.7 and this is annoying because i need to display this answer in terms of money. </p> <p>Is there a way to prevent this?</p>
0debug
Use Cases of NIFI : <p>I have a question about Nifi and its capabilities as well as the appropriate use case for it. </p> <p>I've read that Nifi is really aiming to create a space which allows for flow-based processing. After playing around with Nifi a bit, what I've also come to realize is it's capability to model/shape the data in a way that is useful for me. Is it fair to say that Nifi can also be used for data modeling?</p> <p>Thanks!</p>
0debug
How to get value by key from JObject? : <p>I have a JObject like this:</p> <pre><code>{ "@STARTDATE": "'2016-02-17 00:00:00.000'", "@ENDDATE": "'2016-02-18 23:59:00.000'" } </code></pre> <p>I want to get @STARTDATE and @ENDDATE value from JObject.</p> <hr> <p>This is a sample code that I've tried to do the task:</p> <pre><code>JObject json = JObject.Parse("{\"@STARTDATE\": \"'2016-02-17 00:00:00.000'\",\"@ENDDATE\": \"'2016-02-18 23:59:00.000'\"}"); var key = "@STARTDATE"; var value = GetJArrayValue(json, key); private string GetJArrayValue(JObject yourJArray, JToken key) { string value = ""; foreach (JToken item in yourJArray.Children()) { var itemProperties = item.Children&lt;JProperty&gt;(); //If the property name is equal to key, we get the value var myElement = itemProperties.FirstOrDefault(x =&gt; x.Name == key.ToString()); value = myElement.Value.ToString(); //It run into an exception here because myElement is null break; } return value; } </code></pre> <p><em>Note: The code above cannot get the value by key from JObject.</em></p> <hr> <p><strong>Could you help me to find a way to get the value by key from JObject?</strong></p>
0debug
Go to a new view using SwiftUI : <p>I've got a basic view with a button using SwiftUI and I'm trying to present a new screen/view when the button is tapped. How do I do this? Am I suppose to create a delegate for this view that will tell the app's <code>SceneDelegate</code> to present a new view controller?</p> <pre><code>import SwiftUI struct ContentView : View { var body: some View { VStack { Text("Hello World") Button(action: { //go to another view }) { Text("Do Something") .font(.largeTitle) .fontWeight(.ultraLight) } } } } </code></pre>
0debug
static void ahci_shutdown(AHCIQState *ahci) { QOSState *qs = ahci->parent; free_ahci_device(ahci->dev); g_free(ahci); qtest_shutdown(qs); }
1threat
in c# Pass selected row one gridview to another gridview on another form : private void btnpass_Click(object sender, EventArgs e) { Inventory coo = new Inventory(dataGridView1.SelectedRows[0].Cells[0].Value.ToString(), dataGridView1.SelectedRows[0].Cells[1].Value.ToString(), dataGridView1.SelectedRows[0].Cells[2].Value.ToString(), dataGridView1.SelectedRows[0].Cells[3].Value.ToString(), dataGridView1.SelectedRows[0].Cells[4].Value.ToString(), dataGridView1.SelectedRows[0].Cells[5].Value.ToString(), dataGridView1.SelectedRows[0].Cells[6].Value.ToString()); coo.Show(); } Itried Pass selected row gridview to another gridview on another form but show error. error is (Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index) i use different method but not my problem solve
0debug
c# Capture image from screen and get colors : I'm making a program which can capture a small area on screen and will run something if there is any color on image that match the target colors. My program run as the following Sequence: 1/ Get image from a specific area from screen 2/ Save to a folder 3/ using CountPixel to detect any target_color However, it through an exception at ""b.Save(@"C:\Applications\CaptureImage000.jpg", ImageFormat.Jpeg);"" after I click the "button5" twice times (not double click). Additional information: A generic error occurred in GDI+. My questions are: 1. How can i fix this exception. 2. I want to use another method instead of CountPixel() to improve performance, because I just need to detect only one target color to rise event. 3. Step 2 is troublesome. I wonder if i can skip it and use the other way to call: (@"C:\Applications\CaptureImage000.jpg", ImageFormat.Jpeg) , because using this long string isn't comfortable and result error when im trying to use with GetPixel,... or add it into some "value example" code on internet for improvement purpose. private int CountPixels(Bitmap bm, Color target_color) { // Loop through the pixels. int matches = 0; for (int y = 0; y < bm.Height; y++) { for (int x = 0; x < bm.Width; x++) { if (bm.GetPixel(x, y) == target_color) matches++; } } return matches; } private Bitmap CapturedImage(int x, int y) { Bitmap b = new Bitmap(XX, YY); Graphics g = Graphics.FromImage(b); g.CopyFromScreen(x, y, 0, 0, new Size(XX, YY)); b.Save(@"C:\Applications\CaptureImage000.jpg", ImageFormat.Jpeg); /* Run 3 line below will lead to question 1 - through exception Bitmap bm = new Bitmap(@"C:\Applications\CaptureImage000.jpg"); int black_pixels = CountPixels(b, Color.FromArgb(255, 0, 0, 0)); textBox3.Text = black_pixels + " black pixels"; */ return b; } private void button5_Click(object sender, EventArgs e)// Do screen cap { Bitmap bmp = null; bmp = CapturedImage(X0, Y0); } }
0debug
How to solve Incorrect syntax near 'xml'? : i`m new in programming and i`m working on an administration program, and when writing one of it`s features I encountered this error. I think that this is a simple problems, tho I really question my begginer skills. Here`s the code. Forgott to mention that I`m working in Microsoft SQL Server Management Studio CODE: create procedure wIaTertiDemo @sesiune varchar(50), parXML xml as begin try declare @utilizator varchar(500) exec wIaUtilizator @sesiune @utilizator output select codfiscal, denumire as @dentert, adresa from tertiDemo for xml raw --create table tertiDemo(codfiscal varchar(50), denumire varchar(500), adresa varchar(500) end try BEGIN CATCH DECLARE @mesajEroare varchar(1000) SET @mesajEroare = ERROR_MESSAGE()+ '(' +OBJECT_NAME(@@PROCID) + ')' RAISERROR (@mesajEroare, 16,1) END CATCH ERRORS: Msg 102, Level 15, State 1, Procedure wIaTertiDemo, Line 1 [Batch Start Line 0] Incorrect syntax near 'xml'. Msg 102, Level 15, State 1, Procedure wIaTertiDemo, Line 6 [Batch Start Line 0] Incorrect syntax near '@utilizator'. Msg 102, Level 15, State 1, Procedure wIaTertiDemo, Line 8 [Batch Start Line 0] Incorrect syntax near '@dentert'.
0debug
Hi everyone, How to attach exist mysql volume to a new container : I pull mysql image and I wont to run a container with that image, but instead create a new volume I'd like to use my mysql-db volume. what is the easiest way to do that? docker run -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password -v mysql-db:/var/lib/mysql
0debug
void qemu_aio_unref(void *p) { BlockAIOCB *acb = p; assert(acb->refcnt > 0); if (--acb->refcnt == 0) { g_free(acb); } }
1threat
How catch curl response into variable in Jenkinsfile : <p>I want to curl an URL and capture the response into a variable.</p> <p>when I curl a command and echo its output I get the correct response as below</p> <pre><code>sh 'output=`curl https://some-host/some-service/getApi?apikey=someKey`;echo $output;' </code></pre> <p>I want to catch the same response into a variable and use that response for further operation</p> <p>Below is my Jenkinsfile</p> <pre><code>pipeline { agent { label "build_2" } stages { stage('Build') { steps { checkout scm sh 'npm install' } } stage('Build-Image') { steps { echo '..........................Building Image..........................' //In below line I am getting Output //sh 'output=`curl https://some-host/some-service/getApi?apikey=someKey`;echo $output;' script { //I want to get the same response here def response = sh 'curl https://some-host/some-service/getApi?apikey=someKey' echo '=========================Response===================' + response } } } } } </code></pre> <p>Can you please tell me what changes I need to do in my Jenkinsfile</p>
0debug
li padding not acting as it should : Can someone please explain why my padding is not acting as it should? My padding should be a perfect box, but for some reason it's coming out as some oblong rectangle. A padding of 30 all the way around the sides should be a perfect square. I have more rules for my other li and ul but that's for only in my '#nav' ID, so I don't see why there would be any conflict. <!-- begin snippet: js hide: false console: true --> <!-- language: lang-css --> html { height: 100%; } body{ height: 100%; margin:0; font-family: courier; font-size: 22px; color: white; } #wrapper{ position: relative; margin-left: auto; margin-right: auto; width: 85%; min-height: 100%; margin-top: -130px; } #inner{ margin-top: 130px; width: auto; } /* #wrapper{ margin-left: auto; margin-right: auto; border: 1px solid blue; width: 85%; background-color: blue; height: calc(100vh - 130px); } */ #footer, #wrapper:after{ height: 130px; } .wrap { margin: 0 auto; width: 100%; display: flex; align-items: center; flex-wrap: nowrap; } .sub { padding: 12px; width: 32%; height: 100px; color: white; border-right: solid white 1px; } .sub:last-child{ border: 0px; } #nav { list-style: none; font-weight: bold; width: 100%; text-align: center; background-color: #862d59; height: 100px; box-shadow: 0px 5px 8px grey; } #nav ul { list-style-type: none; margin: 0px; padding: 0; overflow: auto; // background-color: #862d59; } #nav li { margin: 0px; display: inline-block; } #nav li a { padding: 10px; display: inline-block; text-decoration: none; font-weight: bold; font-size: 30px; color: white; // background-color: #862d59; } #nav li a:hover { color: white; text-shadow: 2px 2px 4px white; } #footer { display: flex; height: 130px; width: 100%; background-color: #862d59; clear: both; } li.middle{ background-color: #26004d; padding: 10px 10px 10px 10px; margin-right: 30px; margin-top: 200px; text-align: center; color: white; } <!-- language: lang-html --> <div id="wrapper"> <div id="inner"> <ul> <li class="middle">some stuff</li> </ul> </div> </div> <div id="footer"> <div class="wrap"> <div class="sub"></div> <div class="sub"></div> <div class="sub"></div> </div> </div> <!-- end snippet -->
0debug
static void qio_channel_socket_connect_worker(QIOTask *task, gpointer opaque) { QIOChannelSocket *ioc = QIO_CHANNEL_SOCKET(qio_task_get_source(task)); SocketAddress *addr = opaque; Error *err = NULL; qio_channel_socket_connect_sync(ioc, addr, &err); qio_task_set_error(task, err); }
1threat
static void net_socket_connected(int fd, Error *err, void *opaque) { socket_connect_data *c = opaque; NetSocketState *s; char *addr_str = NULL; Error *local_error = NULL; addr_str = socket_address_to_string(c->saddr, &local_error); if (addr_str == NULL) { error_report_err(local_error); closesocket(fd); goto end; } s = net_socket_fd_init(c->peer, c->model, c->name, fd, true); if (!s) { closesocket(fd); goto end; } snprintf(s->nc.info_str, sizeof(s->nc.info_str), "socket: connect to %s", addr_str); end: g_free(addr_str); socket_connect_data_free(c); }
1threat
static CharDriverState *qemu_chr_open_pp_fd(int fd, Error **errp) { CharDriverState *chr; ParallelCharDriver *drv; if (ioctl(fd, PPCLAIM) < 0) { error_setg_errno(errp, errno, "not a parallel port"); close(fd); return NULL; } drv = g_new0(ParallelCharDriver, 1); drv->fd = fd; drv->mode = IEEE1284_MODE_COMPAT; chr = qemu_chr_alloc(); chr->chr_write = null_chr_write; chr->chr_ioctl = pp_ioctl; chr->chr_close = pp_close; chr->opaque = drv; return chr; }
1threat
Typescript input onchange event.target.value : <p>In my react and typescript app, I use: <code>onChange={(e) =&gt; data.motto = (e.target as any).value}</code>.</p> <p>How do I correctly define the typings for the class, so I wouldn't have to hack my way around the type system with <code>any</code>?</p> <pre><code>export interface InputProps extends React.HTMLProps&lt;Input&gt; { ... } export class Input extends React.Component&lt;InputProps, {}&gt; { } </code></pre> <p>If I put <code>target: { value: string };</code> I get :</p> <pre><code>ERROR in [default] /react-onsenui.d.ts:87:18 Interface 'InputProps' incorrectly extends interface 'HTMLProps&lt;Input&gt;'. Types of property 'target' are incompatible. Type '{ value: string; }' is not assignable to type 'string'. </code></pre>
0debug
Hyperledger fabric Rich Query: How to count number of record filtered by selector? : I'm making smart contract with Golang and I want to use Rich Query to get total count of records from CouchDB filtered by some selector like: `{\"selector\":{\"doc_type\": \"person\"}}` It is similar to: `select count(*) from tb where ...` as SQL query but how to do it with CouchDB? Can somebody help me please? Thanks
0debug
how to check value exist in object of array in angularjs : var aclData=[ { 'Manage Users': ['add','view','edit','delete'] }, { 'Manage Role': ['add','view','edit'] } ]; How to check 'view' exist in 'Manage Role'
0debug
Android Data Storage Security : I want to keep the data secure. Only accessible from my app, I hope that even if you route Android, it is not accessible from the outside and can not be changed. I am searching through 'FileOutputStream fos = openFileOutput (FILE_NAME, Context.MODE_PRIVATE);' I got this code. Is this the best way?
0debug
static void change_parent_backing_link(BlockDriverState *from, BlockDriverState *to) { BdrvChild *c, *next, *to_c; QLIST_FOREACH_SAFE(c, &from->parents, next_parent, next) { if (c->role->stay_at_node) { continue; } if (c->role == &child_backing) { QLIST_FOREACH(to_c, &to->children, next) { if (to_c == c) { break; } } if (to_c) { continue; } } assert(c->role != &child_backing); bdrv_ref(to); bdrv_replace_child(c, to, true); bdrv_unref(from); } }
1threat