problem
stringlengths
26
131k
labels
class label
2 classes
static av_cold int wmv2_decode_init(AVCodecContext *avctx){ Wmv2Context * const w= avctx->priv_data; if(avctx->idct_algo==FF_IDCT_AUTO){ avctx->idct_algo=FF_IDCT_WMV2; } if(ff_msmpeg4_decode_init(avctx) < 0) return -1; ff_wmv2_common_init(w); ff_intrax8_common_init(&w->x8,&w->s); return 0; }
1threat
Go type-error: struct does not implement interface : <pre><code>// BEGIN: external library type realX struct {} type realY struct {} func (realX) Do() realY { return realY{} } // END type A struct { a myX } type myY interface {} type myX interface { Do() myY } func foo (arg1 myY) { } func main() { foo(realY{}) x := A{realX{}} fmt.Println("Hello, playground") } </code></pre> <p>I get:</p> <pre><code>cannot use realX literal (type realX) as type myX in field value: realX does not implement myX (wrong type for Do method) have Do() realY want Do() myY </code></pre> <p>From the looks of it, realY implements myY, so why can't I do this? This is making it impossible to write mock unit tests cleanly.</p>
0debug
void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size) { RTPMuxContext *s = s1->priv_data; int len, max_packet_size; uint8_t *p; const int max_frames_per_packet = s->max_frames_per_packet ? s->max_frames_per_packet : 5; const int max_au_headers_size = 2 + 2 * max_frames_per_packet; if ((s1->streams[0]->codec->extradata_size) == 0) { size -= 7; buff += 7; } max_packet_size = s->max_payload_size - max_au_headers_size; len = (s->buf_ptr - s->buf); if ((s->num_frames == max_frames_per_packet) || (len && (len + size) > s->max_payload_size)) { int au_size = s->num_frames * 2; p = s->buf + max_au_headers_size - au_size - 2; if (p != s->buf) { memmove(p + 2, s->buf + 2, au_size); } p[0] = ((au_size * 8) & 0xFF) >> 8; p[1] = (au_size * 8) & 0xFF; ff_rtp_send_data(s1, p, s->buf_ptr - p, 1); s->num_frames = 0; } if (s->num_frames == 0) { s->buf_ptr = s->buf + max_au_headers_size; s->timestamp = s->cur_timestamp; } if (size <= max_packet_size) { p = s->buf + s->num_frames++ * 2 + 2; *p++ = size >> 5; *p = (size & 0x1F) << 3; memcpy(s->buf_ptr, buff, size); s->buf_ptr += size; } else { int au_size = size; max_packet_size = s->max_payload_size - 4; p = s->buf; p[0] = 0; p[1] = 16; while (size > 0) { len = FFMIN(size, max_packet_size); p[2] = au_size >> 5; p[3] = (au_size & 0x1F) << 3; memcpy(p + 4, buff, len); ff_rtp_send_data(s1, p, len + 4, len == size); size -= len; buff += len; } } }
1threat
Is there a resource to find websites to build for practice? : <p>I am lookimg for website ideas to build for my portfolio, is there any resources because i am not really a designer but need to build some for practice. Cheers Alex</p>
0debug
Bash issue with numbers in specific format : (Need in bash linux)I have a file with numbers like this 1.415949602 91.09582241 91.12042924 91.40270349 91.45625033 91.70150341 91.70174342 91.70660043 91.70966213 91.72597066 91.72876783 91.73986459 91.75429779 91.76781464 91.77196659 91.77299733 abcdefghij 91.7827827 91.78288651 91.7838959 91.7855 91.79080605 91.80103075 91.8050505 (1)1st I need to remove 91. from all numbers in the list (2)then need to delete all numbers which don't have length =10 (3)then need to delete all numbers which not start with 6 or 7 or 8 or 9 Any way possible I can do these 3 steps?
0debug
Is there a way to load async data on InitState method? : <p>I'm a looking for a way to load async data on InitState method, I need some data before build method runs. I'm using a GoogleAuth code, and I need to execute build method 'till a Stream runs.</p> <p>My initState method is:</p> <pre><code> @override void initState () { super.initState(); _googleSignIn.onCurrentUserChanged.listen((GoogleSignInAccount account) { setState(() { _currentUser = account; }); }); _googleSignIn.signInSilently(); } </code></pre> <p>I will appreciate any feedback.</p>
0debug
static int qio_dns_resolver_lookup_sync_nop(QIODNSResolver *resolver, SocketAddress *addr, size_t *naddrs, SocketAddress ***addrs, Error **errp) { *naddrs = 1; *addrs = g_new0(SocketAddress *, 1); (*addrs)[0] = QAPI_CLONE(SocketAddress, addr); return 0; }
1threat
I can't write regex : i would like to use regex in C #. My string should looks in this way: <0.0,100000.0> and I created regex var regexItem = new Regex(@"[<(]*[0-9][.]*[0-9][,]*[0-9][.]*[0-9][>)]$"); but this regex is accepting something like this <0,100000> Generally I want to have range where number needs to have decimal separator
0debug
void do_divduo (void) { if (likely((uint64_t)T1 != 0)) { xer_ov = 0; T0 = (uint64_t)T0 / (uint64_t)T1; } else { xer_so = 1; xer_ov = 1; T0 = 0; } }
1threat
Dynamic Compilation : I'll try to define as mush as possible my problem and forget nothing. For my project, which use a webRequest, I would like to compile dynamically my webRequest. For this I used the CodeDomProvider in a Private Assembly and a public MethodInfo who gives me back a " method" that I can use in my main program. So the main problem is that in my CompileCode, my MethodInfo method = type.getMethod(functionname); gives me a NullReferenceException error. I know it's because my type.getMethod(functionname) can't work on a type which is null. I tried to modify the fact that my object instance and Type type are not null, but I can't give them values because of their gender and I get stuck in the fact that they stay null and gives me no values... I also saw that lot of people used Linq, but as I am compiling a whole .cs file, I can't write it all like this with the @"using System.Linq;"; So here are the partial code were the problem is : Thank you namespace testCodeCompiler { public class CodeCompiler { public CodeCompiler() { } public MethodInfo CompileCode(string code, string namespacename, string classname,string functionname, bool isstatic, params object[] args) { Assembly asm = BuildAssembly(code); object instance = null; Type type = null; if (isstatic) { type = asm.GetType(namespacename + "." + classname); } else { instance = asm.CreateInstance(namespacename + "." + classname); type = instance.GetType(); } MethodInfo method = type.GetMethod(functionname); // here is the error return method; } private Assembly BuildAssembly(string code) { CSharpCodeProvider provider = new CSharpCodeProvider(); CompilerParameters compilerparams = new CompilerParameters(); compilerparams.GenerateExecutable = false; compilerparams.GenerateInMemory = true; compilerparams.ReferencedAssemblies.Add("System.dll"); compilerparams.ReferencedAssemblies.Add("System.Xml.dll"); System.Reflection.Assembly currentAssembly = System.Reflection.Assembly.GetExecutingAssembly(); compilerparams.ReferencedAssemblies.Add(currentAssembly.Location); CompilerResults results = provider.CompileAssemblyFromSource(compilerparams, code); if (results.Errors.HasErrors) { StringBuilder errors = new StringBuilder("Compiler Errors :\r\n"); foreach (CompilerError error in results.Errors ) { errors.AppendFormat("Line {0},{1}\t: {2}\n", error.Line, error.Column, error.ErrorText); } throw new Exception(errors.ToString()); } else { return results.CompiledAssembly; } } } And a little part of the Main() : static void Main(string[] args) { MethodInfo method; [// Little bit of code ] StreamReader sr = new StreamReader(@"c:\pathtothefileIwant\File.cs", System.Text.Encoding.Default); string file = sr.ReadToEnd(); sr.Close(); CodeCompiler cc = new CodeCompiler(); object[] arguments = { popup }; // here are the args which are in another class [...little bit of code...] method = cc.CompileCode(file, "testNamespace", "Class1", "webRequest", true, arguments); List<Test> li = (List<Test>)method.Invoke(null, arguments); // Here I invoke the method to put it in a List<Compte> I made before. }
0debug
WHY MY CODE GIVING 0 AS OUTPUT? : void main() { clrscr(); float f=3.3; /* In printf() I intentionaly put %d format specifier to see what type of output I may get */ printf("value of variable a is: %d",f); getch(); }
0debug
Split the string an get the text : <p>I am having a text as below </p> <pre><code>*~*****|****|**|*|***|***|****|**|null|null|**|***|***|null|71713470|STMS#****** </code></pre> <p>using java i need to get the number 71713470 and STMS values from that string. I have tried all the string methods but invain. Could anyone help on this</p>
0debug
How to remove docker support from an ASP.NET Core project? : <p>I've installed Visual Studio 2017 Community RC with .NET Core and Docker (Preview) so I could try the "Add docker support" on my project. </p> <p>Unfortunatelly I couldn't get things work together (win8.1 + docker toolbox + hyperv engine + docker tools seems like not works together well) so I decided to remove docker support from my project. </p> <p>There was no any menu item to remove docker support so I just deleted all docker related files from the solution. </p> <p>Currently I get an error when I try to build/rebuild/clean/...:</p> <blockquote> <p>Error MSB4018 The "CleanWorkspace" task failed unexpectedly. System.IO.FileNotFoundException: The file 'D:\dev\AspNetCore\docker-compose.yml' was not found.</p> <p>Error MSB4018 The "PrepareForCompile" task failed unexpectedly. System.IO.FileNotFoundException: The file 'D:\dev\AspNetCore\docker-compose.yml' was not found.</p> </blockquote> <p>I tried to delete bin, obj, .vs folders without luck. </p>
0debug
How to display latest posts Wordpress : <p>On one of my pages I want a section to show the latest 3 news posts. </p> <p>Is there a simple way of doing this?</p>
0debug
Android - ConstraintLayout - ellipsize end for large text : <p>I need some help regarding an Android layout. I have the following code:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content"&gt; &lt;android.support.constraint.Guideline android:id="@+id/guideline" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" app:layout_constraintGuide_percent="0.5" /&gt; &lt;android.support.constraint.Guideline android:id="@+id/guideline2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" app:layout_constraintGuide_percent="0.725" /&gt; &lt;TextView android:id="@+id/data_field_1_name" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="10dip" android:layout_marginTop="10dip" app:layout_constraintLeft_toLeftOf="@id/guideline" app:layout_constraintRight_toLeftOf="@id/guideline2" app:layout_constraintTop_toTopOf="parent" tools:text="ACTIVE" /&gt; &lt;TextView android:id="@+id/data_field_1_value" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="15dip" android:layout_toEndOf="@id/data_field_1_name" app:layout_constraintBaseline_toBaselineOf="@id/data_field_1_name" app:layout_constraintLeft_toLeftOf="@id/guideline2" app:layout_constraintRight_toRightOf="parent" tools:text="1750" /&gt; &lt;TextView android:id="@+id/data_field_2_name" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="10dip" android:layout_marginTop="8dip" app:layout_constraintLeft_toLeftOf="@id/guideline" app:layout_constraintRight_toLeftOf="@id/guideline2" app:layout_constraintTop_toBottomOf="@id/data_field_1_name" tools:text="ACTIVE" /&gt; &lt;TextView android:id="@+id/data_field_2_value" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="15dip" android:layout_toEndOf="@id/data_field_2_name" app:layout_constraintBaseline_toBaselineOf="@id/data_field_2_name" app:layout_constraintLeft_toLeftOf="@id/guideline2" app:layout_constraintRight_toRightOf="parent" tools:text="1750" /&gt; &lt;TextView android:id="@+id/data_field_3_name" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="10dip" android:layout_marginTop="8dip" app:layout_constraintLeft_toLeftOf="@id/guideline" app:layout_constraintRight_toLeftOf="@id/guideline2" app:layout_constraintTop_toBottomOf="@id/data_field_2_name" tools:text="ACTIVE" /&gt; &lt;TextView android:id="@+id/data_field_3_value" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="15dip" android:layout_toEndOf="@id/data_field_3_name" app:layout_constraintBaseline_toBaselineOf="@id/data_field_3_name" app:layout_constraintLeft_toLeftOf="@id/guideline2" app:layout_constraintRight_toRightOf="parent" tools:text="1750" /&gt; &lt;TextView android:id="@+id/value" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="15dip" android:layout_marginStart="15dip" android:textSize="25sp" app:layout_constraintBaseline_toBaselineOf="@id/data_field_2_name" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintLeft_toLeftOf="parent" tools:text="17.40" /&gt; &lt;ImageView android:id="@+id/flag" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="0dp" android:layout_marginTop="2dp" android:src="@drawable/ic_launcher_background" app:layout_constraintEnd_toEndOf="@+id/unit" app:layout_constraintStart_toStartOf="@+id/unit" app:layout_constraintTop_toTopOf="parent" /&gt; &lt;android.support.v7.widget.AppCompatTextView android:id="@+id/unit" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="2dp" android:gravity="center_horizontal" app:layout_constraintBaseline_toBaselineOf="@id/value" app:layout_constraintStart_toEndOf="@+id/value" tools:text="KG" /&gt; &lt;TextView android:id="@+id/label" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="15dip" app:layout_constraintBaseline_toBaselineOf="@id/data_field_3_name" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toLeftOf="@id/guideline" tools:text="TOTAL" /&gt; &lt;/android.support.constraint.ConstraintLayout&gt; </code></pre> <p>The output is: <a href="https://i.stack.imgur.com/8ZFsL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/8ZFsL.png" alt="enter image description here"></a></p> <p>My problem is: If the main value(17.40) is too large, that value should be "ellipsized" to end, but it goes over the "Active" text.</p> <p>The input for large text is:<a href="https://i.stack.imgur.com/sGEBM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/sGEBM.png" alt="enter image description here"></a></p> <p>I need something like that for large value: <a href="https://i.stack.imgur.com/1b096.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1b096.png" alt="enter image description here"></a></p> <p>PS: the unit and and the flag should be always displayed at the end of the main value.</p> <p>Could you please help me with suggestions? I tried a lot of ideas, but didn't find a solution. </p>
0debug
x y plane coordinates - find is how many points in the list above are located a distance less than or equal to the radius : <p>Hello I am new to JavaScript, and I have a little project for school that I struggle with. We have a data array set such like [{x:-33,y:83},{x:81,y:-99},{x:-13,y:-89},{x:13,y:-22},{x:-17,y:55},{x:78,y:-96}, {x:77,y:99},{x:-81,y:27}]. I have to use this [formula][1]</p> <p>[1]: <a href="https://i.stack.imgur.com/kaSkf.png" rel="nofollow noreferrer">https://i.stack.imgur.com/kaSkf.png</a> to compute it and what we need to find is how many points in the list above are located a distance less than or equal to the radius from the point the user provides. Any help is appreciated! Thank you</p>
0debug
static MTPData *usb_mtp_get_partial_object(MTPState *s, MTPControl *c, MTPObject *o) { MTPData *d = usb_mtp_data_alloc(c); off_t offset; trace_usb_mtp_op_get_partial_object(s->dev.addr, o->handle, o->path, c->argv[1], c->argv[2]); d->fd = open(o->path, O_RDONLY); if (d->fd == -1) { return NULL; } offset = c->argv[1]; if (offset > o->stat.st_size) { offset = o->stat.st_size; } lseek(d->fd, offset, SEEK_SET); d->length = c->argv[2]; if (d->length > o->stat.st_size - offset) { d->length = o->stat.st_size - offset; } return d; }
1threat
drawable with cutted edge android : <p>I want to get a drawable shape with two sided cutted corner. like this:<a href="https://i.stack.imgur.com/CAsm8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CAsm8.png" alt="enter image description here"></a></p> <p>I am not able to cut the edges. anyone help.</p>
0debug
How to add numbers in side a complex array using a recurring method in Python : x = [[1,2],[3,56],[0,1],[[1, 0, 3]]] How do I add the numbers in x using a recurring method. It should be able to be adopt to other complex arrays e.g if I change x to x = [[1,2, 56],[3,56],[0,1],[[1, 0, 3]]]
0debug
static size_t qemu_rdma_save_page(QEMUFile *f, void *opaque, ram_addr_t block_offset, ram_addr_t offset, size_t size, int *bytes_sent) { QEMUFileRDMA *rfile = opaque; RDMAContext *rdma = rfile->rdma; int ret; CHECK_ERROR_STATE(); qemu_fflush(f); if (size > 0) { ret = qemu_rdma_write(f, rdma, block_offset, offset, size); if (ret < 0) { fprintf(stderr, "rdma migration: write error! %d\n", ret); goto err; } if (bytes_sent) { *bytes_sent = 1; } } else { uint64_t index, chunk; ret = qemu_rdma_search_ram_block(rdma, block_offset, offset, size, &index, &chunk); if (ret) { fprintf(stderr, "ram block search failed\n"); goto err; } qemu_rdma_signal_unregister(rdma, index, chunk, 0); } while (1) { uint64_t wr_id, wr_id_in; int ret = qemu_rdma_poll(rdma, &wr_id_in, NULL); if (ret < 0) { fprintf(stderr, "rdma migration: polling error! %d\n", ret); goto err; } wr_id = wr_id_in & RDMA_WRID_TYPE_MASK; if (wr_id == RDMA_WRID_NONE) { break; } } return RAM_SAVE_CONTROL_DELAYED; err: rdma->error_state = ret; return ret; }
1threat
Show date with time when querying oracle DATE data type : <p>When querying an oracle date, I see only the date - not the time. Example</p> <p><code>select D from ALIK_TZ</code></p> <p>Result:</p> <pre><code>D 01-JUN-16 </code></pre> <p>How can I see the time as well?</p>
0debug
How does returning std::make_unique<SubClass> work? : <p>I have a base class and its subclass:</p> <pre><code>class Base { public: virtual void hi() { cout &lt;&lt; "hi" &lt;&lt; endl; } }; class Derived : public Base { public: void hi() override { cout &lt;&lt; "derived hi" &lt;&lt; endl; } }; </code></pre> <p>Trying to create a helper function that creates a unique pointer of a Derived object.</p> <p>1) This one works:</p> <pre><code>std::unique_ptr&lt;Base&gt; GetDerived() { return std::make_unique&lt;Derived&gt;(); } </code></pre> <p>2) But, this one fails to compile:</p> <pre><code>std::unique_ptr&lt;Base&gt; GetDerived2() { auto a = std::make_unique&lt;Derived&gt;(); return a; } </code></pre> <p>3) std::move works:</p> <pre><code>std::unique_ptr&lt;Base&gt; GetDerived3() { auto a = std::make_unique&lt;Derived&gt;(); return std::move(a); } </code></pre> <p>4) If I create a Base instance, both work:</p> <pre><code>std::unique_ptr&lt;Base&gt; GetDerived4() { auto a = std::make_unique&lt;Base&gt;(); return a; } std::unique_ptr&lt;Base&gt; GetDerived5() { auto a = std::make_unique&lt;Base&gt;(); return std::move(a); } </code></pre> <p>Why (2) fails but others work? </p>
0debug
Wordpress: jQuery not loading. : In the contact form section of my wordpress site, i'm trying to disable the line break from the text area (e.keycode 13). Here's the jQuery i'm using: [jQuery][1] But the script doesn't seem to be loading properly; I get an error on the console as below: [console][2] [1]: https://i.stack.imgur.com/pb8yx.png [2]: https://i.stack.imgur.com/PTZmh.png Any ideas why this is happening? I'm using the plugin Header and Footer Scripts to add the script to my wordpress theme and i'm using Contact Form 7 for the form. Having searched a lot for the solution, this is my last hope so any help would be appreciated.
0debug
How do you make a div shaped like an ellipse in CSS? : <p>I am trying to make the following shapes with css. I don't know how I can do this, can you help?</p> <p><a href="https://i.stack.imgur.com/TnFna.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TnFna.png" alt="ellipse divs"></a></p>
0debug
av_cold int ff_mjpeg_encode_init(MpegEncContext *s) { MJpegContext *m; av_assert0(s->slice_context_count == 1); if (s->width > 65500 || s->height > 65500) { av_log(s, AV_LOG_ERROR, "JPEG does not support resolutions above 65500x65500\n"); return AVERROR(EINVAL); } m = av_malloc(sizeof(MJpegContext)); if (!m) return AVERROR(ENOMEM); s->min_qcoeff=-1023; s->max_qcoeff= 1023; ff_mjpeg_build_huffman_codes(m->huff_size_dc_luminance, m->huff_code_dc_luminance, avpriv_mjpeg_bits_dc_luminance, avpriv_mjpeg_val_dc); ff_mjpeg_build_huffman_codes(m->huff_size_dc_chrominance, m->huff_code_dc_chrominance, avpriv_mjpeg_bits_dc_chrominance, avpriv_mjpeg_val_dc); ff_mjpeg_build_huffman_codes(m->huff_size_ac_luminance, m->huff_code_ac_luminance, avpriv_mjpeg_bits_ac_luminance, avpriv_mjpeg_val_ac_luminance); ff_mjpeg_build_huffman_codes(m->huff_size_ac_chrominance, m->huff_code_ac_chrominance, avpriv_mjpeg_bits_ac_chrominance, avpriv_mjpeg_val_ac_chrominance); ff_init_uni_ac_vlc(m->huff_size_ac_luminance, m->uni_ac_vlc_len); ff_init_uni_ac_vlc(m->huff_size_ac_chrominance, m->uni_chroma_ac_vlc_len); s->intra_ac_vlc_length = s->intra_ac_vlc_last_length = m->uni_ac_vlc_len; s->intra_chroma_ac_vlc_length = s->intra_chroma_ac_vlc_last_length = m->uni_chroma_ac_vlc_len; m->huff_ncode = 0; s->mjpeg_ctx = m; return alloc_huffman(s); }
1threat
C#: getter properties defined, but not found when used : I'm working on adapting some existing C# code that contains a class: public class tagTLSEEKINFO { /* Disable variable visibility on debug. */ [DebuggerBrowsable(DebuggerBrowsableState.Never)] private DateTime date; [DebuggerBrowsable(DebuggerBrowsableState.Never)] private string month; [DebuggerBrowsable(DebuggerBrowsableState.Never)] private string year; [DebuggerBrowsable(DebuggerBrowsableState.Never)] private int trunk; [DebuggerBrowsable(DebuggerBrowsableState.Never)] private int addr; [DebuggerBrowsable(DebuggerBrowsableState.Never)] private int subzone; [DebuggerBrowsable(DebuggerBrowsableState.Never)] private tagTLFILETYPE filetype; [DebuggerBrowsable(DebuggerBrowsableState.Never)] private string path; public tagTLSEEKINFO() { Path = ""; } public tagTLSEEKINFO(tagTLFILETYPE filetype) { FileType = filetype; } public tagTLSEEKINFO(tagTLFILETYPE filetype, string _path) { Month = ""; Year = ""; Trunk = Addr = Subzone = 0; FileType = filetype; Path = _path; } public tagTLSEEKINFO(DateTime date, tagTLFILETYPE filetype) { Date = date; Month = date.Month.ToString("00"); Year = date.Year.ToString().Remove(0, 2); Trunk = Addr = Subzone = 0; FileType = filetype; } public tagTLSEEKINFO(string month, string year, tagTLFILETYPE filetype) { Date = new DateTime(Convert.ToInt16(year), Convert.ToInt16(month), 1); Month = month; Year = year; Trunk = Addr = Subzone = 0; FileType = filetype; } public tagTLSEEKINFO(DateTime date, int trunk, int addr, int subzone) { Date = date; Month = date.Month.ToString("00"); Year = date.Year.ToString().Remove(0, 2); Trunk = trunk; Addr = addr; Subzone = subzone; FileType = tagTLFILETYPE.TRENDLOG; } public tagTLSEEKINFO(string month, string year, int trunk, int addr, int subzone) { Month = month; Year = year; Trunk = trunk; Addr = addr; Subzone = subzone; FileType = tagTLFILETYPE.TRENDLOG; } public virtual DateTime Date { get { return date; } set { date = value; } } public virtual string Month { get { return month; } set { month = value; } } public string Year { get { return year; } set { year = value; } } public int Trunk { get { return trunk; } set { trunk = value; } } public int Addr { get { return addr; } set { addr = value; } } public int Subzone { get { return subzone; } set { subzone = value; } } public tagTLFILETYPE FileType { get { return filetype; } set { filetype = value; } } public string Path { get { return path; } set { path = value; } } }//end class When I try to use the property I need (Date), I get this error: Error CS1061 'tagTLSEEKINFO[]' does not contain a definition for 'Date' and no extension method 'Date' accepting a first argument of type 'tagTLSEEKINFO[]' could be found (are you missing a using directive or an assembly reference?) TrendLogFileViewer Help please? I am new to C# after some Java and a lot of C++ and this is baffling me.
0debug
static void *worker_thread(void *opaque) { ThreadPool *pool = opaque; qemu_mutex_lock(&pool->lock); pool->pending_threads--; do_spawn_thread(pool); while (!pool->stopping) { ThreadPoolElement *req; int ret; do { pool->idle_threads++; qemu_mutex_unlock(&pool->lock); ret = qemu_sem_timedwait(&pool->sem, 10000); qemu_mutex_lock(&pool->lock); pool->idle_threads--; } while (ret == -1 && !QTAILQ_EMPTY(&pool->request_list)); if (ret == -1 || pool->stopping) { break; } req = QTAILQ_FIRST(&pool->request_list); QTAILQ_REMOVE(&pool->request_list, req, reqs); req->state = THREAD_ACTIVE; qemu_mutex_unlock(&pool->lock); ret = req->func(req->arg); req->ret = ret; smp_wmb(); req->state = THREAD_DONE; qemu_mutex_lock(&pool->lock); qemu_bh_schedule(pool->completion_bh); } pool->cur_threads--; qemu_cond_signal(&pool->worker_stopped); qemu_mutex_unlock(&pool->lock); return NULL; }
1threat
static int process_video_header_vp6(AVFormatContext *s) { EaDemuxContext *ea = s->priv_data; AVIOContext *pb = s->pb; avio_skip(pb, 8); ea->nb_frames = avio_rl32(pb); avio_skip(pb, 4); ea->time_base.den = avio_rl32(pb); ea->time_base.num = avio_rl32(pb); ea->video_codec = AV_CODEC_ID_VP6; return 1;
1threat
static inline int32_t mipsdsp_sat_add_i32(int32_t a, int32_t b, CPUMIPSState *env) { int32_t tempI; tempI = a + b; if (MIPSDSP_OVERFLOW(a, b, tempI, 0x80000000)) { if (a > 0) { tempI = 0x7FFFFFFF; } else { tempI = 0x80000000; } set_DSPControl_overflow_flag(1, 20, env); } return tempI; }
1threat
static int fourxm_probe(AVProbeData *p) { if ((AV_RL32(&p->buf[0]) != RIFF_TAG) || (AV_RL32(&p->buf[8]) != _4XMV_TAG)) return 0; return AVPROBE_SCORE_MAX; }
1threat
I couldn't change color of diagonal line in 16*16 label matrix. What's my false in here? : 16*16 matrix is coming to my screen when i start the program. But when i click diagonal button, diagonal line isn't red. that is not change. my codes : Public Class Form1 Dim etk As New Label 'i define the matrix as etk Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load For i = 0 To 15 For j = 0 To 15 Dim etk As New Label Me.Panel.Controls.Add(etk) etk.Name = i etk.Tag = j etk.Size = New Size(26, 26) etk.BackColor = Color.Black etk.Location = New Point(30 * i + 10, 30 * j + 10) Next Next End Sub Private Sub diagonal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Timer1.Enabled = True For i = 0 To 15 For j = 0 To 15 etk.Name = i etk.Tag = j If i = j Then etk.BackColor = Color.Red End If Next Next End Sub End Class thanks for your interests..
0debug
static void gen_tlbwe_440(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } switch (rB(ctx->opcode)) { case 0: case 1: case 2: { TCGv_i32 t0 = tcg_const_i32(rB(ctx->opcode)); gen_helper_440_tlbwe(cpu_env, t0, cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)]); tcg_temp_free_i32(t0); } break; default: gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); break; } #endif }
1threat
static int slirp_smb(SlirpState* s, const char *exported_dir, struct in_addr vserver_addr) { static int instance; char smb_conf[128]; char smb_cmdline[128]; struct passwd *passwd; FILE *f; passwd = getpwuid(geteuid()); if (!passwd) { error_report("failed to retrieve user name"); snprintf(s->smb_dir, sizeof(s->smb_dir), "/tmp/qemu-smb.%ld-%d", (long)getpid(), instance++); if (mkdir(s->smb_dir, 0700) < 0) { error_report("could not create samba server dir '%s'", s->smb_dir); snprintf(smb_conf, sizeof(smb_conf), "%s/%s", s->smb_dir, "smb.conf"); f = fopen(smb_conf, "w"); if (!f) { slirp_smb_cleanup(s); error_report("could not create samba server configuration file '%s'", smb_conf); fprintf(f, "[global]\n" "private dir=%s\n" "socket address=127.0.0.1\n" "pid directory=%s\n" "lock directory=%s\n" "state directory=%s\n" "log file=%s/log.smbd\n" "smb passwd file=%s/smbpasswd\n" "security = share\n" "[qemu]\n" "path=%s\n" "read only=no\n" "guest ok=yes\n" "force user=%s\n", s->smb_dir, s->smb_dir, s->smb_dir, s->smb_dir, s->smb_dir, s->smb_dir, exported_dir, passwd->pw_name ); fclose(f); snprintf(smb_cmdline, sizeof(smb_cmdline), "%s -s %s", CONFIG_SMBD_COMMAND, smb_conf); if (slirp_add_exec(s->slirp, 0, smb_cmdline, &vserver_addr, 139) < 0) { slirp_smb_cleanup(s); error_report("conflicting/invalid smbserver address"); return 0;
1threat
Programatically create a complex JSONArray in Android? : I have been struggling trying to make this work properly. From what I have read the following example is a JSONArray. I need to be able to dynamically create such an array problematically within my Android code, so that it can output this array to a web service. I am most confused about adding the top "header" information and the nested "Position" JSONObject as the last property. I know how a basic JSONObject is created, as well as a basic JSONArray, but this combined one is really throwing me off. Any help would be much appreciated. This is the example I was given that I need to try to create: { "source": "REMOTE", "msgType": "event", "properties": [ { "IMEI": { "string": "1234567890" } }, { "My Time": { "string": "5/4/2016 12:00:00" } }, { "Position": { "geographicPosition": { "latitude": 34.89767579999999, "longitude": -72.03648269999997 } } } ] }
0debug
def round_num(n,m): a = (n //m) * m b = a + m return (b if n - a > b - n else a)
0debug
Can you use es6 import alias syntax for React Components? : <p>I'm trying to do something like the following, however it returns null:</p> <pre><code>import { Button as styledButton } from 'component-library' </code></pre> <p>then attempting to render it as:</p> <pre><code>import React, { PropTypes } from "react"; import cx from 'classNames'; import { Button as styledButton } from 'component-library'; export default class Button extends React.Component { constructor(props){ super(props) } render() { return ( &lt;styledButton {...this.props}&gt;&lt;/styledButton&gt; ) } } </code></pre> <p>The reason is, I need to import the <code>Button</code> component from a library, and also export a wrapper component with the same name but maintaining the functionality from the imported component. If I leave it at <code>import { Button } from component library</code> then of course, I get a multiple declaration error.</p> <p>Any ideas? </p>
0debug
How get input from url html and use it on href variable : <p>i have a page in HTML which get in input an "id" variable by URL:</p> <p>registration.html?id=123456789</p> <p>Now i want use this "id" variable into an href variable inside registration.html file to write the "id" input parameter of php file described on href</p> <p> <p>Can I get some help?</p> <p>Thanks</p>
0debug
static int uhci_handle_td(UHCIState *s, uint32_t addr, UHCI_TD *td, uint32_t *int_mask) { UHCIAsync *async; int len = 0, max_len; uint8_t pid; if (!(td->ctrl & TD_CTRL_ACTIVE)) return 1; async = uhci_async_find_td(s, addr, td->token); if (async) { async->valid = 32; if (!async->done) return 1; uhci_async_unlink(s, async); goto done; } async = uhci_async_alloc(s); if (!async) return 1; async->valid = 10; async->td = addr; async->token = td->token; max_len = ((td->token >> 21) + 1) & 0x7ff; pid = td->token & 0xff; async->packet.pid = pid; async->packet.devaddr = (td->token >> 8) & 0x7f; async->packet.devep = (td->token >> 15) & 0xf; async->packet.data = async->buffer; async->packet.len = max_len; async->packet.complete_cb = uhci_async_complete; async->packet.complete_opaque = s; switch(pid) { case USB_TOKEN_OUT: case USB_TOKEN_SETUP: cpu_physical_memory_read(td->buffer, async->buffer, max_len); len = uhci_broadcast_packet(s, &async->packet); if (len >= 0) len = max_len; break; case USB_TOKEN_IN: len = uhci_broadcast_packet(s, &async->packet); break; default: uhci_async_free(s, async); s->status |= UHCI_STS_HCPERR; uhci_update_irq(s); return -1; } if (len == USB_RET_ASYNC) { uhci_async_link(s, async); return 2; } async->packet.len = len; done: len = uhci_complete_td(s, td, async, int_mask); uhci_async_free(s, async); return len; }
1threat
static int count_contiguous_clusters_by_type(int nb_clusters, uint64_t *l2_table, int wanted_type) { int i; for (i = 0; i < nb_clusters; i++) { int type = qcow2_get_cluster_type(be64_to_cpu(l2_table[i])); if (type != wanted_type) { break; } } return i; }
1threat
instead of passing whole array to intent pass only onClicked value : i am trying to pass only the onClicked value in the below code instead of passing the whole array to intent. Is it possible?? here, i am sending whole array as in "i.putExtra("rank", rank)", is there some other way. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); rank = new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" }; country = new String[] { "China", "India", "United States", "Indonesia", "Brazil", "Pakistan", "Nigeria", "Bangladesh", "Russia", "Japan" }; population = new String[] { "2,000,000,000", "1,500,000,000", "123,123,123", "123,123,123", "123,123,123", "123,123,123", "123,123,123", "123,123,123", "123,123,123", "123,123,123" }; flag = new int[] { R.drawable.china, R.drawable.india, R.drawable.unitedstates, R.drawable.indonesia, R.drawable.brazil, R.drawable.pakistan, R.drawable.nigeria, R.drawable.bangladesh, R.drawable.russia, R.drawable.japan }; listView = (ListView) findViewById(R.id.listview); listViewAdapter = new ListViewAdapter(this, rank, country, population, flag); listView.setAdapter(listViewAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { Intent i = new Intent(MainActivity.this, SingleItemView.class); i.putExtra("rank", rank); i.putExtra("country", country); i.putExtra("population", population); i.putExtra("flag", flag); i.putExtra("position", position); startActivity(i); } }); '
0debug
How to get the output shape of a layer in Keras? : <p>I have the following code in Keras (Basically I am modifying this code for my use) and I get this error:</p> <p>'ValueError: Error when checking target: expected conv3d_3 to have 5 dimensions, but got array with shape (10, 4096)'</p> <p>Code:</p> <pre><code>from keras.models import Sequential from keras.layers.convolutional import Conv3D from keras.layers.convolutional_recurrent import ConvLSTM2D from keras.layers.normalization import BatchNormalization import numpy as np import pylab as plt from keras import layers # We create a layer which take as input movies of shape # (n_frames, width, height, channels) and returns a movie # of identical shape. model = Sequential() model.add(ConvLSTM2D(filters=40, kernel_size=(3, 3), input_shape=(None, 64, 64, 1), padding='same', return_sequences=True)) model.add(BatchNormalization()) model.add(ConvLSTM2D(filters=40, kernel_size=(3, 3), padding='same', return_sequences=True)) model.add(BatchNormalization()) model.add(ConvLSTM2D(filters=40, kernel_size=(3, 3), padding='same', return_sequences=True)) model.add(BatchNormalization()) model.add(ConvLSTM2D(filters=40, kernel_size=(3, 3), padding='same', return_sequences=True)) model.add(BatchNormalization()) model.add(Conv3D(filters=1, kernel_size=(3, 3, 3), activation='sigmoid', padding='same', data_format='channels_last')) model.compile(loss='binary_crossentropy', optimizer='adadelta') </code></pre> <p>the data I feed is in the following format: [1, 10, 64, 64, 1]. So I would like to know where I am wrong and also how to see the output_shape of each layer.</p>
0debug
How to organize html and css better : First of all i am in the learning of coding so im very new to this. But im pretty sure i could set up my code a much better way than i have done, could anyone please help me out here and tell me what i can do better? Reason for asking is to be better on it! Thank you for your time guys! HTML Code: <div class="infobox"> <a href="https://opskins.com/?loc=shop_search&sort=lh&app=433850_1&search_item=%22Skin%3A+Pinstripe+Suit+Jacket%22"><h3>Pinstripe Suit Jacket</h3></a> <div class="suggested"> <div class="sug-text"> <h4 class="opskinsug">OPSkins Suggested:</h4> <h4 class="survivorsug">Survivor's Suggested:</h4> </div> <div class="sug-price"> <h4 class="opssug">$0.26</h4> <h4 class="survsug">$0.27</h4> </div> </div> <div class="cheap" id="pinstripe-jacket"> <p> 40</p> </div> <img src="images/pinstripesuitjacket.png" width="300" > </div> CSS Code: .infobox { background-color: rgba(0, 0, 0, 0.3); position: relative; text-align: center; border-style: solid; border-color: orange; border-width: 1px; border-radius: 25px; width: 250px; height: 300px; display: inline-block; margin-left: 20px; } .infobox a:link { color: #fff; text-decoration: none; } .infobox a:visited { color: #fff; } .infobox a:hover { color: black; } .infobox h3 { background-color: orange; } .infobox img { position: relative; top: -232px; left: 15px; z-index: 0; } .opskinsug { font-size: 13px; text-align: center; width: 100px; position: relative; left: -20px; z-index: 1; display: inline-block; } .survivorsug { position: relative; text-align: center; left: 20px; font-size: 13px; width: 100px; z-index: 1; display: inline-block; } .opssug { position: relative; text-align: center; width: 100px; left: -20px; font-size: 20px; color: #fff; top: -40px; z-index: 1; display: inline-block; } .survsug { text-align: center; position: relative; width: 100px; font-size: 20px; left: 20px; top: -40px; color: #fff; z-index: 1; display: inline-block; } .suggested { background-color: rgba(255, 165, 0, 0.4); height: 70px; position: relative; z-index: 1; } .sug-text { position: relative; top: -5px; } .sug-price { position: relative; top: -8px; } .cheap { position: relative; z-index: 1; font-size: 52px; display: inline-block; left: -70px; color: #fff; }
0debug
Java Object return type vs. Generic Methods : <p>I saw several questions about generic return type, but none answers my question. <br>If there is no bound for any of the arguments, such as the following method in <a href="https://github.com/jayway/JsonPath/blob/master/json-path/src/main/java/com/jayway/jsonpath/JsonPath.java">JayWay</a> :</p> <pre><code>public static &lt;T&gt; T read(String json, String jsonPath, Filter... filters) { return new JsonReader().parse(json).read(jsonPath, filters); } </code></pre> <p>What is the point of using this as generic ?<br> I told the guys from my team that this method should be used as :</p> <pre><code>JsonPath.&lt;Boolean&gt;read(currentRule, "$.logged") </code></pre> <p>instead of:</p> <pre><code>(boolean) JsonPath.read(currentRule, "$.logged") </code></pre> <p>But I really can't tell the difference...</p>
0debug
How to report a bug in the LinkedIn API? : <p>I've been searching and searching, but I can't find out how to report a bug in the LinkedIn API.</p> <p><a href="https://developer.linkedin.com" rel="noreferrer">LinkedIn's Developer site</a> is completely devoid of any mention of bugs. Even Googling "How to report a bug in the LinkedIn API" yields nothing.</p> <p><a href="https://developer.linkedin.com/support" rel="noreferrer">LinkedIn's Developer Support page</a> says that "[engineers] collaborate on questions tagged "linkedin" at Stack Overflow." There are two problems with using SO for reporting this bug:</p> <ol> <li>StackOverflow is not a bug reporting platform.</li> <li>The bug report requires authentication to demonstrate. We cannot publicly disclose this information.</li> </ol> <p>How do I report a non-security-related LinkedIn API bug?</p>
0debug
static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode) { uint8_t *fragment; int imm8OfPShufW1; int imm8OfPShufW2; int fragmentLength; int xpos, i; asm volatile( "jmp 9f \n\t" "0: \n\t" "movq (%%esi), %%mm0 \n\t" "movq %%mm0, %%mm1 \n\t" "psrlq $8, %%mm0 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "movq %%mm2, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "addw %%bx, %%cx \n\t" "pshufw $0xFF, %%mm1, %%mm1 \n\t" "1: \n\t" "adcl %%edx, %%esi \n\t" "pshufw $0xFF, %%mm0, %%mm0 \n\t" "2: \n\t" "psrlw $9, %%mm3 \n\t" "psubw %%mm1, %%mm0 \n\t" "pmullw %%mm3, %%mm0 \n\t" "paddw %%mm6, %%mm2 \n\t" "psllw $7, %%mm1 \n\t" "paddw %%mm1, %%mm0 \n\t" "movq %%mm0, (%%edi, %%eax) \n\t" "addl $8, %%eax \n\t" "9: \n\t" "leal 0b, %0 \n\t" "leal 1b, %1 \n\t" "leal 2b, %2 \n\t" "decl %1 \n\t" "decl %2 \n\t" "subl %0, %1 \n\t" "subl %0, %2 \n\t" "leal 9b, %3 \n\t" "subl %0, %3 \n\t" :"=r" (fragment), "=r" (imm8OfPShufW1), "=r" (imm8OfPShufW2), "=r" (fragmentLength) ); xpos= 0; for(i=0; i<dstW/8; i++) { int xx=xpos>>16; if((i&3) == 0) { int a=0; int b=((xpos+xInc)>>16) - xx; int c=((xpos+xInc*2)>>16) - xx; int d=((xpos+xInc*3)>>16) - xx; memcpy(funnyCode + fragmentLength*i/4, fragment, fragmentLength); funnyCode[fragmentLength*i/4 + imm8OfPShufW1]= funnyCode[fragmentLength*i/4 + imm8OfPShufW2]= a | (b<<2) | (c<<4) | (d<<6); if(d<3) funnyCode[fragmentLength*i/4 + 1]= 0x6E; funnyCode[fragmentLength*(i+4)/4]= RET; } xpos+=xInc; } }
1threat
SwiftUI - Multiple Buttons in a List row : <p>Say I have a <code>List</code> and two buttons in one row, how to ditinguish which button is tapped without the entire row highlighting?</p> <p>For this sample code, when any one of the buttons in the row is tapped, both button's action callbacks are invoked.</p> <pre><code>// a simple list with just one row List { // both buttons in a HStack so that they appear in a single row HStack { Button(action: { print("button 1 tapped") }) { Text("One") } Button(action: { print("button 2 tapped") }) { Text("Two") } } } // when tapping just once on either button: // "button 1 tapped" // "button 2 tapped" </code></pre>
0debug
Please Help i get a error every time with my Programm [Runtime Error "Java"] : Hi Here is the Error **["Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 2 at java.lang.String.charAt(Unknown Source) at Haupt.main(Haupt.java:21)"]** And here is my Code Why did i get this Errors? --------------------------------------------------- import java.util.Scanner; public class Haupt { public static void main(String[] args) { String Wort=""; String WortCpy=""; String WortRev=""; int i=0; Scanner scan = new Scanner(System.in); System.out.print("Geben Sie ein Wort ein : "); //Ausgabe Wort = scan.nextLine(); //Eingabe scan.close(); for(i=0;i < Wort.length();i++) { WortCpy= WortCpy + Wort.charAt(i); //Speichert jeden Buchstaben einzeln in Wortcpy ab } for(i=Wort.length();i>=0;i--) { WortRev = WortRev + Wort.charAt(i); } System.out.println("Wort : " + Wort); System.out.println("Wort Kopiert : " + WortCpy); System.out.println("Wort umgedreht : " + WortRev); } }
0debug
int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MpegEncContext *s = avctx->priv_data; int ret; AVFrame *pict = data; #ifdef PRINT_FRAME_TIME uint64_t time= rdtsc(); #endif #ifdef DEBUG av_log(avctx, AV_LOG_DEBUG, "*****frame %d size=%d\n", avctx->frame_number, buf_size); if(buf_size>0) av_log(avctx, AV_LOG_DEBUG, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]); #endif s->flags= avctx->flags; s->flags2= avctx->flags2; if (buf_size == 0) { if (s->low_delay==0 && s->next_picture_ptr) { *pict= *(AVFrame*)s->next_picture_ptr; s->next_picture_ptr= NULL; *data_size = sizeof(AVFrame); } return 0; } if(s->flags&CODEC_FLAG_TRUNCATED){ int next; if(CONFIG_MPEG4_DECODER && s->codec_id==CODEC_ID_MPEG4){ next= ff_mpeg4_find_frame_end(&s->parse_context, buf, buf_size); }else if(CONFIG_H263_DECODER && s->codec_id==CODEC_ID_H263){ next= ff_h263_find_frame_end(&s->parse_context, buf, buf_size); }else{ av_log(s->avctx, AV_LOG_ERROR, "this codec does not support truncated bitstreams\n"); return -1; } if( ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0 ) return buf_size; } retry: if(s->bitstream_buffer_size && (s->divx_packed || buf_size<20)){ init_get_bits(&s->gb, s->bitstream_buffer, s->bitstream_buffer_size*8); }else init_get_bits(&s->gb, buf, buf_size*8); s->bitstream_buffer_size=0; if (!s->context_initialized) { if (MPV_common_init(s) < 0) return -1; } if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){ int i= ff_find_unused_picture(s, 0); s->current_picture_ptr= &s->picture[i]; } if (CONFIG_WMV2_DECODER && s->msmpeg4_version==5) { ret= ff_wmv2_decode_picture_header(s); } else if (CONFIG_MSMPEG4_DECODER && s->msmpeg4_version) { ret = msmpeg4_decode_picture_header(s); } else if (s->h263_pred) { if(s->avctx->extradata_size && s->picture_number==0){ GetBitContext gb; init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8); ret = ff_mpeg4_decode_picture_header(s, &gb); } ret = ff_mpeg4_decode_picture_header(s, &s->gb); } else if (s->codec_id == CODEC_ID_H263I) { ret = intel_h263_decode_picture_header(s); } else if (s->h263_flv) { ret = flv_h263_decode_picture_header(s); } else { ret = h263_decode_picture_header(s); } if(ret==FRAME_SKIPPED) return get_consumed_bytes(s, buf_size); if (ret < 0){ av_log(s->avctx, AV_LOG_ERROR, "header damaged\n"); return -1; } avctx->has_b_frames= !s->low_delay; if(s->xvid_build==0 && s->divx_version==0 && s->lavc_build==0){ if(s->stream_codec_tag == AV_RL32("XVID") || s->codec_tag == AV_RL32("XVID") || s->codec_tag == AV_RL32("XVIX") || s->codec_tag == AV_RL32("RMP4")) s->xvid_build= -1; #if 0 if(s->codec_tag == AV_RL32("DIVX") && s->vo_type==0 && s->vol_control_parameters==1 && s->padding_bug_score > 0 && s->low_delay) s->xvid_build= -1; #endif } if(s->xvid_build==0 && s->divx_version==0 && s->lavc_build==0){ if(s->codec_tag == AV_RL32("DIVX") && s->vo_type==0 && s->vol_control_parameters==0) s->divx_version= 400; } if(s->xvid_build && s->divx_version){ s->divx_version= s->divx_build= 0; } if(s->workaround_bugs&FF_BUG_AUTODETECT){ if(s->codec_tag == AV_RL32("XVIX")) s->workaround_bugs|= FF_BUG_XVID_ILACE; if(s->codec_tag == AV_RL32("UMP4")){ s->workaround_bugs|= FF_BUG_UMP4; } if(s->divx_version>=500 && s->divx_build<1814){ s->workaround_bugs|= FF_BUG_QPEL_CHROMA; } if(s->divx_version>502 && s->divx_build<1814){ s->workaround_bugs|= FF_BUG_QPEL_CHROMA2; } if(s->xvid_build && s->xvid_build<=3) s->padding_bug_score= 256*256*256*64; if(s->xvid_build && s->xvid_build<=1) s->workaround_bugs|= FF_BUG_QPEL_CHROMA; if(s->xvid_build && s->xvid_build<=12) s->workaround_bugs|= FF_BUG_EDGE; if(s->xvid_build && s->xvid_build<=32) s->workaround_bugs|= FF_BUG_DC_CLIP; #define SET_QPEL_FUNC(postfix1, postfix2) \ s->dsp.put_ ## postfix1 = ff_put_ ## postfix2;\ s->dsp.put_no_rnd_ ## postfix1 = ff_put_no_rnd_ ## postfix2;\ s->dsp.avg_ ## postfix1 = ff_avg_ ## postfix2; if(s->lavc_build && s->lavc_build<4653) s->workaround_bugs|= FF_BUG_STD_QPEL; if(s->lavc_build && s->lavc_build<4655) s->workaround_bugs|= FF_BUG_DIRECT_BLOCKSIZE; if(s->lavc_build && s->lavc_build<4670){ s->workaround_bugs|= FF_BUG_EDGE; } if(s->lavc_build && s->lavc_build<=4712) s->workaround_bugs|= FF_BUG_DC_CLIP; if(s->divx_version) s->workaround_bugs|= FF_BUG_DIRECT_BLOCKSIZE; if(s->divx_version==501 && s->divx_build==20020416) s->padding_bug_score= 256*256*256*64; if(s->divx_version && s->divx_version<500){ s->workaround_bugs|= FF_BUG_EDGE; } if(s->divx_version) s->workaround_bugs|= FF_BUG_HPEL_CHROMA; #if 0 if(s->divx_version==500) s->padding_bug_score= 256*256*256*64; if( s->resync_marker==0 && s->data_partitioning==0 && s->divx_version==0 && s->codec_id==CODEC_ID_MPEG4 && s->vo_type==0) s->workaround_bugs|= FF_BUG_NO_PADDING; if(s->lavc_build && s->lavc_build<4609) s->workaround_bugs|= FF_BUG_NO_PADDING; #endif } if(s->workaround_bugs& FF_BUG_STD_QPEL){ SET_QPEL_FUNC(qpel_pixels_tab[0][ 5], qpel16_mc11_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][ 7], qpel16_mc31_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][ 9], qpel16_mc12_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][11], qpel16_mc32_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][13], qpel16_mc13_old_c) SET_QPEL_FUNC(qpel_pixels_tab[0][15], qpel16_mc33_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][ 5], qpel8_mc11_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][ 7], qpel8_mc31_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][ 9], qpel8_mc12_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][11], qpel8_mc32_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][13], qpel8_mc13_old_c) SET_QPEL_FUNC(qpel_pixels_tab[1][15], qpel8_mc33_old_c) } if(avctx->debug & FF_DEBUG_BUGS) av_log(s->avctx, AV_LOG_DEBUG, "bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s\n", s->workaround_bugs, s->lavc_build, s->xvid_build, s->divx_version, s->divx_build, s->divx_packed ? "p" : ""); #if 0 { static FILE *f=NULL; if(!f) f=fopen("rate_qp_cplx.txt", "w"); fprintf(f, "%d %d %f\n", buf_size, s->qscale, buf_size*(double)s->qscale); } #endif #if HAVE_MMX if(s->codec_id == CODEC_ID_MPEG4 && s->xvid_build && avctx->idct_algo == FF_IDCT_AUTO && (mm_flags & FF_MM_MMX)){ avctx->idct_algo= FF_IDCT_XVIDMMX; avctx->coded_width= 0; s->picture_number=0; } #endif if ( s->width != avctx->coded_width || s->height != avctx->coded_height) { ParseContext pc= s->parse_context; s->parse_context.buffer=0; MPV_common_end(s); s->parse_context= pc; } if (!s->context_initialized) { avcodec_set_dimensions(avctx, s->width, s->height); goto retry; } if((s->codec_id==CODEC_ID_H263 || s->codec_id==CODEC_ID_H263P || s->codec_id == CODEC_ID_H263I)) s->gob_index = ff_h263_get_gob_height(s); s->current_picture.pict_type= s->pict_type; s->current_picture.key_frame= s->pict_type == FF_I_TYPE; if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)) return get_consumed_bytes(s, buf_size); if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return get_consumed_bytes(s, buf_size); if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE) || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE) || avctx->skip_frame >= AVDISCARD_ALL) return get_consumed_bytes(s, buf_size); if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size); if(s->next_p_frame_damaged){ if(s->pict_type==FF_B_TYPE) return get_consumed_bytes(s, buf_size); else s->next_p_frame_damaged=0; } if((s->avctx->flags2 & CODEC_FLAG2_FAST) && s->pict_type==FF_B_TYPE){ s->me.qpel_put= s->dsp.put_2tap_qpel_pixels_tab; s->me.qpel_avg= s->dsp.avg_2tap_qpel_pixels_tab; }else if((!s->no_rounding) || s->pict_type==FF_B_TYPE){ s->me.qpel_put= s->dsp.put_qpel_pixels_tab; s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab; }else{ s->me.qpel_put= s->dsp.put_no_rnd_qpel_pixels_tab; s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab; } if(MPV_frame_start(s, avctx) < 0) return -1; if (avctx->hwaccel) { if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0) return -1; } #ifdef DEBUG av_log(avctx, AV_LOG_DEBUG, "qscale=%d\n", s->qscale); #endif ff_er_frame_start(s); if (CONFIG_WMV2_DECODER && s->msmpeg4_version==5){ ret = ff_wmv2_decode_secondary_picture_header(s); if(ret<0) return ret; if(ret==1) goto intrax8_decoded; } s->mb_x=0; s->mb_y=0; decode_slice(s); while(s->mb_y<s->mb_height){ if(s->msmpeg4_version){ if(s->slice_height==0 || s->mb_x!=0 || (s->mb_y%s->slice_height)!=0 || get_bits_count(&s->gb) > s->gb.size_in_bits) break; }else{ if(ff_h263_resync(s)<0) break; } if(s->msmpeg4_version<4 && s->h263_pred) ff_mpeg4_clean_buffers(s); decode_slice(s); } if (s->h263_msmpeg4 && s->msmpeg4_version<4 && s->pict_type==FF_I_TYPE) if(!CONFIG_MSMPEG4_DECODER || msmpeg4_decode_ext_header(s, buf_size) < 0){ s->error_status_table[s->mb_num-1]= AC_ERROR|DC_ERROR|MV_ERROR; } if(s->codec_id==CODEC_ID_MPEG4 && s->bitstream_buffer_size==0 && s->divx_packed){ int current_pos= get_bits_count(&s->gb)>>3; int startcode_found=0; if(buf_size - current_pos > 5){ int i; for(i=current_pos; i<buf_size-3; i++){ if(buf[i]==0 && buf[i+1]==0 && buf[i+2]==1 && buf[i+3]==0xB6){ startcode_found=1; break; } } } if(s->gb.buffer == s->bitstream_buffer && buf_size>20){ startcode_found=1; current_pos=0; } if(startcode_found){ av_fast_malloc( &s->bitstream_buffer, &s->allocated_bitstream_buffer_size, buf_size - current_pos + FF_INPUT_BUFFER_PADDING_SIZE); if (!s->bitstream_buffer) return AVERROR(ENOMEM); memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos); s->bitstream_buffer_size= buf_size - current_pos; } } intrax8_decoded: ff_er_frame_end(s); if (avctx->hwaccel) { if (avctx->hwaccel->end_frame(avctx) < 0) return -1; } MPV_frame_end(s); assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type); assert(s->current_picture.pict_type == s->pict_type); if (s->pict_type == FF_B_TYPE || s->low_delay) { *pict= *(AVFrame*)s->current_picture_ptr; } else if (s->last_picture_ptr != NULL) { *pict= *(AVFrame*)s->last_picture_ptr; } if(s->last_picture_ptr || s->low_delay){ *data_size = sizeof(AVFrame); ff_print_debug_info(s, pict); } avctx->frame_number = s->picture_number - 1; #ifdef PRINT_FRAME_TIME av_log(avctx, AV_LOG_DEBUG, "%"PRId64"\n", rdtsc()-time); #endif return get_consumed_bytes(s, buf_size); }
1threat
static void set_sigmask(const sigset_t *set) { do_sigprocmask(SIG_SETMASK, set, NULL); }
1threat
multiple definition of function in C : I'm writing a functions for my current project. Right now, I have a Countries.h header. when i try to complie this is the error that I get: CMakeFiles/untitled2.dir/Countries.c.o: In function `addCountry': /home/ise/CLionProjects/untitled2/Countries.c:36: multiple definition of `addCountry' CMakeFiles/untitled2.dir/main.c.o:/home/ise/CLionProjects/untitled2/Countries.c:36: first defined here collect2: error: ld returned 1 exit status CMakeFiles/untitled2.dir/build.make:98: recipe for target 'untitled2' failed make[3]: *** [untitled2] Error 1 CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/untitled2.dir/all' failed make[2]: *** [CMakeFiles/untitled2.dir/all] Error 2 CMakeFiles/Makefile2:84: recipe for target 'CMakeFiles/untitled2.dir/rule' failed make[1]: *** [CMakeFiles/untitled2.dir/rule] Error 2 Makefile:118: recipe for target 'untitled2' failed make: *** [untitled2] Error 2 I tried a lot of things but nothing worked
0debug
static int ppc_hash32_pp_check(int key, int pp, int nx) { int access; access = 0; if (key == 0) { switch (pp) { case 0x0: case 0x1: case 0x2: access |= PAGE_WRITE; case 0x3: access |= PAGE_READ; break; } } else { switch (pp) { case 0x0: access = 0; break; case 0x1: case 0x3: access = PAGE_READ; break; case 0x2: access = PAGE_READ | PAGE_WRITE; break; } } if (nx == 0) { access |= PAGE_EXEC; } return access; }
1threat
Is it possible to use the new Android app bundle architecture with RN 0.57? : <p>App bundles: <a href="https://developer.android.com/guide/app-bundle/" rel="noreferrer">https://developer.android.com/guide/app-bundle/</a> This allows Google Play to manage signing, decrease the app size, and allows for pulling code on demand which is really awesome! </p> <p>I tried setting this up but Android studio kept telling me I need to update my gradle version?</p> <p>Here is my build.gradle:</p> <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules. task wrapper(type: Wrapper) { gradleVersion = '4.4' //version required } buildscript { repositories { /** * Must stay in this order */ google() jcenter() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:3.1.3' } } subprojects { afterEvaluate { project -&gt; if (project.hasProperty("android")) { android { compileSdkVersion 27 } } } } allprojects { repositories { google() jcenter() maven { url "https://jitpack.io" } maven { url "$rootDir/../node_modules/react-native/android" } mavenCentral() } } ext { buildToolsVersion = "26.0.3" minSdkVersion = 16 compileSdkVersion = 26 targetSdkVersion = 26 supportLibVersion = "26.1.0" } </code></pre> <p>Is it possible for me to be able to use the app bundles? Or will I have to install wait until the RN community supports it?</p>
0debug
void filter_mb(VP8Context *s, uint8_t *dst[3], VP8FilterStrength *f, int mb_x, int mb_y) { int mbedge_lim, bedge_lim, hev_thresh; int filter_level = f->filter_level; int inner_limit = f->inner_limit; int inner_filter = f->inner_filter; int linesize = s->linesize; int uvlinesize = s->uvlinesize; static const uint8_t hev_thresh_lut[2][64] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }; if (!filter_level) return; bedge_lim = 2 * filter_level + inner_limit; mbedge_lim = bedge_lim + 4; hev_thresh = hev_thresh_lut[s->keyframe][filter_level]; if (mb_x) { s->vp8dsp.vp8_h_loop_filter16y(dst[0], linesize, mbedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_h_loop_filter8uv(dst[1], dst[2], uvlinesize, mbedge_lim, inner_limit, hev_thresh); } if (inner_filter) { s->vp8dsp.vp8_h_loop_filter16y_inner(dst[0] + 4, linesize, bedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_h_loop_filter16y_inner(dst[0] + 8, linesize, bedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_h_loop_filter16y_inner(dst[0] + 12, linesize, bedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_h_loop_filter8uv_inner(dst[1] + 4, dst[2] + 4, uvlinesize, bedge_lim, inner_limit, hev_thresh); } if (mb_y) { s->vp8dsp.vp8_v_loop_filter16y(dst[0], linesize, mbedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_v_loop_filter8uv(dst[1], dst[2], uvlinesize, mbedge_lim, inner_limit, hev_thresh); } if (inner_filter) { s->vp8dsp.vp8_v_loop_filter16y_inner(dst[0] + 4 * linesize, linesize, bedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_v_loop_filter16y_inner(dst[0] + 8 * linesize, linesize, bedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_v_loop_filter16y_inner(dst[0] + 12 * linesize, linesize, bedge_lim, inner_limit, hev_thresh); s->vp8dsp.vp8_v_loop_filter8uv_inner(dst[1] + 4 * uvlinesize, dst[2] + 4 * uvlinesize, uvlinesize, bedge_lim, inner_limit, hev_thresh); } }
1threat
calling a function from another class in the main method C# : i am trying to call a loadwords function from words class in the main method and its giving me this error Error CS0117 'Words' does not contain a definition for 'load_words' how do i call this function?
0debug
static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; const uint8_t *buf_end = avpkt->data + avpkt->size; PTXContext * const s = avctx->priv_data; AVFrame *picture = data; AVFrame * const p = &s->picture; unsigned int offset, w, h, y, stride, bytes_per_pixel; uint8_t *ptr; if (buf_end - buf < 14) offset = AV_RL16(buf); w = AV_RL16(buf+8); h = AV_RL16(buf+10); bytes_per_pixel = AV_RL16(buf+12) >> 3; if (bytes_per_pixel != 2) { av_log_ask_for_sample(avctx, "Image format is not RGB15.\n"); return -1; } avctx->pix_fmt = PIX_FMT_RGB555; if (offset != 0x2c) av_log_ask_for_sample(avctx, "offset != 0x2c\n"); buf += offset; if (p->data[0]) avctx->release_buffer(avctx, p); if (av_image_check_size(w, h, 0, avctx)) return -1; if (w != avctx->width || h != avctx->height) avcodec_set_dimensions(avctx, w, h); if (avctx->get_buffer(avctx, p) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } p->pict_type = AV_PICTURE_TYPE_I; ptr = p->data[0]; stride = p->linesize[0]; for (y=0; y<h; y++) { if (buf_end - buf < w * bytes_per_pixel) break; #if HAVE_BIGENDIAN unsigned int x; for (x=0; x<w*bytes_per_pixel; x+=bytes_per_pixel) AV_WN16(ptr+x, AV_RL16(buf+x)); #else memcpy(ptr, buf, w*bytes_per_pixel); #endif ptr += stride; buf += w*bytes_per_pixel; } *picture = s->picture; *data_size = sizeof(AVPicture); return offset + w*h*bytes_per_pixel; }
1threat
static int qtrle_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { QtrleContext *s = avctx->priv_data; int header, start_line; int height, row_ptr; int has_palette = 0; int ret; bytestream2_init(&s->g, avpkt->data, avpkt->size); if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; if (avpkt->size < 8) goto done; bytestream2_seek(&s->g, 4, SEEK_SET); header = bytestream2_get_be16(&s->g); if (header & 0x0008) { if (avpkt->size < 14) goto done; start_line = bytestream2_get_be16(&s->g); bytestream2_skip(&s->g, 2); height = bytestream2_get_be16(&s->g); bytestream2_skip(&s->g, 2); if (height > s->avctx->height - start_line) goto done; } else { start_line = 0; height = s->avctx->height; } row_ptr = s->frame->linesize[0] * start_line; switch (avctx->bits_per_coded_sample) { case 1: case 33: qtrle_decode_1bpp(s, row_ptr, height); has_palette = 1; break; case 2: case 34: qtrle_decode_2n4bpp(s, row_ptr, height, 2); has_palette = 1; break; case 4: case 36: qtrle_decode_2n4bpp(s, row_ptr, height, 4); has_palette = 1; break; case 8: case 40: qtrle_decode_8bpp(s, row_ptr, height); has_palette = 1; break; case 16: qtrle_decode_16bpp(s, row_ptr, height); break; case 24: qtrle_decode_24bpp(s, row_ptr, height); break; case 32: qtrle_decode_32bpp(s, row_ptr, height); break; default: av_log (s->avctx, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n", avctx->bits_per_coded_sample); break; } if(has_palette) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); if (pal) { s->frame->palette_has_changed = 1; memcpy(s->pal, pal, AVPALETTE_SIZE); } memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE); } done: if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; *got_frame = 1; return avpkt->size; }
1threat
static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { int i; int64_t pos = avio_tell(pb); avio_wb32(pb, 0); ffio_wfourcc(pb, "moov"); for (i = 0; i < mov->nb_streams; i++) { if (mov->tracks[i].entry <= 0 && !(mov->flags & FF_MOV_FLAG_FRAGMENT)) continue; mov->tracks[i].time = mov->time; mov->tracks[i].track_id = i + 1; if (mov->tracks[i].entry) build_chunks(&mov->tracks[i]); } if (mov->chapter_track) for (i = 0; i < s->nb_streams; i++) { mov->tracks[i].tref_tag = MKTAG('c','h','a','p'); mov->tracks[i].tref_id = mov->tracks[mov->chapter_track].track_id; } for (i = 0; i < mov->nb_streams; i++) { if (mov->tracks[i].tag == MKTAG('r','t','p',' ')) { mov->tracks[i].tref_tag = MKTAG('h','i','n','t'); mov->tracks[i].tref_id = mov->tracks[mov->tracks[i].src_track].track_id; } } for (i = 0; i < mov->nb_streams; i++) { if (mov->tracks[i].tag == MKTAG('t','m','c','d')) { int src_trk = mov->tracks[i].src_track; mov->tracks[src_trk].tref_tag = mov->tracks[i].tag; mov->tracks[src_trk].tref_id = mov->tracks[i].track_id; mov->tracks[i].track_duration = av_rescale(mov->tracks[src_trk].track_duration, mov->tracks[i].timescale, mov->tracks[src_trk].timescale); } } mov_write_mvhd_tag(pb, mov); if (mov->mode != MODE_MOV && !mov->iods_skip) mov_write_iods_tag(pb, mov); for (i = 0; i < mov->nb_streams; i++) { if (mov->tracks[i].entry > 0 || mov->flags & FF_MOV_FLAG_FRAGMENT) { mov_write_trak_tag(pb, mov, &(mov->tracks[i]), i < s->nb_streams ? s->streams[i] : NULL); } } if (mov->flags & FF_MOV_FLAG_FRAGMENT) mov_write_mvex_tag(pb, mov); if (mov->mode == MODE_PSP) mov_write_uuidusmt_tag(pb, s); else mov_write_udta_tag(pb, mov, s); return update_size(pb, pos); }
1threat
Google maps + XAMPP : <p>How can I test google maps APIs with XAMPP (as a localhost). Any help on this matter is highly appreciated. A proper tutorial link would be of great help!</p> <p>Thanks in advance!</p>
0debug
Is the thread in C++ a time slice or the execution of a function? : Is the thread in C++ a time slice or the execution of a function or both? A thread is executing a function which is a block of code inside an outer loop. If you send a signal (via a global variable) to break from the outer loop. The function returns, but what happens to the running thread assuming it is a time slice of execution?
0debug
void qemu_iovec_concat(QEMUIOVector *dst, QEMUIOVector *src, size_t soffset, size_t sbytes) { int i; size_t done; struct iovec *siov = src->iov; assert(dst->nalloc != -1); assert(src->size >= soffset); for (i = 0, done = 0; done < sbytes && i < src->niov; i++) { if (soffset < siov[i].iov_len) { size_t len = MIN(siov[i].iov_len - soffset, sbytes - done); qemu_iovec_add(dst, siov[i].iov_base + soffset, len); done += len; soffset = 0; } else { soffset -= siov[i].iov_len; } } }
1threat
int av_packet_copy_props(AVPacket *dst, const AVPacket *src) { int i; dst->pts = src->pts; dst->dts = src->dts; dst->pos = src->pos; dst->duration = src->duration; dst->convergence_duration = src->convergence_duration; dst->flags = src->flags; dst->stream_index = src->stream_index; dst->side_data_elems = src->side_data_elems; for (i = 0; i < src->side_data_elems; i++) { enum AVPacketSideDataType type = src->side_data[i].type; int size = src->side_data[i].size; uint8_t *src_data = src->side_data[i].data; uint8_t *dst_data = av_packet_new_side_data(dst, type, size); if (!dst_data) { av_packet_free_side_data(dst); return AVERROR(ENOMEM); } memcpy(dst_data, src_data, size); } return 0; }
1threat
SWIFT: Adding Double and a String to then display on a label : I am trying to add up a value that is entered in the text field with a value specified as a double and then returning the value on a label. I would appreciate, if someone could assist. I am a complete beginner so probably something very obvious :( . The code that I have is : @IBOutlet weak var enterField: UITextField! var weekOneTotal:Double = 0 @IBAction func addButton(_ sender: Any) { addCorrectValue() } func addCorrectValue () { guard let addAmount = convertAmount(input: enterField.text!) else { print("Invalid amount") return } let newValue = weekOneTotal += addAmount secondScreen.weekOneAmountLabel.text = String(newValue) } func convertAmount (input:String) -> Double? { let numberFormatter = NumberFormatter () numberFormatter.numberStyle = .decimal return numberFormatter.number(from: input)?.doubleValue }
0debug
Is there a way to make Github un-approve a pull request if a new commit is pushed to the branch? : <p>Using the new pull request approval process in Github, if I approve a PR but then a dev pushes a new commit to that branch I'd want the PR to go back to the state it is in to start with (i.e. not approved).</p> <p>At the moment it stays green but in reality there is code that hasn't been reviewed in the branch.</p>
0debug
QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head, const GraphicHwOps *hw_ops, void *opaque) { int width = 640; int height = 480; QemuConsole *s; DisplayState *ds; ds = get_alloc_displaystate(); trace_console_gfx_new(); s = new_console(ds, GRAPHIC_CONSOLE, head); s->hw_ops = hw_ops; s->hw = opaque; if (dev) { object_property_set_link(OBJECT(s), OBJECT(dev), "device", &error_abort); } s->surface = qemu_create_displaysurface(width, height); return s; }
1threat
long do_rt_sigreturn(CPUM68KState *env) { struct target_rt_sigframe *frame; abi_ulong frame_addr = env->aregs[7] - 4; target_sigset_t target_set; sigset_t set; trace_user_do_rt_sigreturn(env, frame_addr); if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) goto badframe; target_to_host_sigset_internal(&set, &target_set); set_sigmask(&set); if (target_rt_restore_ucontext(env, &frame->uc)) goto badframe; if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe, uc.tuc_stack), 0, get_sp_from_cpustate(env)) == -EFAULT) goto badframe; unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); return 0; }
1threat
Please provide assistance with php filename : I am hoping this will be an easy item for some of you to answer. I am looking at some PHP files and I am seeing stuff where there will be one file: file1.php and then there will be a second file called: file1.php~ I have never seen this before so I am wondering what the tilde (~) after the extension means... Thanks so much, Gerard
0debug
Is use of clojure.spec for coercion idiomatic? : <p>I've seen use of clojure conformers to coerce data in various gists, but have also picked up an impression (I can't recall where though) that coercion (e.g. as follows) is not idiomatic use of conformers. </p> <pre><code>(s/def :conformers/int (s/conformer (fn [x] (cond (integer? x) x (re-matches #"\d+" x) (edn/read-string x) :else :cljs.spec.alpha/invalid)))) (s/def :data.subscription/quantity :conformers/int) (s/def :data/subscription (s/keys :req-un [:data.subscription/quantity])) </code></pre> <p>Is it true that the above is unidiomatic/unintended? And if so, what would be appropriate/idiomatic use. Where do the boundaries of the intended use lie?</p>
0debug
Laravel - What is the most used tool for create automated code for CRUD? : <p>I know another frameworks in PHP that got tools for create automated the code for a CRUD. In Laravel what is the most used tool for this?</p> <p>Thanks</p>
0debug
VBA - If a cell equals a certain value do a certain string otherwise do another string : I am trying to create a Macro. But am not entirely show how to get it to work. I want the Macro to run if cell A1 is not blank. If cell A1 is blank I want a msgbox to appear informing the user to fill in cell A1 before the Macro will work. IE in formula terms =if(A1<>"",do resest of macro,"Populate cell A1") If someone could please help me create the condition do x or y depending on A1's value I would be most appreciative. I think it should work something like below Sub Code () If("A1")<>"""" Goto String1 Else Goto String2 String1: MsgBox "Populate cell A1" String2: Rest of code
0debug
void laio_io_plug(BlockDriverState *bs, void *aio_ctx) { struct qemu_laio_state *s = aio_ctx; s->io_q.plugged++; }
1threat
preg match html to variable php get value span : <p><strong>Hello,</strong></p> <p>I need to get the value of:</p> <pre><code>&lt;span class="price amount"&gt;&lt;/span&gt; </code></pre> <p>This is my complete code:</p> <pre><code>&lt;td&gt;&lt;div class="yith_wapo_group_final_total"&gt;&lt;span id="teste" class="price amount"&gt; VALUE &lt;/span&gt;&lt;/div&gt;&lt;/td&gt; </code></pre> <p>I need to somehow recover the value that this:</p> <pre><code>&lt;span id = "test" class = "price amount"&gt; VALUE &lt;/span&gt; </code></pre> <p><strong>The goal is to pass the value to a php variable.</strong></p> <p><strong>Thanks.</strong></p>
0debug
Angular2 RC5 Mock Activated Route Params : <p>I need to be able to mock the activated route parameters to be able to test my component.</p> <p>Here's my best attempt so far, but it doesn't work.</p> <pre><code>{ provide: ActivatedRoute, useValue: { params: [ { 'id': 1 } ] } }, </code></pre> <p>The ActivatedRoute is used in the actual component like this:</p> <pre><code>this.route.params.subscribe(params =&gt; { this.stateId = +params['id']; this.stateService.getState(this.stateId).then(state =&gt; { this.state = state; }); }); </code></pre> <p>The error I get with my current attempt is simply:</p> <p><code>TypeError: undefined is not a constructor (evaluating 'this.route.params.subscribe')</code></p> <p>Any help would be greatly appreciated.</p>
0debug
static void tcp_chr_tls_init(Chardev *chr) { SocketChardev *s = SOCKET_CHARDEV(chr); QIOChannelTLS *tioc; Error *err = NULL; gchar *name; if (s->is_listen) { tioc = qio_channel_tls_new_server( s->ioc, s->tls_creds, NULL, &err); } else { tioc = qio_channel_tls_new_client( s->ioc, s->tls_creds, s->addr->u.inet.data->host, &err); } if (tioc == NULL) { error_free(err); tcp_chr_disconnect(chr); return; } name = g_strdup_printf("chardev-tls-%s-%s", s->is_listen ? "server" : "client", chr->label); qio_channel_set_name(QIO_CHANNEL(tioc), name); g_free(name); object_unref(OBJECT(s->ioc)); s->ioc = QIO_CHANNEL(tioc); qio_channel_tls_handshake(tioc, tcp_chr_tls_handshake, chr, NULL); }
1threat
static void test_qga_file_ops(gconstpointer fix) { const TestFixture *fixture = fix; const unsigned char helloworld[] = "Hello World!\n"; const char *b64; gchar *cmd, *path, *enc; unsigned char *dec; QDict *ret, *val; int64_t id, eof; gsize count; FILE *f; char tmp[100]; ret = qmp_fd(fixture->fd, "{'execute': 'guest-file-open'," " 'arguments': { 'path': 'foo', 'mode': 'w+' } }"); g_assert_nonnull(ret); qmp_assert_no_error(ret); id = qdict_get_int(ret, "return"); QDECREF(ret); enc = g_base64_encode(helloworld, sizeof(helloworld)); cmd = g_strdup_printf("{'execute': 'guest-file-write'," " 'arguments': { 'handle': %" PRId64 "," " 'buf-b64': '%s' } }", id, enc); ret = qmp_fd(fixture->fd, cmd); g_assert_nonnull(ret); qmp_assert_no_error(ret); val = qdict_get_qdict(ret, "return"); count = qdict_get_int(val, "count"); eof = qdict_get_bool(val, "eof"); g_assert_cmpint(count, ==, sizeof(helloworld)); g_assert_cmpint(eof, ==, 0); QDECREF(ret); g_free(cmd); cmd = g_strdup_printf("{'execute': 'guest-file-flush'," " 'arguments': {'handle': %" PRId64 "} }", id); ret = qmp_fd(fixture->fd, cmd); QDECREF(ret); g_free(cmd); cmd = g_strdup_printf("{'execute': 'guest-file-close'," " 'arguments': {'handle': %" PRId64 "} }", id); ret = qmp_fd(fixture->fd, cmd); QDECREF(ret); g_free(cmd); path = g_build_filename(fixture->test_dir, "foo", NULL); f = fopen(path, "r"); g_assert_nonnull(f); count = fread(tmp, 1, sizeof(tmp), f); g_assert_cmpint(count, ==, sizeof(helloworld)); tmp[count] = 0; g_assert_cmpstr(tmp, ==, (char *)helloworld); fclose(f); ret = qmp_fd(fixture->fd, "{'execute': 'guest-file-open'," " 'arguments': { 'path': 'foo', 'mode': 'r' } }"); g_assert_nonnull(ret); qmp_assert_no_error(ret); id = qdict_get_int(ret, "return"); QDECREF(ret); cmd = g_strdup_printf("{'execute': 'guest-file-read'," " 'arguments': { 'handle': %" PRId64 "} }", id); ret = qmp_fd(fixture->fd, cmd); val = qdict_get_qdict(ret, "return"); count = qdict_get_int(val, "count"); eof = qdict_get_bool(val, "eof"); b64 = qdict_get_str(val, "buf-b64"); g_assert_cmpint(count, ==, sizeof(helloworld)); g_assert(eof); g_assert_cmpstr(b64, ==, enc); QDECREF(ret); g_free(cmd); g_free(enc); cmd = g_strdup_printf("{'execute': 'guest-file-read'," " 'arguments': { 'handle': %" PRId64 "} }", id); ret = qmp_fd(fixture->fd, cmd); val = qdict_get_qdict(ret, "return"); count = qdict_get_int(val, "count"); eof = qdict_get_bool(val, "eof"); b64 = qdict_get_str(val, "buf-b64"); g_assert_cmpint(count, ==, 0); g_assert(eof); g_assert_cmpstr(b64, ==, ""); QDECREF(ret); g_free(cmd); cmd = g_strdup_printf("{'execute': 'guest-file-seek'," " 'arguments': { 'handle': %" PRId64 ", " " 'offset': %d, 'whence': '%s' } }", id, 6, "set"); ret = qmp_fd(fixture->fd, cmd); qmp_assert_no_error(ret); val = qdict_get_qdict(ret, "return"); count = qdict_get_int(val, "position"); eof = qdict_get_bool(val, "eof"); g_assert_cmpint(count, ==, 6); g_assert(!eof); QDECREF(ret); g_free(cmd); cmd = g_strdup_printf("{'execute': 'guest-file-read'," " 'arguments': { 'handle': %" PRId64 "} }", id); ret = qmp_fd(fixture->fd, cmd); val = qdict_get_qdict(ret, "return"); count = qdict_get_int(val, "count"); eof = qdict_get_bool(val, "eof"); b64 = qdict_get_str(val, "buf-b64"); g_assert_cmpint(count, ==, sizeof(helloworld) - 6); g_assert(eof); dec = g_base64_decode(b64, &count); g_assert_cmpint(count, ==, sizeof(helloworld) - 6); g_assert_cmpmem(dec, count, helloworld + 6, sizeof(helloworld) - 6); g_free(dec); QDECREF(ret); g_free(cmd); cmd = g_strdup_printf("{'execute': 'guest-file-close'," " 'arguments': {'handle': %" PRId64 "} }", id); ret = qmp_fd(fixture->fd, cmd); QDECREF(ret); g_free(cmd); }
1threat
Python: efficient way to loop through different lines of a data structure : I have a data structure like this: 1 --- 1 --- 100 2 --- 1 --- 200 3 --- 1 --- 100 1 --- 2 --- 300 2 --- 2 --- 100 3 --- 2 --- 400 I want to extract the data of third column corresponding to different values of second column, for example add three numbers in third column corresponding to number 1 in second column and so on. How should I do it efficiently in Python?
0debug
static bool aio_dispatch_handlers(AioContext *ctx) { AioHandler *node, *tmp; bool progress = false; qemu_lockcnt_inc(&ctx->list_lock); QLIST_FOREACH_SAFE_RCU(node, &ctx->aio_handlers, node, tmp) { int revents; revents = node->pfd.revents & node->pfd.events; node->pfd.revents = 0; if (!node->deleted && (revents & (G_IO_IN | G_IO_HUP | G_IO_ERR)) && aio_node_check(ctx, node->is_external) && node->io_read) { node->io_read(node->opaque); if (node->opaque != &ctx->notifier) { progress = true; } } if (!node->deleted && (revents & (G_IO_OUT | G_IO_ERR)) && aio_node_check(ctx, node->is_external) && node->io_write) { node->io_write(node->opaque); progress = true; } if (node->deleted) { if (qemu_lockcnt_dec_if_lock(&ctx->list_lock)) { QLIST_REMOVE(node, node); g_free(node); qemu_lockcnt_inc_and_unlock(&ctx->list_lock); } } } qemu_lockcnt_dec(&ctx->list_lock); return progress; }
1threat
RGB_FUNCTIONS(rgb565) #undef RGB_IN #undef RGB_OUT #undef BPP #define RGB_IN(r, g, b, s)\ {\ b = (s)[0];\ g = (s)[1];\ r = (s)[2];\ } #define RGB_OUT(d, r, g, b)\ {\ (d)[0] = b;\ (d)[1] = g;\ (d)[2] = r;\ } #define BPP 3 RGB_FUNCTIONS(bgr24) #undef RGB_IN #undef RGB_OUT #undef BPP #define RGB_IN(r, g, b, s)\ {\ r = (s)[0];\ g = (s)[1];\ b = (s)[2];\ } #define RGB_OUT(d, r, g, b)\ {\ (d)[0] = r;\ (d)[1] = g;\ (d)[2] = b;\ } #define BPP 3 RGB_FUNCTIONS(rgb24) static void yuv444p_to_rgb24(AVPicture *dst, AVPicture *src, int width, int height) { uint8_t *y1_ptr, *cb_ptr, *cr_ptr, *d, *d1; int w, y, cb, cr, r_add, g_add, b_add; uint8_t *cm = cropTbl + MAX_NEG_CROP; unsigned int r, g, b; d = dst->data[0]; y1_ptr = src->data[0]; cb_ptr = src->data[1]; cr_ptr = src->data[2]; for(;height > 0; height --) { d1 = d; for(w = width; w > 0; w--) { YUV_TO_RGB1_CCIR(cb_ptr[0], cr_ptr[0]); YUV_TO_RGB2_CCIR(r, g, b, y1_ptr[0]); RGB_OUT(d1, r, g, b); d1 += BPP; y1_ptr++; cb_ptr++; cr_ptr++; } d += dst->linesize[0]; y1_ptr += src->linesize[0] - width; cb_ptr += src->linesize[1] - width; cr_ptr += src->linesize[2] - width; } }
1threat
When can I use a SFSafariViewController, WKWebView, or UIWebView with universal links? : <p>In the <a href="https://developer.apple.com/library/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html#//apple_ref/doc/uid/TP40016308-CH12-SW1" rel="noreferrer">Universal Links</a> section of the <a href="https://developer.apple.com/library/ios/documentation/General/Conceptual/AppSearch/index.html" rel="noreferrer">iOS App Search Programming Guide</a>, Apple says:</p> <blockquote> <p>If you instantiate a SFSafariViewController, WKWebView, or UIWebView object to handle a universal link, iOS opens your website in Safari instead of opening your app. However, if the user taps a universal link from within an embedded SFSafariViewController, WKWebView, or UIWebView object, iOS opens your app.</p> </blockquote> <p>What does "handle a universal link" mean? Can I not ever open the given URL with an <code>SFSafariViewController</code>, <code>WKWebView</code>, or <code>UIWebView</code>? Does it only apply during <code>-[UIApplicationDelegate application:continueUserActivity:restorationHandler:]</code>, or is there a timeout in place? Does this mean we can't ever open the URL in a <code>SFSafariViewController</code>, <code>WKWebView</code>, or <code>UIWebView</code>?</p>
0debug
NoSuchElementException Error with While Loop : <p>My <strong>readDataFromFile()</strong> method reads text files like this: </p> <pre><code>Bird Golden Eagle Eddie Mammal Tiger Tommy Mammal Lion Leo Bird Parrot Polly Reptile Cobra Colin </code></pre> <p>With my current <strong><code>while loop</code></strong>, it separates each column: <strong><code>type, species and name</code></strong>. However the first line has 'Golden Eagle' separated by a <strong><code>space</code></strong> not a <strong><code>tab</code></strong>, so it counts as 2 different substrings, so the output would be <strong><code>'Golden Eagle Eddie'</code></strong> instead of <strong><code>'Bird Golden Eagle Eddie'</code></strong>.</p> <p>To try fix this I used the <strong><code>scanner.useDelimiter("\\t");</code></strong> however the output comes out like this:</p> <pre><code>Golden Eagle Eddie Mammal Tiger Mammal Lion Leo Bird Reptile Cobra Colin </code></pre> <p>with an <strong>ERROR</strong> which highlights this line in my code <strong>'scanner.nextLine();'</strong></p> <pre><code>java.util.NoSuchElementException: No line found at java.util.Scanner.nextLine(Scanner.java:1540) at MyZoo.readDataFromFile(MyZoo.java:72) </code></pre> <p>My Code:</p> <pre><code>scanner.useDelimiter("\\t"); scanner.next(); while(scanner.hasNextLine()) { String type = scanner.next(); String species = scanner.next(); String name = scanner.next(); System.out.println(type + " " + species + " " + name); scanner.nextLine(); addAnimal( new Animal(species, name, this) ); } scanner.close(); </code></pre>
0debug
Put circle top div position center : <p>I need to replicate this. What is the best way to add a cirle like this image with css? </p> <p>thanks <a href="https://i.stack.imgur.com/ZLFie.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZLFie.png" alt="enter image description here"></a></p>
0debug
plot pandas dataframe two columns from : <p>i have a pandas dataframe which has dates as indexes and some columns: I would like to plot a line chart with 2 lines (let's say 'ISP.MI' and 'Ctrv'); on the x axis I need the 'Date' </p> <pre><code>Ticker ISP.MI Daily returns Ctrv Inv_Am Giac_Media Date 2016-01-01 2.90117 NaN 100.000000 100 100.0 2016-01-04 2.80159 -0.034927 196.507301 200 150.0 2016-01-05 2.85608 0.019263 300.292610 300 200.0 2016-01-06 2.77904 -0.027345 392.081255 400 250.0 2016-01-07 2.73206 -0.017050 485.396411 500 300.0 2016-01-08 2.72267 -0.003443 583.725246 600 350.0 </code></pre>
0debug
How to store user settings in excel add-in : <p>I've built an Excel add-in that I would like to distribute to a few team members. There is a field (a key) that the user will need to provide. I have a user form that the user can use to enter in their unique key. I'd like to store that key as a variable within the add-in and don't know how to do it. I see a worksheet object within the add-in. Is there a way to store the variable there? The add-in will be used in multiple files, so I can't sore it in a specific file. </p>
0debug
Why variable y is 0, is not 2? : <pre><code>int x=0, y=0, z=0; z = (x==1) &amp;&amp; (y=2); printf("%d ", y); </code></pre> <p>I'm wondering the output is 0. Why the output is not 2?</p>
0debug
int avpriv_exif_decode_ifd(void *logctx, GetByteContext *gbytes, int le, int depth, AVDictionary **metadata) { int i, ret; int entries; entries = ff_tget_short(gbytes, le); if (bytestream2_get_bytes_left(gbytes) < entries * 12) { return AVERROR_INVALIDDATA; } for (i = 0; i < entries; i++) { if ((ret = exif_decode_tag(logctx, gbytes, le, depth, metadata)) < 0) { return ret; } } return ff_tget_long(gbytes, le); }
1threat
Filter items CSS grid position re-adjusment animations : <p>I have a react app that filters a bunch of items in a css grid layout.</p> <p>When un-filtered the grid contains all the items.</p> <pre><code>&lt;div&gt; &lt;div class="product"&gt;&lt;/div&gt; &lt;div class="product"&gt;&lt;/div&gt; &lt;div class="product"&gt;&lt;/div&gt; &lt;div class="product"&gt;&lt;/div&gt; &lt;div class="product"&gt;&lt;/div&gt; &lt;div class="product"&gt;&lt;/div&gt; &lt;div class="product"&gt;&lt;/div&gt; &lt;div class="product"&gt;&lt;/div&gt; &lt;div class="product"&gt;&lt;/div&gt; &lt;div&gt; </code></pre> <p>Once a filtered is applied the grid of items will get smaller</p> <pre><code>&lt;div&gt; &lt;div class="product"&gt;&lt;/div&gt; &lt;div class="product"&gt;&lt;/div&gt; &lt;div&gt; </code></pre> <p>If another filter is removed there may be more.</p> <pre><code>&lt;div&gt; &lt;div class="product"&gt;&lt;/div&gt; &lt;div class="product"&gt;&lt;/div&gt; &lt;div class="product"&gt;&lt;/div&gt; &lt;div&gt; </code></pre> <p>How can I apply transition animations for grid items to slide into place when grid items disappear or reappear?</p>
0debug
Total size of serialized results of 16 tasks (1048.5 MB) is bigger than spark.driver.maxResultSize (1024.0 MB) : <p>I get the following error when I add <code>--conf spark.driver.maxResultSize=2050</code> to my <code>spark-submit</code> command.</p> <pre><code>17/12/27 18:33:19 ERROR TransportResponseHandler: Still have 1 requests outstanding when connection from /XXX.XX.XXX.XX:36245 is closed 17/12/27 18:33:19 WARN Executor: Issue communicating with driver in heartbeater org.apache.spark.SparkException: Exception thrown in awaitResult: at org.apache.spark.util.ThreadUtils$.awaitResult(ThreadUtils.scala:205) at org.apache.spark.rpc.RpcTimeout.awaitResult(RpcTimeout.scala:75) at org.apache.spark.rpc.RpcEndpointRef.askSync(RpcEndpointRef.scala:92) at org.apache.spark.executor.Executor.org$apache$spark$executor$Executor$$reportHeartBeat(Executor.scala:726) at org.apache.spark.executor.Executor$$anon$2$$anonfun$run$1.apply$mcV$sp(Executor.scala:755) at org.apache.spark.executor.Executor$$anon$2$$anonfun$run$1.apply(Executor.scala:755) at org.apache.spark.executor.Executor$$anon$2$$anonfun$run$1.apply(Executor.scala:755) at org.apache.spark.util.Utils$.logUncaughtExceptions(Utils.scala:1954) at org.apache.spark.executor.Executor$$anon$2.run(Executor.scala:755) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.io.IOException: Connection from /XXX.XX.XXX.XX:36245 closed at org.apache.spark.network.client.TransportResponseHandler.channelInactive(TransportResponseHandler.java:146) </code></pre> <p>The reason of adding this configuration was the error:</p> <pre><code>py4j.protocol.Py4JJavaError: An error occurred while calling o171.collectToPython. : org.apache.spark.SparkException: Job aborted due to stage failure: Total size of serialized results of 16 tasks (1048.5 MB) is bigger than spark.driver.maxResultSize (1024.0 MB) </code></pre> <p>Therefore, I increased <code>maxResultSize</code> to 2.5 Gb, but the Spark job fails anyway (the error shown above). How to solve this issue?</p>
0debug
static inline void writer_print_string(WriterContext *wctx, const char *key, const char *val) { wctx->writer->print_string(wctx, key, val); wctx->nb_item++; }
1threat
int qcow2_zero_clusters(BlockDriverState *bs, uint64_t offset, int nb_sectors, int flags) { BDRVQcow2State *s = bs->opaque; uint64_t end_offset; uint64_t nb_clusters; int ret; end_offset = offset + (nb_sectors << BDRV_SECTOR_BITS); assert(QEMU_IS_ALIGNED(offset, s->cluster_size)); assert(QEMU_IS_ALIGNED(end_offset, s->cluster_size) || end_offset == bs->total_sectors << BDRV_SECTOR_BITS); if (s->qcow_version < 3) { return -ENOTSUP; } nb_clusters = size_to_clusters(s, nb_sectors << BDRV_SECTOR_BITS); s->cache_discards = true; while (nb_clusters > 0) { ret = zero_single_l2(bs, offset, nb_clusters, flags); if (ret < 0) { goto fail; } nb_clusters -= ret; offset += (ret * s->cluster_size); } ret = 0; fail: s->cache_discards = false; qcow2_process_discards(bs, ret); return ret; }
1threat
static void hdcd_reset(hdcd_state *state, unsigned rate, unsigned cdt_ms) { int i; state->window = 0; state->readahead = 32; state->arg = 0; state->control = 0; state->running_gain = 0; state->sustain = 0; state->sustain_reset = cdt_ms*rate/1000; state->code_counterA = 0; state->code_counterA_almost = 0; state->code_counterB = 0; state->code_counterB_checkfails = 0; state->code_counterC = 0; state->code_counterC_unmatched = 0; state->count_peak_extend = 0; state->count_transient_filter = 0; for(i = 0; i < 16; i++) state->gain_counts[i] = 0; state->max_gain = 0; state->count_sustain_expired = -1; state->_ana_snb = 0; }
1threat
static void avc_luma_mid_and_aver_dst_16x16_msa(const uint8_t *src, int32_t src_stride, uint8_t *dst, int32_t dst_stride) { avc_luma_mid_and_aver_dst_8w_msa(src, src_stride, dst, dst_stride, 16); avc_luma_mid_and_aver_dst_8w_msa(src + 8, src_stride, dst + 8, dst_stride, 16); }
1threat
def find_Sum(arr,n): arr.sort() sum = arr[0] for i in range(0,n-1): if (arr[i] != arr[i+1]): sum = sum + arr[i+1] return sum
0debug
How to get Emmet to generate a custom JSX attribute without quotes : <p>I'm trying to remove the quotes generated by Emmet around the <code>props.onInitiateBattle</code> value for custom attribute <code>onClick</code>.</p> <p><strong>My input</strong> (then CTRL + E to expand, similar to tab):<br /> <code>button.btn[type="button"][onClick={props.onInitiateBattle}]</code></p> <p><strong>Emmet's output:</strong><br /> <code>&lt;button className="btn" type="button" onClick="{props.onInitiateBattle}"&gt;&lt;/button&gt;</code></p> <p>Notice <code>props.onInitiateBattle</code> WITH quotes, which isn't good.</p> <p><strong>What I expect</strong> (props... WITHOUT quotes):<br /> <code>&lt;button className="btn" type="button" onClick={props.onInitiateBattle}&gt;&lt;/button&gt;</code></p> <p>Wrapping it around double brackets doesn't work either.</p>
0debug
How to find element with attribute? : <p>I have the following html:</p> <pre><code>&lt;div class="item" data-value="100"&gt;Something&lt;/div&gt; </code></pre> <p>Now, I am using the following to find this element:</p> <pre><code>$( "div[data-value=value]") </code></pre> <p>Where <code>value</code> is <code>"100"</code>. However, I don't think jquery sees the <code>value</code> as javascript object - I think it takes it as it is. How can I fix this?</p>
0debug
static int avi_write_idx1(AVFormatContext *s) { AVIOContext *pb = s->pb; AVIContext *avi = s->priv_data; int64_t idx_chunk; int i; char tag[5]; if (pb->seekable) { AVIStream *avist; AVIIentry *ie = 0, *tie; int empty, stream_id = -1; idx_chunk = ff_start_tag(pb, "idx1"); for (i = 0; i < s->nb_streams; i++) { avist = s->streams[i]->priv_data; avist->entry = 0; } do { empty = 1; for (i = 0; i < s->nb_streams; i++) { avist = s->streams[i]->priv_data; if (avist->indexes.entry <= avist->entry) continue; tie = avi_get_ientry(&avist->indexes, avist->entry); if (empty || tie->pos < ie->pos) { ie = tie; stream_id = i; } empty = 0; } if (!empty) { avist = s->streams[stream_id]->priv_data; avi_stream2fourcc(tag, stream_id, s->streams[stream_id]->codecpar->codec_type); ffio_wfourcc(pb, tag); avio_wl32(pb, ie->flags); avio_wl32(pb, ie->pos); avio_wl32(pb, ie->len); avist->entry++; } } while (!empty); ff_end_tag(pb, idx_chunk); avi_write_counters(s, avi->riff_id); } return 0; }
1threat
Add label text on table view cell : <p>How can i convert labels to integers and sum all of them up </p> <pre><code> var totalCount:Int? if let number = Int(price.text!) { let myNumber = NSNumber(integer:number) totalCount = totalCount! + myNumber.integerValue print(totalCount) } else { print("'\(price.text)' did not convert to an Int") } </code></pre> <p>here is my code it is not working</p>
0debug
Mutiple API controllers into single : <p>I have multiple API controllers is there clean way to merge all? Lot of code in different controller is redundant so need to clean it</p>
0debug
list of all float numbers in 1/d where d = range(1,1000) : how to have a list of float numbers where the numerator is 1 and the the denominator is range(1,1000) my code only return a all zero list x = list(range(1,1000)) aList = [1/d for d in x] print(aList)
0debug
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
static void gic_complete_irq(gic_state * s, int cpu, int irq) { int update = 0; int cm = 1 << cpu; DPRINTF("EOI %d\n", irq); if (s->running_irq[cpu] == 1023) return; if (irq != 1023) { if (!GIC_TEST_TRIGGER(irq) && GIC_TEST_ENABLED(irq) && GIC_TEST_LEVEL(irq, cm) && (GIC_TARGET(irq) & cm) != 0) { DPRINTF("Set %d pending mask %x\n", irq, cm); GIC_SET_PENDING(irq, cm); update = 1; } } if (irq != s->running_irq[cpu]) { int tmp = s->running_irq[cpu]; while (s->last_active[tmp][cpu] != 1023) { if (s->last_active[tmp][cpu] == irq) { s->last_active[tmp][cpu] = s->last_active[irq][cpu]; break; } tmp = s->last_active[tmp][cpu]; } if (update) { gic_update(s); } } else { gic_set_running_irq(s, cpu, s->last_active[s->running_irq[cpu]][cpu]); } }
1threat
Where do I put my python files in the venv folder? : <p>(<em>Probably a noob question, but I didn't find a solution after googling for 20 minutes.</em>)</p> <p>I created a new <em>pure Python</em> project with PyCharm which yielded the following folder structure</p> <pre><code>myproject └── venv β”œβ”€β”€ bin β”‚Β Β  β”œβ”€β”€ activate β”‚Β Β  β”œβ”€β”€ activate.csh β”‚Β Β  β”œβ”€β”€ activate.fish β”‚Β Β  β”œβ”€β”€ easy_install β”‚Β Β  β”œβ”€β”€ easy_install-3.5 β”‚Β Β  β”œβ”€β”€ pip β”‚Β Β  β”œβ”€β”€ pip3 β”‚Β Β  β”œβ”€β”€ pip3.5 β”‚Β Β  β”œβ”€β”€ python β”‚Β Β  β”œβ”€β”€ python3 β”‚Β Β  └── python3.5 β”œβ”€β”€ include β”œβ”€β”€ lib β”‚Β Β  └── python3.5 β”œβ”€β”€ lib64 -&gt; lib └── pyvenv.cfg </code></pre> <p>Where do I put <code>myproject.py</code> or the <code>myproject</code> folder now?</p> <ul> <li>Inside or outside of <code>venv</code>?</li> <li>In the <code>venv/bin</code>folder?</li> <li>Just inside <code>venv</code>, i.e. <code>myproject/venv/myproject.py</code>?</li> </ul>
0debug