problem
stringlengths
26
131k
labels
class label
2 classes
clarifying this Java code and few ambiguities of this bot code : <p>I am working on this Chess bot code, in Java which is new to me. While I understand most of the what the code does, I am not sure I do understand it a full extent. In addition to that there is few things that confuses me in the code. for example this <code>private d a;</code> I thought we need to specify the type of every variable in Java. also this</p> <pre><code>private static final b h = new b((State)null, 1.0D / 0.0); </code></pre> <p>are we declaring b or h? and what doies 1.0D / 0.0 ? doesn't sound like a normal variable.</p> <p>here is the full code:</p> <pre><code>public abstract class AIBot extends Bot { private d a; private int b; private int c; private boolean d; private boolean e; private c f; private static final Comparator g = new a(); private static final b h = new b((State)null, 1.0D / 0.0); private static final b i = new b((State)null, -1.0D / 0.0); public AIBot(String var1, d var2, int var3, boolean var4, boolean var5, InputStream var6) { super(var1); this.c = 0; this.a = var2; this.b = var3 &lt;&lt; 1; this.d = var4; this.e = var5; if (var6 == null) { this.f = null; } else { try { this.f = new c(var6); } catch (IOException var7) { throw new RuntimeException("Failed to read opening book", var7); } } } public AIBot(String var1, d var2, int var3, boolean var4, boolean var5) { this(var1, var2, var3, false, false, (InputStream)null); } protected State chooseMove(State var1) { State var2 = null; if (this.f != null) { var2 = this.f.a(var1); } if (var2 == null) { State var3 = var1; Player var8 = var1.player; AIBot var7 = this; b var4 = null; for(int var6 = 2; var6 &lt;= var7.b; var6 += 2) { var7.c = var6; b var5 = var7.a(var8, var3, 0, -1.0D / 0.0, 1.0D / 0.0); if (var4 == null) { var4 = var5; } if (var3.searchLimitReached()) { break; } var4 = var5; } State var9; for(var9 = var4.a; var9.previous != var3; var9 = var9.previous) { } var2 = var9; } return var2; } private final Iterable a(Iterable var1) { if (!this.d) { return var1; } else { PriorityQueue var2 = new PriorityQueue(g); Iterator var3 = var1.iterator(); while(var3.hasNext()) { State var4 = (State)var3.next(); var2.add(var4); if (var4.searchLimitReached()) { break; } } return var2; } } private final b a(Player var1, State var2, int var3, double var4, double var6) { if (this.a(var2, var3)) { return new b(var2, this.a.a(var2, var1)); } else { b var8 = i; Iterator var10 = this.a(var2.next()).iterator(); while(var10.hasNext()) { State var9 = (State)var10.next(); b var10000 = var8; int var10004 = var3 + 1; double var17 = var6; double var15 = var4; int var12 = var10004; State var11 = var9; Player var21 = var1; AIBot var20 = this; b var10001; if (this.a(var11, var12)) { var10001 = new b(var11, this.a.a(var11, var1)); } else { b var13 = h; Iterator var19 = this.a(var11.next()).iterator(); while(var19.hasNext()) { State var14 = (State)var19.next(); b var23 = var20.a(var21, var14, var12 + 1, var15, var17); if ((var13 = var23.b &lt; var13.b ? var23 : var13).b &lt;= var15) { break; } var17 = Math.min(var17, var13.b); if (var11.searchLimitReached()) { break; } } var10001 = var13; } b var22 = var10001; var8 = var10000; if ((var8 = var22.b &gt; var8.b ? var22 : var8).b &gt;= var6) { break; } var4 = Math.max(var4, var8.b); if (var2.searchLimitReached()) { break; } } return var8; } } private final boolean a(State var1, int var2) { if (var1.over) { return true; } else if (var1.searchLimitReached()) { return true; } else if (var2 &lt; this.c) { return false; } else if (this.e) { return var1.board.countPieces() == var1.previous.board.countPieces() || var2 &gt;= this.c * 3; } else { return true; } } } </code></pre>
0debug
Best practice to pass data from Laravel to Vue component : <blockquote> <p>This is my blade code</p> </blockquote> <pre><code>&lt;div id="app"&gt; &lt;Testcomponent bam-wam="ham" /&gt; &lt;/div&gt; </code></pre> <blockquote> <p>This is my VueJS Component code</p> </blockquote> <pre><code>&lt;script&gt; export default { name: "ExampleComponent", props: [ 'bamWam' ], data () { return { }; }, created() { console.log(this.bamWam); } } &lt;/script&gt; </code></pre> <blockquote> <p>Question is</p> </blockquote> <p>This code runs good but I am asking what is better <strong>using Axios and Vuex to fetch data from my Laravel app</strong> or simply <strong>Pass data throw props like I did in this code</strong>?</p>
0debug
Intercept Fetch() API responses and request in Javascript : <p>I want to intercept the fetch API request and response in Javascript. </p> <p>For ex: Before sending the request want to intercept the request URL and once get the response wants to intercept the response.</p> <p>The below code is for intercepting response of All XMLHTTPRequest.</p> <pre><code>(function(open) { XMLHttpRequest.prototype.open = function(XMLHttpRequest) { var self = this; this.addEventListener("readystatechange", function() { if (this.responseText.length &gt; 0 &amp;&amp; this.readyState == 4 &amp;&amp; this.responseURL.indexOf('www.google.com') &gt;= 0) { Object.defineProperty(self, 'response', { get: function() { return bValue; }, set: function(newValue) { bValue = newValue; }, enumerable: true, configurable: true }); self.response = 'updated value' //Intercepted Value } }, false); open.apply(this, arguments); }; })(XMLHttpRequest.prototype.open); </code></pre> <p>I wan to implement the same feature for Fetch() API. </p> <p>Thanks in Advance..</p>
0debug
Returning values from a separate function in C++? : <p>I am doing a programming assignment in my CS class using C++ that is giving me problems. The assignment is to write a program that asks the user to input a Fahrenheit temperature. The program must then output the Celsius equivalent of that temperature and the Celsius equivalents of the next 20 Fahrenheit temperatures. This must all be done using a separate function to complete the conversion calculation as well as a function prototype. </p> <p>I got everything to work except my Celsius outputs all show a value of 0. I cannot seem to find any errors or figure out what is wrong...Please Help!</p> <pre><code>#include &lt;iostream&gt; #include &lt;iomanip&gt; using namespace std; double Celsius(double temp); int main() { double fTemp, cTemp; cout &lt;&lt; "Please input a temperature in degrees Fahrenheit: "; cin &gt;&gt; fTemp; cout &lt;&lt; "F Temp" &lt;&lt; " " &lt;&lt; "C Temp"&lt;&lt; endl; cout &lt;&lt; "-------------------" &lt;&lt; endl; for(int count=1; count&lt;= 20; count++){ cTemp = Celsius(fTemp); cout &lt;&lt; setw(6) &lt;&lt; fTemp &lt;&lt; setw(12) &lt;&lt; cTemp&lt;&lt; endl; fTemp++; } return 0; } //*************Celsius Function****************// double Celsius(double temp){ double newC; newC = (temp-32) * (5/9); return newC; } //************************************************ </code></pre>
0debug
Failed to start namenode in hadoop? : <p>I config Hadoop in windows 7 <a href="http://toodey.com/2015/08/10/hadoop-installation-on-windows-without-cygwin-in-10-mints/">from tutorial</a> It setting up a Single Node Cluster. When run <code>hdfs namenode -format</code> to format namenode it throw exception like: And when <code>start-all.cmd</code> the windows namenode auto forced then I can open namenode GUI in address – <a href="http://localhost:50070">http://localhost:50070</a>.</p> <p><code>16/01/19 15:18:58 WARN namenode.FSEditLog: No class configured for C, dfs.namenode.edits.journal-plugin.C is empty<br> 16/01/19 15:18:58 ERROR namenode.NameNode: Failed to start namenode. java.lang.IllegalArgumentException: No class configured for C at org.apache.hadoop.hdfs.server.namenode.FSEditLog.getJournalClass(FSEditLog.java:1615) at org.apache.hadoop.hdfs.server.namenode.FSEditLog.createJournal(FSEditLog.java:1629) at org.apache.hadoop.hdfs.server.namenode.FSEditLog.initJournals(FSEditLog.java:282) at org.apache.hadoop.hdfs.server.namenode.FSEditLog.initJournalsForWrite(FSEditLog.java:247) at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:985) at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1429) at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1554) 16/01/19 15:18:58 INFO util.ExitUtil: Exiting with status 1 16/01/19 15:18:58 INFO namenode.NameNode: SHUTDOWN_MSG: /************************************************************</code></p> <p>Core-site.xml</p> <pre><code>&lt;configuration&gt; &lt;property&gt; &lt;name&gt;fs.defaultFS&lt;/name&gt; &lt;value&gt;hdfs://localhost:9000&lt;/value&gt; &lt;/property&gt; &lt;/configuration&gt; </code></pre> <p>hdfs-site.xml</p> <pre><code>&lt;configuration&gt; &lt;property&gt; &lt;name&gt;dfs.replication&lt;/name&gt; &lt;value&gt;1&lt;/value&gt; &lt;/property&gt; &lt;property&gt; &lt;name&gt;dfs.namenode.name.dir&lt;/name&gt; &lt;value&gt;C:/hadoop/data/namenode&lt;/value&gt; &lt;/property&gt; &lt;property&gt; &lt;name&gt;dfs.datanode.data.dir&lt;/name&gt; &lt;value&gt;C:/hadoop/data/datanode&lt;/value&gt; &lt;/property&gt; &lt;/configuration&gt; </code></pre> <p>mapred-site.xml</p> <pre><code>&lt;configuration&gt; &lt;property&gt; &lt;name&gt;mapreduce.framework.name&lt;/name&gt; &lt;value&gt;yarn&lt;/value&gt; &lt;/property&gt; &lt;/configuration&gt; </code></pre> <p>yarn-site.xml</p> <pre><code>&lt;configuration&gt; &lt;property&gt; &lt;name&gt;yarn.nodemanager.aux-services&lt;/name&gt; &lt;value&gt;mapreduce_shuffle&lt;/value&gt; &lt;/property&gt; &lt;property&gt; &lt;name&gt;yarn.nodemanager.aux-services.mapreduce.shuffle.class&lt;/name&gt; &lt;value&gt;org.apache.hadoop.mapred.ShuffleHandler&lt;/value&gt; &lt;/property&gt; &lt;/configuration&gt; </code></pre>
0debug
int qcow2_alloc_cluster_offset(BlockDriverState *bs, uint64_t offset, int n_start, int n_end, int *num, uint64_t *host_offset, QCowL2Meta **m) { BDRVQcowState *s = bs->opaque; uint64_t start, remaining; uint64_t cluster_offset; uint64_t cur_bytes; int ret; trace_qcow2_alloc_clusters_offset(qemu_coroutine_self(), offset, n_start, n_end); assert(n_start * BDRV_SECTOR_SIZE == offset_into_cluster(s, offset)); offset = start_of_cluster(s, offset); again: start = offset + (n_start << BDRV_SECTOR_BITS); remaining = (n_end - n_start) << BDRV_SECTOR_BITS; cluster_offset = 0; *host_offset = 0; cur_bytes = remaining; ret = handle_dependencies(bs, start, &cur_bytes); if (ret == -EAGAIN) { goto again; } else if (ret < 0) { return ret; } else { } ret = handle_copied(bs, start, &cluster_offset, &cur_bytes, m); if (ret < 0) { return ret; } else if (ret) { if (!*host_offset) { *host_offset = start_of_cluster(s, cluster_offset); } start += cur_bytes; remaining -= cur_bytes; cluster_offset += cur_bytes; cur_bytes = remaining; } else if (cur_bytes == 0) { goto done; } if (remaining == 0) { goto done; } ret = handle_alloc(bs, start, &cluster_offset, &cur_bytes, m); if (ret < 0) { return ret; } else if (ret) { if (!*host_offset) { *host_offset = start_of_cluster(s, cluster_offset); } start += cur_bytes; remaining -= cur_bytes; cluster_offset += cur_bytes; } done: *num = (n_end - n_start) - (remaining >> BDRV_SECTOR_BITS); assert(*num > 0); assert(*host_offset != 0); return 0; }
1threat
Why I can't call user function defined in script tags that uses external library : <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Register&lt;/title&gt; &lt;!-- Include CSS File Here --&gt; &lt;link rel="stylesheet" href="css/style.css"/&gt; &lt;!-- Include JS File Here --&gt; &lt;script src="https://sdk.amazonaws.com/js/aws-sdk-2.7.20.min.js"&gt; function dispatchRegister() { //Some AWS lib code } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="container"&gt; &lt;div class="main"&gt; &lt;h2&gt;Put Your credentials&lt;/h2&gt; &lt;form id="form_id" method="post" name="myform"&gt; &lt;label&gt;registerUsername&lt;/label&gt; &lt;input type="text" name="registerUsername" id="registerUsername"/&gt; &lt;label&gt;registerPassword&lt;/label&gt; &lt;input type="text" name="registerPassword" id="registerPassword"/&gt; &lt;label&gt;registerEmail&lt;/label&gt; &lt;input type="text" name="registerEmail" id="registerEmail"/&gt; &lt;input type="button" value="Register" id="submit" onclick="dispatchRegister()"/&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I got error "<em>Uncaught ReferenceError: dispatchRegister is not defined</em>" I suspect function is not in global scope but how I can get around that?</p>
0debug
static void error_mem_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { abort(); }
1threat
n00b doesen't understand arrays in c... : I'm a super noob - as in i've been coding for less than a week. I'm just learning about arrays in c and I can't figure out the following for the life of me, why is the following not correct? string space_inserter (string s, int x) { string text = s; long long N = strlen(s); string a = s; long long c = 0; int z = x; for(int i = 0; i < N + (N/x) ; i++) { if( i == x) { a[c] = 32; c++; z = (z + x); printf("%c\n", a[c]); } a[c] = text[i]; printf("%c\n", a[c]); c++; } //a[c] = '\0'; return a; } It's meant to insert spaces into a string of text after every x chars... I know it's not efficient ( recon i need something called pointers) but why isn't it working. I went through it using a debugger and it seems like my original string is changing as i go... but why?? Thanks vm, Tikhon
0debug
void ff_put_h264_qpel8_mc33_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hv_qrt_8w_msa(src + stride - 2, src - (stride * 2) + sizeof(uint8_t), stride, dst, stride, 8); }
1threat
¿Como soluciono el firebase auth? : [enter image description here][1]El packete de import 'package:firebase_auth/firebase_auth.dart'; me da error, ya he descargado todos los paquetes de flutter con ctrl + shift + get packages. [1]: https://i.stack.imgur.com/eaiDK.png
0debug
Merging two different applications JVM into one : I'm looking for a solution/suggestion to merge two different JVM into single JVM. Currently I have two different applications running on two different JVM. Say application1 has app1_Jvm & application2 has app2_Jvm. Now I need to utilize only one JVM say **app_Jvm for both application1 & application2**. Thanks!!
0debug
static int tight_init_stream(VncState *vs, int stream_id, int level, int strategy) { z_streamp zstream = &vs->tight_stream[stream_id]; if (zstream->opaque == NULL) { int err; VNC_DEBUG("VNC: TIGHT: initializing zlib stream %d\n", stream_id); VNC_DEBUG("VNC: TIGHT: opaque = %p | vs = %p\n", zstream->opaque, vs); zstream->zalloc = vnc_zlib_zalloc; zstream->zfree = vnc_zlib_zfree; err = deflateInit2(zstream, level, Z_DEFLATED, MAX_WBITS, MAX_MEM_LEVEL, strategy); if (err != Z_OK) { fprintf(stderr, "VNC: error initializing zlib\n"); return -1; } vs->tight_levels[stream_id] = level; zstream->opaque = vs; } if (vs->tight_levels[stream_id] != level) { if (deflateParams(zstream, level, strategy) != Z_OK) { return -1; } vs->tight_levels[stream_id] = level; } return 0; }
1threat
static inline int clamp(int value, int min, int max) { if (value < min) return min; else if (value > max) return max; else return value; }
1threat
How do I convert the following R data into a .GEXF format for Gephi? : # My first attempt at building a bipartite graph of co-authors of PubMed publications # using the list of articles with Molina JM as one of the authors as a start (around 226) # the following is a sample of the input file (just one csv line) # 11810598;Chêne G, Angelini E, Cotte L, Lang JM, Morlat P, Rancinan C, May T, Journot V, Raffi F, Jarrousse B, Grappin M, Lepeu G, Molina JM;2002;Mar;Role of long-term nucleoside-analogue therapy in lipodystrophy and metabolic disorders in human immunodeficiency virus-infected patients. > InputFile = 'JMMolina_PubMed.csv' # Read the CSV input file into the initial JMMpubs data frame > setwd('~/Dropbox/R') > JMMpubs <- read.csv(file=InputFile , header = > FALSE , sep = ";" , strip.white = TRUE) > names(JMMpubs) <- c("ID","AuthList", "Year", "Month", "Title") # build a new data frame IdAuth with one Id line for each coauthor # therefor the first article which has 13 co-authors will generate 13 lines with the same Id > Authors <- strsplit(as.character(JMMpubs$AuthList), split = ", ") > IdAuth <- data.frame(Id = rep(JMMpubs$ID, sapply(Authors,length)), Author = unlist(Authors)) # Now I would like to export this data to Gephi # The nodes of the graph should be the UNIQUE names in Authors > UniqueAuthors <- unique(unlist(Authors)) # The edges of the graph should be each row of IdAuth # If possible I would like to associate the year of the publications as in JMMpubs$Year to each edge # so that I could paint the more recent edges in red and older ones in paler hues
0debug
Ambiguity in pattern matching syntax : <p>I came across an oddity in the F# pattern matching syntax today, which can lead to apparent failures in the exhaustivity check.</p> <pre><code>type Thing = | This | That | Other let useThing = function | This -&gt; "A" | That -&gt; "A" | That -&gt; "B" // compiler complains | Other -&gt; "B" </code></pre> <p>In the above scenario the compiler helpfully tells me that the second That rule will never be matched. However, if I had tried to make the code a bit more compact and had written</p> <pre><code>let useThing = function | This | That -&gt; "A" | That | Other -&gt; "B" </code></pre> <p>I do not get any help from the compiler. I <em>think</em> the reason is that <code>| This | That -&gt;. "A"</code> is not a shortcut for <code>| This -&gt; "A" | That -&gt; "A"</code>, even though it looks very much like it is (and I've seen many code samples that treat it as such). Instead, from what I can find, the pipe symbol is used both to separate individual patterns, and also as OR pattern.</p> <p>This is not a big issue for most DUs, but I encountered the problem when mapping a DU with a large number of cases into another DU with a small number of cases. My attempt to use the shortcut syntax caused a bug.</p> <p>So my questions are:</p> <ol> <li>Is my interpretation correct?</li> <li>Is there any workaround apart from listing each pattern on a separate line?</li> </ol>
0debug
static inline void RENAME(yuv2packed2)(SwsContext *c, uint16_t *buf0, uint16_t *buf1, uint16_t *uvbuf0, uint16_t *uvbuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) { int yalpha1=yalpha^4095; int uvalpha1=uvalpha^4095; int i; #if 0 if (flags&SWS_FULL_CHR_H_INT) { switch(dstFormat) { #ifdef HAVE_MMX case PIX_FMT_RGB32: asm volatile( FULL_YSCALEYUV2RGB "punpcklbw %%mm1, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "movq %%mm3, %%mm1 \n\t" "punpcklwd %%mm0, %%mm3 \n\t" "punpckhwd %%mm0, %%mm1 \n\t" MOVNTQ(%%mm3, (%4, %%REGa, 4)) MOVNTQ(%%mm1, 8(%4, %%REGa, 4)) "add $4, %%"REG_a" \n\t" "cmp %5, %%"REG_a" \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" ((long)dstW), "m" (yalpha1), "m" (uvalpha1) : "%"REG_a ); break; case PIX_FMT_BGR24: asm volatile( FULL_YSCALEYUV2RGB "punpcklbw %%mm1, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "movq %%mm3, %%mm1 \n\t" "punpcklwd %%mm0, %%mm3 \n\t" "punpckhwd %%mm0, %%mm1 \n\t" "movq %%mm3, %%mm2 \n\t" "psrlq $8, %%mm3 \n\t" "pand "MANGLE(bm00000111)", %%mm2 \n\t" "pand "MANGLE(bm11111000)", %%mm3 \n\t" "por %%mm2, %%mm3 \n\t" "movq %%mm1, %%mm2 \n\t" "psllq $48, %%mm1 \n\t" "por %%mm1, %%mm3 \n\t" "movq %%mm2, %%mm1 \n\t" "psrld $16, %%mm2 \n\t" "psrlq $24, %%mm1 \n\t" "por %%mm2, %%mm1 \n\t" "mov %4, %%"REG_b" \n\t" "add %%"REG_a", %%"REG_b" \n\t" #ifdef HAVE_MMX2 "movntq %%mm3, (%%"REG_b", %%"REG_a", 2) \n\t" "movntq %%mm1, 8(%%"REG_b", %%"REG_a", 2) \n\t" #else "movd %%mm3, (%%"REG_b", %%"REG_a", 2) \n\t" "psrlq $32, %%mm3 \n\t" "movd %%mm3, 4(%%"REG_b", %%"REG_a", 2) \n\t" "movd %%mm1, 8(%%"REG_b", %%"REG_a", 2) \n\t" #endif "add $4, %%"REG_a" \n\t" "cmp %5, %%"REG_a" \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "m" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%"REG_a, "%"REG_b ); break; case PIX_FMT_BGR555: asm volatile( FULL_YSCALEYUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(g5Dither)", %%mm1 \n\t" "paddusb "MANGLE(r5Dither)", %%mm0 \n\t" "paddusb "MANGLE(b5Dither)", %%mm3 \n\t" #endif "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "psrlw $3, %%mm3 \n\t" "psllw $2, %%mm1 \n\t" "psllw $7, %%mm0 \n\t" "pand "MANGLE(g15Mask)", %%mm1 \n\t" "pand "MANGLE(r15Mask)", %%mm0 \n\t" "por %%mm3, %%mm1 \n\t" "por %%mm1, %%mm0 \n\t" MOVNTQ(%%mm0, (%4, %%REGa, 2)) "add $4, %%"REG_a" \n\t" "cmp %5, %%"REG_a" \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%"REG_a ); break; case PIX_FMT_BGR565: asm volatile( FULL_YSCALEYUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(g6Dither)", %%mm1 \n\t" "paddusb "MANGLE(r5Dither)", %%mm0 \n\t" "paddusb "MANGLE(b5Dither)", %%mm3 \n\t" #endif "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "psrlw $3, %%mm3 \n\t" "psllw $3, %%mm1 \n\t" "psllw $8, %%mm0 \n\t" "pand "MANGLE(g16Mask)", %%mm1 \n\t" "pand "MANGLE(r16Mask)", %%mm0 \n\t" "por %%mm3, %%mm1 \n\t" "por %%mm1, %%mm0 \n\t" MOVNTQ(%%mm0, (%4, %%REGa, 2)) "add $4, %%"REG_a" \n\t" "cmp %5, %%"REG_a" \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%"REG_a ); break; #endif case PIX_FMT_BGR32: #ifndef HAVE_MMX case PIX_FMT_RGB32: #endif if (dstFormat==PIX_FMT_RGB32) { int i; #ifdef WORDS_BIGENDIAN dest++; #endif for (i=0;i<dstW;i++){ int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19); int V=((uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19); dest[0]=clip_table[((Y + yuvtab_40cf[U]) >>13)]; dest[1]=clip_table[((Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13)]; dest[2]=clip_table[((Y + yuvtab_3343[V]) >>13)]; dest+= 4; } } else if (dstFormat==PIX_FMT_BGR24) { int i; for (i=0;i<dstW;i++){ int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19); int V=((uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19); dest[0]=clip_table[((Y + yuvtab_40cf[U]) >>13)]; dest[1]=clip_table[((Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13)]; dest[2]=clip_table[((Y + yuvtab_3343[V]) >>13)]; dest+= 3; } } else if (dstFormat==PIX_FMT_BGR565) { int i; for (i=0;i<dstW;i++){ int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19); int V=((uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19); ((uint16_t*)dest)[i] = clip_table16b[(Y + yuvtab_40cf[U]) >>13] | clip_table16g[(Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13] | clip_table16r[(Y + yuvtab_3343[V]) >>13]; } } else if (dstFormat==PIX_FMT_BGR555) { int i; for (i=0;i<dstW;i++){ int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19); int V=((uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19); ((uint16_t*)dest)[i] = clip_table15b[(Y + yuvtab_40cf[U]) >>13] | clip_table15g[(Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13] | clip_table15r[(Y + yuvtab_3343[V]) >>13]; } } } else { #endif #ifdef HAVE_MMX switch(c->dstFormat) { case PIX_FMT_RGB32: asm volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) WRITEBGR32(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_BGR24: asm volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) WRITEBGR24(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_BGR555: asm volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm2 \n\t" "paddusb "MANGLE(g5Dither)", %%mm4 \n\t" "paddusb "MANGLE(r5Dither)", %%mm5 \n\t" #endif WRITEBGR15(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_BGR565: asm volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm2 \n\t" "paddusb "MANGLE(g6Dither)", %%mm4 \n\t" "paddusb "MANGLE(r5Dither)", %%mm5 \n\t" #endif WRITEBGR16(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; case PIX_FMT_YUYV422: asm volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2PACKED(%%REGBP, %5) WRITEYUY2(%%REGb, 8280(%5), %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest), "a" (&c->redDither) ); return; default: break; } #endif YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB2_C, YSCALE_YUV_2_PACKED2_C) }
1threat
static inline void upmix_mono_to_stereo(AC3DecodeContext *ctx) { int i; float (*output)[256] = ctx->audio_block.block_output; for (i = 0; i < 256; i++) output[2][i] = output[1][i]; }
1threat
Why wont my Excel functions execute? : <p>I am having problems with excel 2013, where none of my functions will execute rather the cell will just present my formula... has any one ran into this problem? it is for all functions</p>
0debug
What is the difference between createMock and getMockBuilder in phpUnit? : <p>For the love of my life I can't figure out the difference between <code>createMock($type)</code> and <code>getMockBuilder($type)</code></p> <p>I am going through the original documentation and there is just a one liner which I didn't understand.</p> <blockquote> <p>... you can use the getMockBuilder($type) method to customize the test double generation using a fluent interface.</p> </blockquote> <p>If you can provide me an example, I would be grateful. Thanks. </p>
0debug
I am unable to click on hyperlink of my web page see below my html plz help me here : <td> <a href="blockedLocalUsers.jsp" target="right">Blocked Local Queues</a> </td>` could you lz provide me the solution here to click on hyperlink using selenium webdriver.
0debug
Angular 2 - Does ngOnDestroy get called on refresh or just when navigate away from component? : <p>I am trying to figure out if ngOnDestroy in Angular 2 gets ran on a refresh or just when someone navigates away from the page?</p>
0debug
Convert String[][] to String[] : <p>I have a <code>String[][]</code> (Double Array) and want it to convert it into a simple <code>String[]</code> (one array). Thanks for any help.</p>
0debug
void tcg_region_init(void) { void *buf = tcg_init_ctx.code_gen_buffer; void *aligned; size_t size = tcg_init_ctx.code_gen_buffer_size; size_t page_size = qemu_real_host_page_size; size_t region_size; size_t n_regions; size_t i; n_regions = 1; aligned = QEMU_ALIGN_PTR_UP(buf, page_size); g_assert(aligned < tcg_init_ctx.code_gen_buffer + size); region_size = (size - (aligned - buf)) / n_regions; region_size = QEMU_ALIGN_DOWN(region_size, page_size); g_assert(region_size >= 2 * page_size); qemu_mutex_init(&region.lock); region.n = n_regions; region.size = region_size - page_size; region.stride = region_size; region.start = buf; region.start_aligned = aligned; region.end = QEMU_ALIGN_PTR_DOWN(buf + size, page_size); region.end -= page_size; for (i = 0; i < region.n; i++) { void *start, *end; int rc; tcg_region_bounds(i, &start, &end); rc = qemu_mprotect_none(end, page_size); g_assert(!rc); } { bool err = tcg_region_initial_alloc__locked(tcg_ctx); g_assert(!err); } }
1threat
how to add a number to the array using php : i have an array and remainder is 4, how to add this number to the array. Help me to split this one. Array ( [2] => 6 [3] => 6 [5] => 6 [6] => 6 [7] => 6 [9] => 6 ) Array ( [2] => 6+1 [3] => 6+1 [5] => 6+1 [6] => 6+1 [7] => 6+0 [9] => 6+0 )
0debug
static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, const char *name, int devfn, PCIConfigReadFunc *config_read, PCIConfigWriteFunc *config_write, uint8_t header_type) { if (devfn < 0) { for(devfn = bus->devfn_min ; devfn < 256; devfn += 8) { if (!bus->devices[devfn]) goto found; } return NULL; found: ; } else if (bus->devices[devfn]) { return NULL; } pci_dev->bus = bus; pci_dev->devfn = devfn; pstrcpy(pci_dev->name, sizeof(pci_dev->name), name); memset(pci_dev->irq_state, 0, sizeof(pci_dev->irq_state)); pci_config_alloc(pci_dev); header_type &= ~PCI_HEADER_TYPE_MULTI_FUNCTION; if (header_type == PCI_HEADER_TYPE_NORMAL) { pci_set_default_subsystem_id(pci_dev); } pci_init_cmask(pci_dev); pci_init_wmask(pci_dev); if (header_type == PCI_HEADER_TYPE_BRIDGE) { pci_init_wmask_bridge(pci_dev); } if (!config_read) config_read = pci_default_read_config; if (!config_write) config_write = pci_default_write_config; pci_dev->config_read = config_read; pci_dev->config_write = config_write; bus->devices[devfn] = pci_dev; pci_dev->irq = qemu_allocate_irqs(pci_set_irq, pci_dev, PCI_NUM_PINS); pci_dev->version_id = 2; return pci_dev; }
1threat
How can this work? : <p>I know this code doesn't work. I want to pass $var1, $var2, and name to next.php. How can I do that?</p> <pre><code>&lt;?php $var1="test1"; $var2="test2"; ?&gt; &lt;form method="get"&gt; &lt;input type="text" name="name"&gt; &lt;a &lt;?php echo "href='next.php?test1=".$var1."&amp;test2=".$var2."'"?&gt; &gt;next&lt;/a&gt; &lt;/form&gt; </code></pre> <p>in next.php</p> <pre><code>$var1=$_GET['name']; $var2=$_GET['test1']; $var3=$_GET['test2']; </code></pre>
0debug
static void pmsav5_data_ap_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { env->cp15.c5_data = extended_mpu_ap_bits(value); }
1threat
where can i find the actual code for Java's Lib : <p>Hello guys im looking to learn more about Java specifically where is the actual code located on my computer when we compile code like in my case PROCESSING IDE and export the compiled sketch I get an executable file/program and the code looks very different from the actual code i wrote and altho i know why i dont know what those other libraries look like in code and i think me reading it will learn how to write better code and move out from Processing's ide into a much better ide.</p> <pre><code>import processing.core.*; import processing.data.*; import processing.event.*; import processing.opengl.*; import muthesius.net.*; import org.webbitserver.*; import guru.ttslib.*; //this particular one is for voice? how can i change this to use other speech?? import java.util.HashMap; import java.util.ArrayList; import java.io.File; import java.io.BufferedReader; import java.io.PrintWriter; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; </code></pre> <p>the libraries above were part of my exported sketch and i want to know where i can find these in my pc and actually dive in and go over how some of this functions were written.</p> <p>thanks for your pointers.</p>
0debug
When i click menu item it should show me all the items related to it in next page.how to do that ? : I want to display all my Items related to menu in next page.For example i have 3 menus (Engineering,Medical,Programming).and when i click at programming it should show all books related to programming in next page. Please help how to do it? <ul class="nav navbar-nav navbar-right"> <?php $res=$dbcon->query("SELECT * FROM users"); while($row=$res->fetch_array()) { ?> <li><a href="pages.php"><?php echo $row['first_name']; ?></a></li> <?php } ?> </ul>
0debug
MongoDB 3.6.2 2008R2 Plus Not Installing : <p>I'm trying to install MongoDb 3.6.2 2008R2 plus on my 64bit Window 10 (build no 1709) but the setup after some time says "setup wizard ended prematurely because of an error.your system has not been modified.To. Install this program at a later time run setup wizard again.click finish button to exit the setup." Any one know any fix regarding this issue?</p>
0debug
how to print datagidview using crystal report in asp.net c# : I would like to know if exists the way to send a crystal report directly to the printer without print dialog. Ex. I have an asp.net page with a crystal report viewer and I want send to print once the report have been loaded into the viewer.
0debug
How to validate textbox input based on combobox selection : <p>I have a <code>ComboBox</code> and a <code>TextBox</code>. The ComboBox items are Int,float,char, ect..</p> <p>I need to validate:</p> <ul> <li>TextBox contains only digits if the ComboBox selection is Int </li> <li>TextBox contains letters if the ComboBox selection is char</li> <li>And so on...</li> </ul> <p>any idea ?</p>
0debug
document.write('<script src="evil.js"></script>');
1threat
document.write('<script src="evil.js"></script>');
1threat
How to show the Linux command line on 1 row? : <p>I discovered that on Mac the BASH command line is a bit different shown than on my Linux. I'd like to have my appearance on Linux as is on Mac.</p> <p>This is as currently on my Linux:</p> <pre><code>namename@machine::home/username $ </code></pre> <p>I'd like to have it someting like this (and that kind of corresponds to the Mac appearance, at least for the 'all on 1 row'):</p> <pre><code>namename@machine::home/username$ </code></pre> <p>I quess it is possible, but how do I accomplish that? Actually I'm using PuTTy 2011-07-19:r9232 b.t.w.</p>
0debug
void sdl_display_init(DisplayState *ds, int full_screen, int no_frame) { int flags; uint8_t data = 0; #if defined(__APPLE__) if (!keyboard_layout) keyboard_layout = "en-us"; #endif if(keyboard_layout) { kbd_layout = init_keyboard_layout(keyboard_layout); if (!kbd_layout) exit(1); } if (no_frame) gui_noframe = 1; flags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE; if (SDL_Init (flags)) { fprintf(stderr, "Could not initialize SDL - exiting\n"); exit(1); } #ifndef _WIN32 signal(SIGINT, SIG_DFL); signal(SIGQUIT, SIG_DFL); #endif ds->dpy_update = sdl_update; ds->dpy_resize = sdl_resize; ds->dpy_refresh = sdl_refresh; ds->dpy_fill = sdl_fill; ds->mouse_set = sdl_mouse_warp; ds->cursor_define = sdl_mouse_define; sdl_resize(ds, 640, 400); sdl_update_caption(); SDL_EnableKeyRepeat(250, 50); gui_grab = 0; sdl_cursor_hidden = SDL_CreateCursor(&data, &data, 8, 1, 0, 0); sdl_cursor_normal = SDL_GetCursor(); atexit(sdl_cleanup); if (full_screen) { gui_fullscreen = 1; gui_fullscreen_initial_grab = 1; sdl_grab_start(); } }
1threat
MySQL - Table 'my_table' was not locked with Lock Tables : <p>I try and load tables via MySQL and get the following error?</p> <blockquote> <p>MySQL said: Table 'cms' was not locked with LOCK TABLES</p> </blockquote> <p>Why does the table need to be Locked? I haven't seen this before? is there any way to unlock? do you even want to?</p>
0debug
Mysql, How do I clone existing rows into same table with continue id(not null) : Mysql, How do I clone existing rows into same table with continue id(not null). Example table like this. Fruit : - ---------------------------------- id | name | color | cc | ---------------------------------- 1 | Apple | red | 111 | 2 | Banano | yellow | 111 | 3 | Melon | Green | 111 | to new (same table):- Fruit : - ---------------------------------- id | name | color | cc | ---------------------------------- 1 | Apple | red | 111 | 2 | Banana | yellow | 111 | 3 | Melon | Green | 111 | 4 | Apple | red | 222 | 5 | Banana | yellow | 222 | 6 | Melon | Green | 222 | 7 | Apple | red | 333 | 8 | Banana | yellow | 333 | 9 | Melon | Green | 333 | Thanks.
0debug
static unsigned int PerformComparison(const unsigned int opcode) { FPA11 *fpa11 = GET_FPA11(); unsigned int Fn, Fm; floatx80 rFn, rFm; int e_flag = opcode & 0x400000; int n_flag = opcode & 0x200000; unsigned int flags = 0; Fn = getFn(opcode); Fm = getFm(opcode); switch (fpa11->fType[Fn]) { case typeSingle: if (float32_is_nan(fpa11->fpreg[Fn].fSingle)) goto unordered; rFn = float32_to_floatx80(fpa11->fpreg[Fn].fSingle, &fpa11->fp_status); break; case typeDouble: if (float64_is_nan(fpa11->fpreg[Fn].fDouble)) goto unordered; rFn = float64_to_floatx80(fpa11->fpreg[Fn].fDouble, &fpa11->fp_status); break; case typeExtended: if (floatx80_is_nan(fpa11->fpreg[Fn].fExtended)) goto unordered; rFn = fpa11->fpreg[Fn].fExtended; break; default: return 0; } if (CONSTANT_FM(opcode)) { rFm = getExtendedConstant(Fm); if (floatx80_is_nan(rFm)) goto unordered; } else { switch (fpa11->fType[Fm]) { case typeSingle: if (float32_is_nan(fpa11->fpreg[Fm].fSingle)) goto unordered; rFm = float32_to_floatx80(fpa11->fpreg[Fm].fSingle, &fpa11->fp_status); break; case typeDouble: if (float64_is_nan(fpa11->fpreg[Fm].fDouble)) goto unordered; rFm = float64_to_floatx80(fpa11->fpreg[Fm].fDouble, &fpa11->fp_status); break; case typeExtended: if (floatx80_is_nan(fpa11->fpreg[Fm].fExtended)) goto unordered; rFm = fpa11->fpreg[Fm].fExtended; break; default: return 0; } } if (n_flag) { rFm.high ^= 0x8000; } return PerformComparisonOperation(rFn,rFm); unordered: flags |= CC_OVERFLOW; flags &= ~(CC_ZERO | CC_NEGATIVE); if (BIT_AC & readFPSR()) flags |= CC_CARRY; if (e_flag) float_raise(float_flag_invalid, &fpa11->fp_status); writeConditionCodes(flags); return 1; }
1threat
static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, void *last, void *dst, int last2, int w, int stride, int comp, int bits) { int i, x = 0; int Ra, Rb, Rc, Rd; int D0, D1, D2; while (x < w) { int err, pred; Ra = x ? R(dst, x - stride) : R(last, x); Rb = R(last, x); Rc = x ? R(last, x - stride) : last2; Rd = (x >= w - stride) ? R(last, x) : R(last, x + stride); D0 = Rd - Rb; D1 = Rb - Rc; D2 = Rc - Ra; if ((FFABS(D0) <= state->near) && (FFABS(D1) <= state->near) && (FFABS(D2) <= state->near)) { int r; int RItype; while (get_bits1(&s->gb)) { int r; r = 1 << ff_log2_run[state->run_index[comp]]; if (x + r * stride > w) r = (w - x) / stride; for (i = 0; i < r; i++) { W(dst, x, Ra); x += stride; } if (r != 1 << ff_log2_run[state->run_index[comp]]) return; if (state->run_index[comp] < 31) state->run_index[comp]++; if (x + stride > w) return; } r = ff_log2_run[state->run_index[comp]]; if (r) r = get_bits_long(&s->gb, r); if (x + r * stride > w) { r = (w - x) / stride; } for (i = 0; i < r; i++) { W(dst, x, Ra); x += stride; } if (x >= w) { av_log(NULL, AV_LOG_ERROR, "run overflow\n"); return; } Rb = R(last, x); RItype = (FFABS(Ra - Rb) <= state->near) ? 1 : 0; err = ls_get_code_runterm(&s->gb, state, RItype, ff_log2_run[state->run_index[comp]]); if (state->run_index[comp]) state->run_index[comp]--; if (state->near && RItype) { pred = Ra + err; } else { if (Rb < Ra) pred = Rb - err; else pred = Rb + err; } } else { int context, sign; context = ff_jpegls_quantize(state, D0) * 81 + ff_jpegls_quantize(state, D1) * 9 + ff_jpegls_quantize(state, D2); pred = mid_pred(Ra, Ra + Rb - Rc, Rb); if (context < 0) { context = -context; sign = 1; } else { sign = 0; } if (sign) { pred = av_clip(pred - state->C[context], 0, state->maxval); err = -ls_get_code_regular(&s->gb, state, context); } else { pred = av_clip(pred + state->C[context], 0, state->maxval); err = ls_get_code_regular(&s->gb, state, context); } pred += err; } if (state->near) { if (pred < -state->near) pred += state->range * state->twonear; else if (pred > state->maxval + state->near) pred -= state->range * state->twonear; pred = av_clip(pred, 0, state->maxval); } pred &= state->maxval; W(dst, x, pred); x += stride; } }
1threat
static int decode_header(EXRContext *s) { int magic_number, version, i, flags, sar = 0; int layer_match = 0; s->current_channel_offset = 0; s->xmin = ~0; s->xmax = ~0; s->ymin = ~0; s->ymax = ~0; s->xdelta = ~0; s->ydelta = ~0; s->channel_offsets[0] = -1; s->channel_offsets[1] = -1; s->channel_offsets[2] = -1; s->channel_offsets[3] = -1; s->pixel_type = EXR_UNKNOWN; s->compression = EXR_UNKN; s->nb_channels = 0; s->w = 0; s->h = 0; s->tile_attr.xSize = -1; s->tile_attr.ySize = -1; s->is_tile = 0; s->is_luma = 0; if (bytestream2_get_bytes_left(&s->gb) < 10) { av_log(s->avctx, AV_LOG_ERROR, "Header too short to parse.\n"); return AVERROR_INVALIDDATA; } magic_number = bytestream2_get_le32(&s->gb); if (magic_number != 20000630) { av_log(s->avctx, AV_LOG_ERROR, "Wrong magic number %d.\n", magic_number); return AVERROR_INVALIDDATA; } version = bytestream2_get_byte(&s->gb); if (version != 2) { avpriv_report_missing_feature(s->avctx, "Version %d", version); return AVERROR_PATCHWELCOME; } flags = bytestream2_get_le24(&s->gb); if (flags == 0x00) s->is_tile = 0; else if (flags & 0x02) s->is_tile = 1; else{ avpriv_report_missing_feature(s->avctx, "flags %d", flags); return AVERROR_PATCHWELCOME; } while (bytestream2_get_bytes_left(&s->gb) > 0 && *s->gb.buffer) { int var_size; if ((var_size = check_header_variable(s, "channels", "chlist", 38)) >= 0) { GetByteContext ch_gb; if (!var_size) return AVERROR_INVALIDDATA; bytestream2_init(&ch_gb, s->gb.buffer, var_size); while (bytestream2_get_bytes_left(&ch_gb) >= 19) { EXRChannel *channel; enum ExrPixelType current_pixel_type; int channel_index = -1; int xsub, ysub; if (strcmp(s->layer, "") != 0) { if (strncmp(ch_gb.buffer, s->layer, strlen(s->layer)) == 0) { layer_match = 1; av_log(s->avctx, AV_LOG_INFO, "Channel match layer : %s.\n", ch_gb.buffer); ch_gb.buffer += strlen(s->layer); if (*ch_gb.buffer == '.') ch_gb.buffer++; } else { av_log(s->avctx, AV_LOG_INFO, "Channel doesn't match layer : %s.\n", ch_gb.buffer); } } else { layer_match = 1; } if (layer_match) { if (!strcmp(ch_gb.buffer, "R") || !strcmp(ch_gb.buffer, "X") || !strcmp(ch_gb.buffer, "U")) { channel_index = 0; s->is_luma = 0; } else if (!strcmp(ch_gb.buffer, "G") || !strcmp(ch_gb.buffer, "V")) { channel_index = 1; s->is_luma = 0; } else if (!strcmp(ch_gb.buffer, "Y")) { channel_index = 1; s->is_luma = 1; } else if (!strcmp(ch_gb.buffer, "B") || !strcmp(ch_gb.buffer, "Z") || !strcmp(ch_gb.buffer, "W")){ channel_index = 2; s->is_luma = 0; } else if (!strcmp(ch_gb.buffer, "A")) { channel_index = 3; } else { av_log(s->avctx, AV_LOG_WARNING, "Unsupported channel %.256s.\n", ch_gb.buffer); } } while (bytestream2_get_bytes_left(&ch_gb) > 0 && bytestream2_get_byte(&ch_gb)) continue; if (bytestream2_get_bytes_left(&ch_gb) < 4) { av_log(s->avctx, AV_LOG_ERROR, "Incomplete header.\n"); return AVERROR_INVALIDDATA; } current_pixel_type = bytestream2_get_le32(&ch_gb); if (current_pixel_type >= EXR_UNKNOWN) { avpriv_report_missing_feature(s->avctx, "Pixel type %d", current_pixel_type); return AVERROR_PATCHWELCOME; } bytestream2_skip(&ch_gb, 4); xsub = bytestream2_get_le32(&ch_gb); ysub = bytestream2_get_le32(&ch_gb); if (xsub != 1 || ysub != 1) { avpriv_report_missing_feature(s->avctx, "Subsampling %dx%d", xsub, ysub); return AVERROR_PATCHWELCOME; } if (s->channel_offsets[channel_index] == -1){ if (channel_index >= 0) { if (s->pixel_type != EXR_UNKNOWN && s->pixel_type != current_pixel_type) { av_log(s->avctx, AV_LOG_ERROR, "RGB channels not of the same depth.\n"); return AVERROR_INVALIDDATA; } s->pixel_type = current_pixel_type; s->channel_offsets[channel_index] = s->current_channel_offset; } } s->channels = av_realloc(s->channels, ++s->nb_channels * sizeof(EXRChannel)); if (!s->channels) return AVERROR(ENOMEM); channel = &s->channels[s->nb_channels - 1]; channel->pixel_type = current_pixel_type; channel->xsub = xsub; channel->ysub = ysub; s->current_channel_offset += 1 << current_pixel_type; } if (!s->is_luma){ if (FFMIN3(s->channel_offsets[0], s->channel_offsets[1], s->channel_offsets[2]) < 0) { if (s->channel_offsets[0] < 0) av_log(s->avctx, AV_LOG_ERROR, "Missing red channel.\n"); if (s->channel_offsets[1] < 0) av_log(s->avctx, AV_LOG_ERROR, "Missing green channel.\n"); if (s->channel_offsets[2] < 0) av_log(s->avctx, AV_LOG_ERROR, "Missing blue channel.\n"); return AVERROR_INVALIDDATA; } } s->gb.buffer = ch_gb.buffer + 1; continue; } else if ((var_size = check_header_variable(s, "dataWindow", "box2i", 31)) >= 0) { if (!var_size) return AVERROR_INVALIDDATA; s->xmin = bytestream2_get_le32(&s->gb); s->ymin = bytestream2_get_le32(&s->gb); s->xmax = bytestream2_get_le32(&s->gb); s->ymax = bytestream2_get_le32(&s->gb); s->xdelta = (s->xmax - s->xmin) + 1; s->ydelta = (s->ymax - s->ymin) + 1; continue; } else if ((var_size = check_header_variable(s, "displayWindow", "box2i", 34)) >= 0) { if (!var_size) return AVERROR_INVALIDDATA; bytestream2_skip(&s->gb, 8); s->w = bytestream2_get_le32(&s->gb) + 1; s->h = bytestream2_get_le32(&s->gb) + 1; continue; } else if ((var_size = check_header_variable(s, "lineOrder", "lineOrder", 25)) >= 0) { int line_order; if (!var_size) return AVERROR_INVALIDDATA; line_order = bytestream2_get_byte(&s->gb); av_log(s->avctx, AV_LOG_DEBUG, "line order: %d.\n", line_order); if (line_order > 2) { av_log(s->avctx, AV_LOG_ERROR, "Unknown line order.\n"); return AVERROR_INVALIDDATA; } continue; } else if ((var_size = check_header_variable(s, "pixelAspectRatio", "float", 31)) >= 0) { if (!var_size) return AVERROR_INVALIDDATA; sar = bytestream2_get_le32(&s->gb); continue; } else if ((var_size = check_header_variable(s, "compression", "compression", 29)) >= 0) { if (!var_size) return AVERROR_INVALIDDATA; if (s->compression == EXR_UNKN) s->compression = bytestream2_get_byte(&s->gb); else av_log(s->avctx, AV_LOG_WARNING, "Found more than one compression attribute.\n"); continue; } else if ((var_size = check_header_variable(s, "tiles", "tiledesc", 22)) >= 0) { char tileLevel; if (!s->is_tile) av_log(s->avctx, AV_LOG_WARNING, "Found tile attribute and scanline flags. Exr will be interpreted as scanline.\n"); s->tile_attr.xSize = bytestream2_get_le32(&s->gb); s->tile_attr.ySize = bytestream2_get_le32(&s->gb); tileLevel = bytestream2_get_byte(&s->gb); s->tile_attr.level_mode = tileLevel & 0x0f; s->tile_attr.level_round = (tileLevel >> 4) & 0x0f; if (s->tile_attr.level_mode >= EXR_TILE_LEVEL_UNKNOWN){ avpriv_report_missing_feature(s->avctx, "Tile level mode %d", s->tile_attr.level_mode); return AVERROR_PATCHWELCOME; } if (s->tile_attr.level_round >= EXR_TILE_ROUND_UNKNOWN) { avpriv_report_missing_feature(s->avctx, "Tile level round %d", s->tile_attr.level_round); return AVERROR_PATCHWELCOME; } continue; } if (bytestream2_get_bytes_left(&s->gb) <= 9) { av_log(s->avctx, AV_LOG_ERROR, "Incomplete header\n"); return AVERROR_INVALIDDATA; } for (i = 0; i < 2; i++) while (bytestream2_get_byte(&s->gb) != 0); bytestream2_skip(&s->gb, bytestream2_get_le32(&s->gb)); } ff_set_sar(s->avctx, av_d2q(av_int2float(sar), 255)); if (s->compression == EXR_UNKN) { av_log(s->avctx, AV_LOG_ERROR, "Missing compression attribute.\n"); return AVERROR_INVALIDDATA; } if (s->is_tile) { if (s->tile_attr.xSize < 1 || s->tile_attr.ySize < 1) { av_log(s->avctx, AV_LOG_ERROR, "Invalid tile attribute.\n"); return AVERROR_INVALIDDATA; } } if (bytestream2_get_bytes_left(&s->gb) <= 0) { av_log(s->avctx, AV_LOG_ERROR, "Incomplete frame.\n"); return AVERROR_INVALIDDATA; } bytestream2_skip(&s->gb, 1); return 0; }
1threat
How can I make a FloatTensor with requires_grad=True from a numpy array using PyTorch 0.4.0? : <p>Pytorch 0.4.0 introduced the merging on the Tensor and Variable classes. </p> <p>Before this version, when I wanted to create a <code>Variable</code> with autograd from a numpy array I would do the following (where <code>x</code> is a numpy array):</p> <pre><code>x = Variable(torch.from_numpy(x).float(), requires_grad=True) </code></pre> <p>With PyTorch version 0.4.0, <a href="http://pytorch.org/2018/04/22/0_4_0-migration-guide.html" rel="noreferrer">the migration guide</a> shows how we can create Tensors with autograd enabled, examples show you can do things such as </p> <pre><code>x = torch.ones(3, 4, requires_grad=True) </code></pre> <p>and also set <code>requires_grad</code> to existing tensors</p> <pre><code>existing_tensor.requires_grad_() </code></pre> <p>I have tried the following three things to try and create a Tensor with <code>requires_grad=True</code> which give errors (where <code>x</code> is a numpy array):</p> <p>The first is </p> <pre><code>x = FloatTensor(x, requires_grad=True) </code></pre> <p>which gives the error</p> <pre><code>TypeError: new() received an invalid combination of arguments - got (numpy.ndarray, requires_grad=bool), but expected one of: * (torch.device device) * (tuple of ints size, torch.device device) didn't match because some of the keywords were incorrect: requires_grad * (torch.Storage storage) * (Tensor other) * (object data, torch.device device) didn't match because some of the keywords were incorrect: requires_grad </code></pre> <p>The second is to do</p> <pre><code>x = FloatTensor(x) x.requires_grad() </code></pre> <p>And the third is </p> <pre><code>x = torch.from_numpy(x).single() x.requires_grad() </code></pre> <p>Which both throw the following error on the second line:</p> <pre><code>TypeError: 'bool' object is not callable </code></pre> <p>These errors give me little hint at what I'm doing wrong, and since the latest version is so new its hard to find content online to help. How can I make a <code>FloatTensor</code> with <code>requires_grad=True</code> from a numpy array using PyTorch 0.4.0, preferably in a single line?</p>
0debug
static void nvdimm_realize(PCDIMMDevice *dimm, Error **errp) { MemoryRegion *mr = host_memory_backend_get_memory(dimm->hostmem, errp); NVDIMMDevice *nvdimm = NVDIMM(dimm); uint64_t align, pmem_size, size = memory_region_size(mr); align = memory_region_get_alignment(mr); pmem_size = size - nvdimm->label_size; nvdimm->label_data = memory_region_get_ram_ptr(mr) + pmem_size; pmem_size = QEMU_ALIGN_DOWN(pmem_size, align); if (size <= nvdimm->label_size || !pmem_size) { HostMemoryBackend *hostmem = dimm->hostmem; char *path = object_get_canonical_path_component(OBJECT(hostmem)); error_setg(errp, "the size of memdev %s (0x%" PRIx64 ") is too " "small to contain nvdimm label (0x%" PRIx64 ") and " "aligned PMEM (0x%" PRIx64 ")", path, memory_region_size(mr), nvdimm->label_size, align); return; } memory_region_init_alias(&nvdimm->nvdimm_mr, OBJECT(dimm), "nvdimm-memory", mr, 0, pmem_size); nvdimm->nvdimm_mr.align = align; }
1threat
static inline int check_for_slice(AVSContext *h) { GetBitContext *gb = &h->s.gb; int align; if(h->mbx) return 0; align = (-get_bits_count(gb)) & 7; if(!align && (show_bits(gb,8) == 0x80)) get_bits(gb,8); if((show_bits_long(gb,24+align) & 0xFFFFFF) == 0x000001) { skip_bits_long(gb,24+align); h->stc = get_bits(gb,8); decode_slice_header(h,gb); return 1; } return 0; }
1threat
Geting all the selected nodes in jstree on check event? : <p>I'm using get_bottom_selected to get all the checked/selected nodes in JSTree. When I setup a button in my form that calls the following method it works. When I try to call the same function from check box click event it does not find any selected nodes, even if there are some.</p> <pre><code>function testit() { var data = $('#my_tree').jstree(true).get_bottom_selected(true); for(var count = 0; count &lt; data.length; count++){ // Do Stuff } } </code></pre> <p>When the following event fires I want to call the function and get all the selected child nodes, but it does not work. Is there something specific to do on this event that works different than calling from a button click event?</p> <pre><code>.on("check_node.jstree uncheck_node.jstree", function(e, data) { testit(); // first line of this function does not get any selected data, even if several are selected. When called from a button click event in my form it does work. }); </code></pre> <p>Here's how I currently have my jstree setup.</p> <pre><code>$('#my_tree') .on("changed.jstree", function (e, data) { // Do Stuff }) .jstree({ checkbox: { "keep_selected_style": false, "visible" : true, "three_state": true, "whole_node" : true, }, plugins: ['checkbox'], 'core' : { 'multiple' : true, 'data' : { "url" : "/static/content_data.json", "dataType" : "json" } } }) .on("check_node.jstree uncheck_node.jstree", function(e, data) { testit(); }); </code></pre>
0debug
Swift Tap Gesture Recognizer doesn't work : <p>override func viewDidLoad() {</p> <pre><code> super.viewDidLoad() imageView.isUserInteractionEnabled = true let gestureRecognizer = UIGestureRecognizer(target: self, action: #selector(chooseImage)) imageView.addGestureRecognizer(gestureRecognizer) } @objc func chooseImage() { let pickerController = UIImagePickerController() pickerController.delegate = self pickerController.sourceType = .photoLibrary present(pickerController,animated: true,completion: nil) } func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { imageView.image = info[.originalImage] as? UIImage self.dismiss(animated: true, completion: nil) } </code></pre> <p>Tap gesture recognizer doesn't work on simulator.I created a photo called select an image but I can't click on it to go through my photo library</p>
0debug
IS "this" is only a local variable(reference) in java? : I have read recently that "this" is a local variable which contain a reference ID of the current object and can be used inside in any instance function. But when i explicitly declare "this" as in int argument i am getting compile time error stated: "the receiver type doesn't match the enclosing class type". class ThisDemo { void show(int this) { System.out.println(this); } } class ThisDemo1 { public static void main(String... s) { ThisDemo a=new ThisDemo(); int x=10; a.show(x); } }
0debug
static void gen_spr_440 (CPUPPCState *env) { spr_register(env, SPR_440_DNV0, "DNV0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_440_DNV1, "DNV1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_440_DNV2, "DNV2", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_440_DNV3, "DNV3", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_440_DVT0, "DVT0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_440_DVT1, "DVT1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_440_DVT2, "DVT2", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_440_DVT3, "DVT3", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_440_DVLIM, "DVLIM", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_440_INV0, "INV0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_440_INV1, "INV1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_440_INV2, "INV2", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_440_INV3, "INV3", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_440_IVT0, "IVT0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_440_IVT1, "IVT1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_440_IVT2, "IVT2", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_440_IVT3, "IVT3", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_440_IVLIM, "IVLIM", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_BOOKE_DCBTRH, "DCBTRH", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, 0x00000000); spr_register(env, SPR_BOOKE_DCBTRL, "DCBTRL", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, 0x00000000); spr_register(env, SPR_BOOKE_ICBDR, "ICBDR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, 0x00000000); spr_register(env, SPR_BOOKE_ICBTRH, "ICBTRH", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, 0x00000000); spr_register(env, SPR_BOOKE_ICBTRL, "ICBTRL", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, 0x00000000); spr_register(env, SPR_440_DBDR, "DBDR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_4xx_CCR0, "CCR0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_440_RSTCFG, "RSTCFG", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, 0x00000000); spr_register(env, SPR_440_MMUCR, "MMUCR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); }
1threat
What is a DOMString really? : <p>I came across <code>DOMString</code> while reading the <a href="https://html.spec.whatwg.org/" rel="noreferrer">HTML spec</a>. On some research, found the following data regarding it:</p> <p>From <a href="https://developer.mozilla.org/en/docs/Web/API/DOMString" rel="noreferrer">MDN</a>: </p> <blockquote> <p>DOMString is a UTF-16 String. As JavaScript already uses such strings, DOMString is mapped directly to a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String" rel="noreferrer">String</a>.</p> </blockquote> <p>From <a href="https://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString" rel="noreferrer">W3C spec</a>:</p> <blockquote> <p>A <a href="https://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString" rel="noreferrer">DOMString</a> is a sequence of <a href="https://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-16-bit-unit" rel="noreferrer">16-bit units</a>.</p> </blockquote> <p>But I still have the following questions:</p> <ol> <li>What is a <code>DOMString</code> actually and what is it used for?</li> <li>Why is it named as <strong>DOM</strong>String and not <strong>UTF16</strong>String? More specifically, how does it relate to DOM?</li> <li>If I UTF-16 encode a <code>String</code>, does it become a <code>DOMString</code>?</li> </ol>
0debug
Scope email issue on google login codeigniter : <p>Sorry, I am repeating my question again because I don't get any answer but I hope today I will. Now, I have created google login using CodeIgniter which is working fine it takes me on login page when I click on <code>Google image</code> after filling up all details when I click on next button then it takes me out from google login to my website and URL look likes </p> <p><code>https://example.com/google_login?code=4/lQDGQ6sJog3ZrLKGJtn-VVD3rbzgJl16jMLUrk6wzBIbsu-F6mjlLuPOepeobDLmFYqQL25jo4iAgI9ZnVKTSVY&amp;scope=email%20profile%20https://www.googleapis.com/auth/userinfo.email%20https://www.googleapis.com/auth/userinfo.profile</code></p> <p>which show me 404 error but if I remove </p> <p><code>&amp;scope=email%20profile%20https://www.googleapis.com/auth/userinfo.email%20https://www.googleapis.com/auth/userinfo.profile</code> from URL then it shows me all information of clients.</p> <p>Please help me</p> <p>Thank You</p>
0debug
static int append_extradata(APNGDemuxContext *ctx, AVIOContext *pb, int len) { int previous_size = ctx->extra_data_size; int new_size, ret; uint8_t *new_extradata; if (previous_size > INT_MAX - len) return AVERROR_INVALIDDATA; new_size = previous_size + len; new_extradata = av_realloc(ctx->extra_data, new_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!new_extradata) return AVERROR(ENOMEM); ctx->extra_data = new_extradata; ctx->extra_data_size = new_size; if ((ret = avio_read(pb, ctx->extra_data + previous_size, len)) < 0) return ret; return previous_size; }
1threat
static int dvbsub_parse_clut_segment(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { DVBSubContext *ctx = avctx->priv_data; const uint8_t *buf_end = buf + buf_size; int i, clut_id; int version; DVBSubCLUT *clut; int entry_id, depth , full_range; int y, cr, cb, alpha; int r, g, b, r_add, g_add, b_add; ff_dlog(avctx, "DVB clut packet:\n"); for (i=0; i < buf_size; i++) { ff_dlog(avctx, "%02x ", buf[i]); if (i % 16 == 15) ff_dlog(avctx, "\n"); } if (i % 16) ff_dlog(avctx, "\n"); clut_id = *buf++; version = ((*buf)>>4)&15; buf += 1; clut = get_clut(ctx, clut_id); if (!clut) { clut = av_malloc(sizeof(DVBSubCLUT)); if (!clut) return AVERROR(ENOMEM); memcpy(clut, &default_clut, sizeof(DVBSubCLUT)); clut->id = clut_id; clut->version = -1; clut->next = ctx->clut_list; ctx->clut_list = clut; } if (clut->version != version) { clut->version = version; while (buf + 4 < buf_end) { entry_id = *buf++; depth = (*buf) & 0xe0; if (depth == 0) { av_log(avctx, AV_LOG_ERROR, "Invalid clut depth 0x%x!\n", *buf); return 0; } full_range = (*buf++) & 1; if (full_range) { y = *buf++; cr = *buf++; cb = *buf++; alpha = *buf++; } else { y = buf[0] & 0xfc; cr = (((buf[0] & 3) << 2) | ((buf[1] >> 6) & 3)) << 4; cb = (buf[1] << 2) & 0xf0; alpha = (buf[1] << 6) & 0xc0; buf += 2; } if (y == 0) alpha = 0xff; YUV_TO_RGB1_CCIR(cb, cr); YUV_TO_RGB2_CCIR(r, g, b, y); ff_dlog(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha); if (!!(depth & 0x80) + !!(depth & 0x40) + !!(depth & 0x20) > 1) { ff_dlog(avctx, "More than one bit level marked: %x\n", depth); if (avctx->strict_std_compliance > FF_COMPLIANCE_NORMAL) return AVERROR_INVALIDDATA; } if (depth & 0x80) clut->clut4[entry_id] = RGBA(r,g,b,255 - alpha); else if (depth & 0x40) clut->clut16[entry_id] = RGBA(r,g,b,255 - alpha); else if (depth & 0x20) clut->clut256[entry_id] = RGBA(r,g,b,255 - alpha); } } return 0; }
1threat
Received push notification : How to open activity when get notification.I already did when we click notification it will open activity.But Now I want when i get push notification from firebase it automatically open my activity.(Without user interaction)
0debug
char *qemu_strdup(const char *str) { char *ptr; size_t len = strlen(str); ptr = qemu_malloc(len + 1); if (!ptr) return NULL; pstrcpy(ptr, len + 1, str); return ptr; }
1threat
ValueError: Attempted relative import in non-package not for tests package : <p>I know this has been asked many times but somehow I am not able to get over this error. Here is my directory structure-</p> <pre><code>project/ pkg/ __init__.py subpackage1/ script1.py __init__.py subpackage2/ script2.py __init__.py </code></pre> <p>script2.py has:</p> <pre><code>class myclass: def myfunction: </code></pre> <p>script1.py has</p> <pre><code> from ..subpackage2 import script2 </code></pre> <p>I also tried</p> <pre><code>from ..subpackage2 import myclass </code></pre> <p>And this gives me : ValueError: Attempted relative import in non-package</p> <p>Any help would be really appreciated. </p>
0debug
Reading and displaying a file in Cobol : I am creating a program that is reading in a file which consists of companies and their information. I am new to Cobol so I am having some trouble trying to find where my problem is. So far the program is compiling but the output file is showing the headings and the title with only $00.00, 000, 0.0 for the quote, number of items and the rating. It is not printing the name, number and all the other info including the quote, number of items and the rating. Any ideas on what could be going on? It is supposed to read all the records in my file then display them all, then it is to display the highest quote and the lowest rate and then the avgerage information. IDENTIFICATION DIVISION. PROGRAM-ID. MOVING-QUOTES. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT MOVING-QUOTES-FILE ASSIGN TO 'Moving-Quotes.txt' ORGANIZATION IS LINE SEQUENTIAL. SELECT MOVING-QUOTES-RESULTS-FILE ASSIGN TO "MOVING.TXT" ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. FILE SECTION. FD MOVING-QUOTES-FILE. 01 FS-MOVING-QUOTES-RECORD PIC X(45). FD MOVING-QUOTES-RESULTS-FILE. 01 MOVING-QUOTES-RESULTS-RECORD PIC X(80). WORKING-STORAGE SECTION. 01 WS-MOVING-QUOTES-RECORD. 05 FILLER PIC X(2). 05 MQR-COMPANY-NAME PIC X(15). 05 FILLER PIC X(1). 05 MQR-COMPANY-PHONE PIC X(13). 05 FILLER PIC X(1). 05 MQR-MOVING-QUOTE PIC 9999V99. 05 FILLER PIC X(1). 05 MQR-NUMBER-ITEMS PIC 999. 05 FILLER PIC X(1). 05 MQR-RATING PIC 9V9. 01 PRT-MOVING-QUOTES-FILE. 05 FILLER PIC X(2). 05 PRT-MQR-COMPANY-NAME PIC X(15). 05 FILLER PIC X(1) VALUE SPACES. 05 PRT-MQR-COMPANY-PHONE PIC X(13). 05 FILLER PIC X(5). 05 PRT-MQR-MOVING-QUOTE PIC $zz99.99. 05 FILLER PIC X(7). 05 PRT-MQR-NUMBER-ITEMS PIC 9(3). 05 FILLER PIC X(15). 05 PRT-MQR-RATING PIC 9.9. 01 PAGE-TITLE. 05 PIC X(22) VALUE SPACES. 05 PIC X(40) VALUE 'MOVING COMPANY QUOTES'. 05 PIC X(18) VALUE SPACES. 05 PRT-PAGE-NUM PIC Z9. 01 QUOTE-HEADING-1. 05 PIC X(7) VALUE SPACES. 05 PIC X(7) VALUE 'COMPANY'. 05 PIC X(9) VALUE SPACES. 05 PIC X(5) VALUE 'PHONE'. 05 PIC X(21) VALUE SPACES. 05 PIC X(9) VALUE 'NUMBER OF'. 05 PIC X(11) VALUE SPACES. 05 PIC X(4) VALUE 'YELP'. 05 PIC X(7). 01 QUOTE-HEADING-2. 05 PIC X(8). 05 PIC X(4) VALUE 'NAME'. 05 PIC X(11) VALUE SPACES. 05 PIC X(6) VALUE 'NUMBER'. 05 PIC X(9) VALUE SPACES. 05 PIC X(5) VALUE 'QUOTE'. 05 PIC X(7) VALUE SPACES. 05 PIC X(5) VALUE 'ITEMS'. 05 PIC X(13) VALUE SPACES. 05 PIC X(6) VALUE 'RATING'. 05 PIC X(2) VALUE SPACES. 01 QUOTE-HEADING-3. 05 PIC X(6) VALUE SPACES. 05 PIC X(9) VALUE ALL '-'. 05 PIC X(7) VALUE SPACES. 05 PIC X(8) VALUE ALL '-'. 05 PIC X(7) VALUE SPACES. 05 PIC X(7) VALUE ALL '-'. 05 PIC X(5) VALUE SPACES. 05 PIC X(11) VALUE ALL '-'. 05 PIC X(7) VALUE SPACES. 05 PIC X(8) VALUE ALL '-'. 01 WS-SWITCHES-AND-COUNTERS. 05 WS-EOF PIC X VALUE 'F'. 05 NUMBER-OF-PAGES PIC S9(4) COMP VALUE 0. 05 NUMBER-OF-LINES-USED PIC S9(4) COMP VALUE 0. 05 WS-HI-BID PIC 9999V99 VALUE 0. 05 WS-LO-BID PIC 9999V99 VALUE 9999.99. 05 WS-TOTAL-BID-SUM PIC 9999V99 VALUE 0. 05 WS-NUMBER-OF-RECORDS PIC 9(4) VALUE 4. 05 WS-AVERAGE PIC 9999V99. 01 HI-COMPANY-INFO. 05 FILLER PIC X(6) VALUE SPACES. 05 SAV-HI-MQR-COMPANY-NAME PIC X(15). 05 FILLER PIC X(2) VALUE SPACES. 05 SAV-HI-MQR-COMPANY-PHONE PIC X(13). 05 FILLER PIC X(2) VALUE SPACES. 05 SAV-HI-MQR-QUOTE PIC $ZZ99.99. 01 LO-COMPANY-INFO. 05 FILLER PIC X(5) VALUE SPACES. 05 SAV-LO-MQR-COMPANY-NAME PIC X(15). 05 FILLER PIC X(2) VALUE SPACES. 05 SAV-LO-MQR-COMPANY-PHONE PIC X(13). 05 FILLER PIC X(2) VALUE SPACES. 05 SAV-LO-MQR-QUOTE PIC $ZZ99.99. 01 AVG-INFO. 05 PIC X(6) VALUE SPACES. 05 SAV-AVG PIC $ZZ99.99. 01 HI-INFO-HD1. 05 PIC X(8). 05 PIC X(7) VALUE 'HIGH'. 05 PIC X(8). 05 PIC X(5) VALUE 'PHONE'. 05 PIC X(52). 01 HI-INFO-HD2. 05 PIC X(6). 05 PIC X(7) VALUE 'COMPANY'. 05 PIC X(10). 05 PIC X(6) VALUE 'NUMBER'. 05 PIC X(9). 05 PIC X(5) VALUE 'QUOTE'. 05 PIC X(37). 01 HI-INFO-HD3. 05 PIC X(5). 05 PIC X(9) VALUE ALL '-'. 05 PIC X(8). 05 PIC X(8) VALUE ALL '-'. 05 PIC X(7). 05 PIC X(7) VALUE ALL '-'. 05 PIC X(36). 01 LO-INFO-HD1. 05 PIC X(7). 05 PIC X(3) VALUE 'LOW'. 05 PIC X(13). 05 PIC X(5) VALUE 'PHONE'. 05 PIC X(52). 01 LO-INFO-HD2. 05 PIC X(6). 05 PIC X(7) VALUE 'COMPANY'. 05 PIC X(10). 05 PIC X(6) VALUE 'NUMBER'. 05 PIC X(9). 05 PIC X(5) VALUE 'QUOTE'. 05 PIC X(37). 01 LO-INFO-HD3. 05 PIC X(5). 05 PIC X(9) VALUE ALL '-'. 05 PIC X(8). 05 PIC X(8) VALUE ALL '-'. 05 PIC X(7). 05 PIC X(7) VALUE ALL '-'. 05 PIC X(36). 01 AVG-INFO-HD1. 05 PIC X(7). 05 PIC X(7) VALUE 'AVERAGE'. 01 AVG-INFO-HD2. 05 PIC X(6). 05 PIC X(9) VALUE ALL '-'. 05 PIC X(65). PROCEDURE DIVISION. 0000-MAINLINE. PERFORM 1000-START-MOVING-QUOTES PERFORM 2000-READ-N-PRINT-MQ UNTIL WS-EOF = 'T'. PERFORM 3000-FINISH-UP STOP RUN. 1000-START-MOVING-QUOTES. OPEN INPUT MOVING-QUOTES-FILE OUTPUT MOVING-QUOTES-RESULTS-FILE. PERFORM 8000-READ-MOVING-QUOTES-FILE. IF WS-EOF NOT ='T' PERFORM 8020-PRINT-TITLE-AND-HEADINGS. 8000-READ-MOVING-QUOTES-FILE. READ MOVING-QUOTES-FILE AT END MOVE 'T' TO WS-EOF MOVE FS-MOVING-QUOTES-RECORD TO WS-MOVING-QUOTES-RECORD. 8010-CHECK-LINES. ADD 2 TO NUMBER-OF-LINES-USED. IF NUMBER-OF-LINES-USED > 80 PERFORM 8020-PRINT-TITLE-AND-HEADINGS. 8020-PRINT-TITLE-AND-HEADINGS. ADD 1 TO NUMBER-OF-PAGES MOVE NUMBER-OF-PAGES TO PRT-PAGE-NUM MOVE SPACES TO MOVING-QUOTES-RESULTS-RECORD MOVE PAGE-TITLE TO MOVING-QUOTES-RESULTS-RECORD WRITE MOVING-QUOTES-RESULTS-RECORD AFTER ADVANCING 3 LINES WRITE MOVING-QUOTES-RESULTS-RECORD FROM NUMBER-OF-PAGES AFTER ADVANCING 1 LINE WRITE MOVING-QUOTES-RESULTS-RECORD FROM QUOTE-HEADING-1 AFTER ADVANCING 1 LINE WRITE MOVING-QUOTES-RESULTS-RECORD FROM QUOTE-HEADING-2 AFTER ADVANCING 1 LINE WRITE MOVING-QUOTES-RESULTS-RECORD FROM QUOTE-HEADING-3 AFTER ADVANCING 1 LINE. 8025-PRINT-HI-LO-HD. WRITE MOVING-QUOTES-RESULTS-RECORD FROM HI-INFO-HD1 AFTER ADVANCING 1 LINE WRITE MOVING-QUOTES-RESULTS-RECORD FROM HI-INFO-HD2 AFTER ADVANCING 1 LINE WRITE MOVING-QUOTES-RESULTS-RECORD FROM HI-INFO-HD3 AFTER ADVANCING 1 LINE WRITE MOVING-QUOTES-RESULTS-RECORD FROM LO-INFO-HD1 AFTER ADVANCING 1 LINE WRITE MOVING-QUOTES-RESULTS-RECORD FROM LO-INFO-HD2 AFTER ADVANCING 1 LINE WRITE MOVING-QUOTES-RESULTS-RECORD FROM LO-INFO-HD3 AFTER ADVANCING 1 LINE WRITE MOVING-QUOTES-RESULTS-RECORD FROM AVG-INFO-HD1 AFTER ADVANCING 1 LINE WRITE MOVING-QUOTES-RESULTS-RECORD FROM AVG-INFO-HD2 AFTER ADVANCING 1 LINE. 2000-READ-N-PRINT-MQ. PERFORM 8010-CHECK-LINES MOVE MQR-COMPANY-NAME TO PRT-MQR-COMPANY-NAME MOVE MQR-COMPANY-PHONE TO PRT-MQR-COMPANY-PHONE MOVE MQR-MOVING-QUOTE TO PRT-MQR-MOVING-QUOTE MOVE MQR-NUMBER-ITEMS TO PRT-MQR-NUMBER-ITEMS MOVE MQR-RATING TO PRT-MQR-RATING MOVE PRT-MOVING-QUOTES-FILE TO MOVING-QUOTES-RESULTS-RECORD WRITE MOVING-QUOTES-RESULTS-RECORD AFTER ADVANCING 2 LINES PERFORM 2010-FIND-HI-LO-AVG. PERFORM 8000-READ-MOVING-QUOTES-FILE. 2010-FIND-HI-LO-AVG. IF (MQR-RATING >= 3.5) PERFORM 2011-STORING-VAL-HI PERFORM 2012-FIND-HI PERFORM 2013-STORING-VAL-LO PERFORM 2014-FIND-LO PERFORM 2015-GET-SUM PERFORM 8000-READ-MOVING-QUOTES-FILE. 2011-STORING-VAL-HI. MOVE MQR-MOVING-QUOTE TO WS-HI-BID. 2012-FIND-HI. IF (MQR-MOVING-QUOTE > WS-HI-BID) MOVE MQR-MOVING-QUOTE TO WS-HI-BID MOVE MQR-COMPANY-NAME TO SAV-HI-MQR-COMPANY-NAME MOVE MQR-COMPANY-PHONE TO SAV-HI-MQR-COMPANY-PHONE MOVE MQR-MOVING-QUOTE TO SAV-HI-MQR-QUOTE. 2013-STORING-VAL-LO. MOVE MQR-MOVING-QUOTE TO WS-LO-BID. 2014-FIND-LO. IF (MQR-MOVING-QUOTE < WS-LO-BID) MOVE MQR-MOVING-QUOTE TO WS-LO-BID MOVE MQR-COMPANY-NAME TO SAV-LO-MQR-COMPANY-NAME MOVE MQR-COMPANY-PHONE TO SAV-LO-MQR-COMPANY-PHONE MOVE MQR-MOVING-QUOTE TO SAV-LO-MQR-QUOTE. 2015-GET-SUM. ADD MQR-MOVING-QUOTE GIVING WS-TOTAL-BID-SUM. 2020-READ-N-PRINT-MQR. MOVE MQR-COMPANY-NAME TO PRT-MQR-COMPANY-NAME MOVE MQR-COMPANY-PHONE TO PRT-MQR-COMPANY-PHONE MOVE MQR-MOVING-QUOTE TO PRT-MQR-MOVING-QUOTE MOVE MQR-NUMBER-ITEMS TO PRT-MQR-NUMBER-ITEMS MOVE MQR-RATING TO PRT-MQR-RATING MOVE PRT-MOVING-QUOTES-FILE TO MOVING-QUOTES-RESULTS-RECORD WRITE MOVING-QUOTES-RESULTS-RECORD AFTER ADVANCING 2 LINES PERFORM 8000-READ-MOVING-QUOTES-FILE. 3000-FINISH-UP. DIVIDE WS-TOTAL-BID-SUM BY 12 GIVING WS-AVERAGE MOVE WS-AVERAGE TO SAV-AVG PERFORM 8120-PRINT-CALC-DATA PERFORM 3010-PRT-HI PERFORM 3020-PRT-LO PERFORM 3030-PRT-AVG CLOSE MOVING-QUOTES-FILE MOVING-QUOTES-RESULTS-FILE. 3010-PRT-HI. MOVE HI-COMPANY-INFO TO MOVING-QUOTES-RESULTS-RECORD. 3020-PRT-LO. MOVE LO-COMPANY-INFO TO MOVING-QUOTES-RESULTS-RECORD. 3030-PRT-AVG. MOVE SAV-AVG TO MOVING-QUOTES-RESULTS-RECORD. 8120-PRINT-CALC-DATA. MOVE SPACES TO MOVING-QUOTES-RESULTS-RECORD WRITE MOVING-QUOTES-RESULTS-RECORD AFTER ADVANCING 2 LINES. ---------------------------------------------- This is my input file record Movers (361)443-3245 22000 30 25 Move With Us (361)848-9354 19000 25 39 Move It (361)765-9843 13299 20 40 Texas Movers (361)888-7623 20000 30 27 We Haul It (210)667-2341 50000 50 40 Carry It (512)786-9865 45000 40 29 U Haul (361)764-0987 35000 30 40 CC Movers (361)738-8214 32500 50 33 Bargain Moving (361)923-4576 28000 45 38 We Move It All (361)555-8390 35000 50 40 Awesome Movers (361)888-3454 32500 41 21 Payless Movers (361)555-0347 19500 30 32
0debug
static int v9fs_synth_lremovexattr(FsContext *ctx, V9fsPath *path, const char *name) { errno = ENOTSUP; return -1; }
1threat
How to import data from excel or csv file to MySql using C# Winform? : <p>I'm really a newbie one.</p> <p>I wanted to import data from excel or CSV file to MySQL using C#. I just need a button and then, viola! It should insert automatically to MySQL database. </p> <p>I only know how the structure of my excel file and my MySQL database table looks like. Just don't know how to import it.</p> <p>Please help. As always, thank you!</p>
0debug
Parse error: syntax error, unexpected 'company_name' (T_STRING) : <p>what am i gonna put inside the for loop to connect it to the database </p> <pre><code>&lt;?php try { require ("db.php"); $sql = ("select company_name, company_logo from company"); mysql_query($sql); for () { print '&lt;a href="systemlogin2.php"&gt;$row['company_name']&lt;/h2&gt;'; print '&lt;p&gt;&lt;img border="0" src="$row['company_logo']" width="230" height="198"&gt;&lt;/p&gt;'; } } ?&gt; </code></pre>
0debug
def min_sum_path(A): memo = [None] * len(A) n = len(A) - 1 for i in range(len(A[n])): memo[i] = A[n][i] for i in range(len(A) - 2, -1,-1): for j in range( len(A[i])): memo[j] = A[i][j] + min(memo[j], memo[j + 1]) return memo[0]
0debug
static void alac_linear_predictor(AlacEncodeContext *s, int ch) { int i; LPCContext lpc = s->lpc[ch]; if(lpc.lpc_order == 31) { s->predictor_buf[0] = s->sample_buf[ch][0]; for(i=1; i<s->avctx->frame_size; i++) s->predictor_buf[i] = s->sample_buf[ch][i] - s->sample_buf[ch][i-1]; return; } if(lpc.lpc_order > 0) { int32_t *samples = s->sample_buf[ch]; int32_t *residual = s->predictor_buf; residual[0] = samples[0]; for(i=1;i<=lpc.lpc_order;i++) residual[i] = samples[i] - samples[i-1]; for(i = lpc.lpc_order + 1; i < s->avctx->frame_size; i++) { int sum = 1 << (lpc.lpc_quant - 1), res_val, j; for (j = 0; j < lpc.lpc_order; j++) { sum += (samples[lpc.lpc_order-j] - samples[0]) * lpc.lpc_coeff[j]; } sum >>= lpc.lpc_quant; sum += samples[0]; residual[i] = samples[lpc.lpc_order+1] - sum; res_val = residual[i]; if(res_val) { int index = lpc.lpc_order - 1; int neg = (res_val < 0); while(index >= 0 && (neg ? (res_val < 0):(res_val > 0))) { int val = samples[0] - samples[lpc.lpc_order - index]; int sign = (val ? FFSIGN(val) : 0); if(neg) sign*=-1; lpc.lpc_coeff[index] -= sign; val *= sign; res_val -= ((val >> lpc.lpc_quant) * (lpc.lpc_order - index)); index--; } } samples++; } } }
1threat
Java sort hashmap by double value not working : <p>I am trying to sort a hashmap containing an object and a double value but it's not working as expected. Here is my code.</p> <pre><code>HashMap&lt;Route, Double&gt; unsortedRoutes = new HashMap&lt;&gt;(); unsortedRoutes.add(new Route("Route Z"),9.49307305463114167); unsortedRoutes.add(new Route("Route A"),9.546311415463114167); unsortedRoutes.add(new Route("Route K"),9.37307305463114167); unsortedRoutes.add(new Route("Route Y"),9.89730305463114167); unsortedRoutes.add(new Route("Route Z"),3.49307305463114167); unsortedRoutes.add(new Route("Route A"),3.41870305463114167); unsortedRoutes.add(new Route("Route K"),4.49307305463114167); unsortedRoutes.add(new Route("Route Y"),5.34307305463114167); HashMap&lt;Route, Double&gt; sortedRoutes = new HashMap&lt;&gt;(); unsortedRoutes.entrySet() .stream() .sorted(comparingByValue()) .forEachOrdered(x -&gt; sortedRoutes.put(x.getKey(), x.getValue())); </code></pre> <p>When I ran the code these are the results I get</p> <pre><code>Name: Route D Distance = 3.4187030546311417 Name: Route J Distance = 5.343073054631142 Name: Route A Distance = 9.546311415463114 Name: Route Y Distance = 9.897303054631141 Name: Route U Distance = 4.493073054631141 Name: Route K Distance = 9.373073054631142 Name: Route Z Distance = 9.493073054631141 Name: Route Q Distance = 3.4930730546311417 </code></pre> <p>I expected the results to be listed in ascending order.</p>
0debug
Sealed classes inside another class in Kotlin can't be compiled: cannot access '<init>' it is private : <p>If I used the example from the <a href="https://kotlinlang.org/docs/reference/sealed-classes.html" rel="noreferrer">docs</a>, </p> <pre><code>class SomeActivity : AppCompatActivity() { sealed class Expr data class Const(val number: Double) : Expr() data class Sum(val e1: Expr, val e2: Expr) : Expr() object NotANumber : Expr() } </code></pre> <p>it does not compile, with the error:</p> <pre><code>Cannot access '&lt;init&gt;', it is private in 'Expr'. </code></pre> <p>However, moving it outside the enclosing class makes it compile:</p> <pre><code>sealed class Expr data class Const(val number: Double) : Expr() data class Sum(val e1: Expr, val e2: Expr) : Expr() object NotANumber : Expr() class SomeActivity : AppCompatActivity() { } </code></pre> <p>Why is this so? Is this an intended behavior? The docs does not seem to mention this.</p>
0debug
Simple MS SQL query - If exists in one table need to return Y else N : I have 2 tables. One table (employeemaster) contains all of my employees in the company. Primary key = EmpNo The other table (employeeNoTime) contains a smaller list of employees that have no benefits. Primary key = EmpNo I want to query that will return 2 columns. The EmployeeNo, and Y or N Yif the employee number is in the EmployeeNoTime table. Any suggestions?
0debug
Protocol Buffer Error on compile during GOOGLE_PROTOBUF_MIN_PROTOC_VERSION check : <p>I'm currently getting an error which points me to these lines in the header file produced by protoc:</p> <pre><code>#if 2006001 &lt; GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. #endif </code></pre> <p>But my protoc version matches the one above:</p> <pre><code>protoc --version libprotoc 2.6.1 </code></pre> <p>What am I doing wrong?</p> <p>Originally my protoc version was 3.0.0 then reinstalled it by syncing back to 2.6.1 and doing the steps; make distclean, ./configure , make, make install to install the desired 2.6.1 version. I needed the older version since that's the one installed in our servers.</p>
0debug
Please help parse Json result : Please help me get JSON result - "col1":"64.7020" to $result https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20csv%20where%20url%3D%22http%3A%2F%2Ffinance.yahoo.com%2Fd%2Fquotes.csv%3Fe%3D.csv%26f%3Dc4l1%26s%3DUSDRUB%3DX%22%3B&format=json&diagnostics=true&callback= {"query":{"count":1,"created":"2016-08-28T09:50:07Z","lang":"ru-RU","diagnostics":{"publiclyCallable":"true","url":{"execution-start-time":"1","execution-stop-time":"2","execution-time":"1","content":"http://finance.yahoo.com/d/quotes.csv?e=.csv&f=c4l1&s=USDRUB=X"},"user-time":"2","service-time":"1","build-version":"0.2.48"},"results":{"row":{"col0":"RUB","col1":"64.7020"}}}} $tick=file_get_contents('https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20csv%20where%20url%3D%22http%3A%2F%2Ffinance.yahoo.com%2Fd%2Fquotes.csv%3Fe%3D.csv%26f%3Dc4l1%26s%3DUSDRUB%3DX%22%3B&format=json&diagnostics=true&callback='); $url = $tick; $json = file_get_contents($url); $data = json_decode($json, TRUE); $result ?? echo col1 ???????
0debug
static void gen_logicq_cc(TCGv_i64 val) { TCGv tmp = new_tmp(); gen_helper_logicq_cc(tmp, val); gen_logic_CC(tmp); dead_tmp(tmp); }
1threat
static void cmd_start_stop_unit(IDEState *s, uint8_t* buf) { int sense; bool start = buf[4] & 1; bool loej = buf[4] & 2; int pwrcnd = buf[4] & 0xf0; if (pwrcnd) { return; } if (loej) { if (!start && !s->tray_open && s->tray_locked) { sense = bdrv_is_inserted(s->bs) ? NOT_READY : ILLEGAL_REQUEST; ide_atapi_cmd_error(s, sense, ASC_MEDIA_REMOVAL_PREVENTED); return; } if (s->tray_open != !start) { bdrv_eject(s->bs, !start); s->tray_open = !start; } } ide_atapi_cmd_ok(s); }
1threat
void qemu_del_polling_cb(PollingFunc *func, void *opaque) { PollingEntry **ppe, *pe; for(ppe = &first_polling_entry; *ppe != NULL; ppe = &(*ppe)->next) { pe = *ppe; if (pe->func == func && pe->opaque == opaque) { *ppe = pe->next; g_free(pe); break; } } }
1threat
visual studio code keybindings - Running two or more commands with one shortcut : <p>I have the following keybinding in VS code which toggles the position of the cursor between the active document and built-in terminal:</p> <pre><code> // Toggle between terminal and editor focus { "key": "oem_8", "command": "workbench.action.terminal.focus" }, { "key": "oem_8", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus" } </code></pre> <p>Before i click the shortcut key to move the cursor to the terminal, i first have to save the active file. </p> <p>I would therefore like to run the file saving command, which after searching on google i believe is :<code>workbench.action.files.save</code></p> <p>How would i do this please? i have tried adding the above code snippet at the end of the "command" line but it has not worked.</p> <p>cheers</p>
0debug
Redirect website but keep the original url in the address bar : <p>I have a local domain name <strong>.dz</strong> which <strong>doesn't allow DNS changes</strong>, I want to redirect the domain and all the pages to another domain <strong>.com</strong>, and keep the .dz address in the address bar and completely hide the .com domain.</p> <p>I've searched the whole Internet all solutions doesn't do this, some does the redirect to .com and the .com shows in the address bar and some others redirect only the homepage.</p> <p>I am wondering if the is a php function to read directly from the .com domain and then writes the content to the .dz domain</p> <p>I have access to both .htaccess or the PHP files.</p>
0debug
AssertionError: Egg-link .. does not match installed location of ReviewBoard (at /...) : <pre><code>AssertionError: Egg-link /home/daniel/other-rb/reviewboard does not match installed location of ReviewBoard (at /home/daniel/reviewboard) </code></pre> <p>I believe this was caused by me installing a package at an additional location using the same virtualenv.</p> <p>How can I fix this problem? I'm guessing I need to redirect the Egg-link to match the installed location?</p> <p>Stack trace:</p> <pre><code>(reviewboard-3.0) daniel@beepboop ~/reviewboard $ ./setup.py develop /home/daniel/envs/reviewboard-3.0/local/lib/python2.7/site-packages/setuptools/dist.py:334: UserWarning: Normalizing '4.0alpha0' to '4.0a0' normalized_version, running develop Requirement already up-to-date: setuptools in /home/daniel/envs/reviewboard-3.0/lib/python2.7/site-packages Requirement already up-to-date: appdirs&gt;=1.4.0 in /home/daniel/envs/reviewboard-3.0/lib/python2.7/site-packages (from setuptools) Requirement already up-to-date: packaging&gt;=16.8 in /home/daniel/envs/reviewboard-3.0/lib/python2.7/site-packages (from setuptools) Requirement already up-to-date: six&gt;=1.6.0 in /usr/lib/python2.7/dist-packages (from setuptools) Requirement already up-to-date: pyparsing in /home/daniel/envs/reviewboard-3.0/lib/python2.7/site-packages (from packaging&gt;=16.8-&gt;setuptools) Requirement already up-to-date: pip in /home/daniel/envs/reviewboard-3.0/lib/python2.7/site-packages Obtaining file:///home/daniel/reviewboard Requirement already satisfied: django-haystack&lt;=2.4.999,&gt;=2.3.1 in /usr/local/lib/python2.7/dist-packages (from ReviewBoard==4.0a0.dev0) Requirement already satisfied: django-multiselectfield in /usr/local/lib/python2.7/dist-packages (from ReviewBoard==4.0a0.dev0) Requirement already satisfied: Django&lt;1.6.999,&gt;=1.6.11 in /usr/local/lib/python2.7/dist-packages (from ReviewBoard==4.0a0.dev0) Requirement already satisfied: django_evolution&lt;=0.7.999,&gt;=0.7.6 in /usr/local/lib/python2.7/dist-packages (from ReviewBoard==4.0a0.dev0) Requirement already satisfied: Djblets&lt;=0.10.999,&gt;=0.10a0.dev in /home/daniel/djblets (from ReviewBoard==4.0a0.dev0) Requirement already satisfied: docutils in /usr/local/lib/python2.7/dist-packages (from ReviewBoard==4.0a0.dev0) Requirement already satisfied: markdown&lt;2.4.999,&gt;=2.4.0 in /usr/local/lib/python2.7/dist-packages (from ReviewBoard==4.0a0.dev0) Requirement already satisfied: mimeparse&gt;=0.1.3 in /usr/local/lib/python2.7/dist-packages (from ReviewBoard==4.0a0.dev0) Requirement already satisfied: paramiko&gt;=1.12 in /usr/lib/python2.7/dist-packages (from ReviewBoard==4.0a0.dev0) Requirement already satisfied: pycrypto&gt;=2.6 in /usr/lib/python2.7/dist-packages (from ReviewBoard==4.0a0.dev0) Requirement already satisfied: Pygments&gt;=2.1 in /usr/local/lib/python2.7/dist-packages (from ReviewBoard==4.0a0.dev0) Requirement already satisfied: python-dateutil==1.5 in /usr/local/lib/python2.7/dist-packages (from ReviewBoard==4.0a0.dev0) Requirement already satisfied: python-memcached in /usr/local/lib/python2.7/dist-packages (from ReviewBoard==4.0a0.dev0) Requirement already satisfied: pytz in /usr/local/lib/python2.7/dist-packages (from ReviewBoard==4.0a0.dev0) Requirement already satisfied: Whoosh&gt;=2.6 in /usr/local/lib/python2.7/dist-packages (from ReviewBoard==4.0a0.dev0) Requirement already satisfied: pillowfight in /usr/local/lib/python2.7/dist-packages (from Djblets&lt;=0.10.999,&gt;=0.10a0.dev-&gt;ReviewBoard==4.0a0.dev0) Requirement already satisfied: django-pipeline==1.6.9 in /usr/local/lib/python2.7/dist-packages (from Djblets&lt;=0.10.999,&gt;=0.10a0.dev-&gt;ReviewBoard==4.0a0.dev0) Requirement already satisfied: feedparser&gt;=5.1.2 in /usr/lib/python2.7/dist-packages (from Djblets&lt;=0.10.999,&gt;=0.10a0.dev-&gt;ReviewBoard==4.0a0.dev0) Requirement already satisfied: dnspython&gt;=1.14.0 in /usr/local/lib/python2.7/dist-packages (from Djblets&lt;=0.10.999,&gt;=0.10a0.dev-&gt;ReviewBoard==4.0a0.dev0) Requirement already satisfied: publicsuffix&gt;=1.1 in /usr/local/lib/python2.7/dist-packages (from Djblets&lt;=0.10.999,&gt;=0.10a0.dev-&gt;ReviewBoard==4.0a0.dev0) Requirement already satisfied: six&gt;=1.4.0 in /usr/lib/python2.7/dist-packages (from python-memcached-&gt;ReviewBoard==4.0a0.dev0) Requirement already satisfied: Pillow&gt;=3.4.2 in /usr/local/lib/python2.7/dist-packages (from pillowfight-&gt;Djblets&lt;=0.10.999,&gt;=0.10a0.dev-&gt;ReviewBoard==4.0a0.dev0) Requirement already satisfied: olefile in /usr/local/lib/python2.7/dist-packages (from Pillow&gt;=3.4.2-&gt;pillowfight-&gt;Djblets&lt;=0.10.999,&gt;=0.10a0.dev-&gt;ReviewBoard==4.0a0.dev0) Installing collected packages: ReviewBoard Found existing installation: ReviewBoard 4.0a0.dev0 Exception: Traceback (most recent call last): File "/home/daniel/envs/reviewboard-3.0/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/home/daniel/envs/reviewboard-3.0/local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run prefix=options.prefix_path, File "/home/daniel/envs/reviewboard-3.0/local/lib/python2.7/site-packages/pip/req/req_set.py", line 778, in install requirement.uninstall(auto_confirm=True) File "/home/daniel/envs/reviewboard-3.0/local/lib/python2.7/site-packages/pip/req/req_install.py", line 703, in uninstall '(at %s)' % (link_pointer, self.name, dist.location) AssertionError: Egg-link /home/daniel/other-rb/reviewboard does not match installed location of ReviewBoard (at /home/daniel/reviewboard) Traceback (most recent call last): File "./setup.py", line 434, in &lt;module&gt; 'Topic :: Software Development :: Quality Assurance', File "/usr/lib/python2.7/distutils/core.py", line 151, in setup dist.run_commands() File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands self.run_command(cmd) File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "/home/daniel/envs/reviewboard-3.0/local/lib/python2.7/site-packages/setuptools/command/develop.py", line 36, in run self.install_for_development() File "./setup.py", line 132, in install_for_development self._run_pip(['install', '-e', '.']) File "./setup.py", line 158, in _run_pip raise RuntimeError('Failed to run `%s`' % cmd) RuntimeError: Failed to run `/home/daniel/envs/reviewboard-3.0/bin/python -m pip install -e .` </code></pre>
0debug
How to read value pointed by a reference : I have a pointer to an u64 value and I can't read it. I am getting this error: error[E0507]: cannot move out of borrowed content --> /home/niko/sub/substrate/srml/system/src/lib.rs:533:32 | 533 | let mut aid: T::AccountId = *copy_who; | ^^^^^^^^^ | | | cannot move out of borrowed content | help: consider removing the `*`: `copy_who` How does one get around "borrowed content" error ? And what is the point of having a pointer to a variable if you can't read anything that it points to ??? // getter for AccountId pub fn get_account_id(who: &T::AccountId) -> T::AccountId { let mut copy_who: &T::AccountId=who; { let mut aid: T::AccountId = *copy_who; return aid; } } AccountId is defined like this: type AccountId = u64;
0debug
What are the uses for . in Django? : <p>What are the uses for . in Django? One use I know is to indicate a directory like 'directory.file'. Can somebody give a complete use case?</p>
0debug
int ff_h264_decode_slice_header(H264Context *h, H264Context *h0) { unsigned int first_mb_in_slice; unsigned int pps_id; int ret; unsigned int slice_type, tmp, i, j; int last_pic_structure, last_pic_droppable; int must_reinit; int needs_reinit = 0; int field_pic_flag, bottom_field_flag; h->qpel_put = h->h264qpel.put_h264_qpel_pixels_tab; h->qpel_avg = h->h264qpel.avg_h264_qpel_pixels_tab; first_mb_in_slice = get_ue_golomb_long(&h->gb); if (first_mb_in_slice == 0) { if (h0->current_slice && h->cur_pic_ptr && FIELD_PICTURE(h)) { ff_h264_field_end(h, 1); } h0->current_slice = 0; if (!h0->first_field) { if (h->cur_pic_ptr && !h->droppable) { ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, h->picture_structure == PICT_BOTTOM_FIELD); } h->cur_pic_ptr = NULL; } } slice_type = get_ue_golomb_31(&h->gb); if (slice_type > 9) { av_log(h->avctx, AV_LOG_ERROR, "slice type %d too large at %d %d\n", slice_type, h->mb_x, h->mb_y); return AVERROR_INVALIDDATA; } if (slice_type > 4) { slice_type -= 5; h->slice_type_fixed = 1; } else h->slice_type_fixed = 0; slice_type = golomb_to_pict_type[slice_type]; h->slice_type = slice_type; h->slice_type_nos = slice_type & 3; if (h->nal_unit_type == NAL_IDR_SLICE && h->slice_type_nos != AV_PICTURE_TYPE_I) { av_log(h->avctx, AV_LOG_ERROR, "A non-intra slice in an IDR NAL unit.\n"); return AVERROR_INVALIDDATA; } if ( (h->avctx->skip_frame >= AVDISCARD_NONREF && !h->nal_ref_idc) || (h->avctx->skip_frame >= AVDISCARD_BIDIR && h->slice_type_nos == AV_PICTURE_TYPE_B) || (h->avctx->skip_frame >= AVDISCARD_NONINTRA && h->slice_type_nos != AV_PICTURE_TYPE_I) || (h->avctx->skip_frame >= AVDISCARD_NONKEY && h->nal_unit_type != NAL_IDR_SLICE) || h->avctx->skip_frame >= AVDISCARD_ALL) { return SLICE_SKIPED; } h->pict_type = h->slice_type; pps_id = get_ue_golomb(&h->gb); if (pps_id >= MAX_PPS_COUNT) { av_log(h->avctx, AV_LOG_ERROR, "pps_id %u out of range\n", pps_id); return AVERROR_INVALIDDATA; } if (!h0->pps_buffers[pps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing PPS %u referenced\n", pps_id); return AVERROR_INVALIDDATA; } if (h0->au_pps_id >= 0 && pps_id != h0->au_pps_id) { av_log(h->avctx, AV_LOG_ERROR, "PPS change from %d to %d forbidden\n", h0->au_pps_id, pps_id); return AVERROR_INVALIDDATA; } h->pps = *h0->pps_buffers[pps_id]; if (!h0->sps_buffers[h->pps.sps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing SPS %u referenced\n", h->pps.sps_id); return AVERROR_INVALIDDATA; } if (h->pps.sps_id != h->sps.sps_id || h->pps.sps_id != h->current_sps_id || h0->sps_buffers[h->pps.sps_id]->new) { h->sps = *h0->sps_buffers[h->pps.sps_id]; if (h->mb_width != h->sps.mb_width || h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) || h->avctx->bits_per_raw_sample != h->sps.bit_depth_luma || h->cur_chroma_format_idc != h->sps.chroma_format_idc ) needs_reinit = 1; if (h->bit_depth_luma != h->sps.bit_depth_luma || h->chroma_format_idc != h->sps.chroma_format_idc) { h->bit_depth_luma = h->sps.bit_depth_luma; h->chroma_format_idc = h->sps.chroma_format_idc; needs_reinit = 1; } if ((ret = ff_h264_set_parameter_from_sps(h)) < 0) return ret; } h->avctx->profile = ff_h264_get_profile(&h->sps); h->avctx->level = h->sps.level_idc; h->avctx->refs = h->sps.ref_frame_count; must_reinit = (h->context_initialized && ( 16*h->sps.mb_width != h->avctx->coded_width || 16*h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) != h->avctx->coded_height || h->avctx->bits_per_raw_sample != h->sps.bit_depth_luma || h->cur_chroma_format_idc != h->sps.chroma_format_idc || av_cmp_q(h->sps.sar, h->avctx->sample_aspect_ratio) || h->mb_width != h->sps.mb_width || h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) )); if (non_j_pixfmt(h0->avctx->pix_fmt) != non_j_pixfmt(get_pixel_format(h0, 0))) must_reinit = 1; h->mb_width = h->sps.mb_width; h->mb_height = h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag); h->mb_num = h->mb_width * h->mb_height; h->mb_stride = h->mb_width + 1; h->b_stride = h->mb_width * 4; h->chroma_y_shift = h->sps.chroma_format_idc <= 1; h->width = 16 * h->mb_width; h->height = 16 * h->mb_height; ret = init_dimensions(h); if (ret < 0) return ret; if (h->sps.video_signal_type_present_flag) { h->avctx->color_range = h->sps.full_range>0 ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; if (h->sps.colour_description_present_flag) { if (h->avctx->colorspace != h->sps.colorspace) needs_reinit = 1; h->avctx->color_primaries = h->sps.color_primaries; h->avctx->color_trc = h->sps.color_trc; h->avctx->colorspace = h->sps.colorspace; } } if (h->context_initialized && (must_reinit || needs_reinit)) { if (h != h0) { av_log(h->avctx, AV_LOG_ERROR, "changing width %d -> %d / height %d -> %d on " "slice %d\n", h->width, h->avctx->coded_width, h->height, h->avctx->coded_height, h0->current_slice + 1); return AVERROR_INVALIDDATA; } ff_h264_flush_change(h); if ((ret = get_pixel_format(h, 1)) < 0) return ret; h->avctx->pix_fmt = ret; av_log(h->avctx, AV_LOG_INFO, "Reinit context to %dx%d, " "pix_fmt: %s\n", h->width, h->height, av_get_pix_fmt_name(h->avctx->pix_fmt)); if ((ret = h264_slice_header_init(h, 1)) < 0) { av_log(h->avctx, AV_LOG_ERROR, "h264_slice_header_init() failed\n"); return ret; } } if (!h->context_initialized) { if (h != h0) { av_log(h->avctx, AV_LOG_ERROR, "Cannot (re-)initialize context during parallel decoding.\n"); return AVERROR_PATCHWELCOME; } if ((ret = get_pixel_format(h, 1)) < 0) return ret; h->avctx->pix_fmt = ret; if ((ret = h264_slice_header_init(h, 0)) < 0) { av_log(h->avctx, AV_LOG_ERROR, "h264_slice_header_init() failed\n"); return ret; } } if (h == h0 && h->dequant_coeff_pps != pps_id) { h->dequant_coeff_pps = pps_id; h264_init_dequant_tables(h); } h->frame_num = get_bits(&h->gb, h->sps.log2_max_frame_num); h->mb_mbaff = 0; h->mb_aff_frame = 0; last_pic_structure = h0->picture_structure; last_pic_droppable = h0->droppable; h->droppable = h->nal_ref_idc == 0; if (h->sps.frame_mbs_only_flag) { h->picture_structure = PICT_FRAME; } else { if (!h->sps.direct_8x8_inference_flag && slice_type == AV_PICTURE_TYPE_B) { av_log(h->avctx, AV_LOG_ERROR, "This stream was generated by a broken encoder, invalid 8x8 inference\n"); return -1; } field_pic_flag = get_bits1(&h->gb); if (field_pic_flag) { bottom_field_flag = get_bits1(&h->gb); h->picture_structure = PICT_TOP_FIELD + bottom_field_flag; } else { h->picture_structure = PICT_FRAME; h->mb_aff_frame = h->sps.mb_aff; } } h->mb_field_decoding_flag = h->picture_structure != PICT_FRAME; if (h0->current_slice != 0) { if (last_pic_structure != h->picture_structure || last_pic_droppable != h->droppable) { av_log(h->avctx, AV_LOG_ERROR, "Changing field mode (%d -> %d) between slices is not allowed\n", last_pic_structure, h->picture_structure); h->picture_structure = last_pic_structure; h->droppable = last_pic_droppable; return AVERROR_INVALIDDATA; } else if (!h0->cur_pic_ptr) { av_log(h->avctx, AV_LOG_ERROR, "unset cur_pic_ptr on slice %d\n", h0->current_slice + 1); return AVERROR_INVALIDDATA; } } else { if (h->frame_num != h->prev_frame_num) { int unwrap_prev_frame_num = h->prev_frame_num; int max_frame_num = 1 << h->sps.log2_max_frame_num; if (unwrap_prev_frame_num > h->frame_num) unwrap_prev_frame_num -= max_frame_num; if ((h->frame_num - unwrap_prev_frame_num) > h->sps.ref_frame_count) { unwrap_prev_frame_num = (h->frame_num - h->sps.ref_frame_count) - 1; if (unwrap_prev_frame_num < 0) unwrap_prev_frame_num += max_frame_num; h->prev_frame_num = unwrap_prev_frame_num; } } if (h0->first_field) { assert(h0->cur_pic_ptr); assert(h0->cur_pic_ptr->f.buf[0]); assert(h0->cur_pic_ptr->reference != DELAYED_PIC_REF); if (h0->cur_pic_ptr->tf.owner == h0->avctx) { ff_thread_report_progress(&h0->cur_pic_ptr->tf, INT_MAX, last_pic_structure == PICT_BOTTOM_FIELD); } if (!FIELD_PICTURE(h) || h->picture_structure == last_pic_structure) { if (last_pic_structure != PICT_FRAME) { ff_thread_report_progress(&h0->cur_pic_ptr->tf, INT_MAX, last_pic_structure == PICT_TOP_FIELD); } } else { if (h0->cur_pic_ptr->frame_num != h->frame_num) { if (last_pic_structure != PICT_FRAME) { ff_thread_report_progress(&h0->cur_pic_ptr->tf, INT_MAX, last_pic_structure == PICT_TOP_FIELD); } } else { if (!((last_pic_structure == PICT_TOP_FIELD && h->picture_structure == PICT_BOTTOM_FIELD) || (last_pic_structure == PICT_BOTTOM_FIELD && h->picture_structure == PICT_TOP_FIELD))) { av_log(h->avctx, AV_LOG_ERROR, "Invalid field mode combination %d/%d\n", last_pic_structure, h->picture_structure); h->picture_structure = last_pic_structure; h->droppable = last_pic_droppable; return AVERROR_INVALIDDATA; } else if (last_pic_droppable != h->droppable) { avpriv_request_sample(h->avctx, "Found reference and non-reference fields in the same frame, which"); h->picture_structure = last_pic_structure; h->droppable = last_pic_droppable; return AVERROR_PATCHWELCOME; } } } } while (h->frame_num != h->prev_frame_num && !h0->first_field && h->frame_num != (h->prev_frame_num + 1) % (1 << h->sps.log2_max_frame_num)) { H264Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL; av_log(h->avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n", h->frame_num, h->prev_frame_num); if (!h->sps.gaps_in_frame_num_allowed_flag) for(i=0; i<FF_ARRAY_ELEMS(h->last_pocs); i++) h->last_pocs[i] = INT_MIN; ret = h264_frame_start(h); if (ret < 0) { h0->first_field = 0; return ret; } h->prev_frame_num++; h->prev_frame_num %= 1 << h->sps.log2_max_frame_num; h->cur_pic_ptr->frame_num = h->prev_frame_num; h->cur_pic_ptr->invalid_gap = !h->sps.gaps_in_frame_num_allowed_flag; ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 0); ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 1); ret = ff_generate_sliding_window_mmcos(h, 1); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) return ret; ret = ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) return ret; if (h->short_ref_count) { if (prev) { av_image_copy(h->short_ref[0]->f.data, h->short_ref[0]->f.linesize, (const uint8_t **)prev->f.data, prev->f.linesize, h->avctx->pix_fmt, h->mb_width * 16, h->mb_height * 16); h->short_ref[0]->poc = prev->poc + 2; } h->short_ref[0]->frame_num = h->prev_frame_num; } } if (h0->first_field) { assert(h0->cur_pic_ptr); assert(h0->cur_pic_ptr->f.buf[0]); assert(h0->cur_pic_ptr->reference != DELAYED_PIC_REF); if (!FIELD_PICTURE(h) || h->picture_structure == last_pic_structure) { h0->cur_pic_ptr = NULL; h0->first_field = FIELD_PICTURE(h); } else { if (h0->cur_pic_ptr->frame_num != h->frame_num) { ff_thread_report_progress(&h0->cur_pic_ptr->tf, INT_MAX, h0->picture_structure==PICT_BOTTOM_FIELD); h0->first_field = 1; h0->cur_pic_ptr = NULL; } else { h0->first_field = 0; } } } else { h0->first_field = FIELD_PICTURE(h); } if (!FIELD_PICTURE(h) || h0->first_field) { if (h264_frame_start(h) < 0) { h0->first_field = 0; return AVERROR_INVALIDDATA; } } else { release_unused_pictures(h, 0); } if (FIELD_PICTURE(h)) { for(i = (h->picture_structure == PICT_BOTTOM_FIELD); i<h->mb_height; i++) memset(h->slice_table + i*h->mb_stride, -1, (h->mb_stride - (i+1==h->mb_height)) * sizeof(*h->slice_table)); } else { memset(h->slice_table, -1, (h->mb_height * h->mb_stride - 1) * sizeof(*h->slice_table)); } h0->last_slice_type = -1; } if (h != h0 && (ret = clone_slice(h, h0)) < 0) return ret; for (i = 0; i < h->slice_context_count; i++) if (h->thread_context[i]) { ret = alloc_scratch_buffers(h->thread_context[i], h->linesize); if (ret < 0) return ret; } h->cur_pic_ptr->frame_num = h->frame_num; av_assert1(h->mb_num == h->mb_width * h->mb_height); if (first_mb_in_slice << FIELD_OR_MBAFF_PICTURE(h) >= h->mb_num || first_mb_in_slice >= h->mb_num) { av_log(h->avctx, AV_LOG_ERROR, "first_mb_in_slice overflow\n"); return AVERROR_INVALIDDATA; } h->resync_mb_x = h->mb_x = first_mb_in_slice % h->mb_width; h->resync_mb_y = h->mb_y = (first_mb_in_slice / h->mb_width) << FIELD_OR_MBAFF_PICTURE(h); if (h->picture_structure == PICT_BOTTOM_FIELD) h->resync_mb_y = h->mb_y = h->mb_y + 1; av_assert1(h->mb_y < h->mb_height); if (h->picture_structure == PICT_FRAME) { h->curr_pic_num = h->frame_num; h->max_pic_num = 1 << h->sps.log2_max_frame_num; } else { h->curr_pic_num = 2 * h->frame_num + 1; h->max_pic_num = 1 << (h->sps.log2_max_frame_num + 1); } if (h->nal_unit_type == NAL_IDR_SLICE) get_ue_golomb(&h->gb); if (h->sps.poc_type == 0) { h->poc_lsb = get_bits(&h->gb, h->sps.log2_max_poc_lsb); if (h->pps.pic_order_present == 1 && h->picture_structure == PICT_FRAME) h->delta_poc_bottom = get_se_golomb(&h->gb); } if (h->sps.poc_type == 1 && !h->sps.delta_pic_order_always_zero_flag) { h->delta_poc[0] = get_se_golomb(&h->gb); if (h->pps.pic_order_present == 1 && h->picture_structure == PICT_FRAME) h->delta_poc[1] = get_se_golomb(&h->gb); } ff_init_poc(h, h->cur_pic_ptr->field_poc, &h->cur_pic_ptr->poc); if (h->pps.redundant_pic_cnt_present) h->redundant_pic_count = get_ue_golomb(&h->gb); ret = ff_set_ref_count(h); if (ret < 0) return ret; if (slice_type != AV_PICTURE_TYPE_I && (h0->current_slice == 0 || slice_type != h0->last_slice_type || memcmp(h0->last_ref_count, h0->ref_count, sizeof(h0->ref_count)))) { ff_h264_fill_default_ref_list(h); } if (h->slice_type_nos != AV_PICTURE_TYPE_I) { ret = ff_h264_decode_ref_pic_list_reordering(h); if (ret < 0) { h->ref_count[1] = h->ref_count[0] = 0; return ret; } } if ((h->pps.weighted_pred && h->slice_type_nos == AV_PICTURE_TYPE_P) || (h->pps.weighted_bipred_idc == 1 && h->slice_type_nos == AV_PICTURE_TYPE_B)) ff_pred_weight_table(h); else if (h->pps.weighted_bipred_idc == 2 && h->slice_type_nos == AV_PICTURE_TYPE_B) { implicit_weight_table(h, -1); } else { h->use_weight = 0; for (i = 0; i < 2; i++) { h->luma_weight_flag[i] = 0; h->chroma_weight_flag[i] = 0; } } if (h->nal_ref_idc) { ret = ff_h264_decode_ref_pic_marking(h0, &h->gb, !(h->avctx->active_thread_type & FF_THREAD_FRAME) || h0->current_slice == 0); if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) return AVERROR_INVALIDDATA; } if (FRAME_MBAFF(h)) { ff_h264_fill_mbaff_ref_list(h); if (h->pps.weighted_bipred_idc == 2 && h->slice_type_nos == AV_PICTURE_TYPE_B) { implicit_weight_table(h, 0); implicit_weight_table(h, 1); } } if (h->slice_type_nos == AV_PICTURE_TYPE_B && !h->direct_spatial_mv_pred) ff_h264_direct_dist_scale_factor(h); ff_h264_direct_ref_list_init(h); if (h->slice_type_nos != AV_PICTURE_TYPE_I && h->pps.cabac) { tmp = get_ue_golomb_31(&h->gb); if (tmp > 2) { av_log(h->avctx, AV_LOG_ERROR, "cabac_init_idc %u overflow\n", tmp); return AVERROR_INVALIDDATA; } h->cabac_init_idc = tmp; } h->last_qscale_diff = 0; tmp = h->pps.init_qp + get_se_golomb(&h->gb); if (tmp > 51 + 6 * (h->sps.bit_depth_luma - 8)) { av_log(h->avctx, AV_LOG_ERROR, "QP %u out of range\n", tmp); return AVERROR_INVALIDDATA; } h->qscale = tmp; h->chroma_qp[0] = get_chroma_qp(h, 0, h->qscale); h->chroma_qp[1] = get_chroma_qp(h, 1, h->qscale); if (h->slice_type == AV_PICTURE_TYPE_SP) get_bits1(&h->gb); if (h->slice_type == AV_PICTURE_TYPE_SP || h->slice_type == AV_PICTURE_TYPE_SI) get_se_golomb(&h->gb); h->deblocking_filter = 1; h->slice_alpha_c0_offset = 0; h->slice_beta_offset = 0; if (h->pps.deblocking_filter_parameters_present) { tmp = get_ue_golomb_31(&h->gb); if (tmp > 2) { av_log(h->avctx, AV_LOG_ERROR, "deblocking_filter_idc %u out of range\n", tmp); return AVERROR_INVALIDDATA; } h->deblocking_filter = tmp; if (h->deblocking_filter < 2) h->deblocking_filter ^= 1; if (h->deblocking_filter) { h->slice_alpha_c0_offset = get_se_golomb(&h->gb) * 2; h->slice_beta_offset = get_se_golomb(&h->gb) * 2; if (h->slice_alpha_c0_offset > 12 || h->slice_alpha_c0_offset < -12 || h->slice_beta_offset > 12 || h->slice_beta_offset < -12) { av_log(h->avctx, AV_LOG_ERROR, "deblocking filter parameters %d %d out of range\n", h->slice_alpha_c0_offset, h->slice_beta_offset); return AVERROR_INVALIDDATA; } } } if (h->avctx->skip_loop_filter >= AVDISCARD_ALL || (h->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->nal_unit_type != NAL_IDR_SLICE) || (h->avctx->skip_loop_filter >= AVDISCARD_NONINTRA && h->slice_type_nos != AV_PICTURE_TYPE_I) || (h->avctx->skip_loop_filter >= AVDISCARD_BIDIR && h->slice_type_nos == AV_PICTURE_TYPE_B) || (h->avctx->skip_loop_filter >= AVDISCARD_NONREF && h->nal_ref_idc == 0)) h->deblocking_filter = 0; if (h->deblocking_filter == 1 && h0->max_contexts > 1) { if (h->avctx->flags2 & CODEC_FLAG2_FAST) { h->deblocking_filter = 2; } else { h0->max_contexts = 1; if (!h0->single_decode_warning) { av_log(h->avctx, AV_LOG_INFO, "Cannot parallelize deblocking type 1, decoding such frames in sequential order\n"); h0->single_decode_warning = 1; } if (h != h0) { av_log(h->avctx, AV_LOG_ERROR, "Deblocking switched inside frame.\n"); return SLICE_SINGLETHREAD; } } } h->qp_thresh = 15 - FFMIN(h->slice_alpha_c0_offset, h->slice_beta_offset) - FFMAX3(0, h->pps.chroma_qp_index_offset[0], h->pps.chroma_qp_index_offset[1]) + 6 * (h->sps.bit_depth_luma - 8); h0->last_slice_type = slice_type; memcpy(h0->last_ref_count, h0->ref_count, sizeof(h0->last_ref_count)); h->slice_num = ++h0->current_slice; if (h->slice_num) h0->slice_row[(h->slice_num-1)&(MAX_SLICES-1)]= h->resync_mb_y; if ( h0->slice_row[h->slice_num&(MAX_SLICES-1)] + 3 >= h->resync_mb_y && h0->slice_row[h->slice_num&(MAX_SLICES-1)] <= h->resync_mb_y && h->slice_num >= MAX_SLICES) { av_log(h->avctx, AV_LOG_WARNING, "Possibly too many slices (%d >= %d), increase MAX_SLICES and recompile if there are artifacts\n", h->slice_num, MAX_SLICES); } for (j = 0; j < 2; j++) { int id_list[16]; int *ref2frm = h->ref2frm[h->slice_num & (MAX_SLICES - 1)][j]; for (i = 0; i < 16; i++) { id_list[i] = 60; if (j < h->list_count && i < h->ref_count[j] && h->ref_list[j][i].f.buf[0]) { int k; AVBuffer *buf = h->ref_list[j][i].f.buf[0]->buffer; for (k = 0; k < h->short_ref_count; k++) if (h->short_ref[k]->f.buf[0]->buffer == buf) { id_list[i] = k; break; } for (k = 0; k < h->long_ref_count; k++) if (h->long_ref[k] && h->long_ref[k]->f.buf[0]->buffer == buf) { id_list[i] = h->short_ref_count + k; break; } } } ref2frm[0] = ref2frm[1] = -1; for (i = 0; i < 16; i++) ref2frm[i + 2] = 4 * id_list[i] + (h->ref_list[j][i].reference & 3); ref2frm[18 + 0] = ref2frm[18 + 1] = -1; for (i = 16; i < 48; i++) ref2frm[i + 4] = 4 * id_list[(i - 16) >> 1] + (h->ref_list[j][i].reference & 3); } if (h->ref_count[0]) ff_h264_set_erpic(&h->er.last_pic, &h->ref_list[0][0]); if (h->ref_count[1]) ff_h264_set_erpic(&h->er.next_pic, &h->ref_list[1][0]); h->er.ref_count = h->ref_count[0]; h0->au_pps_id = pps_id; h->sps.new = h0->sps_buffers[h->pps.sps_id]->new = 0; h->current_sps_id = h->pps.sps_id; if (h->avctx->debug & FF_DEBUG_PICT_INFO) { av_log(h->avctx, AV_LOG_DEBUG, "slice:%d %s mb:%d %c%s%s pps:%u frame:%d poc:%d/%d ref:%d/%d qp:%d loop:%d:%d:%d weight:%d%s %s\n", h->slice_num, (h->picture_structure == PICT_FRAME ? "F" : h->picture_structure == PICT_TOP_FIELD ? "T" : "B"), first_mb_in_slice, av_get_picture_type_char(h->slice_type), h->slice_type_fixed ? " fix" : "", h->nal_unit_type == NAL_IDR_SLICE ? " IDR" : "", pps_id, h->frame_num, h->cur_pic_ptr->field_poc[0], h->cur_pic_ptr->field_poc[1], h->ref_count[0], h->ref_count[1], h->qscale, h->deblocking_filter, h->slice_alpha_c0_offset, h->slice_beta_offset, h->use_weight, h->use_weight == 1 && h->use_weight_chroma ? "c" : "", h->slice_type == AV_PICTURE_TYPE_B ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : ""); } return 0; }
1threat
static int mpeg1_decode_picture(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { Mpeg1Context *s1 = avctx->priv_data; MpegEncContext *s = &s1->mpeg_enc_ctx; int ref, f_code, vbv_delay; init_get_bits(&s->gb, buf, buf_size * 8); ref = get_bits(&s->gb, 10); s->pict_type = get_bits(&s->gb, 3); if (s->pict_type == 0 || s->pict_type > 3) return -1; vbv_delay = get_bits(&s->gb, 16); if (s->pict_type == AV_PICTURE_TYPE_P || s->pict_type == AV_PICTURE_TYPE_B) { s->full_pel[0] = get_bits1(&s->gb); f_code = get_bits(&s->gb, 3); if (f_code == 0 && (avctx->err_recognition & AV_EF_BITSTREAM)) return -1; s->mpeg_f_code[0][0] = f_code; s->mpeg_f_code[0][1] = f_code; } if (s->pict_type == AV_PICTURE_TYPE_B) { s->full_pel[1] = get_bits1(&s->gb); f_code = get_bits(&s->gb, 3); if (f_code == 0 && (avctx->err_recognition & AV_EF_BITSTREAM)) return -1; s->mpeg_f_code[1][0] = f_code; s->mpeg_f_code[1][1] = f_code; } s->current_picture.f.pict_type = s->pict_type; s->current_picture.f.key_frame = s->pict_type == AV_PICTURE_TYPE_I; if (avctx->debug & FF_DEBUG_PICT_INFO) av_log(avctx, AV_LOG_DEBUG, "vbv_delay %d, ref %d type:%d\n", vbv_delay, ref, s->pict_type); s->y_dc_scale = 8; s->c_dc_scale = 8; return 0; }
1threat
How to get float by integer / integer C lang : <p>I wanna get 1.666667 by dividing 2*n+1 by 3 (n=2). and it always creates 1.000000 but i want 1.666667. I tried printing (2*n+1)/3 as a float but it doesn't work.</p>
0debug
Flask-RESTful vs Flask-RESTplus : <p>Other than the ability to automatically generate an interactive documentation for our API using Swagger UI, are there any real advantages of using <a href="http://flask-restplus.readthedocs.io/en/stable/">Flask-RESTplus</a> over <a href="http://flask-restful.readthedocs.io/en/0.3.5/">Flask-RESTful</a>?</p>
0debug
finding the index based on two data frames of strings : One of my data look like this O75663 O95456 O75663 O95456 O95400 O95670 O95400 O95670 O95433 O95433 O95801 O95456 P00352 O95670 My second data looks like this O75663 O95400 O95433 O95456 O95670 O95801 P00352 P00492 I want to know each string from second data is seen in which columns of the first data. it might never be seen or seen several time. I want the output to look like the following strings column ids O75663 1, 3 O95400 1, 3 O95433 1, 3 O95456 2, 3, 4 O95670 2, 3, 4 O95801 4 P00352 4 P00492 NA
0debug
Regular expression : <p>I want regex to match Google.com to apple.com YouTube.com but not admin.google.com payment.apple.com admingoogle.com student.google.admin.co.in etc</p>
0debug
Why is my operater "<" undefined for the argument type(s) boolean, int : <p>If the input is between a certain value I want the formula to be different than when the input falls between another range. However, when I write my if statement, I am getting an error that states "The operator &lt; is undefined for the argument type(s) boolean, int".</p> <p>import java.util.Scanner;</p> <p>public class jOne {</p> <pre><code>public static void main(String[] args) { System.out.println("Enter daytime minutes:"); Scanner a = new Scanner(System.in); String daytime = a.nextLine(); double daytime1 = Integer.parseInt(daytime); System.out.println("Enter evening minutes:"); Scanner b = new Scanner(System.in); String evening = b.nextLine(); Integer.parseInt(evening); double evening1 = Integer.parseInt(evening); System.out.println("Enter weekend minutes:"); Scanner c = new Scanner(System.in); String weekend = c.nextLine(); Integer.parseInt(weekend); double weekend1 = Integer.parseInt(weekend); if (0 &lt; daytime1 &lt; 100) { double PlanA = (((daytime1 - 100)) + (evening1 * 0.15)+(weekend1 * 0.20)); double PlanB = (((daytime1 - 250)) + (evening1 * 0.35)+(weekend1 * 0.25)); } else if (100 &lt; daytime1 &lt; 250) { double PlanA = (((daytime1 - 100)*0.25) + (evening1 * 0.15)+(weekend1 * 0.20)); double PlanB = (((daytime1 - 250)) + (evening1 * 0.35)+(weekend1 * 0.25)); } else if (daytime1 &gt; 250) { double PlanA = (((daytime1 - 100)*0.25) + (evening1 * 0.15)+(weekend1 * 0.20)); double PlanB = (((daytime1 - 250)*0.45) + (evening1 * 0.35)+(weekend1 * 0.25)); } </code></pre>
0debug
how do i updated multiple records column value of based selected id : In products table i have fields like id product_name product_value quantity status 1 abc 10000 50 received 2 efg 5000 15 shipment 3 hij 850 100 received 4 klm 7000 20 shipment 5 nop 350 50 received I can select multiple rows at a time.And here i selected id=2,4 and need to change the status='received'. How to do multiple update at single time in rails
0debug
static void create_cpu(const char *cpu_model, qemu_irq *cbus_irq, qemu_irq *i8259_irq) { CPUMIPSState *env; MIPSCPU *cpu; int i; if (cpu_model == NULL) { #ifdef TARGET_MIPS64 cpu_model = "20Kc"; #else cpu_model = "24Kf"; #endif } for (i = 0; i < smp_cpus; i++) { cpu = cpu_mips_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } env = &cpu->env; cpu_mips_irq_init_cpu(env); cpu_mips_clock_init(env); qemu_register_reset(main_cpu_reset, cpu); } cpu = MIPS_CPU(first_cpu); env = &cpu->env; *i8259_irq = env->irq[2]; *cbus_irq = env->irq[4]; }
1threat
static inline void RENAME(rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size) { const uint8_t *s = src; const uint8_t *end; #if COMPILE_TEMPLATE_MMX const uint8_t *mm_end; #endif uint16_t *d = (uint16_t *)dst; end = s + src_size; #if COMPILE_TEMPLATE_MMX __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm__ volatile( "movq %0, %%mm7 \n\t" "movq %1, %%mm6 \n\t" ::"m"(red_16mask),"m"(green_16mask)); mm_end = end - 11; while (s < mm_end) { __asm__ volatile( PREFETCH" 32%1 \n\t" "movd %1, %%mm0 \n\t" "movd 3%1, %%mm3 \n\t" "punpckldq 6%1, %%mm0 \n\t" "punpckldq 9%1, %%mm3 \n\t" "movq %%mm0, %%mm1 \n\t" "movq %%mm0, %%mm2 \n\t" "movq %%mm3, %%mm4 \n\t" "movq %%mm3, %%mm5 \n\t" "psrlq $3, %%mm0 \n\t" "psrlq $3, %%mm3 \n\t" "pand %2, %%mm0 \n\t" "pand %2, %%mm3 \n\t" "psrlq $5, %%mm1 \n\t" "psrlq $5, %%mm4 \n\t" "pand %%mm6, %%mm1 \n\t" "pand %%mm6, %%mm4 \n\t" "psrlq $8, %%mm2 \n\t" "psrlq $8, %%mm5 \n\t" "pand %%mm7, %%mm2 \n\t" "pand %%mm7, %%mm5 \n\t" "por %%mm1, %%mm0 \n\t" "por %%mm4, %%mm3 \n\t" "por %%mm2, %%mm0 \n\t" "por %%mm5, %%mm3 \n\t" "psllq $16, %%mm3 \n\t" "por %%mm3, %%mm0 \n\t" MOVNTQ" %%mm0, %0 \n\t" :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory"); d += 4; s += 12; } __asm__ volatile(SFENCE:::"memory"); __asm__ volatile(EMMS:::"memory"); #endif while (s < end) { const int b = *s++; const int g = *s++; const int r = *s++; *d++ = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8); } }
1threat
static int asf_read_stream_properties(AVFormatContext *s, const GUIDParseTable *g) { ASFContext *asf = s->priv_data; AVIOContext *pb = s->pb; uint64_t size; uint32_t err_data_len, ts_data_len; uint16_t flags; ff_asf_guid stream_type; enum AVMediaType type; int i, ret; uint8_t stream_index; AVStream *st; ASFStream *asf_st; if (asf->nb_streams >= ASF_MAX_STREAMS) return AVERROR_INVALIDDATA; size = avio_rl64(pb); ff_get_guid(pb, &stream_type); if (!ff_guidcmp(&stream_type, &ff_asf_audio_stream)) type = AVMEDIA_TYPE_AUDIO; else if (!ff_guidcmp(&stream_type, &ff_asf_video_stream)) type = AVMEDIA_TYPE_VIDEO; else if (!ff_guidcmp(&stream_type, &ff_asf_jfif_media)) type = AVMEDIA_TYPE_VIDEO; else if (!ff_guidcmp(&stream_type, &ff_asf_command_stream)) type = AVMEDIA_TYPE_DATA; else if (!ff_guidcmp(&stream_type, &ff_asf_ext_stream_embed_stream_header)) type = AVMEDIA_TYPE_UNKNOWN; else return AVERROR_INVALIDDATA; ff_get_guid(pb, &stream_type); avio_skip(pb, 8); ts_data_len = avio_rl32(pb); err_data_len = avio_rl32(pb); flags = avio_rl16(pb); stream_index = flags & ASF_STREAM_NUM; for (i = 0; i < asf->nb_streams; i++) if (stream_index == asf->asf_st[i]->stream_index) { av_log(s, AV_LOG_WARNING, "Duplicate stream found, this stream will be ignored.\n"); align_position(pb, asf->offset, size); return 0; } st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); avpriv_set_pts_info(st, 32, 1, 1000); st->codec->codec_type = type; asf->asf_st[asf->nb_streams] = av_mallocz(sizeof(*asf_st)); if (!asf->asf_st[asf->nb_streams]) return AVERROR(ENOMEM); asf_st = asf->asf_st[asf->nb_streams]; asf_st->stream_index = stream_index; asf_st->index = st->index; asf_st->indexed = 0; st->id = flags & ASF_STREAM_NUM; av_init_packet(&asf_st->pkt.avpkt); asf_st->pkt.data_size = 0; avio_skip(pb, 4); switch (type) { case AVMEDIA_TYPE_AUDIO: asf_st->type = AVMEDIA_TYPE_AUDIO; if ((ret = ff_get_wav_header(s, pb, st->codec, ts_data_len)) < 0) return ret; break; case AVMEDIA_TYPE_VIDEO: asf_st->type = AVMEDIA_TYPE_VIDEO; if ((ret = parse_video_info(pb, st)) < 0) return ret; break; default: avio_skip(pb, ts_data_len); break; } if (err_data_len) { if (type == AVMEDIA_TYPE_AUDIO) { uint8_t span = avio_r8(pb); if (span > 1) { asf_st->span = span; asf_st->virtual_pkt_len = avio_rl16(pb); asf_st->virtual_chunk_len = avio_rl16(pb); if (!asf_st->virtual_chunk_len || !asf_st->virtual_pkt_len) return AVERROR_INVALIDDATA; avio_skip(pb, err_data_len - 5); } else avio_skip(pb, err_data_len - 1); } else avio_skip(pb, err_data_len); } asf->nb_streams++; align_position(pb, asf->offset, size); return 0; }
1threat
how can i produce this json object in php mysqli : { "name": "Top Node", "children": [ { "name": "Bob: Child of Top Node", "parent": "Top Node", "children": [ { "name": "Son of Bob", "parent": "Bob: Child of Top Node" }, { "name": "Daughter of Bob", "parent": "Bob: Child of Top Node" } ] }, { "name": "Sally: Child of Top Node", "parent": "Top Node" } ] }
0debug
Why does my keras LSTM model get stuck in an infinite loop? : <p>I am trying to build a small LSTM that can learn to write code (even if it's garbage code) by training it on existing Python code. I have concatenated a few thousand lines of code together in one file across several hundred files, with each file ending in <code>&lt;eos&gt;</code> to signify "end of sequence".</p> <p>As an example, my training file looks like:</p> <pre><code> setup(name='Keras', ... ], packages=find_packages()) &lt;eos&gt; import pyux ... with open('api.json', 'w') as f: json.dump(sign, f) &lt;eos&gt; </code></pre> <p>I am creating tokens from the words with:</p> <pre><code>file = open(self.textfile, 'r') filecontents = file.read() file.close() filecontents = filecontents.replace("\n\n", "\n") filecontents = filecontents.replace('\n', ' \n ') filecontents = filecontents.replace(' ', ' \t ') text_in_words = [w for w in filecontents.split(' ') if w != ''] self._words = set(text_in_words) STEP = 1 self._codelines = [] self._next_words = [] for i in range(0, len(text_in_words) - self.seq_length, STEP): self._codelines.append(text_in_words[i: i + self.seq_length]) self._next_words.append(text_in_words[i + self.seq_length]) </code></pre> <p>My <code>keras</code> model is:</p> <pre><code>model = Sequential() model.add(Embedding(input_dim=len(self._words), output_dim=1024)) model.add(Bidirectional( LSTM(128), input_shape=(self.seq_length, len(self._words)))) model.add(Dropout(rate=0.5)) model.add(Dense(len(self._words))) model.add(Activation('softmax')) model.compile(loss='sparse_categorical_crossentropy', optimizer="adam", metrics=['accuracy']) </code></pre> <p>But no matter how much I train it, the model never seems to generate <code>&lt;eos&gt;</code> or even <code>\n</code>. I think it might be because my LSTM size is <code>128</code> and my <code>seq_length</code> is 200, but that doesn't quite make sense? Is there something I'm missing?</p>
0debug
is there any possible way to change the style using css only but not using any pseudo classes? : `<ul> <li>number 1</li> <li>number 2</li> <li>number 3</li> <li>number 4</li> <li>number 5</li> <li>number 6</li> <li>number 7</li> <li>number 8</li> <li>number 9</li> <li>number n</li> </ul>` this is my html and i don't know how many **'li'** is there now i want to give style to first and the last **'li'** but **without** using any **pseudo class** like first-child last-child last-type-of etc and i don't want to use any attribute in html not class also and **not using any javascript code nor jquery no code**. Just using css is there any possible way to do this?
0debug
Cloudformation Cognito - how to setup App Client Settings, Domain, and Federated Identities via SAM template : <p>I already have my cognito user pool cloudformation template working, and have it integrated to my api gateway. But somehow i still have to manually configure the app client settings, domain, and federated identities to have a working login portal for the users. I have been looking here and there for possible solutions in automating these, but i cannot seem to find anything close to it.</p> <p>I would like to automate the configuration of the app client settings, domain, and federated identities via cloudformation sam template so i do not have to do these manually.</p> <p>Any suggestions are much appreciated. Thank you.</p> <p>(attachments posted for additional info)</p> <ul> <li><a href="https://i.stack.imgur.com/I7NSt.png" rel="noreferrer">https://i.stack.imgur.com/I7NSt.png</a></li> <li><a href="https://i.stack.imgur.com/ZbiTI.png" rel="noreferrer">https://i.stack.imgur.com/ZbiTI.png</a></li> <li><a href="https://i.stack.imgur.com/F8rfH.png" rel="noreferrer">https://i.stack.imgur.com/F8rfH.png</a></li> </ul>
0debug
find number of paths (ending at leaves) where the sum of the elements in the path is equal to the number passed : <p>Given a binary tree you need to find number of paths (ending at leaves) where the sum of the elements in the path is equal to the number passed.</p> <p>Getting Error in my code .</p> <p>E.g. if tree is 10 5 12 4 7 and number passed is 22</p> <p>than we have two paths 10->5->7 and 10->12 where the sum is 22. So, the answer is 2.</p> <p>E.g. if tree is 10 5 12 4 7 1 3 and number passed is 22</p> <p>than we have only one path 10->5->7 as 12 is not a leaf node and adding 1 or 3 increases the value above 22. So, the answer is 1. </p> <p>// Java program to print to print root to leaf path sum equal to // a given number</p> <p>/* A binary tree node has data, pointer to left child and a pointer to right child */</p> <pre><code>class Node { int data; Node left, right; Node(int item) { data = item; left = right = null; } } class BinaryTree { int count =0; Node root; /* Given a tree and a sum, return true if there is a path from the root down to a leaf, such that adding up all the values along the path equals the given sum. Strategy: subtract the node value from the sum when recurring down, and check to see if the sum is 0 when you run out of tree. */ int haspathSum(Node node, int sum) { if (node == null) { return (count=0); } else { /* otherwise check both subtrees */ int subsum = sum - node.data; if (subsum == 0 &amp;&amp; node.left == null &amp;&amp; node.right == null) count = count + 1; //return count; if node.left haspathSum(node.left, subsum); //return count; if (node.right) haspathSum(node.right, subsum); return count; } } /* Driver program to test the above functions */ public static void main(String args[]) { int sum = 22; /* Constructed binary tree is 10 / \ 8 2 / \ / 3 5 2 */ BinaryTree tree = new BinaryTree(); tree.root = new Node(10); tree.root.left = new Node(5); tree.root.right = new Node(12); tree.root.left.left = new Node(4); tree.root.left.right = new Node(7); //tree.root.right.left = new Node(2); // BinaryTree ch = new BinaryTree(); System.out.println("count = " +tree.haspathSum(tree.root,sum)); } } </code></pre> <p>Error :--</p> <pre><code>46: error: incompatible types: Node cannot be converted to boolean if (node.left) ^ 49: error: incompatible types: Node cannot be converted to boolean if (node.right) ^ 2 errors </code></pre>
0debug
How do I add sass-lint to my angular-cli.json file? : <p>I'm using this seed app: <a href="https://github.com/2sic/app-tutorial-angular4-hello-dnn" rel="noreferrer">https://github.com/2sic/app-tutorial-angular4-hello-dnn</a></p> <p>I've installed sass-lint: <a href="https://www.npmjs.com/package/sass-lint" rel="noreferrer">https://www.npmjs.com/package/sass-lint</a></p> <p>But not sure how to add this to my angular-cli.json file.</p> <p>I've using <strong>angular version 4</strong>, <strong>webpack</strong>, with <strong>typescript</strong> and <strong>sass</strong> for this example.</p> <p>I've added a "sass-lint.yml" file to my root with the default settings.</p> <p><strong>This is my angular-cli.json file:</strong></p> <pre><code>{ "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "project": { "name": "my-app" }, "apps": [ { "root": "src", "outDir": "dist", "assets": [ "assets", "favicon.ico" ], "index": "index.html", "main": "main.ts", "polyfills": "polyfills.ts", "test": "test.ts", "tsconfig": "tsconfig.app.json", "testTsconfig": "tsconfig.spec.json", "prefix": "app", "styles": [ "styles.scss" ], "scripts": [ "../node_modules/lodash/lodash.js" ], "environmentSource": "environments/environment.ts", "environments": { "dev": "environments/environment.ts", "prod": "environments/environment.prod.ts" } } ], "e2e": { "protractor": { "config": "./protractor.conf.js" } }, "lint": [ { "project": "src/tsconfig.app.json" }, { "project": "src/tsconfig.spec.json" }, { "project": "e2e/tsconfig.e2e.json" } ], "test": { "karma": { "config": "./karma.conf.js" } }, "defaults": { "styleExt": "scss", "component": { } } } </code></pre>
0debug
Disable or stop blocking content in Objective-C : <p>Is it possible to stop or disable a content blocker from an app without using the safari section in the settings app?</p>
0debug
Ignoring an error message to continue with the loop in python : <p>I am using a Python script for executing some function in Abaqus. Now, after running for some iterations Abaqus is exiting the script due to an error.</p> <p>Is it possible in Python to bypass the error and continue with the other iterations?</p> <p>The error message is </p> <pre><code>#* The extrude direction must be approximately orthogonal #* to the plane containing the edges being extruded. </code></pre> <p>The error comes out for some of the iterations, I am looking for a way to ignore the errors and continue with the loop whenever such error is encountered.</p> <p>The for loop is as given;</p> <pre><code>for i in xrange(0,960): p = mdb.models['Model-1'].parts['Part-1'] c = p.cells pickedCells = c.getSequenceFromMask(mask=('[#1 ]', ), ) e, d1 = p.edges, p.datums pickedEdges =(e[i], ) p.PartitionCellByExtrudeEdge(line=d1[3], cells=pickedCells, edges=pickedEdges, sense=REVERSE) </code></pre> <p>Is this doable? Thanks!</p>
0debug
static inline void helper_ret_protected(CPUX86State *env, int shift, int is_iret, int addend) { uint32_t new_cs, new_eflags, new_ss; uint32_t new_es, new_ds, new_fs, new_gs; uint32_t e1, e2, ss_e1, ss_e2; int cpl, dpl, rpl, eflags_mask, iopl; target_ulong ssp, sp, new_eip, new_esp, sp_mask; #ifdef TARGET_X86_64 if (shift == 2) { sp_mask = -1; } else #endif { sp_mask = get_sp_mask(env->segs[R_SS].flags); } sp = env->regs[R_ESP]; ssp = env->segs[R_SS].base; new_eflags = 0; #ifdef TARGET_X86_64 if (shift == 2) { POPQ(sp, new_eip); POPQ(sp, new_cs); new_cs &= 0xffff; if (is_iret) { POPQ(sp, new_eflags); } } else #endif { if (shift == 1) { POPL(ssp, sp, sp_mask, new_eip); POPL(ssp, sp, sp_mask, new_cs); new_cs &= 0xffff; if (is_iret) { POPL(ssp, sp, sp_mask, new_eflags); if (new_eflags & VM_MASK) { goto return_to_vm86; } } } else { POPW(ssp, sp, sp_mask, new_eip); POPW(ssp, sp, sp_mask, new_cs); if (is_iret) { POPW(ssp, sp, sp_mask, new_eflags); } } } LOG_PCALL("lret new %04x:" TARGET_FMT_lx " s=%d addend=0x%x\n", new_cs, new_eip, shift, addend); LOG_PCALL_STATE(CPU(x86_env_get_cpu(env))); if ((new_cs & 0xfffc) == 0) { raise_exception_err(env, EXCP0D_GPF, new_cs & 0xfffc); } if (load_segment(env, &e1, &e2, new_cs) != 0) { raise_exception_err(env, EXCP0D_GPF, new_cs & 0xfffc); } if (!(e2 & DESC_S_MASK) || !(e2 & DESC_CS_MASK)) { raise_exception_err(env, EXCP0D_GPF, new_cs & 0xfffc); } cpl = env->hflags & HF_CPL_MASK; rpl = new_cs & 3; if (rpl < cpl) { raise_exception_err(env, EXCP0D_GPF, new_cs & 0xfffc); } dpl = (e2 >> DESC_DPL_SHIFT) & 3; if (e2 & DESC_C_MASK) { if (dpl > rpl) { raise_exception_err(env, EXCP0D_GPF, new_cs & 0xfffc); } } else { if (dpl != rpl) { raise_exception_err(env, EXCP0D_GPF, new_cs & 0xfffc); } } if (!(e2 & DESC_P_MASK)) { raise_exception_err(env, EXCP0B_NOSEG, new_cs & 0xfffc); } sp += addend; if (rpl == cpl && (!(env->hflags & HF_CS64_MASK) || ((env->hflags & HF_CS64_MASK) && !is_iret))) { cpu_x86_load_seg_cache(env, R_CS, new_cs, get_seg_base(e1, e2), get_seg_limit(e1, e2), e2); } else { #ifdef TARGET_X86_64 if (shift == 2) { POPQ(sp, new_esp); POPQ(sp, new_ss); new_ss &= 0xffff; } else #endif { if (shift == 1) { POPL(ssp, sp, sp_mask, new_esp); POPL(ssp, sp, sp_mask, new_ss); new_ss &= 0xffff; } else { POPW(ssp, sp, sp_mask, new_esp); POPW(ssp, sp, sp_mask, new_ss); } } LOG_PCALL("new ss:esp=%04x:" TARGET_FMT_lx "\n", new_ss, new_esp); if ((new_ss & 0xfffc) == 0) { #ifdef TARGET_X86_64 if ((env->hflags & HF_LMA_MASK) && rpl != 3) { cpu_x86_load_seg_cache(env, R_SS, new_ss, 0, 0xffffffff, DESC_G_MASK | DESC_B_MASK | DESC_P_MASK | DESC_S_MASK | (rpl << DESC_DPL_SHIFT) | DESC_W_MASK | DESC_A_MASK); ss_e2 = DESC_B_MASK; } else #endif { raise_exception_err(env, EXCP0D_GPF, 0); } } else { if ((new_ss & 3) != rpl) { raise_exception_err(env, EXCP0D_GPF, new_ss & 0xfffc); } if (load_segment(env, &ss_e1, &ss_e2, new_ss) != 0) { raise_exception_err(env, EXCP0D_GPF, new_ss & 0xfffc); } if (!(ss_e2 & DESC_S_MASK) || (ss_e2 & DESC_CS_MASK) || !(ss_e2 & DESC_W_MASK)) { raise_exception_err(env, EXCP0D_GPF, new_ss & 0xfffc); } dpl = (ss_e2 >> DESC_DPL_SHIFT) & 3; if (dpl != rpl) { raise_exception_err(env, EXCP0D_GPF, new_ss & 0xfffc); } if (!(ss_e2 & DESC_P_MASK)) { raise_exception_err(env, EXCP0B_NOSEG, new_ss & 0xfffc); } cpu_x86_load_seg_cache(env, R_SS, new_ss, get_seg_base(ss_e1, ss_e2), get_seg_limit(ss_e1, ss_e2), ss_e2); } cpu_x86_load_seg_cache(env, R_CS, new_cs, get_seg_base(e1, e2), get_seg_limit(e1, e2), e2); cpu_x86_set_cpl(env, rpl); sp = new_esp; #ifdef TARGET_X86_64 if (env->hflags & HF_CS64_MASK) { sp_mask = -1; } else #endif { sp_mask = get_sp_mask(ss_e2); } validate_seg(env, R_ES, rpl); validate_seg(env, R_DS, rpl); validate_seg(env, R_FS, rpl); validate_seg(env, R_GS, rpl); sp += addend; } SET_ESP(sp, sp_mask); env->eip = new_eip; if (is_iret) { eflags_mask = TF_MASK | AC_MASK | ID_MASK | RF_MASK | NT_MASK; if (cpl == 0) { eflags_mask |= IOPL_MASK; } iopl = (env->eflags >> IOPL_SHIFT) & 3; if (cpl <= iopl) { eflags_mask |= IF_MASK; } if (shift == 0) { eflags_mask &= 0xffff; } cpu_load_eflags(env, new_eflags, eflags_mask); } return; return_to_vm86: POPL(ssp, sp, sp_mask, new_esp); POPL(ssp, sp, sp_mask, new_ss); POPL(ssp, sp, sp_mask, new_es); POPL(ssp, sp, sp_mask, new_ds); POPL(ssp, sp, sp_mask, new_fs); POPL(ssp, sp, sp_mask, new_gs); cpu_load_eflags(env, new_eflags, TF_MASK | AC_MASK | ID_MASK | IF_MASK | IOPL_MASK | VM_MASK | NT_MASK | VIF_MASK | VIP_MASK); load_seg_vm(env, R_CS, new_cs & 0xffff); cpu_x86_set_cpl(env, 3); load_seg_vm(env, R_SS, new_ss & 0xffff); load_seg_vm(env, R_ES, new_es & 0xffff); load_seg_vm(env, R_DS, new_ds & 0xffff); load_seg_vm(env, R_FS, new_fs & 0xffff); load_seg_vm(env, R_GS, new_gs & 0xffff); env->eip = new_eip & 0xffff; env->regs[R_ESP] = new_esp; }
1threat
Why use the new Android feature plugin over the library plugin? : <p>Android recently came out with a new <code>com.android.feature</code> plugin to be used to split up applications into features for the new Instant apps. It seems to be an architecture they are recommending in general, not just for features you are splitting up for instant apps. You can do some reading about it's usage <a href="https://developer.android.com/topic/instant-apps/getting-started/structure.html" rel="noreferrer">here</a>.</p> <p>What I'm failing to understand is what this plugin actually does better / differently than the normal <code>android-library</code> plugin. I ask, because my team is legitimately considering splitting up our code into feature modules, for reasons that have nothing to do with Android instant apps, and I'm not understanding what the benefit to using the <code>com.android.feature</code> plugin is.</p>
0debug
def frequency(a,x): count = 0 for i in a: if i == x: count += 1 return count
0debug
How to make my website load faster built with laravel vue js : <p>so I just got hired , and I was giving the task of optimizing a new site they want to launch soon , <a href="https://bizguruh.com" rel="nofollow noreferrer">https://bizguruh.com</a> , so far I have tried everything I can,reduced image size, but it doesn't seem to be helping , any ideas from anyone would be greatly appreciated please </p>
0debug
python TypeError when using OptionMenu Tkinter : <p>ive currently been trying to build a GUI application in Tkinter that takes user input from an Entry and subsiquently populate a drop down menu. The probelm is that the OptionMenu keeps throwing: </p> <pre><code>Traceback (most recent call last): File "C:/Python34/food2GUIree.py", line 70, in &lt;module&gt; mealOneButton = Button(root, text = "query database", command = GetEntry(mealOneString)) File "C:/Python34/food2GUIree.py", line 68, in GetEntry meal = OptionMenu(root, '', *getMeal).pack() TypeError: __init__() missing 1 required positional argument: 'value' </code></pre> <p>when i replace getMeal in:</p> <pre><code>def GetEntry(x): formatted = x.get().split()##gets the entry and forms a list getMeal = CsvLoadSearch(u, formatted) meal = OptionMenu(root, '', *getMeal).pack() </code></pre> <p>with list = [1,2,3,4] or any other list it works fine. why is this?</p> <p>bellow is the complete program:</p> <pre><code>from tkinter import * from tkinter import ttk import csv import os u = "C:\\Users\\luke daniels\\Documents\\fooddata.csv" """ Loads csv and compares elements from foodList with current row. returns a list of rows that match elements in foodList. """ def CsvLoadSearch(u, foodList): results = [] inputfile = open(u) for row in csv.reader(inputfile): for food in foodList: if food in row[0]: results.append(row[0]) ##print(row) return results root = Tk() root.title("MacroCalc") caloriesAim = StringVar() protien = StringVar() fat = StringVar() carbs = StringVar() mealOneString = StringVar() mealTwoString = StringVar() mealThreeString = StringVar() mealFourString = StringVar() mealFiveString = StringVar() mealSixString = StringVar() mealOneKeyword = Entry(root, textvariable = mealOneString) mealTwoKeyword = Entry(root, textvariable = mealTwoString) mealThreeKeyword = Entry(root, textvariable = mealThreeString) mealFourKeyword = Entry(root, textvariable = mealFourString) mealFiveKeyword = Entry(root, textvariable = mealFiveString) mealSixKeyword = Entry(root, textvariable = mealSixString) mealLabel = Label(root,text = "meals") mealLabel.config(font=("Courier", 30)) mealLabel.pack() mealLone = Label(root,text = "meal one") mealLtwo = Label(root,text = "meal two") mealLthree = Label(root,text = "meal three") mealLfour = Label(root,text = "meal four") mealLfive = Label(root,text = "meal five") mealLsix = Label(root,text = "meal six") caloriesLabel = Label(root,text = "calories needed").pack() calories = Text(root, height = 1, width = 10).pack() protienLabel= Label(root,text = "protien ratio").pack() protien = Text(root, height = 1, width = 4).pack() carbsLabel = Label(root,text = "carbohydrate ratio").pack() carbs = Text(root, height = 1, width = 4).pack() fatsLabel = Label(root,text = "fats ratio").pack() fats = Text(root, height = 1, width = 4).pack() displayText = Text(root).pack(side = RIGHT) def GetEntry(x): formatted = x.get().split()##gets the entry and forms a list getMeal = CsvLoadSearch(u, formatted) meal = OptionMenu(root, '', *getMeal).pack() mealOneButton = Button(root, text = "query database", command = GetEntry(mealOneString)) mealTwoButton = Button(root, text = "query database", command = GetEntry(mealTwoString)) mealThreeButton = Button(root, text = "query database", command = GetEntry(mealThreeString)) mealFourButton = Button(root, text = "query database", command = GetEntry(mealFourString)) mealFiveButton = Button(root, text = "query database", command = GetEntry(mealFiveString)) mealSixButton = Button(root, text = "query database", command = GetEntry(mealSixString)) mealButtons = [mealOneButton, mealTwoButton, mealThreeButton, mealFourButton, mealFiveButton, mealSixButton] mealKeywords = [mealOneKeyword, mealTwoKeyword, mealThreeKeyword, mealFourKeyword, mealFiveKeyword, mealSixKeyword] mealLabels = [mealLone, mealLtwo, mealLthree, mealLfour, mealLfive, mealLsix] ##meals = [mealOne, mealTwo, mealThree, mealFour, mealFive, mealSix] ##packs the drop downs and respective lables i = 0 while i &lt; len(mealLabels): mealLabels[i].pack() mealKeywords[i].pack() mealButtons[i].pack() ##meal.pack() i = i + 1 root.mainloop() </code></pre>
0debug
C++ Easiest Way to sort and read this file? : <p>This file seems a bit... awkward to manage. I need to sort the file by the highest score and here is a small sample of the file at hand:</p> <pre><code>reece 0 john 5 alex 2 </code></pre> <p>Just a few bits of the data. Basically I need it sorted in the following arrangement and then wrote back to the original file:</p> <pre><code>john 5 alex 2 reece 0 </code></pre> <p>This also needs to be possible with an infinite amount of data (not inf but you understand what I mean). I have tried this:</p> <pre><code>void read() { vector&lt;string&gt; arr; string a, b; ifstream file1; file1.open("Scores.txt", ios::out); int count = 0; while (file1 &gt;&gt; a &gt;&gt; b) { string toVec = a + b; arr.push_back(toVec); count++; } for (int outLoop = 0; outLoop &lt; count; outLoop++) cout &lt;&lt; arr[outLoop]; } </code></pre> <p>Now this reads from the file and put them into a vector but I don't know what to do from that point. The cout just shows this:</p> <pre><code>reece0john5alex2 </code></pre> <p>How would I go about splitting that up and sorting it?</p>
0debug