problem
stringlengths
26
131k
labels
class label
2 classes
Refused to execute script from because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled : <p>I am trying to setup react routing which works when I click on something on my site the route works, however if I open a new tab and copy that url. I get</p> <pre><code>Refused to execute script from 'http://localhost:8080/something/index_bundle.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. </code></pre> <p>webpack.config </p> <pre><code>const path = require("path"); const HtmlWebpackPlugin = require("html-webpack-plugin"); module.exports = { entry: "./src/index.js", output: { path: path.join(__dirname, "/dist"), filename: "index_bundle.js" }, module: { rules: [ { test: /\.js$/, exclude: /node_modules/, use: { loader: "babel-loader" } }, { test: /\.s?css$/, use: [ { loader: "style-loader" // creates style nodes from JS strings }, { loader: "css-loader" // translates CSS into CommonJS }, { loader: "sass-loader" // compiles Sass to CSS } ] } ] }, plugins: [ new HtmlWebpackPlugin({ template: "./src/index.html" }) ], devServer: { historyApiFallback:{ index:'/dist/index.html' }, } }; </code></pre> <p>index.js</p> <pre><code>import React from 'react'; import ReactDOM from 'react-dom'; import { Provider } from 'mobx-react'; import { useStrict } from 'mobx'; import createBrowserHistory from 'history/createBrowserHistory'; import {syncHistoryWithStore } from 'mobx-react-router'; import { Router } from 'react-router' import AppContainer from './components/App'; const browserHistory = createBrowserHistory(); import stores from '../src/stores/Stores'; const history = syncHistoryWithStore(browserHistory, stores.routingStore); ReactDOM.render( &lt;Provider {... stores}&gt; &lt;Router history={history}&gt; &lt;AppContainer /&gt; &lt;/Router&gt; &lt;/Provider&gt;, document.getElementById('app') ); </code></pre> <p>stores</p> <pre><code>import {RouterStore} from 'mobx-react-router'; const routingStore = new RouterStore(); const stores = { routingStore } export default stores; </code></pre> <p>I also tried <code>historyApiFallback: true</code></p>
0debug
int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func, void *opaque, int abort_on_failure) { QemuOpts *opts; int rc = 0; QTAILQ_FOREACH(opts, &list->head, next) { rc = func(opts, opaque); if (abort_on_failure && rc != 0) break; } return rc; }
1threat
How to add asterisk text input field in andriod : How do you get a red asterisk in a entry so that you can display it at the end of the text to indicate its a required field, like: Enter your name * (asterisk will be red). Or, for that matter, anywhere within the text.
0debug
static int xmv_process_packet_header(AVFormatContext *s) { XMVDemuxContext *xmv = s->priv_data; AVIOContext *pb = s->pb; uint8_t data[8]; uint16_t audio_track; uint64_t data_offset; xmv->next_packet_size = avio_rl32(pb); if (avio_read(pb, data, 8) != 8) return AVERROR(EIO); xmv->video.data_size = AV_RL32(data) & 0x007FFFFF; xmv->video.current_frame = 0; xmv->video.frame_count = (AV_RL32(data) >> 23) & 0xFF; xmv->video.has_extradata = (data[3] & 0x80) != 0; xmv->video.data_size -= xmv->audio_track_count * 4; xmv->current_stream = 0; if (!xmv->video.frame_count) { xmv->video.frame_count = 1; xmv->current_stream = xmv->stream_count > 1; } for (audio_track = 0; audio_track < xmv->audio_track_count; audio_track++) { XMVAudioPacket *packet = &xmv->audio[audio_track]; if (avio_read(pb, data, 4) != 4) return AVERROR(EIO); packet->data_size = AV_RL32(data) & 0x007FFFFF; if ((packet->data_size == 0) && (audio_track != 0)) packet->data_size = xmv->audio[audio_track - 1].data_size; packet->frame_size = packet->data_size / xmv->video.frame_count; packet->frame_size -= packet->frame_size % packet->block_align; } data_offset = avio_tell(pb); xmv->video.data_offset = data_offset; data_offset += xmv->video.data_size; for (audio_track = 0; audio_track < xmv->audio_track_count; audio_track++) { xmv->audio[audio_track].data_offset = data_offset; data_offset += xmv->audio[audio_track].data_size; } if (xmv->video.data_size > 0) { if (xmv->video.has_extradata) { xmv_read_extradata(xmv->video.extradata, pb); xmv->video.data_size -= 4; xmv->video.data_offset += 4; if (xmv->video.stream_index >= 0) { AVStream *vst = s->streams[xmv->video.stream_index]; av_assert0(xmv->video.stream_index < s->nb_streams); if (vst->codec->extradata_size < 4) { av_freep(&vst->codec->extradata); ff_alloc_extradata(vst->codec, 4); } memcpy(vst->codec->extradata, xmv->video.extradata, 4); } } } return 0; }
1threat
AttributeError: 'numpy.ndarray' object has no attribute 'median' : <p>I can perform a number of statistics on a numpy array but "median" returns an attribute error. When I do a "dir(np)" I do see the median method listed.</p> <pre><code>(newpy2) 7831c1c083a2:src scaldara$ python Python 2.7.12 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:43:17) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. Anaconda is brought to you by Continuum Analytics. Please check out: http://continuum.io/thanks and https://anaconda.org &gt;&gt;&gt; import numpy as np &gt;&gt;&gt; print(np.version.version) 1.11.2 &gt;&gt;&gt; a = np.array([1,2,3,4,5,6,7,8,9,10]) &gt;&gt;&gt; print(a) [ 1 2 3 4 5 6 7 8 9 10] &gt;&gt;&gt; print(a.min()) 1 &gt;&gt;&gt; print(a.max()) 10 &gt;&gt;&gt; print(a.mean()) 5.5 &gt;&gt;&gt; print(a.std()) 2.87228132327 &gt;&gt;&gt; print(a.median()) Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; AttributeError: 'numpy.ndarray' object has no attribute 'median' &gt;&gt;&gt; </code></pre>
0debug
static int64_t coroutine_fn bdrv_co_get_block_status_above(BlockDriverState *bs, BlockDriverState *base, int64_t sector_num, int nb_sectors, int *pnum, BlockDriverState **file) { BlockDriverState *p; int64_t ret = 0; bool first = true; assert(bs != base); for (p = bs; p != base; p = backing_bs(p)) { ret = bdrv_co_get_block_status(p, sector_num, nb_sectors, pnum, file); if (ret < 0) { break; } if (ret & BDRV_BLOCK_ZERO && ret & BDRV_BLOCK_EOF && !first) { *pnum = nb_sectors; } if (ret & (BDRV_BLOCK_ZERO | BDRV_BLOCK_DATA)) { break; } nb_sectors = MIN(nb_sectors, *pnum); first = false; } return ret; }
1threat
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
1threat
Getting all identical content between 2 List<String> : <p>I am currently able to get the total number of identical string value between my list of string using this.</p> <pre><code> Set&lt;String&gt; set = new HashSet&lt;&gt;(yourFriendList); set.addAll(requestModelList.get(getAdapterPosition()).list); int count = (yourFriendList.size() + requestModelList.get(getAdapterPosition()).list.size()) - set.size()); </code></pre> <p>But now I want to get all of this identical value and put it in a new variable List.</p> <pre><code> List 1 : a b c d e f g List 2 : a h i e d j k </code></pre> <p>identical count is 3 identical string are a d e;</p>
0debug
static void pci_unplug_disks(PCIBus *bus) { pci_for_each_device(bus, 0, unplug_disks, NULL); }
1threat
How do I find the time complexity of my program? : <p>what is the time complexity of this program? I understand that time complexity has something to do with the processor. here is the program</p> <pre><code>public static void main(String[] args) { System.out.println("Heelo, world!"); </code></pre> <p>}</p> <p>please give me time complexity of this program in java vs c++ vs c#</p> <p>Sorry if noob question.</p>
0debug
Trouble with loops : <p>I have this simple program to formulate a table of any given number however at the end i want the user to be prompted to either end the program or formulate another table.however the loop does not occur.(i'm only a newbie)</p> <pre><code>int table(){ int tablenumber; int tablecount; cout&lt;&lt;"which number's table would you like to print?"&lt;&lt;endl; cin&gt;&gt;tablenumber; cout&lt;&lt;"till which number would you like to multiply it?"&lt;&lt;endl; cin&gt;&gt;tablecount; for(int i=0; i&lt;=tablecount; i++){ cout&lt;&lt;tablenumber&lt;&lt;" X "&lt;&lt;i&lt;&lt;"="&lt;&lt;tablenumber*i&lt;&lt;endl; } } int main(){ bool yes=true; bool no=false; char answer= yes; while(answer==true){ table(); cout&lt;&lt;"would you like to formulate another table?(yes/no)"&lt;&lt;endl; cin&gt;&gt;answer; } return 0; } </code></pre>
0debug
static inline void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst, long dstWidth, const uint8_t *src, int srcW, int xInc) { #if ARCH_X86 #if COMPILE_TEMPLATE_MMX2 int32_t *filterPos = c->hLumFilterPos; int16_t *filter = c->hLumFilter; int canMMX2BeUsed = c->canMMX2BeUsed; void *mmx2FilterCode= c->lumMmx2FilterCode; int i; #if defined(PIC) DECLARE_ALIGNED(8, uint64_t, ebxsave); #endif if (canMMX2BeUsed) { __asm__ volatile( #if defined(PIC) "mov %%"REG_b", %5 \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "mov %0, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "mov %2, %%"REG_d" \n\t" "mov %3, %%"REG_b" \n\t" "xor %%"REG_a", %%"REG_a" \n\t" PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" #if ARCH_X86_64 #define CALL_MMX2_FILTER_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "movl (%%"REG_b", %%"REG_a"), %%esi \n\t"\ "add %%"REG_S", %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #else #define CALL_MMX2_FILTER_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "addl (%%"REG_b", %%"REG_a"), %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #endif CALL_MMX2_FILTER_CODE CALL_MMX2_FILTER_CODE CALL_MMX2_FILTER_CODE CALL_MMX2_FILTER_CODE CALL_MMX2_FILTER_CODE CALL_MMX2_FILTER_CODE CALL_MMX2_FILTER_CODE CALL_MMX2_FILTER_CODE #if defined(PIC) "mov %5, %%"REG_b" \n\t" #endif :: "m" (src), "m" (dst), "m" (filter), "m" (filterPos), "m" (mmx2FilterCode) #if defined(PIC) ,"m" (ebxsave) #endif : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D #if !defined(PIC) ,"%"REG_b #endif ); for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) dst[i] = src[srcW-1]*128; } else { #endif x86_reg xInc_shr16 = xInc >> 16; uint16_t xInc_mask = xInc & 0xffff; x86_reg dstWidth_reg = dstWidth; __asm__ volatile( "xor %%"REG_a", %%"REG_a" \n\t" "xor %%"REG_d", %%"REG_d" \n\t" "xorl %%ecx, %%ecx \n\t" ".p2align 4 \n\t" "1: \n\t" "movzbl (%0, %%"REG_d"), %%edi \n\t" "movzbl 1(%0, %%"REG_d"), %%esi \n\t" FAST_BILINEAR_X86 "movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t" "addw %4, %%cx \n\t" "adc %3, %%"REG_d" \n\t" "movzbl (%0, %%"REG_d"), %%edi \n\t" "movzbl 1(%0, %%"REG_d"), %%esi \n\t" FAST_BILINEAR_X86 "movw %%si, 2(%%"REG_D", %%"REG_a", 2) \n\t" "addw %4, %%cx \n\t" "adc %3, %%"REG_d" \n\t" "add $2, %%"REG_a" \n\t" "cmp %2, %%"REG_a" \n\t" " jb 1b \n\t" :: "r" (src), "m" (dst), "m" (dstWidth_reg), "m" (xInc_shr16), "m" (xInc_mask) : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" ); #if COMPILE_TEMPLATE_MMX2 } #endif #else int i; unsigned int xpos=0; for (i=0;i<dstWidth;i++) { register unsigned int xx=xpos>>16; register unsigned int xalpha=(xpos&0xFFFF)>>9; dst[i]= (src[xx]<<7) + (src[xx+1] - src[xx])*xalpha; xpos+=xInc; } #endif }
1threat
How do I run a URL whithout opening the browser in Visual Studio? : <p>I am using the <code>System.Diagnostics.Process.Start()</code> to run a URL, but every time I execute the function, it opens a new browser tab. How can I just access the link without open the browser?</p>
0debug
C : In function, malloc two dimensional array and duplicatating array of argument does not work : <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; int** asd(int map[][7]); int main(void) { int **child_map = (int**)malloc(sizeof(int*) * 6); int i, k; for (i = 0; i &lt; 6; i++) child_map[i] = (int*)malloc(sizeof(int) * 7); for (i = 0; i &lt; 6; i++) { for (k = 0; k &lt; 7; k++) { child_map[i][k] = 10; } } for (i = 0; i &lt; 6; i++) { for (k = 0; k &lt; 7; k++) { printf("%3d", child_map[i][k]); } printf("\n"); } int **map = NULL; map = asd(child_map); for (i = 0; i &lt; 6; i++) { for (k = 0; k &lt; 7; k++) { printf("%3d", map[i][k]); } printf("\n"); } return 0; } int** asd(int map[][7]) { int **a = (int**)malloc(sizeof(int*) * 6); int i, k; for (i = 0; i &lt; 6; i++) a[i] = (int*)malloc(sizeof(int) * 7); for (i = 0; i &lt; 6; i++) { for (k = 0; k &lt; 7; k++) { a[i][k] = map[i][k]; } } return a; } </code></pre> <p>In function, a[i][k] and map[i][k] are not mapped. Value of array a is very strange like 99882978. Why doesn't it work?<br> I have been made tree of game like go and each tree node has copy of parent's map. So i made function malloc two dimesional array , copies map of parent and return pointer of copy map. But it do not work... I'm very stuck here...</p>
0debug
CORS error when calling a firebase function : I am using Google Cloud Functions and I am getting an error related to CORS. I have made a simple function but it's not working because I keep getting the same error over and over again. I have tried almost everything but nothing is working. [enter image description here][1] [1]: https://i.stack.imgur.com/FrdPS.png
0debug
Ruby accessing json key value pair with same key name, : i am new to RUBY, trying to refer the json string with same key name but wanted the second key value to be printed example text= "[{ "name" : "car", "status": "good"}, { "name" : "bus", "status": "bad"},{ "name" : "taxi", "status": "soso"}]" wanted to print 2nd key value name = bus
0debug
def sum_Of_Series(n): sum = 0 for i in range(1,n + 1): sum += i * i*i return sum
0debug
How do i show the current CodePush Version label in my React Native Android app? : <p>Looking for something like: <code> &lt;Text&gt;VERSION={CodePush.VersionLabel}&lt;/Text&gt; </code></p> <p>Where CodePush.VersionLabel is something like "v6" that is displayed in <code>code-push deployment ls &lt;MyApp&gt;</code></p> <p>I'd like to show this at the bottom my login screen.</p>
0debug
void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in) { ARMCPU *cpu = arm_env_get_cpu(env); uint64_t blocklen = 4 << cpu->dcz_blocksize; uint64_t vaddr = vaddr_in & ~(blocklen - 1); #ifndef CONFIG_USER_ONLY { int maxidx = DIV_ROUND_UP(blocklen, TARGET_PAGE_SIZE); void *hostaddr[maxidx]; int try, i; unsigned mmu_idx = cpu_mmu_index(env, false); TCGMemOpIdx oi = make_memop_idx(MO_UB, mmu_idx); for (try = 0; try < 2; try++) { for (i = 0; i < maxidx; i++) { hostaddr[i] = tlb_vaddr_to_host(env, vaddr + TARGET_PAGE_SIZE * i, 1, mmu_idx); if (!hostaddr[i]) { break; } } if (i == maxidx) { for (i = 0; i < maxidx - 1; i++) { memset(hostaddr[i], 0, TARGET_PAGE_SIZE); } memset(hostaddr[i], 0, blocklen - (i * TARGET_PAGE_SIZE)); return; } helper_ret_stb_mmu(env, vaddr_in, 0, oi, GETRA()); for (i = 0; i < maxidx; i++) { uint64_t va = vaddr + TARGET_PAGE_SIZE * i; if (va != (vaddr_in & TARGET_PAGE_MASK)) { helper_ret_stb_mmu(env, va, 0, oi, GETRA()); } } } for (i = 0; i < blocklen; i++) { helper_ret_stb_mmu(env, vaddr + i, 0, oi, GETRA()); } } #else memset(g2h(vaddr), 0, blocklen); #endif }
1threat
ip_init(void) { ipq.ip_link.next = ipq.ip_link.prev = &ipq.ip_link; ip_id = tt.tv_sec & 0xffff; udp_init(); tcp_init(); }
1threat
How to get the HTTP method in AWS Lambda? : <p>In an AWS Lambda code, how can I get the HTTP method (e.g. GET, POST...) of an HTTP request coming from the AWS Gateway API? </p> <p>I understand from the <a href="http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html" rel="noreferrer">documentation</a> that <strong>context.httpMethod</strong> is the solution for that. </p> <p>However, I cannot manage to make it work. </p> <p>For instance, when I try to add the following 3 lines:</p> <pre><code> if (context.httpMethod) { console.log('HTTP method:', context.httpMethod) } </code></pre> <p>into the AWS sample code of the "microservice-http-endpoint" blueprint as follows:</p> <pre><code>exports.handler = function(event, context) { if (context.httpMethod) { console.log('HTTP method:', context.httpMethod) } console.log('Received event:', JSON.stringify(event, null, 2)); // For clarity, I have removed the remaining part of the sample // provided by AWS, which works well, for instance when triggered // with Postman through the API Gateway as an intermediary. }; </code></pre> <p>I never have anything in the log because <strong>httpMethod is always empty</strong>. </p>
0debug
void parse_options(int argc, char **argv, const OptionDef *options, void (* parse_arg_function)(const char*)) { const char *opt, *arg; int optindex, handleoptions=1; const OptionDef *po; optindex = 1; while (optindex < argc) { opt = argv[optindex++]; if (handleoptions && opt[0] == '-' && opt[1] != '\0') { int bool_val = 1; if (opt[1] == '-' && opt[2] == '\0') { handleoptions = 0; continue; } opt++; po= find_option(options, opt); if (!po->name && opt[0] == 'n' && opt[1] == 'o') { po = find_option(options, opt + 2); if (!(po->name && (po->flags & OPT_BOOL))) goto unknown_opt; bool_val = 0; } if (!po->name) po= find_option(options, "default"); if (!po->name) { unknown_opt: fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], opt); exit(1); } arg = NULL; if (po->flags & HAS_ARG) { arg = argv[optindex++]; if (!arg) { fprintf(stderr, "%s: missing argument for option '%s'\n", argv[0], opt); exit(1); } } if (po->flags & OPT_STRING) { char *str; str = av_strdup(arg); *po->u.str_arg = str; } else if (po->flags & OPT_BOOL) { *po->u.int_arg = bool_val; } else if (po->flags & OPT_INT) { *po->u.int_arg = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX); } else if (po->flags & OPT_INT64) { *po->u.int64_arg = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX); } else if (po->flags & OPT_FLOAT) { *po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0); } else if (po->flags & OPT_FUNC2) { if (po->u.func2_arg(opt, arg) < 0) { fprintf(stderr, "%s: invalid value '%s' for option '%s'\n", argv[0], arg, opt); exit(1); } } else { po->u.func_arg(arg); } if(po->flags & OPT_EXIT) exit(0); } else { if (parse_arg_function) parse_arg_function(opt); } } }
1threat
void ff_id3v2_read(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_meta) { id3v2_read_internal(s->pb, &s->metadata, s, magic, extra_meta); }
1threat
python 3.5 : quit a if loop (or other loops) : <p>When running the program, the user is asked to input a number. If the number is 1, quit the program. If the number is not 1, print the number. </p> <p>I wonder how to realize this. </p> <p>I am using python 3.5.</p> <p>My code is like this. I always get an error: <code>'break' outside loop</code></p> <p>How can I fix this?</p> <pre><code>x = input('Please input a number: ') if x == '1': print('quit') break else: continue print(x) </code></pre>
0debug
bool qemu_peer_has_vnet_hdr_len(NetClientState *nc, int len) { if (!nc->peer || !nc->peer->info->has_vnet_hdr_len) { return false; } return nc->peer->info->has_vnet_hdr_len(nc->peer, len); }
1threat
Write a function that accepts a list of integer values as a parameter. Replace all even numbers with a 0 and all odd numbers with a 1 : <p>currently studying for a final exam and I stumbled upon this practice problem. I understand how to find all the even and odd numbers within a list but I have 0 idea on how to change them. My book and class notes have proven to be zero help so any insight someone could provide would be greatly appreciated </p>
0debug
qemu_irq *mpic_init (target_phys_addr_t base, int nb_cpus, qemu_irq **irqs, qemu_irq irq_out) { openpic_t *mpp; int i; struct { CPUReadMemoryFunc * const *read; CPUWriteMemoryFunc * const *write; target_phys_addr_t start_addr; ram_addr_t size; } const list[] = { {mpic_glb_read, mpic_glb_write, MPIC_GLB_REG_START, MPIC_GLB_REG_SIZE}, {mpic_tmr_read, mpic_tmr_write, MPIC_TMR_REG_START, MPIC_TMR_REG_SIZE}, {mpic_ext_read, mpic_ext_write, MPIC_EXT_REG_START, MPIC_EXT_REG_SIZE}, {mpic_int_read, mpic_int_write, MPIC_INT_REG_START, MPIC_INT_REG_SIZE}, {mpic_msg_read, mpic_msg_write, MPIC_MSG_REG_START, MPIC_MSG_REG_SIZE}, {mpic_msi_read, mpic_msi_write, MPIC_MSI_REG_START, MPIC_MSI_REG_SIZE}, {mpic_cpu_read, mpic_cpu_write, MPIC_CPU_REG_START, MPIC_CPU_REG_SIZE}, }; if (nb_cpus != 1) return NULL; mpp = g_malloc0(sizeof(openpic_t)); for (i = 0; i < sizeof(list)/sizeof(list[0]); i++) { int mem_index; mem_index = cpu_register_io_memory(list[i].read, list[i].write, mpp, DEVICE_BIG_ENDIAN); if (mem_index < 0) { goto free; } cpu_register_physical_memory(base + list[i].start_addr, list[i].size, mem_index); } mpp->nb_cpus = nb_cpus; mpp->max_irq = MPIC_MAX_IRQ; mpp->irq_ipi0 = MPIC_IPI_IRQ; mpp->irq_tim0 = MPIC_TMR_IRQ; for (i = 0; i < nb_cpus; i++) mpp->dst[i].irqs = irqs[i]; mpp->irq_out = irq_out; mpp->irq_raise = mpic_irq_raise; mpp->reset = mpic_reset; register_savevm(NULL, "mpic", 0, 2, openpic_save, openpic_load, mpp); qemu_register_reset(mpic_reset, mpp); return qemu_allocate_irqs(openpic_set_irq, mpp, mpp->max_irq); free: g_free(mpp); return NULL; }
1threat
what is the difference between Class<? extends T> and Class<? extends ?> in JAVA? : I was going through the some legacy code in my application and I found uses of JAVA generics. I am not clear about how and when to use these generics.
0debug
Import data from excel spreadsheet to django model : <p>I'm building a website that'll have a django backend. I want to be able to serve the medical billing data from a database that django will have access to. However, all of the data we receive is in excel spreadsheets. So I've been looking for a way to get the data from a spreadsheet, and then import it into a django model. I know there are some different django packages that can do this, but I'm having a hard time understanding how to use these packages. On top of that I'm using python 3 for this project. I've used win32com for automation stuff in excel in the past. I could write a function that could grab the data from the spreadsheet. Though what I want figure out is how would I write the data to a django model? Any advice is appreciated.</p>
0debug
static int oggvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { OggVorbisEncContext *s = avctx->priv_data; ogg_packet op; int ret, duration; if (frame) { const int samples = frame->nb_samples; float **buffer; int c, channels = s->vi.channels; buffer = vorbis_analysis_buffer(&s->vd, samples); for (c = 0; c < channels; c++) { int co = (channels > 8) ? c : ff_vorbis_encoding_channel_layout_offsets[channels - 1][c]; memcpy(buffer[c], frame->extended_data[co], samples * sizeof(*buffer[c])); } if ((ret = vorbis_analysis_wrote(&s->vd, samples)) < 0) { av_log(avctx, AV_LOG_ERROR, "error in vorbis_analysis_wrote()\n"); return vorbis_error_to_averror(ret); } if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) return ret; } else { if (!s->eof) if ((ret = vorbis_analysis_wrote(&s->vd, 0)) < 0) { av_log(avctx, AV_LOG_ERROR, "error in vorbis_analysis_wrote()\n"); return vorbis_error_to_averror(ret); } s->eof = 1; } while ((ret = vorbis_analysis_blockout(&s->vd, &s->vb)) == 1) { if ((ret = vorbis_analysis(&s->vb, NULL)) < 0) break; if ((ret = vorbis_bitrate_addblock(&s->vb)) < 0) break; while ((ret = vorbis_bitrate_flushpacket(&s->vd, &op)) == 1) { if (av_fifo_space(s->pkt_fifo) < sizeof(ogg_packet) + op.bytes) { av_log(avctx, AV_LOG_ERROR, "packet buffer is too small\n"); return AVERROR_BUG; } av_fifo_generic_write(s->pkt_fifo, &op, sizeof(ogg_packet), NULL); av_fifo_generic_write(s->pkt_fifo, op.packet, op.bytes, NULL); } if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "error getting available packets\n"); break; } } if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "error getting available packets\n"); return vorbis_error_to_averror(ret); } if (av_fifo_size(s->pkt_fifo) < sizeof(ogg_packet)) return 0; av_fifo_generic_read(s->pkt_fifo, &op, sizeof(ogg_packet), NULL); if ((ret = ff_alloc_packet2(avctx, avpkt, op.bytes))) return ret; av_fifo_generic_read(s->pkt_fifo, avpkt->data, op.bytes, NULL); avpkt->pts = ff_samples_to_time_base(avctx, op.granulepos); duration = avpriv_vorbis_parse_frame(&s->vp, avpkt->data, avpkt->size); if (duration > 0) { if (!avctx->delay && s->afq.frames) { avctx->delay = duration; av_assert0(!s->afq.remaining_delay); s->afq.frames->duration += duration; s->afq.frames->pts -= duration; s->afq.remaining_samples += duration; } ff_af_queue_remove(&s->afq, duration, &avpkt->pts, &avpkt->duration); } *got_packet_ptr = 1; return 0; }
1threat
How to automatically format XAML code in Visual Studio? : <p>Here:</p> <p><a href="https://social.msdn.microsoft.com/Forums/de-DE/b77c7529-298f-4b9a-874a-f94f699986ac/automatically-formatting-xaml-code?forum=vswpfdesigner" rel="noreferrer">https://social.msdn.microsoft.com/Forums/de-DE/b77c7529-298f-4b9a-874a-f94f699986ac/automatically-formatting-xaml-code?forum=vswpfdesigner</a></p> <p>... it is written that one can use "Ctrl+K+D" ... but that didn't work.</p> <p>I also tried "shift + alt + F", which was suggested here:</p> <p><a href="https://stackoverflow.com/questions/29973357/how-do-you-format-code-in-visual-studio-code-vscode">How do you format code in Visual Studio Code (VSCode)</a></p> <p>... it didn't work either.</p> <p>So my question is: how can you automatically format XAML code in Visual Studio?</p>
0debug
How can i write a program that computes all the possible combinations involving any 3 numbers from 0 to 3 and gives sum as 5 : How can i write a java program using recursion that computes all the possible combinations involving any 3 numbers from 0 to 3 and gives sum as 5. Repetitions are allowed. The answer should print all permutations like this 3 + 2 + 0 3 + 1 + 1 3 + 0 + 2 2 + 2 + 1 2 + 1 + 2 2 + 0 + 3 1 + 3 + 1 1 + 2 + 2 1 + 1 + 3
0debug
Exctracting a substring in iOS : I have a string like this: "/Myapp/auth/hrHeadcount+ME+All IOU+Headcount+Grade" and I want to save only the "HeadCount" in another string. How can I do that?
0debug
Android Studio - No Target Device Found : <p>I'm having trouble getting an Android app that I developed working on my phone. (<code>Android Studio</code> on <code>Windows 7</code> trying to run the app on <code>Samsung Note 3</code> running <code>Android 5.0</code>)</p> <p>Here's what I've done so far:</p> <ul> <li>Turned on <code>USB debugging</code> and allowed <code>unknown sources</code></li> <li>Installed <code>Google USB Driver</code></li> <li>Restarted computer</li> <li>Tried <code>updating the driver</code> for the phone but no updates were available</li> <li>Turned on <code>debugging</code> in the <code>build.gradle</code> file</li> </ul> <p>and yet it is still returning <code>Error running app: No target device found</code></p> <p>I have also tried the dialog option for when I run the app but that says <code>No USB devices or running emulators detected</code></p> <p>Is there anything I have missed?</p> <p>Thanks in advance!</p>
0debug
int ff_read_riff_info(AVFormatContext *s, int64_t size) { int64_t start, end, cur; AVIOContext *pb = s->pb; start = avio_tell(pb); end = start + size; while ((cur = avio_tell(pb)) >= 0 && cur <= end - 8 ) { uint32_t chunk_code; int64_t chunk_size; char key[5] = {0}; char *value; chunk_code = avio_rl32(pb); chunk_size = avio_rl32(pb); if (chunk_size > end || end - chunk_size < cur || chunk_size == UINT_MAX) { av_log(s, AV_LOG_ERROR, "too big INFO subchunk\n"); return AVERROR_INVALIDDATA; } chunk_size += (chunk_size & 1); value = av_malloc(chunk_size + 1); if (!value) { av_log(s, AV_LOG_ERROR, "out of memory, unable to read INFO tag\n"); return AVERROR(ENOMEM); } AV_WL32(key, chunk_code); if (avio_read(pb, value, chunk_size) != chunk_size) { av_freep(key); av_freep(value); av_log(s, AV_LOG_ERROR, "premature end of file while reading INFO tag\n"); return AVERROR_INVALIDDATA; } value[chunk_size] = 0; av_dict_set(&s->metadata, key, value, AV_DICT_DONT_STRDUP_VAL); } return 0; }
1threat
How can I convert an array of elements to the individual elements for variable element method in Scala? : <p>I'm wondering if it's possible to convert an array of elements to the elements themselves. For my example, I'm trying to pass individual strings into a function whose arguments are a variable number of strings. I currently have an array of strings and am trying to pass them into .toDF (which takes a variable number of strings). This is what I have:</p> <p>.toDF((df.columns)</p> <p>How can I convert this array into the individual elements?</p>
0debug
Android - Selecting five random numbers with some probability : <p>I want to select 5 random numbers with some probability.</p> <p>my numbers: 2-5-6-9-14</p> <pre><code>probability: 2 -&gt; %30 5 -&gt; %20 6 -&gt; %35 9 -&gt; %10 14 -&gt; %5 </code></pre> <p>I want to go new activity if the three numbers are the same.</p> <p>Not: maximum three numbers can be the same.</p> <p>How Can I do that?</p>
0debug
def sum_Odd(n): terms = (n + 1)//2 sum1 = terms * terms return sum1 def sum_in_Range(l,r): return sum_Odd(r) - sum_Odd(l - 1)
0debug
static void force_sigsegv(int oldsig) { CPUState *cpu = thread_cpu; CPUArchState *env = cpu->env_ptr; target_siginfo_t info; if (oldsig == SIGSEGV) { sigact_table[oldsig - 1]._sa_handler = TARGET_SIG_DFL; } info.si_signo = TARGET_SIGSEGV; info.si_errno = 0; info.si_code = TARGET_SI_KERNEL; info._sifields._kill._pid = 0; info._sifields._kill._uid = 0; queue_signal(env, info.si_signo, QEMU_SI_KILL, &info); }
1threat
i want to Instantiate prefab when have a collision c# : i want to Instantiate prefab in unity when i have a collision now i use this code if (IgnourColl.Ddeer = true) { Instantiate(Deer, new Vector3(TPlayer.transform.position.x + 5, TPlayer.transform.position.y, 0), Quaternion.identity); IgnourColl.Ddeer = false; } IgnourColl.Ddeer = false; is a bool become true if have collision ; i add false after true so Instantiate stop until another collision ... everything is work fine, but the if statement does't work Instantiate is not stop after he Instantiate the first prefab
0debug
how to Using PHP variable to set width of progress bar : My PHP Code ready and its working fine on the live server, ----------- I want to add progress bar for showing active server player **Here Code** But it's not working images [enter image description here][1] [enter image description here][2] [1]: https://i.stack.imgur.com/nHSlV.png [2]: https://i.stack.imgur.com/ariwz.png
0debug
Where can I find examples of Material Design Animated Icons? : <p>These days, I am interested in Material Design Animated Icons.</p> <p>So I tried to make the icons in the url below.</p> <p><a href="https://material.io/design/iconography/animated-icons.html#usage" rel="nofollow noreferrer">https://material.io/design/iconography/animated-icons.html#usage</a></p> <p>But I can't find examples :(</p> <p>So, Could you tell me where I can see the example?</p> <p>plz.. </p>
0debug
static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length) { GetBitContext gb; int i; init_get_bits(&gb, src, length * 8); for (i = 0; i < 3; i++) { if (read_len_table(s->len[i], &gb) < 0) return -1; if (ff_huffyuv_generate_bits_table(s->bits[i], s->len[i]) < 0) { return -1; } ff_free_vlc(&s->vlc[i]); init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0); } generate_joint_tables(s); return (get_bits_count(&gb) + 7) / 8; }
1threat
static void memory_region_oldmmio_read_accessor(MemoryRegion *mr, hwaddr addr, uint64_t *value, unsigned size, unsigned shift, uint64_t mask) { uint64_t tmp; tmp = mr->ops->old_mmio.read[ctz32(size)](mr->opaque, addr); trace_memory_region_ops_read(mr, addr, tmp, size); *value |= (tmp & mask) << shift; }
1threat
crop sting in sql : [1]: https://imgur.com/AyQBXkA "" Hi everyone! I have a problem with ms-sql project. I want to convert one sql column for two, and send to first a numeric symbol, (1,2,3...) from parent column and char to second. Using only query in mssql! [2]: https://imgur.com/3yIKPft ""
0debug
I'm getting the error in angularJs : "angular.js:13550Error: [$injector:unpr] http://errors.angularjs.org/1.5.5/$injector/unpr?p0=DTOptionsBuilderProvider%20%3C-%20DTOptionsBuilder%20%3C-%20playbackController at n (http://localhost:63721/Scripts/angular.min.js:64:374)" Following is the code of my controller myApp.controller('playController',['DTOptionsBuilder','DTColumnBuilder', function (DTOptionsBuilder, DTColumnBuilder) { this.standardOptions = DTOptionsBuilder .fromSource('Scripts/datatables.standard.json') //Add Bootstrap compatibility .withDOM("<'dt-toolbar'<'col-xs-12 col-sm-6'f><'col-sm-6 col-xs-12 hidden-xs'l>r>" + "t" + "<'dt-toolbar-footer'<'col-sm-6 col-xs-12 hidden-xs'i><'col-xs-12 col-sm-6'p>>") .withBootstrap(); this.standardColumns = [ DTColumnBuilder.newColumn('id').withClass('text-danger'), DTColumnBuilder.newColumn('name'), DTColumnBuilder.newColumn('phone'), DTColumnBuilder.newColumn('company'), DTColumnBuilder.newColumn('zip'), DTColumnBuilder.newColumn('city'), DTColumnBuilder.newColumn('date') ]; }]);
0debug
static void armv7m_nvic_class_init(ObjectClass *klass, void *data) { NVICClass *nc = NVIC_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass); SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); nc->parent_reset = dc->reset; nc->parent_init = sdc->init; sdc->init = armv7m_nvic_init; dc->vmsd = &vmstate_nvic; dc->reset = armv7m_nvic_reset; }
1threat
Could not find method android() for arguments org.gradle.api.Project : <p>Getting a bug, when I try to compile my project in studio , i have search quite a bit with no real solution to it </p> <p>Error:(17, 0) Could not find method android() for arguments [build_a7zf1o8ge4ow4uolz6kqzw5ov$_run_closure2@19201053] on root project 'booksStudioDir' of type org.gradle.api.Project.</p> <p>This is a sample of my build/gradle file </p> <pre><code>buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'io.fabric.tools:gradle:1.+' } } apply plugin: 'com.android.application' apply plugin: 'io.fabric' android { compileSdkVersion 21 buildToolsVersion "23.0.1" defaultConfig { applicationId "com.peade.time" minSdkVersion 10 targetSdkVersion 13 } signingConfigs { release { storeFile file("/home/bestman/Desktop/mkey/key") storePassword "androidkeys" keyAlias "peade" keyPassword "yes1234" } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' signingConfig signingConfigs.release } } } repositories { maven { url 'https://maven.fabric.io/public' } mavenCentral() } dependencies { compile 'com.edmodo:cropper:1.0.1' compile 'com.android.support:support-v4:21.0.3' compile 'com.itextpdf:itextpdf:5.5.6' // compile files('libs/commons-lang3-3.3.2.jar') compile files('libs/dropbox-android-sdk-1.6.1.jar') // compile files('libs/httpmime-4.0.3.jar') compile files('libs/json_simple-1.1.jar') compile files('libs/picasso-2.5.2.jar') compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') { transitive = true; } compile project(':owncloud') } </code></pre>
0debug
static int rtc_post_load(void *opaque, int version_id) { RTCState *s = opaque; if (version_id <= 2 || rtc_clock == QEMU_CLOCK_REALTIME) { rtc_set_time(s); s->offset = 0; check_update_timer(s); } uint64_t now = qemu_clock_get_ns(rtc_clock); if (now < s->next_periodic_time || now > (s->next_periodic_time + get_max_clock_jump())) { periodic_timer_update(s, qemu_clock_get_ns(rtc_clock)); } #ifdef TARGET_I386 if (version_id >= 2) { if (s->lost_tick_policy == LOST_TICK_POLICY_SLEW) { rtc_coalesced_timer_update(s); } } #endif return 0; }
1threat
Iterate through a datatable columns using lambda expression : I want to iterate through datatable columns using lambda expression. Currently I'm trying with foreach. Below is the sample code. foreach (DataColumn x in registeredpeople.Columns) { Response.Write(tab + x.ColumnName); tab = "\t"; } I want to achieve something like this, which we can do with the collection of list. exampleCollection.ForEach(x => { sample.ID = x.Value, sample.Name = x.Text });
0debug
void migrate_add_blocker(Error *reason) { migration_blockers = g_slist_prepend(migration_blockers, reason); }
1threat
How to call an vector inside a list without explicitly referencing object's name? : <p>I have a list mylist and I know how to call one of its object by its name</p> <pre><code>head(mylist$"26533") [1] 39.67125 33.33558 33.75013 51.71748 47.86691 35.98055 </code></pre> <p>But when I try to get the same result with using x,</p> <pre><code>x &lt;- "26533" head(mylist$x) </code></pre> <p>R tells me the result is NULL. Can anyone tell me what is the problem?</p>
0debug
How to grab data from selected checkbox : I currently have a number of items each with a list of data inside. What I'm trying to achieve is, when i select a checkbox that has the same matching attribute of "itemName", the matching div that contains the additional data is appended to a container. I have written some code up here: [http://codepen.io/anon/pen/OXkgdk?editors=1010][1] [1]: http://codepen.io/anon/pen/OXkgdk?editors=1010 <div class="item" itemName="itemOne"> <h2> Item One </h2> <ul> <li> Data 1 </li> <li> Data 2 </li> <li> Data 3 </li> </ul> </div> <div class="item" itemName="itemTwo"> <h2> Item Two </h2> <ul> <li> Data 1 </li> <li> Data 2 </li> <li> Data 3 </li> </ul> </div> <ul class="itemSelection"> <li itemName="itemOne"><label><input type="checkbox"/>Item One</label></li> <li itemName="itemTwo"><label><input type="checkbox"/>Item Two</label></li> </ul> <div id="container"></div> Any help would be greatly appreciated.
0debug
need help to move image to left center of page : I want to know how i can move a image when i click on that it should move to left center. code is <div id="myanm" > <a href="#"><img src="img/home/Services.png" class="service animated fadeInUp img_move"> <h2 class="txt1 shadow animated fadeInUp">SERVICES</h2> </a> </div> css file is .service{ position:absolute; left:0px; bottom:0; z-index:1; animation-delay: 3.5s; height:324px; width:433px; } though already animation is applied i am unable to do click function. please help me out. thank you in advance.
0debug
TranslationBlock *tb_gen_code(CPUState *cpu, target_ulong pc, target_ulong cs_base, uint32_t flags, int cflags) { CPUArchState *env = cpu->env_ptr; TranslationBlock *tb; tb_page_addr_t phys_pc, phys_page2; target_ulong virt_page2; tcg_insn_unit *gen_code_buf; int gen_code_size, search_size; #ifdef CONFIG_PROFILER int64_t ti; #endif assert_memory_lock(); phys_pc = get_page_addr_code(env, pc); if (use_icount && !(cflags & CF_IGNORE_ICOUNT)) { cflags |= CF_USE_ICOUNT; } tb = tb_alloc(pc); if (unlikely(!tb)) { buffer_overflow: tb_flush(cpu); mmap_unlock(); cpu->exception_index = EXCP_INTERRUPT; cpu_loop_exit(cpu); } gen_code_buf = tcg_ctx.code_gen_ptr; tb->tc_ptr = gen_code_buf; tb->pc = pc; tb->cs_base = cs_base; tb->flags = flags; tb->cflags = cflags; tb->trace_vcpu_dstate = *cpu->trace_dstate; tb->invalid = false; #ifdef CONFIG_PROFILER tcg_ctx.tb_count1++; ti = profile_getclock(); #endif tcg_func_start(&tcg_ctx); tcg_ctx.cpu = ENV_GET_CPU(env); gen_intermediate_code(cpu, tb); tcg_ctx.cpu = NULL; trace_translate_block(tb, tb->pc, tb->tc_ptr); tb->jmp_reset_offset[0] = TB_JMP_RESET_OFFSET_INVALID; tb->jmp_reset_offset[1] = TB_JMP_RESET_OFFSET_INVALID; tcg_ctx.tb_jmp_reset_offset = tb->jmp_reset_offset; if (TCG_TARGET_HAS_direct_jump) { tcg_ctx.tb_jmp_insn_offset = tb->jmp_target_arg; tcg_ctx.tb_jmp_target_addr = NULL; } else { tcg_ctx.tb_jmp_insn_offset = NULL; tcg_ctx.tb_jmp_target_addr = tb->jmp_target_arg; } #ifdef CONFIG_PROFILER tcg_ctx.tb_count++; tcg_ctx.interm_time += profile_getclock() - ti; tcg_ctx.code_time -= profile_getclock(); #endif gen_code_size = tcg_gen_code(&tcg_ctx, tb); if (unlikely(gen_code_size < 0)) { goto buffer_overflow; } search_size = encode_search(tb, (void *)gen_code_buf + gen_code_size); if (unlikely(search_size < 0)) { goto buffer_overflow; } #ifdef CONFIG_PROFILER tcg_ctx.code_time += profile_getclock(); tcg_ctx.code_in_len += tb->size; tcg_ctx.code_out_len += gen_code_size; tcg_ctx.search_out_len += search_size; #endif #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM) && qemu_log_in_addr_range(tb->pc)) { qemu_log_lock(); qemu_log("OUT: [size=%d]\n", gen_code_size); if (tcg_ctx.data_gen_ptr) { size_t code_size = tcg_ctx.data_gen_ptr - tb->tc_ptr; size_t data_size = gen_code_size - code_size; size_t i; log_disas(tb->tc_ptr, code_size); for (i = 0; i < data_size; i += sizeof(tcg_target_ulong)) { if (sizeof(tcg_target_ulong) == 8) { qemu_log("0x%08" PRIxPTR ": .quad 0x%016" PRIx64 "\n", (uintptr_t)tcg_ctx.data_gen_ptr + i, *(uint64_t *)(tcg_ctx.data_gen_ptr + i)); } else { qemu_log("0x%08" PRIxPTR ": .long 0x%08x\n", (uintptr_t)tcg_ctx.data_gen_ptr + i, *(uint32_t *)(tcg_ctx.data_gen_ptr + i)); } } } else { log_disas(tb->tc_ptr, gen_code_size); } qemu_log("\n"); qemu_log_flush(); qemu_log_unlock(); } #endif tcg_ctx.code_gen_ptr = (void *) ROUND_UP((uintptr_t)gen_code_buf + gen_code_size + search_size, CODE_GEN_ALIGN); assert(((uintptr_t)tb & 3) == 0); tb->jmp_list_first = (uintptr_t)tb | 2; tb->jmp_list_next[0] = (uintptr_t)NULL; tb->jmp_list_next[1] = (uintptr_t)NULL; if (tb->jmp_reset_offset[0] != TB_JMP_RESET_OFFSET_INVALID) { tb_reset_jump(tb, 0); } if (tb->jmp_reset_offset[1] != TB_JMP_RESET_OFFSET_INVALID) { tb_reset_jump(tb, 1); } virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK; phys_page2 = -1; if ((pc & TARGET_PAGE_MASK) != virt_page2) { phys_page2 = get_page_addr_code(env, virt_page2); } tb_link_page(tb, phys_pc, phys_page2); return tb; }
1threat
In Python how to use list in dictionary? : in python. i am trying to fetch a value from a dictionary but the value is a list eg: dict_1 ={A:[2,3,4],B:[3,4,5],C:[6,7,8]} now i am trying to iterate through the dictionary and fetch the value of it divide by any integer and return the value to form another dictionary dict_2 ={ A:[2/x,3/x,4/x],B:[3/x,4/x,5/x],C:[6/x,7/x,8/x]}
0debug
Atom setting to open files in the same window? : <p>I'm just trying out Atom for the first time and I find it bothersome that Atom keeps opening a new window for each file I click on - I'd prefer that it defaulted to opening each file in the same window.</p> <p>I'm hoping for something along the lines of <code>"open_files_in_new_window" : false,</code> in Sublime. Unfortunately, all the google results I'm seeing just lament that this toggle is not immediately obvious.</p>
0debug
SQL Server Error creating store proc : Select count(*) as Colcunt from tbl_Calibration_Transaction where CardId = @CardId and ScalingMachine= @ScalingMachine IF (Colcunt = 0 ) BEGIN INSERT INTO tbl_Calibration_Transaction Iam getting this error Msg 207, Level 16, State 1, Procedure InsertScalingTrans, Line 19 Invalid column name 'Colcunt'.
0debug
How to apply classes to Vue.js Functional Component from parent component? : <p>Suppose I have a functional component:</p> <pre><code>&lt;template functional&gt; &lt;div&gt;Some functional component&lt;/div&gt; &lt;/template&gt; </code></pre> <p>Now I render this component in some parent with classes:</p> <pre><code>&lt;parent&gt; &lt;some-child class="new-class"&gt;&lt;/some-child&gt; &lt;/parent&gt; </code></pre> <p>Resultant <code>DOM</code> doesn't have <code>new-class</code> applied to the Functional child component. Now as I understand, <code>Vue-loader</code> compiles <strong>Functional</strong> component against <code>render</code> function <code>context</code> as <a href="https://vue-loader.vuejs.org/guide/functional.html" rel="noreferrer">explained here</a>. That means classes won't be directly applied and merge intelligently.</p> <p>Question is - <strong>how can I make Functional component play nicely with the externally applied class when using a template?</strong></p> <p><em>Note: I know it is easily possible to do so via render function:</em></p> <pre><code>Vue.component("functional-comp", { functional: true, render(h, context) { return h("div", context.data, "Some functional component"); } }); </code></pre>
0debug
Not clickable aren around circle ?? : It have to be not clickable area arount this circle https://jsbin.com/dupadoleke/1/edit?html,css,output
0debug
static int protocol_client_vencrypt_auth(VncState *vs, uint8_t *data, size_t len) { int auth = read_u32(data, 0); if (auth != vs->vd->subauth) { VNC_DEBUG("Rejecting auth %d\n", auth); vnc_write_u8(vs, 0); vnc_flush(vs); vnc_client_error(vs); } else { VNC_DEBUG("Accepting auth %d, starting handshake\n", auth); vnc_write_u8(vs, 1); vnc_flush(vs); if (vnc_start_tls(vs) < 0) { VNC_DEBUG("Failed to complete TLS\n"); return 0; } if (vs->wiremode == VNC_WIREMODE_TLS) { VNC_DEBUG("Starting VeNCrypt subauth\n"); return start_auth_vencrypt_subauth(vs); } else { VNC_DEBUG("TLS handshake blocked\n"); return 0; } } return 0; }
1threat
PredicateBuilder.New vs PredicateBuilder.True : <p>I am using PredicateBuilder to create a search/filter section in my action. Here it is:</p> <pre><code> [HttpPost] public ActionResult Test(int? cty, string inumber, int? page) { var lstValues = db.TableName.Include(x =&gt; x.Table1) .Include(x =&gt; x.Table2) .Include(x =&gt; x.Table3) .ToList(); var predicate = PredicateBuilder.True&lt;TableName&gt;(); if (!string.IsNullOrWhiteSpace(inumber)) { predicate = predicate.And(x =&gt; x.Inumber == inumber); } if (!string.IsNullOrWhiteSpace(cty.ToString())) { predicate = predicate.And(x =&gt; x.CtyID == cty); } if (predicate.Parameters.Count &gt; 0) { lstValues = db.TableName.AsExpandable().Where(predicate).ToList(); Session["Paging"] = lstValues; ViewBag.Paging = lstValues.ToPagedList(page ?? 1, 2); return View(lstValues.ToPagedList(page ?? 1, 2)); } else { return View(lstValues.ToPagedList(page ?? 1, 2)); } } </code></pre> <p>Under this line <code>PredicateBuilder.True&lt;TableName&gt;();</code> I get a green squiggly saying</p> <blockquote> <p>PredicateBuilder.True() is obsolete. Use PredicateBuilder.New instead.</p> </blockquote> <p>But I have tried <code>PredicateBuilder.New&lt;T&gt;</code> and my predicate always gets a value of <code>1</code> even if I don't have any values coming in for the parameters, so <code>cty</code>, and <code>inumber</code> are null. This returns me an empty table.. when it should be returning all records by entering the <code>else</code> statement with <code>return View(lstValues.ToPagedList(page ?? 1, 2));</code>.</p> <p>When I use <code>PredicateBuilder.True&lt;T&gt;</code> I get all records returned when all of the parameters are null.</p> <p>Any idea on why that is? Any help is appreciated.</p>
0debug
Docker shell completion on OSX iTerm2 oh-my-zsh : <p>I am trying to get Docker shell completion on this stack (OSX iTerm2 oh-my-zsh) </p> <p>I followed this guide -> <a href="https://docs.docker.com/compose/completion/" rel="noreferrer">https://docs.docker.com/compose/completion/</a></p> <p>First I executed this</p> <pre><code>$ mkdir -p ~/.zsh/completion $ curl -L https://raw.githubusercontent.com/docker/compose/master/contrib/completion/zsh/_docker-compose &gt; ~/.zsh/completion/_docker-compose </code></pre> <p>Then I added this two lines almost at the end <code>~/.zshrc</code> file</p> <pre><code>fpath=(~/.zsh/completion $fpath) autoload -Uz compinit &amp;&amp; compinit -i </code></pre> <p>Then in the terminal I run</p> <pre><code>source ~/.zshrc exec $SHELL -l </code></pre> <p>But when I press <code>tab</code> it suggest the files and folders on the path</p>
0debug
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
1threat
static int hls_write_trailer(struct AVFormatContext *s) { HLSContext *hls = s->priv_data; AVFormatContext *oc = hls->avf; av_write_trailer(oc); avio_closep(&oc->pb); avformat_free_context(oc); av_free(hls->basename); append_entry(hls, hls->duration); hls_window(s, 1); free_entries(hls); return 0; }
1threat
Variable inside ei function. Python can't calculate : My code is attached below. Python is unable to calculate the value of N_next because it's inside the Ei function. How can I circumvent this? Exact error is "Can't assign function to call". import math import numpy as np import matplotlib import matplotlib.pyplot as plt t_f =100 N_0 = 10 t = [] N_t = [N_0,] r = 2.5 K = 1000 for i in range(0,100): ei(r*N_next/K) = i*e^r + ei(r/K * N_t[i]) N_t.append(N_next) t.append(i) plt.plot(t,N_t) plt.show
0debug
static int vmdk_create(const char *filename, QEMUOptionParameter *options, Error **errp) { int idx = 0; BlockDriverState *new_bs = NULL; Error *local_err; char *desc = NULL; int64_t total_size = 0, filesize; const char *adapter_type = NULL; const char *backing_file = NULL; const char *fmt = NULL; int flags = 0; int ret = 0; bool flat, split, compress; GString *ext_desc_lines; char path[PATH_MAX], prefix[PATH_MAX], postfix[PATH_MAX]; const int64_t split_size = 0x80000000; const char *desc_extent_line; char parent_desc_line[BUF_SIZE] = ""; uint32_t parent_cid = 0xffffffff; uint32_t number_heads = 16; bool zeroed_grain = false; uint32_t desc_offset = 0, desc_len; const char desc_template[] = "# Disk DescriptorFile\n" "version=1\n" "CID=%" PRIx32 "\n" "parentCID=%" PRIx32 "\n" "createType=\"%s\"\n" "%s" "\n" "# Extent description\n" "%s" "\n" "# The Disk Data Base\n" "#DDB\n" "\n" "ddb.virtualHWVersion = \"%d\"\n" "ddb.geometry.cylinders = \"%" PRId64 "\"\n" "ddb.geometry.heads = \"%" PRIu32 "\"\n" "ddb.geometry.sectors = \"63\"\n" "ddb.adapterType = \"%s\"\n"; ext_desc_lines = g_string_new(NULL); if (filename_decompose(filename, path, prefix, postfix, PATH_MAX, errp)) { ret = -EINVAL; goto exit; } while (options && options->name) { if (!strcmp(options->name, BLOCK_OPT_SIZE)) { total_size = options->value.n; } else if (!strcmp(options->name, BLOCK_OPT_ADAPTER_TYPE)) { adapter_type = options->value.s; } else if (!strcmp(options->name, BLOCK_OPT_BACKING_FILE)) { backing_file = options->value.s; } else if (!strcmp(options->name, BLOCK_OPT_COMPAT6)) { flags |= options->value.n ? BLOCK_FLAG_COMPAT6 : 0; } else if (!strcmp(options->name, BLOCK_OPT_SUBFMT)) { fmt = options->value.s; } else if (!strcmp(options->name, BLOCK_OPT_ZEROED_GRAIN)) { zeroed_grain |= options->value.n; } options++; } if (!adapter_type) { adapter_type = "ide"; } else if (strcmp(adapter_type, "ide") && strcmp(adapter_type, "buslogic") && strcmp(adapter_type, "lsilogic") && strcmp(adapter_type, "legacyESX")) { error_setg(errp, "Unknown adapter type: '%s'", adapter_type); ret = -EINVAL; goto exit; } if (strcmp(adapter_type, "ide") != 0) { number_heads = 255; } if (!fmt) { fmt = "monolithicSparse"; } else if (strcmp(fmt, "monolithicFlat") && strcmp(fmt, "monolithicSparse") && strcmp(fmt, "twoGbMaxExtentSparse") && strcmp(fmt, "twoGbMaxExtentFlat") && strcmp(fmt, "streamOptimized")) { error_setg(errp, "Unknown subformat: '%s'", fmt); ret = -EINVAL; goto exit; } split = !(strcmp(fmt, "twoGbMaxExtentFlat") && strcmp(fmt, "twoGbMaxExtentSparse")); flat = !(strcmp(fmt, "monolithicFlat") && strcmp(fmt, "twoGbMaxExtentFlat")); compress = !strcmp(fmt, "streamOptimized"); if (flat) { desc_extent_line = "RW %" PRId64 " FLAT \"%s\" 0\n"; } else { desc_extent_line = "RW %" PRId64 " SPARSE \"%s\"\n"; } if (flat && backing_file) { error_setg(errp, "Flat image can't have backing file"); ret = -ENOTSUP; goto exit; } if (flat && zeroed_grain) { error_setg(errp, "Flat image can't enable zeroed grain"); ret = -ENOTSUP; goto exit; } if (backing_file) { BlockDriverState *bs = NULL; ret = bdrv_open(&bs, backing_file, NULL, NULL, BDRV_O_NO_BACKING, NULL, errp); if (ret != 0) { goto exit; } if (strcmp(bs->drv->format_name, "vmdk")) { bdrv_unref(bs); ret = -EINVAL; goto exit; } parent_cid = vmdk_read_cid(bs, 0); bdrv_unref(bs); snprintf(parent_desc_line, sizeof(parent_desc_line), "parentFileNameHint=\"%s\"", backing_file); } filesize = total_size; while (filesize > 0) { char desc_line[BUF_SIZE]; char ext_filename[PATH_MAX]; char desc_filename[PATH_MAX]; int64_t size = filesize; if (split && size > split_size) { size = split_size; } if (split) { snprintf(desc_filename, sizeof(desc_filename), "%s-%c%03d%s", prefix, flat ? 'f' : 's', ++idx, postfix); } else if (flat) { snprintf(desc_filename, sizeof(desc_filename), "%s-flat%s", prefix, postfix); } else { snprintf(desc_filename, sizeof(desc_filename), "%s%s", prefix, postfix); } snprintf(ext_filename, sizeof(ext_filename), "%s%s", path, desc_filename); if (vmdk_create_extent(ext_filename, size, flat, compress, zeroed_grain, errp)) { ret = -EINVAL; goto exit; } filesize -= size; snprintf(desc_line, sizeof(desc_line), desc_extent_line, size / BDRV_SECTOR_SIZE, desc_filename); g_string_append(ext_desc_lines, desc_line); } desc = g_strdup_printf(desc_template, (uint32_t)time(NULL), parent_cid, fmt, parent_desc_line, ext_desc_lines->str, (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4), total_size / (int64_t)(63 * number_heads * BDRV_SECTOR_SIZE), number_heads, adapter_type); desc_len = strlen(desc); if (!split && !flat) { desc_offset = 0x200; } else { ret = bdrv_create_file(filename, options, &local_err); if (ret < 0) { error_setg_errno(errp, -ret, "Could not create image file"); goto exit; } } assert(new_bs == NULL); ret = bdrv_open(&new_bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL, NULL, &local_err); if (ret < 0) { error_setg_errno(errp, -ret, "Could not write description"); goto exit; } ret = bdrv_pwrite(new_bs, desc_offset, desc, desc_len); if (ret < 0) { error_setg_errno(errp, -ret, "Could not write description"); goto exit; } if (desc_offset == 0) { ret = bdrv_truncate(new_bs, desc_len); if (ret < 0) { error_setg_errno(errp, -ret, "Could not truncate file"); } } exit: if (new_bs) { bdrv_unref(new_bs); } g_free(desc); g_string_free(ext_desc_lines, true); return ret; }
1threat
static void open_eth_cleanup(NetClientState *nc) { }
1threat
How do you add/remove to a redux store generated with normalizr? : <p>Looking the examples from the <a href="https://github.com/gaearon/normalizr">README</a>:</p> <p>Given the "bad" structure:</p> <pre><code>[{ id: 1, title: 'Some Article', author: { id: 1, name: 'Dan' } }, { id: 2, title: 'Other Article', author: { id: 1, name: 'Dan' } }] </code></pre> <p>It's extremely easy to add a new object. All I have to do is something like </p> <pre><code>return { ...state, myNewObject } </code></pre> <p>In the reducer.</p> <p>Now given the structure of the "good" tree, I have no idea how I should approach it.</p> <pre><code>{ result: [1, 2], entities: { articles: { 1: { id: 1, title: 'Some Article', author: 1 }, 2: { id: 2, title: 'Other Article', author: 1 } }, users: { 1: { id: 1, name: 'Dan' } } } } </code></pre> <p>Every approach I've thought of requires some complex object manipulation, which makes me feel like I'm not on the right track because normalizr is supposed to be making my life easier.</p> <p>I can't find any examples online of someone working with the normalizr tree in this way. <a href="https://github.com/rackt/redux/tree/master/examples/real-world">The official example</a> does no adding and removing so it was no help either.</p> <p>Could someone let me know how to add/remove from a normalizr tree the right way?</p>
0debug
What is better way to compare Strings? : <p>Which among the 2 is better way to compare String?</p> <pre><code>String str="Hello"; //case 1: if(str.equals("Hello")){ //case 2: if("Hello".equals(str)) </code></pre>
0debug
How to import android.support.v7.app.NotificationCompat.Builder class in Android Studio : <p>I am trying to implement simple notifications in my android app. I am reffering this <a href="https://developer.android.com/guide/topics/ui/notifiers/notifications.html" rel="noreferrer">developer guide</a> </p> <p><strong>But getting this error message :</strong> </p> <pre><code>Incompatible types. Required: android.support.v7app.NotificationCompat.Builder Found: android.support.v4.app.Notification.Compat.Builder </code></pre> <p><a href="http://i.stack.imgur.com/fBG5r.png" rel="noreferrer">Error Message screenshot</a></p> <p><strong>For the following code snippet :</strong></p> <pre><code>NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle("My notification") .setContentText("Hello World!"); </code></pre> <p><strong>Here are my imports :</strong></p> <pre><code>import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.app.NotificationCompat; import android.view.View; import android.widget.Button; </code></pre> <p>I think the correct <code>NotificationCompat</code> class is imported. I am using <code>Android Studio v2.1.2</code> for development. Please help me with this error message. I am new to android programming and java.</p>
0debug
Regex: Capturing Group that does not contain regex : <pre><code>&lt;DIV&gt;&lt;SPAN CLASS="dt23 ll0"&gt;A suggestion: for the &lt;SPAN CLASS="jl2"&gt;quickest&lt;/SPAN&gt; overview of &lt;SPAN CLASS="jl2"&gt;Mark&lt;/SPAN&gt;, first read all the Division titles (I, II, III, etc.), then come back and read &lt;/SPAN&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;SPAN CLASS="dt24 ll0"&gt;the individual outline titles. &lt;/SPAN&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;SPAN CLASS="dt25 ll2"&gt; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;SPAN CLASS="dt26 ll2"&gt; &lt;/SPAN&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;SPAN CLASS="dt27 ll2"&gt; &lt;/SPAN&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;SPAN CLASS="jl4"&gt;UTLINE OF &lt;/SPAN&gt;M&lt;SPAN CLASS="jl4"&gt;ARK&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;SPAN CLASS="dt29 ll2"&gt; &lt;/SPAN&gt;&lt;/DIV&gt; &lt;DIV&gt;&lt;SPAN CLASS="dt30 ll2"&gt; &lt;/SPAN&gt;&lt;/DIV&gt; </code></pre> <p>I'm trying to retrieve entire SPAN elements here without capturing another SPAN's open tag. This regex here clearly fails</p> <pre><code>&lt;SPAN.*?&gt;(.*?)&lt;\/SPAN&gt; </code></pre> <p>An example result of the regex above is this:</p> <pre><code>&lt;SPAN CLASS="ps23 ft0"&gt;A suggestion: for the &lt;SPAN CLASS="em2"&gt;quickest&lt;/SPAN&gt; </code></pre> <p>Which is undesirable. The regex that I've coded so far to achieve this is this:</p> <pre><code>&lt;SPAN.*?&gt;(.*?(?!&lt;SPAN&gt;.*?).)&lt;\/SPAN&gt; </code></pre> <p>And miserably fails</p>
0debug
Grouped graph with error bars : <p>I need to reproduce this plot in R with ggplot2<a href="https://i.stack.imgur.com/fD1du.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fD1du.jpg" alt="enter image description here"></a></p> <p>Does anyone know how to do it? Thank you.</p>
0debug
static unsigned int dec_move_rs(DisasContext *dc) { DIS(fprintf (logfile, "move $r%u, $s%u\n", dc->op1, dc->op2)); cris_cc_mask(dc, 0); tcg_gen_helper_0_2(helper_movl_sreg_reg, tcg_const_tl(dc->op2), tcg_const_tl(dc->op1)); return 2; }
1threat
Which 'li' was clicked using vanilla JS : <p>I have some li elements:</p> <pre><code>&lt;ul&gt; &lt;li&gt;One&lt;/li&gt; &lt;li&gt;Two&lt;/li&gt; &lt;li&gt;Three&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I need to know the number of the element that was clicked. For example, if an user clicks on </p> <pre><code>&lt;li&gt;Three&lt;/li&gt; </code></pre> <p>my output will be "3". </p> <p><br> How can I get this result using vanilla JavaScript?</p>
0debug
Why does not work styling in Pandas Excel? : import pandas as pd import xlsxwriter from datetime import datetime import sys path = sys.argv[1] xl = pd.ExcelFile(path) df = xl.parse("Sheet1") df.columns = ['Nume', 'Tip de', 'Unit', 'Speciale Price', 'Suma de', 'Suma'] def highlight_max(x): return ['background-color: yellow' if v == x.max() else '' for v in x] df.style.apply(highlight_max) df.loc[-1] = ['Totul', '', '', '', df['Suma de'].sum(), df['Suma'].sum()] I tried to apply `highlight_max` to columns
0debug
PHP mysqli query wrong result : <p>I am using the following script to get joindate of the account: </p> <pre><code>$date = mysqli_query($conn,"SELECT joindate from account where id = 6"); </code></pre> <p>The result of that query should be 2016-01-30 00:00:00 but when i use</p> <pre><code>print_r($date); </code></pre> <p>i get only </p> <pre><code>mysqli_result Object ( [current_field] =&gt; 0 [field_count] =&gt; 1 [lengths] =&gt; [num_rows] =&gt; 1 [type] =&gt; 0 ) </code></pre>
0debug
Creating a diagonal matrix? : I want to generate the matrix below by using a R statement. 1) 0 1 1 1 0 1 1 1 0 2) 0 2 3 0 5 0 7 0 0 3) 1 3 5 7 3 7 11 15 7 15 23 31 I need to write a function?diag function doesn;t help for the first question.
0debug
How to delete everything in a folder except one or two folders that I want to retain? : <p>I have folder "Folder1" that contains files and folders such as "file1", "file2" "Folder11" "Folder12" "Folder13" etc. I want to retain only "Folder11" &amp; "Folder12" and delete rest of the things. I need help to write python script for the same.</p>
0debug
Distinguish between iPad and mac on iPad with iPadOs : <p>In iOS 13 apple changed the user-agent that iPad uses.</p> <p>Instead of (for example)</p> <blockquote> <p>Mozilla/5.0(<strong>iPad</strong>; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10</p> </blockquote> <p>it become (for example)</p> <blockquote> <p>Mozilla/5.0 (<strong>Macintosh</strong>; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Safari/605.1.15</p> </blockquote> <p>My question is how can we distinguish between iPad and mac now?</p>
0debug
def validate(n): for i in range(10): temp = n; count = 0; while (temp): if (temp % 10 == i): count+=1; if (count > i): return False temp //= 10; return True
0debug
I need help understanding what the following code does : <pre><code>while(u!=1) { if(u%2==0) { u=u/2; }else{ u=u*3+1; } count = count + 1; } </code></pre> <p>Can someone explain to me what does this count? It seems pretty simple but I just can't figure it out.</p>
0debug
How to specify Memory & CPU limit in docker compose version 3 : <p>I am unable to specify CPU &amp; memory for services specified in version 3 .</p> <p>With version 2 it works fine with "mem_limit" &amp; "cpu_shares" parameters under the services . But it fails while using version 3 , putting them under deploy section doesn't seem worthy unless i am using swarm mode .</p> <p>Can somebody help ?</p> <pre><code>version: "3" services: node: build: context: . dockerfile: ./docker-build/Dockerfile.node restart: always environment: - VIRTUAL_HOST=localhost volumes: - logs:/app/out/ expose: - 8083 command: ["npm","start"] cap_drop: - NET_ADMIN - SYS_ADMIN </code></pre>
0debug
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
from collections import Counter def second_frequent(input): dict = Counter(input) value = sorted(dict.values(), reverse=True) second_large = value[1] for (key, val) in dict.items(): if val == second_large: return (key)
0debug
How to approach first and last element of one dimensional numpy array in python? : <p>I have a 1 dimensional numpy array. I don't have any information about its first and last element. I want to do slicing. Is there any other way to approach first and last element rather than the following method?<br> <code>a= np.arange(100).reshape(10,10) b= a.reshape(-1) even = b[b[0]:b[len(b):2]] odd = b[b[1]:b[len(b)]:2]</code></p>
0debug
How to get struct name in elixir? : <p>Let say I have a struct, <code>struct = %MyApp.MyModel{ filled_with_data: "true }</code>.</p> <p>How can I get struct name (<code>MyApp.MyModel</code> in my case)?</p>
0debug
static int convert_sub_to_old_ass_form(AVSubtitle *sub, const AVPacket *pkt, AVRational tb) { int i; AVBPrint buf; av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED); for (i = 0; i < sub->num_rects; i++) { char *final_dialog; const char *dialog; AVSubtitleRect *rect = sub->rects[i]; int ts_start, ts_duration = -1; long int layer; if (rect->type != SUBTITLE_ASS || !strncmp(rect->ass, "Dialogue ", 10)) continue; av_bprint_clear(&buf); dialog = strchr(rect->ass, ','); if (!dialog) continue; dialog++; layer = strtol(dialog, (char**)&dialog, 10); if (*dialog != ',') continue; dialog++; ts_start = av_rescale_q(pkt->pts, tb, av_make_q(1, 100)); if (pkt->duration != -1) ts_duration = av_rescale_q(pkt->duration, tb, av_make_q(1, 100)); sub->end_display_time = FFMAX(sub->end_display_time, 10 * ts_duration); av_bprintf(&buf, "Dialogue: %ld,", layer); insert_ts(&buf, ts_start); insert_ts(&buf, ts_duration == -1 ? -1 : ts_start + ts_duration); av_bprintf(&buf, "%s\r\n", dialog); final_dialog = av_strdup(buf.str); if (!av_bprint_is_complete(&buf) || !final_dialog) { av_freep(&final_dialog); av_bprint_finalize(&buf, NULL); return AVERROR(ENOMEM); } av_freep(&rect->ass); rect->ass = final_dialog; } av_bprint_finalize(&buf, NULL); return 0; }
1threat
What is the difference between a method and a function in javascript : <p>Can someone give a simple explanation of methods vs. functions in Javascript context? I have not found any answer on stack overflow</p>
0debug
Database [] not configured Laravel 5 : <p>I create new db in phpmyadmin and new tables.</p> <p>Then i do</p> <pre><code> public function next(Request $request){ $langs = DB::connection('mydb')-&gt;select('select * from lang'); } </code></pre> <p>and get</p> <pre><code>Database [compgen] not configured. </code></pre> <p>in my .env</p> <pre><code>DB_HOST=localhost DB_DATABASE=test DB_USERNAME=root DB_PASSWORD=123 </code></pre> <p>in my config/database.php</p> <pre><code> 'mysql' =&gt; [ 'driver' =&gt; 'mysql', 'host' =&gt; env('DB_HOST', 'localhost'), 'database' =&gt; env('DB_DATABASE', 'test'), 'username' =&gt; env('DB_USERNAME', 'root'), 'password' =&gt; env('DB_PASSWORD', '123'), 'charset' =&gt; 'utf8', 'collation' =&gt; 'utf8_unicode_ci', 'prefix' =&gt; 'test_', 'strict' =&gt; false, ], </code></pre>
0debug
1/2 in python shell gives 0.5 while within a program, it gives 0 : <p>Simple Question:</p> <p>When I do 1/2 in python shell it gives float value</p> <pre><code>&gt;&gt;&gt; 1/2 &gt;&gt;&gt; 0.5 </code></pre> <p>But</p> <pre><code>sum = 0 for i in range(1, 20): p = 1/i print(p) val = 2.0**p sum += val print(sum) </code></pre> <p>When run this program, value of p always comes to 0.</p> <p>What is the reason behind this behaviour. What am i missing?</p>
0debug
What is the most frequent way to send an HTTP request in the industry at the moment (AJAX, Fetch API, Async/Await)? : <p>I know that AJAX used to be more prevalent in the past when it came to creating HTTP requests and i'm curious on what the industry standard is now?</p>
0debug
static void vp56_decode_mb(VP56Context *s, int row, int col, int is_alpha) { AVFrame *frame_current, *frame_ref; VP56mb mb_type; VP56Frame ref_frame; int b, ab, b_max, plane, off; if (s->framep[VP56_FRAME_CURRENT]->key_frame) mb_type = VP56_MB_INTRA; else mb_type = vp56_decode_mv(s, row, col); ref_frame = vp56_reference_frame[mb_type]; s->dsp.clear_blocks(*s->block_coeff); s->parse_coeff(s); vp56_add_predictors_dc(s, ref_frame); frame_current = s->framep[VP56_FRAME_CURRENT]; frame_ref = s->framep[ref_frame]; if (mb_type != VP56_MB_INTRA && !frame_ref->data[0]) return; ab = 6*is_alpha; b_max = 6 - 2*is_alpha; switch (mb_type) { case VP56_MB_INTRA: for (b=0; b<b_max; b++) { plane = ff_vp56_b2p[b+ab]; s->dsp.idct_put(frame_current->data[plane] + s->block_offset[b], s->stride[plane], s->block_coeff[b]); } break; case VP56_MB_INTER_NOVEC_PF: case VP56_MB_INTER_NOVEC_GF: for (b=0; b<b_max; b++) { plane = ff_vp56_b2p[b+ab]; off = s->block_offset[b]; s->dsp.put_pixels_tab[1][0](frame_current->data[plane] + off, frame_ref->data[plane] + off, s->stride[plane], 8); s->dsp.idct_add(frame_current->data[plane] + off, s->stride[plane], s->block_coeff[b]); } break; case VP56_MB_INTER_DELTA_PF: case VP56_MB_INTER_V1_PF: case VP56_MB_INTER_V2_PF: case VP56_MB_INTER_DELTA_GF: case VP56_MB_INTER_4V: case VP56_MB_INTER_V1_GF: case VP56_MB_INTER_V2_GF: for (b=0; b<b_max; b++) { int x_off = b==1 || b==3 ? 8 : 0; int y_off = b==2 || b==3 ? 8 : 0; plane = ff_vp56_b2p[b+ab]; vp56_mc(s, b, plane, frame_ref->data[plane], s->stride[plane], 16*col+x_off, 16*row+y_off); s->dsp.idct_add(frame_current->data[plane] + s->block_offset[b], s->stride[plane], s->block_coeff[b]); } break; } }
1threat
Unable to run cygwin in Windows Docker Container : <p>I've been working with Docker for Windows, attempting to create a Windows Container that can run cygwin as the shell within the container itself. I haven't had any luck getting this going yet. Here's the Dockerfile that I've been messing with.</p> <pre><code># escape=` FROM microsoft/windowsservercore SHELL ["powershell", "-command"] RUN Invoke-WebRequest https://chocolatey.org/install.ps1 -UseBasicParsing | Invoke-Expression RUN choco install cygwin -y RUN refreshenv RUN [Environment]::SetEnvironmentVariable('Path', $env:Path + ';C:\tools\cygwin\bin', [EnvironmentVariableTarget]::Machine) </code></pre> <p>I've tried setting the ENTRYPOINT and CMD to try and get into cygwin, but neither seems to do anything. I've also attached to the container with <code>docker run -it</code> and fired off the cygwin command to get into the shell, but it doesn't appear to do anything. I don't get an error, it just returns to the command prompt as if nothing happened.</p> <p>Is it possible to run another shell in the Windows Container, or am I just doing something incorrectly?</p> <p>Thanks!</p>
0debug
Unexpected NullpointExpection inside a setter : <p>I'm trying to do a simple operation: click a button and show a custom DialogFragment, but I'm getting a NullPointExpection and I can't figure out why.</p> <p><strong>mAlertDialog.java:</strong></p> <pre><code>public class mAlertDialog extends DialogFragment { TextView title; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.dialog_invalid_time, container, false); title = (TextView)view.findViewById(R.id.titleText); return view; } public void setTheTitle(String title) { this.title.setText(title); } } </code></pre> <p><strong>Showing mAlertDialog:</strong></p> <pre><code>mAlertDialog dialog = new mAlertDialog(); dialog.setTheTitle(getActivity().getString(R.string.invalidTimeTitle)); dialog.show(fm, "InvalidTime"); </code></pre> <p><strong>Error message:</strong></p> <pre><code>java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference at m.inschool8.Objects.mAlertDialog.setTheTitle(mAlertDialog.java:20) at m.inschool8.bSubjects.Fragment_Subjects$55.onClick(Fragment_Subjects.java:2654) at android.view.View.performClick(View.java:4780) at android.view.View$PerformClick.run(View.java:19866) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) </code></pre>
0debug
Application is running inside IIS process but is not configured to use IIS server .NET Core 3.0 : <p>I have migrated our application from .NET Core 2.2 to version 3.0. Actually I created the new application in 3.0 from scratch and then copied source code files. Everything looks great but when I try to run the application within Visual Studio 2019 I get the exception: </p> <blockquote> <p>Application is running inside IIS process but is not configured to use IIS server</p> </blockquote> <p>Here is my Program.cs</p> <pre><code>public static class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) =&gt; Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder =&gt; { webBuilder.UseContentRoot(Directory.GetCurrentDirectory()); webBuilder.UseKestrel(); webBuilder.UseIISIntegration(); webBuilder.UseStartup&lt;Startup&gt;(); }); } </code></pre> <p>The error occurs at the line: CreateHostBuilder(args).Build().Run(); It worked fine in .NET Core 2.2 but it doesn't want to run as 3.0. I cannot find anything else that should be done. Something new in the Startup.cs? I don't know.</p>
0debug
static int rtl8139_can_receive(void *opaque) { RTL8139State *s = opaque; int avail; if (!s->clock_enabled) return 1; if (!rtl8139_receiver_enabled(s)) return 1; if (rtl8139_cp_receiver_enabled(s)) { return 1; } else { avail = MOD2(s->RxBufferSize + s->RxBufPtr - s->RxBufAddr, s->RxBufferSize); return (avail == 0 || avail >= 1514); } }
1threat
No provider for ConnectionBackend : <p>So recently I had to update to the latest version of Angular2, RC.6. The biggest breaking change seems to be the whole bootstrapping (by "introducing" ngModule).</p> <pre><code>@NgModule({ imports: [HttpModule, BrowserModule, FormsModule], schemas: [CUSTOM_ELEMENTS_SCHEMA], declarations: [AppComponent, ...], providers: [FrameService, Http, { provide: $WINDOW, useValue: window }], bootstrap: [AppComponent] }) class AppModule { } platformBrowserDynamic().bootstrapModule(AppModule); </code></pre> <p>However after a lot of tears, sweat and pleading to all the deities I could come up with... I still remain with what is hopefully the last error in a series of many:</p> <p><strong>No provider for ConnectionBackend!</strong></p> <p>At this point I am tearing out the last strains of hair I have left as I am clueless at this point regarding the "what I am missing".</p> <p>Kind regards!</p>
0debug
How to color `matplotlib` scatterplot using a continuous value [`seaborn` color palettes?] : <p>I have a scatterplot and I want to color it based on another value (naively assigned to <code>np.random.random()</code> in this case). </p> <p><strong>Is there a way to use <code>seaborn</code> to map a continuous value (not directly associated with the data being plotted) for each point to a value along a continuous gradient in <code>seaborn</code>?</strong> </p> <p>Here's my code to generate the data:</p> <pre><code>import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.datasets import load_iris from sklearn.preprocessing import StandardScaler from sklearn import decomposition import seaborn as sns; sns.set_style("whitegrid", {'axes.grid' : False}) %matplotlib inline np.random.seed(0) # Iris dataset DF_data = pd.DataFrame(load_iris().data, index = ["iris_%d" % i for i in range(load_iris().data.shape[0])], columns = load_iris().feature_names) Se_targets = pd.Series(load_iris().target, index = ["iris_%d" % i for i in range(load_iris().data.shape[0])], name = "Species") # Scaling mean = 0, var = 1 DF_standard = pd.DataFrame(StandardScaler().fit_transform(DF_data), index = DF_data.index, columns = DF_data.columns) # Sklearn for Principal Componenet Analysis # Dims m = DF_standard.shape[1] K = 2 # PCA (How I tend to set it up) Mod_PCA = decomposition.PCA(n_components=m) DF_PCA = pd.DataFrame(Mod_PCA.fit_transform(DF_standard), columns=["PC%d" % k for k in range(1,m + 1)]).iloc[:,:K] # Plot fig, ax = plt.subplots() ax.scatter(x=DF_PCA["PC1"], y=DF_PCA["PC2"], color="k") ax.set_title("No Coloring") </code></pre> <p><a href="https://i.stack.imgur.com/qh5LW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qh5LW.png" alt="enter image description here"></a></p> <p>Ideally, I wanted to do something like this:</p> <pre><code># Color classes cmap = {obsv_id:np.random.random() for obsv_id in DF_PCA.index} # Plot fig, ax = plt.subplots() ax.scatter(x=DF_PCA["PC1"], y=DF_PCA["PC2"], color=[cmap[obsv_id] for obsv_id in DF_PCA.index]) ax.set_title("With Coloring") # ValueError: to_rgba: Invalid rgba arg "0.2965562650640299" # to_rgb: Invalid rgb arg "0.2965562650640299" # cannot convert argument to rgb sequence </code></pre> <p>but it didn't like the continuous value.</p> <p>I want to use a color palette like:</p> <pre><code>sns.palplot(sns.cubehelix_palette(8)) </code></pre> <p><a href="https://i.stack.imgur.com/nVxYv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/nVxYv.png" alt="enter image description here"></a></p> <p>I also tried doing something like below, but it wouldn't make sense b/c it doesn't know which values I used in my <code>cmap</code> dictionary above:</p> <pre><code>ax.scatter(x=DF_PCA["PC1"], y=DF_PCA["PC2"],cmap=sns.cubehelix_palette(as_cmap=True) </code></pre>
0debug
def average_Odd(n) : if (n%2==0) : return ("Invalid Input") return -1 sm =0 count =0 while (n>=1) : count=count+1 sm = sm + n n = n-2 return sm//count
0debug