problem
stringlengths
26
131k
labels
class label
2 classes
Adding Parameter to Angular router.navigate : <p>First of all, I am not sure if this is the right way, to achieve what I want.. I am trying to add an export binding like the following to a router.navigate()-method:</p> <pre><code>&lt;call [caller]="caller"&gt;&lt;/call&gt; </code></pre> <p>The problem is that I never use the directive, but instead adress it through a router:</p> <pre><code>acceptCall() { this.router.navigate(["call"]); } </code></pre> <p>How can I achieve the same export binding from the first example in the acceptCall()-method? I Have already added an Input() variable and tried it with queryParams like this:</p> <pre><code>@Input() caller: Caller; acceptCall(caller) { this.router.navigate(["call"], {queryParams: caller}); } </code></pre> <p>But this does not work.</p>
0debug
Playframework: Use Scalatags instead of Twirl : <p>I'd prefer to use the former over the latter, but am not sure how to incorporate Scalatags into the playframework.</p> <p>This is my simple layout:</p> <pre><code>object Test { import scalatags.Text.all._ def build = { html( head( title := "Test" ), body( h1("This is a Triumph"), div( "Test" ) ) ) } } </code></pre> <p>This is how I try to render it:</p> <pre><code>Ok(views.Test.build.render) </code></pre> <p>Problem is, that I get it as a plain String, not as HTML.</p> <p>Now, of course one solution would be to simply append.</p> <pre><code>Ok(views.Test.build.render).as("text/html") </code></pre> <p>but is that really the only way? (Without creating a helper method that is)</p>
0debug
How to create shortcode in wordpress? : <p>When I run the following i get:</p> <blockquote> <p>Parse error: syntax error, unexpected 'if' (T_IF) in /home3/</p> </blockquote> <pre><code>function list_pages_function( $atts, $content ) { return if(ICL_LANGUAGE_CODE=='en'){ echo "Define topic and title"; } if(ICL_LANGUAGE_CODE=='es'){ echo "Definir el tema y título"; } if(ICL_LANGUAGE_CODE=='it'){ echo "Definisci il topic ed il titolo"; } if(ICL_LANGUAGE_CODE=='fr'){ echo "Définir le sujet et le titre"; } } add_shortcode( 'output_pages', 'list_pages_function' ); </code></pre> <p>If I remove <code>return</code> it is fine but when I place <code>&lt;li id="a"&gt;&lt;strong&gt;1.&lt;/strong&gt;[output_pages]&lt;/li&gt;</code> the output won't be within the <code>&lt;li&gt;</code> but it will be right at the top of the content breaking the layout</p>
0debug
About ListBox limit item : <p><strong><em>Hello everyone,I am new here, can I ask a question:</em></strong></p> <ul> <li><p>Let's say I have a ListBox (with more than 5k items of all English words ). and a richTextBox.</p></li> <li><p>And a ListBox usually load every items, right? How can I change my ListBox to just load/pick a few (maybe 10 items) from the data?</p></li> </ul> <p><strong><em>EXAMPLE:</em></strong></p> <p>**When a user type a word, I dont want my ListBox to load every thing starting with the word my user input. I just want my ListBox to load just a few item.(More to like a word prediction software) **</p> <p><strong>Please give an answer that is not too complicated, since I am a beginner.</strong></p> <p>Thanks, Teik Fai.</p>
0debug
dotnet aspnetcore docker build fails with a 145 error code : <p>I've used <a href="https://stormpath.com/blog/tutorial-deploy-asp-net-core-on-linux-with-docker" rel="noreferrer">this tutorial</a> to create my first docker webapi project.</p> <p>I'm using windows 7 (docker toolbox).</p> <p>This what I've ran:</p> <pre><code>dotnet new webapi </code></pre> <p>This is the Dockerfile:</p> <pre><code>FROM microsoft/dotnet:latest COPY . /app WORKDIR /app RUN ["dotnet", "restore"] RUN ["dotnet", "build"] EXPOSE 5000/tcp ENV ASPNETCORE_URLS http://*:5000 ENTRYPOINT ["dotnet", "run"] </code></pre> <p>This is how I created the image:</p> <pre><code>docker build -t mydemos:aspnetcorehelloworld . </code></pre> <p>And this is how I've created and ran the container:</p> <pre><code>docker run -d -p 8080:5000 -t mydemos:aspnetcorehelloworld </code></pre> <p><strong>My service ran successfully as a docker container.</strong></p> <p>Then, I tried changing the Dockerfile to work on a aspnetcore base image:</p> <p><code>FROM microsoft/dotnet:latest</code> was changed to <code>FROM microsoft/aspnetcore:1.0.1</code></p> <p>The new Dockerfile looks like:</p> <pre><code>FROM microsoft/aspnetcore:1.0.1 COPY . /app WORKDIR /app RUN ["dotnet", "restore"] RUN ["dotnet", "build"] EXPOSE 5000/tcp ENV ASPNETCORE_URLS http://*:5000 ENTRYPOINT ["dotnet", "run"] </code></pre> <p>Now, I've tried to build the new image using</p> <pre><code>docker build -t mydemos:aspnetcorehelloworld1 . </code></pre> <p>And I get an error.<br/> This is the build log:</p> <pre><code>Sending build context to Docker daemon 636.9 kB Step 1/8 : FROM microsoft/aspnetcore:1.0.1 ---&gt; 2c7bbc508bb2 Step 2/8 : COPY . /app ---&gt; Using cache ---&gt; 1d5b9bd908b3 Step 3/8 : WORKDIR /app ---&gt; Using cache ---&gt; c1d5d091d111 Step 4/8 : RUN dotnet restore ---&gt; Running in 8399e21caeb2 Did you mean to run dotnet SDK commands? Please install dotnet SDK from: http://go.microsoft.com/fwlink/?LinkID=798306&amp;clcid=0x409 The command 'dotnet restore' returned a non-zero code: 145 </code></pre> <p>I went into the url, reinstalled stuff and I still get an error.<br/> I've tried to use the dotnet cli commands in the same command line session and I succeed (<code>dotnet restore</code> works).</p> <p>I've tried to search this error around, but couldn't really find any solution.</p> <p>What am I missing here? I'm getting this 145 error on multiple occasions and tests.</p>
0debug
Need help fixing "property value expected" in CSS (Beginner/amateur) : <p>So I'm trying to set up some animated text in my project, but I keep getting an error in vscode saying "property value expected css(css-propertyvalueexpected) [59, 1]" in ".main-title" which I think is leading the code not to work cause it's not showing anything like what I'm trying to do when I open the page in browser, it shows it like the css code is non existent</p> <p>I haven't tried to fix it, I posted the full code below cause I'm not sure what's causing it and I'm a beginner</p> <pre class="lang-html prettyprint-override"><code>&lt;main role="main" class="main-content" id="main-content"&gt; &lt;div class="titleCont"&gt; &lt;h1 class="main-title" id="main-title"&gt; "Here, in the forest,&lt;br&gt;&lt;span style="padding-left:100px"&gt;dark and deep,&lt;/span&gt;&lt;br&gt;&lt;span style="padding-right:110px"&gt;I offer you,&lt;/span&gt;&lt;br&gt;&lt;span style="padding-left:-20px"&gt;eternal sleep."&lt;/span&gt; &lt;/h1&gt; &lt;/div&gt; &lt;canvas id="noise" class="noise"&gt;&lt;/canvas&gt; &lt;div class="vignette"&gt;&lt;/div&gt; &lt;/main&gt; </code></pre> <pre class="lang-css prettyprint-override"><code>.main-content { overflow:hidden; position: relative; display: flex; align-items: center; justify-content: center; flex-flow: column; height: 100vh; background: linear-gradient(to right, rgba(36,31,31,1) 0%, rgba(36,31,31,1) 32%, rgba(74,71,70,1) 100%); color: #fff; text-align: center; } .vignette{ position:absolute; width:100%; height:100%; box-shadow:inset 0px 0px 150px 20px black; mix-blend-mode: multiply; -webkit-animation: vignette-anim 3s infinite; /* Safari 4+ */ -moz-animation: vignette-anim 3s infinite; /* Fx 5+ */ -o-animation: vignette-anim 3s infinite; /* Opera 12+ */ animation: vignette-anim 3s infinite; /* IE 10+, Fx 29+ */ } .noise { z-index: 100; position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; opacity: .15; } .line{ position:absolute; height:100%; width:1px; opacity:0.1; background-color:#000; } .titleCont{position:relative;} .main-title { padding: .3em 1em .25em; font-weight: 400; font-size: 40px; color: white; font-family: 'Bellefair', serif; position:relative; line-height:1.3; white-spacing: } .overTitle{ position:absolute; top:0; left:0; } .dot{ width:3px; height:2px; background-color:white; position:absolute; opacity:0.3; } @-webkit-keyframes vignette-anim { 0% , 100%{ opacity: 1; } 50% { opacity: 0.7; } } @-moz-keyframes vignette-anim { 0% , 100%{ opacity: 1; } 50% { opacity: 0.7; } } @-o-keyframes vignette-anim { 0% , 100%{ opacity: 1; } 50% { opacity: 0.7; } } @keyframes vignette-anim { 0% , 100%{ opacity: 1; } 50% { opacity: 0.7; } } </code></pre> <p>I copy pasted the code from here "<a href="https://codepen.io/mimikos/pen/QMjjzy" rel="nofollow noreferrer">https://codepen.io/mimikos/pen/QMjjzy</a>" expected it to look the same.</p> <p>Thanks in advance</p>
0debug
static void sysbus_fdc_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->props = sysbus_fdc_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); }
1threat
No instance of function template "std::fpclassify" matches the argument list : I have some project with code using both Boost and CUDA. I haven't built it in a while (a couple of months), and now - without any changes to the code, but with a change of Boost version to 1.67.0 - I get the following errors: /path/to/boost/include/boost/container_hash/detail/hash_float.hpp(212): error: no instance of function template "std::fpclassify" matches the argument list argument types are: (float) detected during: instantiation of "std::size_t boost::hash_detail::float_hash_value(T) [with T=float]" /path/to/boost/include/boost/container_hash/hash.hpp(503): here instantiation of "boost::hash_detail::float_numbers<T>::type boost::hash_value(T) [with T=float]" /path/to/boost/include/boost/container_hash/hash.hpp(623): here and the same thing for `double`'s and `long double`'s. I know this isn't an MCVE, but - are these error a known issue by any chance? Versions: CUDA 9.1, GCC 5.4.0, Boost 1.67.0 on a Fedora 26 system.
0debug
How to sort array in javascript or typescript by a key but if key is same sort in alphabetical order? : <p>I have this array </p> <pre><code>[ { "Books": [], "_id": "5dea9a11a8e1bf301c462ce4", "FileName": "AAAAA", "Order": 99999 }, { "_id": "5dea9864a8e1bf301c462cdb", "Books": [], "FileName": "some1", "Order": 3 }, { "Books": [], "_id": "5dea9873a8e1bf301c462ce1", "FileName": "among3", "Order": 3 }, { "Books": [], "_id": "5dea986ba8e1bf301c462cde", "FileName": "things2", "Order": 2 }, { "Books": [], "_id": "5dea9a18a8e1bf301c462ce7", "FileName": "FFFF", "Order": 99999 }, { "Books": [], "_id": "5dea9a1ea8e1bf301c462cea", "FileName": "BBBB", "Order": 99999 } ] </code></pre> <p>Now I want to sort array by Order and if order is same then sort by alphabetically FileName. So sorted array will look like this:</p> <pre><code>[ { "Books": [], "_id": "5dea986ba8e1bf301c462cde", "FileName": "things2", "Order": 2 }, { "Books": [], "_id": "5dea9873a8e1bf301c462ce1", "FileName": "among3", "Order": 3 }, { "_id": "5dea9864a8e1bf301c462cdb", "Books": [], "FileName": "some1", "Order": 3 }, { "Books": [], "_id": "5dea9a11a8e1bf301c462ce4", "FileName": "AAAAA", "Order": 99999 }, { "Books": [], "_id": "5dea9a1ea8e1bf301c462cea", "FileName": "BBBB", "Order": 99999 }, { "Books": [], "_id": "5dea9a18a8e1bf301c462ce7", "FileName": "FFFF", "Order": 99999 }, ] </code></pre> <p>I am able to do it in more than two loops but not sure how optimized is that. Looking for any optimized solution. Plain javascript or Typescript with Interface comparer will also work thanks.</p>
0debug
Iteration in Python [Please help] : Why would the code below produce an output of 5? And what does it mean for the condition while n? Shouldn't it produce an infinite loop since n will always be true? n = 10000 count = 0 while n: count = count + 1 n = n / 10 n = int(n) print (count) Output: 5
0debug
How to save and restore terminal sessions for a specific IntelliJ project? : <p>Is there a way in IntelliJ IDEA (either built-in on via a plugin) to store the open <strong>terminal sessions</strong> (their <em>name</em>, their <em>current folder</em>, ideally also the <em>history</em> of the commands and the <em>output</em>) and restore them when re-opening the project again?</p> <p>I often have several Terminal sessions opened concurrently (it's one of the features for which I like IntelliJ!) but it's very sad that their layout and history is forgotten when I reopen the project.</p>
0debug
Getting this error **System.NullReferenceException: 'Object reference not set to an instance of an object.'** : <p>I have a page which updates the details of lender in the database but when I click the update button it is throwing this error.</p> <p>I have put the breakpoints and inspected the code it shows the values when I hover but also it is throwing this error</p> <p>This is the place where I get the values from the textboxes and when I hover on the <code>enttity.lender_name</code>(same for all the textboxes) it shows the value in textbox correctly </p> <pre><code>protected void btn_update_Click(object sender, EventArgs e) { try { enttity.lender_name = lender_name.Text; enttity.lender_code = lender_code.Text; enttity.manager_name = manager_name.Text; enttity.manager_number = manager_number.Text; enttity.lc_number = lc_number.Text; enttity.manager_email = manager_email.Text; enttity.lc_email = lc_email.Text; enttity.contact_name = contact_name.Text; enttity.designation = designation.Text; enttity.branch_name = branch_name.Text; enttity.branch_add = branch_add.Text; enttity.branch_add2 = branch_add2.Text; enttity.branch_city = branch_city.Text; enttity.branch_state = branch_state.Text; enttity.branch_zip = branch_zip.Text; enttity.branch_country = branch_country.Text; int update = bal.lenderupdate(enttity, Convert.ToInt32(ViewState["lender_id"].ToString())); ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "alert(' Successfully updated!');window.location.href = 'Lender_registration.aspx'", true); } catch (Exception ex) { throw ex; } } </code></pre> <p>The error is thrown in this line <code>int update = bal.lenderupdate(enttity, Convert.ToInt32(ViewState["lender_id"].ToString()));</code> and goes to <code>throw ex</code> saying the error <strong>System.NullReferenceException: 'Object reference not set to an instance of an object.'</strong></p> <p>This my code where it goes to Stored procedure </p> <pre><code>public int lenderupdate(lender_entity enttity, int lender_id) { try { cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@lender_id ", lender_id); cmd.Parameters.AddWithValue("@lender_name ", enttity.lender_name); cmd.Parameters.AddWithValue("@lender_code", enttity.lender_code); cmd.Parameters.AddWithValue("@manager_name", enttity.manager_name); cmd.Parameters.AddWithValue("@manager_number ", enttity.manager_number); cmd.Parameters.AddWithValue("@lc_number", enttity.lc_number); cmd.Parameters.AddWithValue("@manager_email", enttity.manager_email); cmd.Parameters.AddWithValue("@lc_email ", enttity.lc_email); cmd.Parameters.AddWithValue("@contact_name", enttity.contact_name); cmd.Parameters.AddWithValue("@designation", enttity.designation); cmd.Parameters.AddWithValue("@branch_name ", enttity.branch_name); cmd.Parameters.AddWithValue("@branch_add", enttity.branch_add); cmd.Parameters.AddWithValue("@branch_add2", enttity.branch_add2); cmd.Parameters.AddWithValue("@branch_city", enttity.branch_city); cmd.Parameters.AddWithValue("@branch_state", enttity.branch_state); cmd.Parameters.AddWithValue("@branch_zip", enttity.branch_zip); cmd.Parameters.AddWithValue("@branch_country", enttity.branch_country); int updatelender = dbmngr.ExecuteNonQuery(cmd, CommandType.StoredProcedure, "updatelenders"); return updatelender; } catch (Exception ex) { throw ex; } } </code></pre> <p>The values are coming here to but it is throwing the error </p> <p>data should go to database and update the details of particular lender</p>
0debug
with excel showing producs when insterting measurments with multiple results : Hello i'm having problems with getting this to work. What i'm trying to do is when you insert a set of measurements i want excel to show the ( In this case products) which are closest to those measurements. Ill insert a picture of the excel document as an example later. Any help is greatly appreciated.
0debug
CORS error :Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response : <p>I am trying to send the request from one localhost port to the another. I am using <strong>angularjs on the frontend and node on the backend</strong>.</p> <p>Since it is <strong>CORS</strong> request, In node.js, i am using </p> <pre><code>res.header('Access-Control-Allow-Origin', '*'); res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, PATCH'); res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization'); </code></pre> <p>and in the angular.js service file, I am using</p> <pre><code>return { getValues: $resource(endpoint + '/admin/getvalues', null, { 'get': { method: 'GET', headers:{'Authorization':'Bearer'+' '+ $localStorage.token} } }), } </code></pre> <p>I am getting the following error</p> <p><strong>Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response.</strong></p> <p>Please help!</p>
0debug
int ff_h263_decode_picture_header(MpegEncContext *s) { int format, width, height, i; uint32_t startcode; align_get_bits(&s->gb); if (show_bits(&s->gb, 2) == 2 && s->avctx->frame_number == 0) { av_log(s->avctx, AV_LOG_WARNING, "Header looks like RTP instead of H.263\n"); } startcode= get_bits(&s->gb, 22-8); for(i= get_bits_left(&s->gb); i>24; i-=8) { startcode = ((startcode << 8) | get_bits(&s->gb, 8)) & 0x003FFFFF; if(startcode == 0x20) break; } if (startcode != 0x20) { av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n"); return -1; } i = get_bits(&s->gb, 8); if( (s->picture_number&~0xFF)+i < s->picture_number) i+= 256; s->picture_number= (s->picture_number&~0xFF) + i; if (get_bits1(&s->gb) != 1) { av_log(s->avctx, AV_LOG_ERROR, "Bad marker\n"); return -1; } if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "Bad H263 id\n"); return -1; } skip_bits1(&s->gb); skip_bits1(&s->gb); skip_bits1(&s->gb); format = get_bits(&s->gb, 3); if (format != 7 && format != 6) { s->h263_plus = 0; width = ff_h263_format[format][0]; height = ff_h263_format[format][1]; if (!width) return -1; s->pict_type = AV_PICTURE_TYPE_I + get_bits1(&s->gb); s->h263_long_vectors = get_bits1(&s->gb); if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "H263 SAC not supported\n"); return -1; } s->obmc= get_bits1(&s->gb); s->unrestricted_mv = s->h263_long_vectors || s->obmc; s->pb_frame = get_bits1(&s->gb); s->chroma_qscale= s->qscale = get_bits(&s->gb, 5); skip_bits1(&s->gb); s->width = width; s->height = height; s->avctx->sample_aspect_ratio= (AVRational){12,11}; s->avctx->framerate = (AVRational){ 30000, 1001 }; } else { int ufep; s->h263_plus = 1; ufep = get_bits(&s->gb, 3); if (ufep == 1) { format = get_bits(&s->gb, 3); av_dlog(s->avctx, "ufep=1, format: %d\n", format); s->custom_pcf= get_bits1(&s->gb); s->umvplus = get_bits1(&s->gb); if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "Syntax-based Arithmetic Coding (SAC) not supported\n"); } s->obmc= get_bits1(&s->gb); s->h263_aic = get_bits1(&s->gb); s->loop_filter= get_bits1(&s->gb); s->unrestricted_mv = s->umvplus || s->obmc || s->loop_filter; if(s->avctx->lowres) s->loop_filter = 0; s->h263_slice_structured= get_bits1(&s->gb); if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "Reference Picture Selection not supported\n"); } if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "Independent Segment Decoding not supported\n"); } s->alt_inter_vlc= get_bits1(&s->gb); s->modified_quant= get_bits1(&s->gb); if(s->modified_quant) s->chroma_qscale_table= ff_h263_chroma_qscale_table; skip_bits(&s->gb, 1); skip_bits(&s->gb, 3); } else if (ufep != 0) { av_log(s->avctx, AV_LOG_ERROR, "Bad UFEP type (%d)\n", ufep); return -1; } s->pict_type = get_bits(&s->gb, 3); switch(s->pict_type){ case 0: s->pict_type= AV_PICTURE_TYPE_I;break; case 1: s->pict_type= AV_PICTURE_TYPE_P;break; case 2: s->pict_type= AV_PICTURE_TYPE_P;s->pb_frame = 3;break; case 3: s->pict_type= AV_PICTURE_TYPE_B;break; case 7: s->pict_type= AV_PICTURE_TYPE_I;break; default: return -1; } skip_bits(&s->gb, 2); s->no_rounding = get_bits1(&s->gb); skip_bits(&s->gb, 4); if (ufep) { if (format == 6) { s->aspect_ratio_info = get_bits(&s->gb, 4); av_dlog(s->avctx, "aspect: %d\n", s->aspect_ratio_info); width = (get_bits(&s->gb, 9) + 1) * 4; skip_bits1(&s->gb); height = get_bits(&s->gb, 9) * 4; av_dlog(s->avctx, "\nH.263+ Custom picture: %dx%d\n",width,height); if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) { s->avctx->sample_aspect_ratio.num= get_bits(&s->gb, 8); s->avctx->sample_aspect_ratio.den= get_bits(&s->gb, 8); }else{ s->avctx->sample_aspect_ratio= ff_h263_pixel_aspect[s->aspect_ratio_info]; } } else { width = ff_h263_format[format][0]; height = ff_h263_format[format][1]; s->avctx->sample_aspect_ratio= (AVRational){12,11}; } s->avctx->sample_aspect_ratio.den <<= s->ehc_mode; if ((width == 0) || (height == 0)) return -1; s->width = width; s->height = height; if(s->custom_pcf){ int gcd; s->avctx->framerate.num = 1800000; s->avctx->framerate.den = 1000 + get_bits1(&s->gb); s->avctx->framerate.den *= get_bits(&s->gb, 7); if(s->avctx->framerate.den == 0){ av_log(s, AV_LOG_ERROR, "zero framerate\n"); return -1; } gcd= av_gcd(s->avctx->framerate.den, s->avctx->framerate.num); s->avctx->framerate.den /= gcd; s->avctx->framerate.num /= gcd; }else{ s->avctx->framerate = (AVRational){ 30000, 1001 }; } } if(s->custom_pcf){ skip_bits(&s->gb, 2); } if (ufep) { if (s->umvplus) { if(get_bits1(&s->gb)==0) skip_bits1(&s->gb); } if(s->h263_slice_structured){ if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "rectangular slices not supported\n"); } if (get_bits1(&s->gb) != 0) { av_log(s->avctx, AV_LOG_ERROR, "unordered slices not supported\n"); } } } s->qscale = get_bits(&s->gb, 5); } if (s->width == 0 || s->height == 0) { av_log(s->avctx, AV_LOG_ERROR, "dimensions 0\n"); return -1; } s->mb_width = (s->width + 15) / 16; s->mb_height = (s->height + 15) / 16; s->mb_num = s->mb_width * s->mb_height; if (s->pb_frame) { skip_bits(&s->gb, 3); if (s->custom_pcf) skip_bits(&s->gb, 2); skip_bits(&s->gb, 2); } if (s->pict_type!=AV_PICTURE_TYPE_B) { s->time = s->picture_number; s->pp_time = s->time - s->last_non_b_time; s->last_non_b_time = s->time; }else{ s->time = s->picture_number; s->pb_time = s->pp_time - (s->last_non_b_time - s->time); if (s->pp_time <=s->pb_time || s->pp_time <= s->pp_time - s->pb_time || s->pp_time <= 0){ s->pp_time = 2; s->pb_time = 1; } ff_mpeg4_init_direct_mv(s); } if (skip_1stop_8data_bits(&s->gb) < 0) return AVERROR_INVALIDDATA; if(s->h263_slice_structured){ if (get_bits1(&s->gb) != 1) { av_log(s->avctx, AV_LOG_ERROR, "SEPB1 marker missing\n"); return -1; } ff_h263_decode_mba(s); if (get_bits1(&s->gb) != 1) { av_log(s->avctx, AV_LOG_ERROR, "SEPB2 marker missing\n"); return -1; } } s->f_code = 1; if(s->h263_aic){ s->y_dc_scale_table= s->c_dc_scale_table= ff_aic_dc_scale_table; }else{ s->y_dc_scale_table= s->c_dc_scale_table= ff_mpeg1_dc_scale_table; } ff_h263_show_pict_info(s); if (s->pict_type == AV_PICTURE_TYPE_I && s->codec_tag == AV_RL32("ZYGO") && get_bits_left(&s->gb) >= 85 + 13*3*16 + 50){ int i,j; for(i=0; i<85; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb)); av_log(s->avctx, AV_LOG_DEBUG, "\n"); for(i=0; i<13; i++){ for(j=0; j<3; j++){ int v= get_bits(&s->gb, 8); v |= get_sbits(&s->gb, 8)<<8; av_log(s->avctx, AV_LOG_DEBUG, " %5d", v); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); } for(i=0; i<50; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb)); } return 0; }
1threat
static float ssim_end4(int sum0[5][4], int sum1[5][4], int width) { float ssim = 0.0; int i; for (i = 0; i < width; i++) ssim += ssim_end1(sum0[i][0] + sum0[i + 1][0] + sum1[i][0] + sum1[i + 1][0], sum0[i][1] + sum0[i + 1][1] + sum1[i][1] + sum1[i + 1][1], sum0[i][2] + sum0[i + 1][2] + sum1[i][2] + sum1[i + 1][2], sum0[i][3] + sum0[i + 1][3] + sum1[i][3] + sum1[i + 1][3]); return ssim; }
1threat
static void ahci_port_write(AHCIState *s, int port, int offset, uint32_t val) { AHCIPortRegs *pr = &s->dev[port].port_regs; DPRINTF(port, "offset: 0x%x val: 0x%x\n", offset, val); switch (offset) { case PORT_LST_ADDR: pr->lst_addr = val; map_page(s->as, &s->dev[port].lst, ((uint64_t)pr->lst_addr_hi << 32) | pr->lst_addr, 1024); s->dev[port].cur_cmd = NULL; break; case PORT_LST_ADDR_HI: pr->lst_addr_hi = val; map_page(s->as, &s->dev[port].lst, ((uint64_t)pr->lst_addr_hi << 32) | pr->lst_addr, 1024); s->dev[port].cur_cmd = NULL; break; case PORT_FIS_ADDR: pr->fis_addr = val; map_page(s->as, &s->dev[port].res_fis, ((uint64_t)pr->fis_addr_hi << 32) | pr->fis_addr, 256); break; case PORT_FIS_ADDR_HI: pr->fis_addr_hi = val; map_page(s->as, &s->dev[port].res_fis, ((uint64_t)pr->fis_addr_hi << 32) | pr->fis_addr, 256); break; case PORT_IRQ_STAT: pr->irq_stat &= ~val; ahci_check_irq(s); break; case PORT_IRQ_MASK: pr->irq_mask = val & 0xfdc000ff; ahci_check_irq(s); break; case PORT_CMD: pr->cmd = val & ~(PORT_CMD_LIST_ON | PORT_CMD_FIS_ON); if (pr->cmd & PORT_CMD_START) { pr->cmd |= PORT_CMD_LIST_ON; } if (pr->cmd & PORT_CMD_FIS_RX) { pr->cmd |= PORT_CMD_FIS_ON; } if ((pr->cmd & PORT_CMD_FIS_ON) && !s->dev[port].init_d2h_sent) { ahci_init_d2h(&s->dev[port]); s->dev[port].init_d2h_sent = true; } check_cmd(s, port); break; case PORT_TFDATA: s->dev[port].port.ifs[0].error = (val >> 8) & 0xff; s->dev[port].port.ifs[0].status = val & 0xff; break; case PORT_SIG: pr->sig = val; break; case PORT_SCR_STAT: pr->scr_stat = val; break; case PORT_SCR_CTL: if (((pr->scr_ctl & AHCI_SCR_SCTL_DET) == 1) && ((val & AHCI_SCR_SCTL_DET) == 0)) { ahci_reset_port(s, port); } pr->scr_ctl = val; break; case PORT_SCR_ERR: pr->scr_err &= ~val; break; case PORT_SCR_ACT: pr->scr_act |= val; break; case PORT_CMD_ISSUE: pr->cmd_issue |= val; check_cmd(s, port); break; default: break; } }
1threat
Building a row from a dict in pySpark : <p>I'm trying to dynamically build a row in pySpark 1.6.1, then build it into a dataframe. The general idea is to extend the results of <code>describe</code> to include, for example, skew and kurtosis. Here's what I thought should work:</p> <pre><code>from pyspark.sql import Row row_dict = {'C0': -1.1990072635132698, 'C3': 0.12605772684660232, 'C4': 0.5760856026559944, 'C5': 0.1951877800894315, 'C6': 24.72378589441825, 'summary': 'kurtosis'} new_row = Row(row_dict) </code></pre> <p>But this returns <code>TypeError: sequence item 0: expected string, dict found</code> which is a fairly clear error. Then I found that if I defined the Row fields first, I <em>could</em> use a dict:</p> <pre><code>r = Row('summary', 'C0', 'C3', 'C4', 'C5', 'C6') r(row_dict) &gt; Row(summary={'summary': 'kurtosis', 'C3': 0.12605772684660232, 'C0': -1.1990072635132698, 'C6': 24.72378589441825, 'C5': 0.1951877800894315, 'C4': 0.5760856026559944}) </code></pre> <p>Which would be a fine step, except it doesn't seem like I can dynamically specify the fields in <code>Row</code>. I need this to work for an unknown number of rows with unknown names. According to the documentation you can actually go the other way:</p> <pre><code>&gt;&gt;&gt; Row(name="Alice", age=11).asDict() == {'name': 'Alice', 'age': 11} True </code></pre> <p>So it seems like I should be able to do this. It also appears there may be some deprecated features from older versions that allowed this, for example <a href="https://spark.apache.org/docs/1.0.2/api/python/pyspark.sql.Row-class.html" rel="noreferrer">here</a>. Is there a more current equivalent I'm missing?</p>
0debug
vuejs v-for add bootstrap row every 5 items : <p>I have an array of items like 'Item 1', 'Item 2' up to 'Item 25'. I want the HTML after rendering look like this:</p> <pre><code>&lt;div class="row"&gt; &lt;div&gt;Item 1&lt;/div&gt; &lt;div&gt;Item 2&lt;/div&gt; &lt;div&gt;Item 3&lt;/div&gt; &lt;div&gt;Item 4&lt;/div&gt; &lt;div&gt;Item 5&lt;/div&gt; &lt;/div&gt; &lt;div class="row"&gt; &lt;div&gt;Item 6&lt;/div&gt; &lt;div&gt;Item 7&lt;/div&gt; &lt;div&gt;Item 8&lt;/div&gt; &lt;div&gt;Item 9&lt;/div&gt; &lt;div&gt;Item 10&lt;/div&gt; &lt;/div&gt; </code></pre> <p>What is the proper way to express this in vue.js? </p> <pre><code> &lt;div class="row"&gt; &lt;span v-for="(item, index) in items"&gt; // do something like this in vue.js style: // if (item % 5 == 0) print "&lt;/div&gt;&lt;div class='row'&gt;" &lt;app-field &gt;{{ item }}&lt;/app-field&gt; &lt;/span&gt; &lt;/div&gt; </code></pre>
0debug
static void flash_sync_page(Flash *s, int page) { int bdrv_sector, nb_sectors; QEMUIOVector iov; if (!s->bdrv || bdrv_is_read_only(s->bdrv)) { return; } bdrv_sector = (page * s->pi->page_size) / BDRV_SECTOR_SIZE; nb_sectors = DIV_ROUND_UP(s->pi->page_size, BDRV_SECTOR_SIZE); qemu_iovec_init(&iov, 1); qemu_iovec_add(&iov, s->storage + bdrv_sector * BDRV_SECTOR_SIZE, nb_sectors * BDRV_SECTOR_SIZE); bdrv_aio_writev(s->bdrv, bdrv_sector, &iov, nb_sectors, bdrv_sync_complete, NULL); }
1threat
when i type localhost/phpmyadmin in browser instead of login page the page opens with the following errors. Why is this happening? : #1045 - Access denied for user 'root'@'localhost' (using password: NO) mysqli_real_connect(): (HY000/1045): Access denied for user 'pma'@'localhost' (using password: NO) Connection for controluser as defined in your configuration failed. mysqli_real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO) phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.
0debug
How to handle alert having javascript embedded into a button? : <p>I am automating a sharepoint website using webdriver and java, which contains javascript embedded into the button code. </p> <p>Please find the HTML snippet of the same :</p> <pre><code>&lt;input id="ctl00_ContentPlaceHolder1_btnDelete" class="btn" type="submit" onclick="javascript:return confirm('Please select OK to proceed else Cancel.');" value="Delete" name="ctl00$ContentPlaceHolder1$btnDelete"/&gt; </code></pre> <p>Please find my code to handle the same :</p> <pre><code>String js = "if (window.alert.myAlertText == undefined) {window.alert.myAlertText = null; window.alert = function(msg){ window.alert.myAlertText = msg; };}"; //Click delete button ((JavascriptExecutor) driver).executeScript("arguments[0].click();", driver.findElement(By.xpath(".//*@id='ctl00_ContentPlaceHolder1_btnDelete']"))); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", driver.switchTo().alert(), js); </code></pre> <p>But i am not able to accept or dismiss alert.</p> <p>Kindly help!!!!</p> <p>Snapshot of the button :</p> <p><a href="http://i.stack.imgur.com/6UL88.jpg" rel="nofollow">Snapshot Alert</a></p>
0debug
static void core_commit(MemoryListener *listener) { PhysPageMap info = cur_map; cur_map = next_map; phys_sections_clear(&info); }
1threat
Difference in the end of lifetime rules? : <p><a href="https://en.cppreference.com/w/cpp/language/lifetime" rel="noreferrer">https://en.cppreference.com/w/cpp/language/lifetime</a> in <strong>Notes</strong> section has this code, reproduced here:</p> <pre><code>struct A { int* p; ~A() { std::cout &lt;&lt; *p; } // if n outlives a, prints 123 }; void f() { A a; int n = 123; // if n does not outlive a, this is optimized out (dead store) a.p = &amp;n; } </code></pre> <p>What is it trying to say in this <strong>Notes</strong> section? </p> <p>From what I understand, the code is UB (or is it) as it's clear that <code>n</code> does not outlive <code>a</code>.</p> <p>What does it mean by:</p> <blockquote> <p>difference in the end of lifetime rules between non-class objects (end of storage duration) and class objects (reverse order of construction) matters</p> </blockquote> <p>But it does not say matter <strong>how</strong>.</p> <p>I am very confused by this entire section.</p>
0debug
static void RENAME(chrRangeFromJpeg)(int16_t *dst, int width) { int i; for (i = 0; i < width; i++) { dst[i ] = (dst[i ]*1799 + 4081085)>>11; dst[i+VOFW] = (dst[i+VOFW]*1799 + 4081085)>>11; } }
1threat
Go test string contains substring : <p>How do I check if a string is a substring of another string in Go? For example, I want to check <code>someString.contains("something")</code>.</p>
0debug
static int coroutine_fn bdrv_co_do_writev(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) { BlockDriver *drv = bs->drv; BdrvTrackedRequest req; int ret; if (!bs->drv) { return -ENOMEDIUM; if (bs->read_only) { return -EACCES; if (bdrv_check_request(bs, sector_num, nb_sectors)) { return -EIO; if (bs->io_limits_enabled) { bdrv_io_limits_intercept(bs, true, nb_sectors); tracked_request_begin(&req, bs, sector_num, nb_sectors, true); ret = drv->bdrv_co_writev(bs, sector_num, nb_sectors, qiov); if (bs->dirty_bitmap) { set_dirty_bitmap(bs, sector_num, nb_sectors, 1); if (bs->wr_highest_sector < sector_num + nb_sectors - 1) { bs->wr_highest_sector = sector_num + nb_sectors - 1; tracked_request_end(&req); return ret;
1threat
static av_cold int pcx_init(AVCodecContext *avctx) { PCXContext *s = avctx->priv_data; avcodec_get_frame_defaults(&s->picture); avctx->coded_frame= &s->picture; return 0; }
1threat
How do you connect to Google Cloud Postgresql via Django framework? : <p>This is the default configuration one would have for a local postgresql connection using Django framework in setting.py file:</p> <pre><code>DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'LOCAL_DB_NAME', 'USER': 'LOCAL_DB_USER', 'PASSWORD': 'LOCAL_DB_PASS', 'HOST': '127.0.0.1', 'PORT': '5432', } } </code></pre> <p>How to configure it to work with Google Cloud Postgresql managed database?</p>
0debug
GuestFileWrite *qmp_guest_file_write(int64_t handle, const char *buf_b64, bool has_count, int64_t count, Error **errp) { GuestFileWrite *write_data = NULL; guchar *buf; gsize buf_len; bool is_ok; DWORD write_count; GuestFileHandle *gfh = guest_file_handle_find(handle, errp); HANDLE fh; if (!gfh) { return NULL; } fh = gfh->fh; buf = g_base64_decode(buf_b64, &buf_len); if (!has_count) { count = buf_len; } else if (count < 0 || count > buf_len) { error_setg(errp, "value '%" PRId64 "' is invalid for argument count", count); goto done; } is_ok = WriteFile(fh, buf, count, &write_count, NULL); if (!is_ok) { error_setg_win32(errp, GetLastError(), "failed to write to file"); slog("guest-file-write-failed, handle: %" PRId64, handle); } else { write_data = g_new0(GuestFileWrite, 1); write_data->count = (size_t) write_count; } done: g_free(buf); return write_data; }
1threat
static int kvm_get_msrs(CPUState *env) { struct { struct kvm_msrs info; struct kvm_msr_entry entries[100]; } msr_data; struct kvm_msr_entry *msrs = msr_data.entries; int ret, i, n; n = 0; msrs[n++].index = MSR_IA32_SYSENTER_CS; msrs[n++].index = MSR_IA32_SYSENTER_ESP; msrs[n++].index = MSR_IA32_SYSENTER_EIP; if (kvm_has_msr_star(env)) { msrs[n++].index = MSR_STAR; } if (kvm_has_msr_hsave_pa(env)) { msrs[n++].index = MSR_VM_HSAVE_PA; } msrs[n++].index = MSR_IA32_TSC; #ifdef TARGET_X86_64 if (lm_capable_kernel) { msrs[n++].index = MSR_CSTAR; msrs[n++].index = MSR_KERNELGSBASE; msrs[n++].index = MSR_FMASK; msrs[n++].index = MSR_LSTAR; } #endif msrs[n++].index = MSR_KVM_SYSTEM_TIME; msrs[n++].index = MSR_KVM_WALL_CLOCK; #ifdef KVM_CAP_ASYNC_PF msrs[n++].index = MSR_KVM_ASYNC_PF_EN; #endif #ifdef KVM_CAP_MCE if (env->mcg_cap) { msrs[n++].index = MSR_MCG_STATUS; msrs[n++].index = MSR_MCG_CTL; for (i = 0; i < (env->mcg_cap & 0xff) * 4; i++) { msrs[n++].index = MSR_MC0_CTL + i; } } #endif msr_data.info.nmsrs = n; ret = kvm_vcpu_ioctl(env, KVM_GET_MSRS, &msr_data); if (ret < 0) { return ret; } for (i = 0; i < ret; i++) { switch (msrs[i].index) { case MSR_IA32_SYSENTER_CS: env->sysenter_cs = msrs[i].data; break; case MSR_IA32_SYSENTER_ESP: env->sysenter_esp = msrs[i].data; break; case MSR_IA32_SYSENTER_EIP: env->sysenter_eip = msrs[i].data; break; case MSR_STAR: env->star = msrs[i].data; break; #ifdef TARGET_X86_64 case MSR_CSTAR: env->cstar = msrs[i].data; break; case MSR_KERNELGSBASE: env->kernelgsbase = msrs[i].data; break; case MSR_FMASK: env->fmask = msrs[i].data; break; case MSR_LSTAR: env->lstar = msrs[i].data; break; #endif case MSR_IA32_TSC: env->tsc = msrs[i].data; break; case MSR_VM_HSAVE_PA: env->vm_hsave = msrs[i].data; break; case MSR_KVM_SYSTEM_TIME: env->system_time_msr = msrs[i].data; break; case MSR_KVM_WALL_CLOCK: env->wall_clock_msr = msrs[i].data; break; #ifdef KVM_CAP_MCE case MSR_MCG_STATUS: env->mcg_status = msrs[i].data; break; case MSR_MCG_CTL: env->mcg_ctl = msrs[i].data; break; #endif default: #ifdef KVM_CAP_MCE if (msrs[i].index >= MSR_MC0_CTL && msrs[i].index < MSR_MC0_CTL + (env->mcg_cap & 0xff) * 4) { env->mce_banks[msrs[i].index - MSR_MC0_CTL] = msrs[i].data; } #endif break; #ifdef KVM_CAP_ASYNC_PF case MSR_KVM_ASYNC_PF_EN: env->async_pf_en_msr = msrs[i].data; break; #endif } } return 0; }
1threat
Why immutable state with redux : <p>I'm learning redux and am struggling to understand why state has to be immutable. Could you provide me with an example, in code preferably, where breaking the immutable contract results in an not so obvious side effect.</p>
0debug
static int get_phys_addr_v5(CPUARMState *env, uint32_t address, int access_type, ARMMMUIdx mmu_idx, hwaddr *phys_ptr, int *prot, target_ulong *page_size) { CPUState *cs = CPU(arm_env_get_cpu(env)); int code; uint32_t table; uint32_t desc; int type; int ap; int domain = 0; int domain_prot; hwaddr phys_addr; uint32_t dacr; if (!get_level1_table_address(env, mmu_idx, &table, address)) { code = 5; goto do_fault; } desc = ldl_phys(cs->as, table); type = (desc & 3); domain = (desc >> 5) & 0x0f; if (regime_el(env, mmu_idx) == 1) { dacr = env->cp15.dacr_ns; } else { dacr = env->cp15.dacr_s; } domain_prot = (dacr >> (domain * 2)) & 3; if (type == 0) { code = 5; goto do_fault; } if (domain_prot == 0 || domain_prot == 2) { if (type == 2) code = 9; else code = 11; goto do_fault; } if (type == 2) { phys_addr = (desc & 0xfff00000) | (address & 0x000fffff); ap = (desc >> 10) & 3; code = 13; *page_size = 1024 * 1024; } else { if (type == 1) { table = (desc & 0xfffffc00) | ((address >> 10) & 0x3fc); } else { table = (desc & 0xfffff000) | ((address >> 8) & 0xffc); } desc = ldl_phys(cs->as, table); switch (desc & 3) { case 0: code = 7; goto do_fault; case 1: phys_addr = (desc & 0xffff0000) | (address & 0xffff); ap = (desc >> (4 + ((address >> 13) & 6))) & 3; *page_size = 0x10000; break; case 2: phys_addr = (desc & 0xfffff000) | (address & 0xfff); ap = (desc >> (4 + ((address >> 9) & 6))) & 3; *page_size = 0x1000; break; case 3: if (type == 1) { if (arm_feature(env, ARM_FEATURE_XSCALE)) { phys_addr = (desc & 0xfffff000) | (address & 0xfff); } else { code = 7; goto do_fault; } } else { phys_addr = (desc & 0xfffffc00) | (address & 0x3ff); } ap = (desc >> 4) & 3; *page_size = 0x400; break; default: abort(); } code = 15; } *prot = check_ap(env, mmu_idx, ap, domain_prot, access_type); if (!*prot) { goto do_fault; } *prot |= PAGE_EXEC; *phys_ptr = phys_addr; return 0; do_fault: return code | (domain << 4); }
1threat
static void realtime_init(void) { if (enable_mlock) { if (os_mlock() < 0) { fprintf(stderr, "qemu: locking memory failed\n"); exit(1); } } }
1threat
How can I shorten a test for a list being null or having no elements? : <p>I have this code:</p> <pre><code>if (App.selectedPhrases == null || App.selectedPhrases.Count == 0) </code></pre> <p>I know that I can use App.selectedPhrases?.Count to return null if needed but how how can I shorten this test? I can't see a way to check for null or 0 without needing to use the || and have two tests.</p>
0debug
bool gs_allowed(void) { if (kvm_enabled()) { MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); if (object_class_dynamic_cast(OBJECT_CLASS(mc), TYPE_S390_CCW_MACHINE)) { S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc); return s390mc->gs_allowed; } return true; } return false; }
1threat
Android Alarm notification on particular date and time and app should be active : <p>I need to know step by step process to do notification</p> <p>requirement: user will register for an event and then they will notification before one day at 9 am and before half an hour.</p> <ul> <li>even if app is not active they should get notification.</li> </ul>
0debug
Why Locale.current.regionCode is nil? : <p>I am trying to get user's region code in swift 3 by using:</p> <pre><code>Locale.current.regionCode </code></pre> <p>Unfortunately regionCode is nil, do you have an idea why? And what should I do to obtain it?</p> <p>Thanks a lot.</p>
0debug
What are ES6 arrow functions, how do they work? : <p>I am curious about ES6 arrow functions (fat arrow functions). Are they simply syntactic sugar derived from CoffeeScript, or is there more to them than meets the eye?</p>
0debug
UITextChecker with Swift 3 : <p>I'm trying to make use of Apple's UITextChecker in Xcode 8 to automatically search for spelling errors in a string of words and give suggestions as to replacements. I'm relatively new to referencing Apple API's so any help would be appreciated.</p> <p>Thanks!</p>
0debug
How can I write javascript on Katalon tool? : Sometimes, I've met the element which is unable to click with the normal script by selenium so I have to use javascript to execute my script.
0debug
static int tpm_passthrough_unix_transfer(TPMPassthruState *tpm_pt, const TPMLocality *locty_data) { return tpm_passthrough_unix_tx_bufs(tpm_pt, locty_data->w_buffer.buffer, locty_data->w_offset, locty_data->r_buffer.buffer, locty_data->r_buffer.size); }
1threat
static void test_visitor_out_list_qapi_free(TestOutputVisitorData *data, const void *unused) { UserDefTwoList *p, *head = NULL; const char string[] = "foo bar"; int i, max_count = 1024; for (i = 0; i < max_count; i++) { p = g_malloc0(sizeof(*p)); p->value = g_malloc0(sizeof(*p->value)); p->value->string0 = g_strdup(string); p->value->dict1 = g_new0(UserDefTwoDict, 1); p->value->dict1->string1 = g_strdup(string); p->value->dict1->dict2 = g_new0(UserDefTwoDictDict, 1); p->value->dict1->dict2->userdef = g_new0(UserDefOne, 1); p->value->dict1->dict2->userdef->string = g_strdup(string); p->value->dict1->dict2->userdef->integer = 42; p->value->dict1->dict2->string = g_strdup(string); p->value->dict1->has_dict3 = false; p->next = head; head = p; } qapi_free_UserDefTwoList(head); }
1threat
Order 'Contain' Model in CakePHP 3.x : <p>I have multiple <code>Things</code> in <code>AnotherThing</code> now I am trying to order them in my edit action in my <code>AnotherThing Controller</code> - I can access the <code>Things</code> just fine in my edit, but I want to sort them differently (not over their ID), for example <code>Things.pos</code></p> <p>Whats the best practice here? I tried it with </p> <pre><code>public $hasMany = array( 'Thing' =&gt; array( 'order' =&gt; 'Thing.pos DESC' ) ); </code></pre> <p>But nothing changed. Any idea?</p>
0debug
libsystem_symptoms.dylib missing in Xcode 8 : <p>I just updated to Xcode 8, and I can no longer build xml2-based applications. If I build a simple file and try to build it as follows:</p> <pre><code>c++ myapp.cc `xml2-config --cflags` `xml2-config --libs` </code></pre> <p>...I get the following error message:</p> <pre><code>ld: file not found: /usr/lib/system/libsystem_symptoms.dylib for architecture x86_64 </code></pre> <p>It doesn't matter what's in myapp.cc (mine is just a main routine that returns 0). The root problem seems to be that Apple removed /usr/lib/system/libsystem_symptoms.dylib in Xcode 8, but many of the .tbd files in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib still point to it. Has anyone else run into a problem like this?</p>
0debug
static void blk_disconnect(struct XenDevice *xendev) { struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev); if (blkdev->bs) { bdrv_detach_dev(blkdev->bs, blkdev); if (!blkdev->dinfo) { blk_unref(blk_by_name(blkdev->dev)); } blkdev->bs = NULL; } xen_be_unbind_evtchn(&blkdev->xendev); if (blkdev->sring) { xc_gnttab_munmap(blkdev->xendev.gnttabdev, blkdev->sring, 1); blkdev->cnt_map--; blkdev->sring = NULL; } }
1threat
C++ error: no match for 'operator>>' : <p>I'm somewhat new to C++ and I was trying to write a code to make a basic c++ calculator, but when I try to build it the following error pops up:</p> <p>"error: no match for 'operator>>' (operand types are 'std::basic_ostream::__ostream_type {aka std::basic_ostream}' and 'char')|"</p> <p>The code is:</p> <pre><code>#include &lt;iostream&gt; #include &lt;string.h&gt; using namespace std; void add(int x, int y) { cout&lt;&lt;"First number:"; cin&gt;&gt;x; cout&lt;&lt;endl&lt;&lt;"Second number:"; cin&gt;&gt;y; cout&lt;&lt;endl&lt;&lt;x&lt;&lt;"+"&lt;&lt;y&lt;&lt;"="&lt;&lt;x+y; } void subtract(int x, int y) { cout&lt;&lt;"First number:"; cin&gt;&gt;x; cout&lt;&lt;endl&lt;&lt;"Second number:"; cin&gt;&gt;y; cout&lt;&lt;endl&lt;&lt;x&lt;&lt;"-"&lt;&lt;y&lt;&lt;"="&lt;&lt;x-y; } void multiply(int x, int y) { cout&lt;&lt;"First number:"; cin&gt;&gt;x; cout&lt;&lt;endl&lt;&lt;"Second number:"; cin&gt;&gt;y; cout&lt;&lt;endl&lt;&lt;x&lt;&lt;"*"&lt;&lt;y&lt;&lt;"="&lt;&lt;x*y; } void divide(int x, int y) { cout&lt;&lt;"First number:"; cin&gt;&gt;x; cout&lt;&lt;endl&lt;&lt;"Second number:"; cin&gt;&gt;y; cout&lt;&lt;endl&lt;&lt;x&lt;&lt;"/"&lt;&lt;y&lt;&lt;"="&lt;&lt;x/y; } int main() { int x,y; char z; cout &lt;&lt; "\t\t\t Welcome to the C++ Calculator." &lt;&lt; endl; cout &lt;&lt; "What operation would you like to perform? "; cout &lt;&lt; "Add(+), Subtract(-), Multiply(*), Divide(/):"&lt;&lt; cin &gt;&gt; z; cout &lt;&lt;endl; if (z=='+') add(x,y); else if (z=='-') subtract(x,y); else if (z=='*') multiply(x,y); else if (z=='/') divide(x,y); else if ((z!='+')&amp;&amp;(z!='-')&amp;&amp;(z!='*')&amp;&amp;(z!='/')) cout&lt;&lt;"Unknown symbol."; return 0; } </code></pre>
0debug
question on Linked List implementation concept and how it is traverse from node to node : I just started to learn the concept of Linked List recently, and having some problem on how is the else statement work in the below code? How it is traverse to next node until it found a null value in Node.next? please see the code below: public class LinkedList { Node head; public void insert(int data) { Node node = new Node(data); node.data = data; if(head == null) { head = node; }else{ Node temp = head; while(temp.next != null) { temp = temp.next; } temp.next = node; } } }
0debug
static int http_read_stream(URLContext *h, uint8_t *buf, int size) { HTTPContext *s = h->priv_data; int err, new_location, read_ret; int64_t seek_ret; int reconnect_delay = 0; if (!s->hd) return AVERROR_EOF; if (s->end_chunked_post && !s->end_header) { err = http_read_header(h, &new_location); if (err < 0) return err; } #if CONFIG_ZLIB if (s->compressed) return http_buf_read_compressed(h, buf, size); #endif read_ret = http_buf_read(h, buf, size); while ((read_ret < 0 && s->reconnect && (!h->is_streamed || s->reconnect_streamed) && s->filesize > 0 && s->off < s->filesize) || (read_ret == AVERROR_EOF && s->reconnect_at_eof && (!h->is_streamed || s->reconnect_streamed))) { uint64_t target = h->is_streamed ? 0 : s->off; if (read_ret == AVERROR_EXIT) return read_ret; if (reconnect_delay > s->reconnect_delay_max) return AVERROR(EIO); av_log(h, AV_LOG_WARNING, "Will reconnect at %"PRIu64" in %d second(s), error=%s.\n", s->off, reconnect_delay, av_err2str(read_ret)); err = ff_network_sleep_interruptible(1000U*1000*reconnect_delay, &h->interrupt_callback); if (err != AVERROR(ETIMEDOUT)) return err; reconnect_delay = 1 + 2*reconnect_delay; seek_ret = http_seek_internal(h, target, SEEK_SET, 1); if (seek_ret >= 0 && seek_ret != target) { av_log(h, AV_LOG_ERROR, "Failed to reconnect at %"PRIu64".\n", target); return read_ret; } read_ret = http_buf_read(h, buf, size); } return read_ret; }
1threat
void HELPER(ucf64_cmps)(float32 a, float32 b, uint32_t c, CPUUniCore32State *env) { int flag; flag = float32_compare_quiet(a, b, &env->ucf64.fp_status); env->CF = 0; switch (c & 0x7) { case 0: break; case 1: if (flag == 2) { env->CF = 1; } break; case 2: if (flag == 0) { env->CF = 1; } break; case 3: if ((flag == 0) || (flag == 2)) { env->CF = 1; } break; case 4: if (flag == -1) { env->CF = 1; } break; case 5: if ((flag == -1) || (flag == 2)) { env->CF = 1; } break; case 6: if ((flag == -1) || (flag == 0)) { env->CF = 1; } break; case 7: if (flag != 1) { env->CF = 1; } break; } env->ucf64.xregs[UC32_UCF64_FPSCR] = (env->CF << 29) | (env->ucf64.xregs[UC32_UCF64_FPSCR] & 0x0fffffff); }
1threat
What is a flag in python while loops? : <p><strong><em>I am new to python and I came across this terminology-> flag in python while loops so can anyone explain what that is?</em></strong></p>
0debug
PHPStorm - Huge use of CPU usage : What is up with PHPStorm? Are they quietly BitCoin mining in the background or something along those lines... My CPU usage can range anything between 150% and 500%... and if I am using a laptop, it gets really warm and toasts my nads... which is unpleasant and they need constant re-arranging. I am really thinking of changing IDE if this continues for the sake of my future children... Any help would be appreciated! [![enter image description here][1]][1] [![enter image description here][2]][2] [1]: https://i.stack.imgur.com/aR92k.png [2]: https://i.stack.imgur.com/vztvl.png
0debug
static void filter(SPPContext *p, uint8_t *dst, uint8_t *src, int dst_linesize, int src_linesize, int width, int height, const uint8_t *qp_table, int qp_stride, int is_luma, int sample_bytes) { int x, y, i; const int count = 1 << p->log2_count; const int linesize = is_luma ? p->temp_linesize : FFALIGN(width+16, 16); DECLARE_ALIGNED(16, uint64_t, block_align)[32]; int16_t *block = (int16_t *)block_align; int16_t *block2 = (int16_t *)(block_align + 16); uint16_t *psrc16 = (uint16_t*)p->src; for (y = 0; y < height; y++) { int index = 8 + 8*linesize + y*linesize; memcpy(p->src + index*sample_bytes, src + y*src_linesize, width*sample_bytes); if (sample_bytes == 1) { for (x = 0; x < 8; x++) { p->src[index - x - 1] = p->src[index + x ]; p->src[index + width + x ] = p->src[index + width - x - 1]; } } else { for (x = 0; x < 8; x++) { psrc16[index - x - 1] = psrc16[index + x ]; psrc16[index + width + x ] = psrc16[index + width - x - 1]; } } } for (y = 0; y < 8; y++) { memcpy(p->src + ( 7-y)*linesize * sample_bytes, p->src + ( y+8)*linesize * sample_bytes, linesize * sample_bytes); memcpy(p->src + (height+8+y)*linesize * sample_bytes, p->src + (height-y+7)*linesize * sample_bytes, linesize * sample_bytes); } for (y = 0; y < height + 8; y += 8) { memset(p->temp + (8 + y) * linesize, 0, 8 * linesize * sizeof(*p->temp)); for (x = 0; x < width + 8; x += 8) { int qp; if (p->qp) { qp = p->qp; } else{ const int qps = 3 + is_luma; qp = qp_table[(FFMIN(x, width - 1) >> qps) + (FFMIN(y, height - 1) >> qps) * qp_stride]; qp = FFMAX(1, norm_qscale(qp, p->qscale_type)); } for (i = 0; i < count; i++) { const int x1 = x + offset[i + count - 1][0]; const int y1 = y + offset[i + count - 1][1]; const int index = x1 + y1*linesize; p->dct->get_pixels(block, p->src + sample_bytes*index, sample_bytes*linesize); p->dct->fdct(block); p->requantize(block2, block, qp, p->dct->idct_permutation); p->dct->idct(block2); add_block(p->temp + index, linesize, block2); } } if (y) { if (sample_bytes == 1) { p->store_slice(dst + (y - 8) * dst_linesize, p->temp + 8 + y*linesize, dst_linesize, linesize, width, FFMIN(8, height + 8 - y), MAX_LEVEL - p->log2_count, ldither); } else { store_slice16_c((uint16_t*)(dst + (y - 8) * dst_linesize), p->temp + 8 + y*linesize, dst_linesize/2, linesize, width, FFMIN(8, height + 8 - y), MAX_LEVEL - p->log2_count, ldither); } } } }
1threat
No php_mongodb.dll file in this archive? : <p>As it's written on this website: <code>http://www.hongkiat.com/blog/webdev-with-mongodb-part3/</code>, i need to unzip mongo-php-driver archive to get php_mongo.dll, but i can't find it...</p> <p>Any help ?</p> <p>Cheers</p>
0debug
Show all warnings and errors in visual studio code : <p>I'am using Visual Studio Code Version 1.6.0. Is there any possibility to show errors and warnings of all files in the current root folder?</p> <p>At the moment it shows only errors and warnings for open files. </p>
0debug
PHP regexp how to get value from parentheses? : <p>Input:</p> <blockquote> <p>Gujarat (24)</p> </blockquote> <p>Expected Output:</p> <blockquote> <p>24</p> </blockquote> <p>How can I get value from parentheses?</p>
0debug
What's alternative to 'AppBarLayout$ScrollingViewBehavior' in AndroidX? : <p>I've recently migrated my project to AndroidX. Now when I open specific page of the app that has code below, the app Crashes</p> <pre><code>&lt;androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="fill_vertical" android:clipToPadding="false" app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior" &gt; </code></pre> <p>Error in Logcat:</p> <pre><code>android.view.InflateException: Binary XML file line #119: Could not inflate Behavior subclass android.support.design.widget.AppBarLayout$ScrollingViewBehavior Caused by: java.lang.RuntimeException: Could not inflate Behavior subclass android.support.design.widget.AppBarLayout$ScrollingViewBehavior </code></pre> <p>I think I must replace this behavior with it's alternative in AndroidX. But what is that alternative code? I searched in <a href="https://developer.android.com/jetpack/androidx/migrate" rel="noreferrer">https://developer.android.com/jetpack/androidx/migrate</a>. But didn't find AppBarLayout.</p> <p>Thanks in advance.</p>
0debug
Invoke pytest from python for current module only : <p>I know that py.test can test a single module if I do:</p> <pre><code>py.test mod1.py </code></pre> <p>Or, I can invoke pytest inside python:</p> <pre><code>import pytest pytest.run(['mod1.py']) </code></pre> <p>Can I do it inside python, and let it to run the current module? I guess I can do:</p> <pre><code>import pytest import os pytest.main([os.path.basename(__file__)]) </code></pre> <p>But wonder whether this is the most "pythonic" way to do it. Thanks!</p>
0debug
static int image_probe(AVProbeData *p) { if (av_str2id(img_tags, p->filename)) { if (av_filename_number_test(p->filename)) return AVPROBE_SCORE_MAX; else return AVPROBE_SCORE_MAX/2; } return 0; }
1threat
Yoga error building React Native from source : <p>I'm trying to build React Native from source to use some changes I made to its Camera Roll functions. I've followed the guide for how to do that, but I'm running into some downright arcane errors when trying to compile the whole thing.</p> <p>Here's the whole pile:</p> <pre><code>[armeabi-v7a] Compile++ thumb: yogacore &lt;= Utils.cpp [armeabi-v7a] Compile++ thumb: yogacore &lt;= YGEnums.cpp [armeabi-v7a] Compile++ thumb: yogacore &lt;= YGNodePrint.cpp [armeabi-v7a] Compile++ thumb: yogacore &lt;= YGNode.cpp [armeabi-v7a] Compile++ thumb: yogacore &lt;= Yoga.cpp C:/Users/jon-g/OneDrive/Documents/GitHub/kulaapp/node_modules/react-native/ReactAndroid/../ReactCommon/yoga/yoga/YGEnums.cpp:228:1: fatal error: opening dependency file C:\Users\jon-g\OneDrive\Documents\GitHub\kulaapp\node_modules\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/yogacore/C_/Users/jon-g/OneDrive/Documents/GitHub/kulaapp/node_modules/react-native/ReactAndroid/__/ReactCommon/yoga/yoga/YGEnums.o.d: No such file or directory } ^ compilation terminated. make.exe: *** [C:\Users\jon-g\OneDrive\Documents\GitHub\kulaapp\node_modules\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/yogacore/C_/Users/jon-g/OneDrive/Documents/GitHub/kulaapp/node_modules/react-native/ReactAndroid/__/ReactCommon/yoga/yoga/YGEnums.o] Error 1 make.exe: *** Waiting for unfinished jobs.... [armeabi-v7a] StaticLibrary : libreactnative.a C:/Users/jon-g/OneDrive/Documents/GitHub/kulaapp/node_modules/react-native/ReactAndroid/../ReactCommon/yoga/yoga/YGNodePrint.cpp:227:1: fatal error: opening dependency file C:\Users\jon-g\OneDrive\Documents\GitHub\kulaapp\node_modules\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/yogacore/C_/Users/jon-g/OneDrive/Documents/GitHub/kulaapp/node_modules/react-native/ReactAndroid/__/ReactCommon/yoga/yoga/YGNodePrint.o.d: No such file or directory } // namespace facebook ^ compilation terminated. make.exe: *** [C:\Users\jon-g\OneDrive\Documents\GitHub\kulaapp\node_modules\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/yogacore/C_/Users/jon-g/OneDrive/Documents/GitHub/kulaapp/node_modules/react-native/ReactAndroid/__/ReactCommon/yoga/yoga/YGNodePrint.o] Error 1 C:/Users/jon-g/OneDrive/Documents/GitHub/kulaapp/node_modules/react-native/ReactAndroid/../ReactCommon/yoga/yoga/Utils.cpp:31:1: fatal error: opening dependency file C:\Users\jon-g\OneDrive\Documents\GitHub\kulaapp\node_modules\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/yogacore/C_/Users/jon-g/OneDrive/Documents/GitHub/kulaapp/node_modules/react-native/ReactAndroid/__/ReactCommon/yoga/yoga/Utils.o.d: No such file or directory } ^ compilation terminated. make.exe: *** [C:\Users\jon-g\OneDrive\Documents\GitHub\kulaapp\node_modules\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/yogacore/C_/Users/jon-g/OneDrive/Documents/GitHub/kulaapp/node_modules/react-native/ReactAndroid/__/ReactCommon/yoga/yoga/Utils.o] Error 1 C:/Users/jon-g/OneDrive/Documents/GitHub/kulaapp/node_modules/react-native/ReactAndroid/../ReactCommon/yoga/yoga/YGNode.cpp:668:1: fatal error: opening dependency file C:\Users\jon-g\OneDrive\Documents\GitHub\kulaapp\node_modules\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/yogacore/C_/Users/jon-g/OneDrive/Documents/GitHub/kulaapp/node_modules/react-native/ReactAndroid/__/ReactCommon/yoga/yoga/YGNode.o.d: No such file or directory } ^ compilation terminated. make.exe: *** [C:\Users\jon-g\OneDrive\Documents\GitHub\kulaapp\node_modules\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/yogacore/C_/Users/jon-g/OneDrive/Documents/GitHub/kulaapp/node_modules/react-native/ReactAndroid/__/ReactCommon/yoga/yoga/YGNode.o] Error 1 C:/Users/jon-g/OneDrive/Documents/GitHub/kulaapp/node_modules/react-native/ReactAndroid/../ReactCommon/yoga/yoga/Yoga.cpp:3493:1: fatal error: opening dependency file C:\Users\jon-g\OneDrive\Documents\GitHub\kulaapp\node_modules\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/yogacore/C_/Users/jon-g/OneDrive/Documents/GitHub/kulaapp/node_modules/react-native/ReactAndroid/__/ReactCommon/yoga/yoga/Yoga.o.d: No such file or directory } ^ compilation terminated. make.exe: *** [C:\Users\jon-g\OneDrive\Documents\GitHub\kulaapp\node_modules\react-native\ReactAndroid\build\tmp\buildReactNdkLib/local/armeabi-v7a/objs/yogacore/C_/Users/jon-g/OneDrive/Documents/GitHub/kulaapp/node_modules/react-native/ReactAndroid/__/ReactCommon/yoga/yoga/Yoga.o] Error 1 make.exe: Leaving directory `C:/Users/jon-g/OneDrive/Documents/GitHub/kulaapp/node_modules/react-native/ReactAndroid/src/main/jni/react/jni' :ReactAndroid:buildReactNdkLib FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':ReactAndroid:buildReactNdkLib'. &gt; Process 'command 'C:\Users\jon-g\AppData\Local\Android\Ndk\android-ndk-r10e\ndk-build.cmd'' finished with non-zero exit value 2 * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED </code></pre> <p>None of this makes much sense to me. These file paths are entirely ridiculous.</p> <p>Why is this happening? How do I get this to compile?</p>
0debug
START_TEST(qstring_get_str_test) { QString *qstring; const char *ret_str; const char *str = "QEMU/KVM"; qstring = qstring_from_str(str); ret_str = qstring_get_str(qstring); fail_unless(strcmp(ret_str, str) == 0); QDECREF(qstring); }
1threat
How to access string in another class in Java - GUI : Another question for Java... I know it's basic, but I am not pro. So I have Main.java public class Main { public static void main(String[] args) { System.setProperty("webdriver.gecko.driver", "C:/geckodriver.exe"); WebDriver driver = new FirefoxDriver(); driver.get("https://my.emerchantpay.com/"); eMerchantPay emp = PageFactory.initElements(driver, eMerchantPay.class); SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame frame = new MainFrame("Please enter your credentials"); frame.setSize(500, 400); //frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }); emp.uid(username); emp.pwd(password); emp.LoginButton.click(); And the string is located in DetailsPanel.java public class DetailsPanel extends JPanel{ private static final long serialVersionUID = 1234567891; private EventListenerList listenerList = new EventListenerList(); public DetailsPanel() { Dimension size = getPreferredSize(); size.width = 250; setPreferredSize(size); setBorder(BorderFactory.createTitledBorder("Personal Details")); JLabel nameLabel = new JLabel("Name: "); JLabel passwordLabel = new JLabel("Password: "); final JTextField nameField = new JTextField(10); final JPasswordField passwordField = new JPasswordField(10); final JButton addBtn = new JButton("Submit"); addBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { String name = nameField.getText(); String password = passwordField.getText(); String text = name + ": " + password + "\n"; JFrame frame = (JFrame) SwingUtilities.getWindowAncestor(addBtn); frame.dispose(); System.out.println (text); } }); setLayout(new GridBagLayout()); GridBagConstraints gc = new GridBagConstraints(); /// First column /// gc.anchor = GridBagConstraints.LINE_END; gc.weightx = 0.5; gc.weighty = 0.5; gc.gridx = 0; gc.gridy = 0; add(nameLabel, gc); gc.gridx = 0; gc.gridy = 1; add(passwordLabel, gc); /// Second column /// gc.anchor = GridBagConstraints.LINE_START; gc.gridx = 1; gc.gridy = 0; add(nameField, gc); gc.gridx = 1; gc.gridy = 1; add(passwordField, gc); /// Final row /// gc.weighty = 10; gc.anchor = GridBagConstraints.FIRST_LINE_START; gc.gridx = 1; gc.gridy = 2; add(addBtn, gc); } public void fireDetailEvent(DetailEvent event) { Object[] listeners = listenerList.getListenerList(); for (int i=0; i < listeners.length; i += 2) { if (listeners[i] == DetailListener.class) { ((DetailListener)listeners[i+1]).detailEventOccured(event); } } } public void addDetailsListener(DetailListener listener) { listenerList.add(DetailListener.class, listener); } public void removeDetailListener(DetailListener listener) { listenerList.remove(DetailListener.class, listener); } So the strings are located here String name = nameField.getText(); String password = passwordField.getText(); How do I access these from Main.java? I have to assign the name value to emp.uid(username); Thank you in advance!!!
0debug
Changing link to pop up link : <p>Hello trying change this link ;</p> <pre><code> &lt;a href="@String.Format("http://www.koltukcubey.com/chat/index.php?project={0}&amp;member={1}", item.Id, item.Member)" class="theme-btn btn-style-one hvr-bounce-to-right"&gt;&lt;span style="float:right;min-width:210px;"&gt;&lt;/span&gt;GİRİŞ&lt;/a&gt;&lt;br /&gt;&lt;br /&gt; </code></pre> <p>To This ;</p> <pre><code>&lt;a href="#" onclick="javascript: window.open('http://www.koltukcubey.com/chat/index.php?project=24&amp;member=2', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=1046,height=520'); return false" &gt;Chat sistemine git&lt;/a&gt; </code></pre>
0debug
static void musicpal_init(ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { CPUState *env; qemu_irq *cpu_pic; qemu_irq pic[32]; DeviceState *dev; DeviceState *i2c_dev; DeviceState *lcd_dev; DeviceState *key_dev; #ifdef HAS_AUDIO DeviceState *wm8750_dev; SysBusDevice *s; #endif i2c_bus *i2c; int i; unsigned long flash_size; DriveInfo *dinfo; ram_addr_t sram_off; if (!cpu_model) { cpu_model = "arm926"; } env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } cpu_pic = arm_pic_init_cpu(env); cpu_register_physical_memory(0, MP_RAM_DEFAULT_SIZE, qemu_ram_alloc(MP_RAM_DEFAULT_SIZE)); sram_off = qemu_ram_alloc(MP_SRAM_SIZE); cpu_register_physical_memory(MP_SRAM_BASE, MP_SRAM_SIZE, sram_off); dev = sysbus_create_simple("mv88w8618_pic", MP_PIC_BASE, cpu_pic[ARM_PIC_CPU_IRQ]); for (i = 0; i < 32; i++) { pic[i] = qdev_get_gpio_in(dev, i); } sysbus_create_varargs("mv88w8618_pit", MP_PIT_BASE, pic[MP_TIMER1_IRQ], pic[MP_TIMER2_IRQ], pic[MP_TIMER3_IRQ], pic[MP_TIMER4_IRQ], NULL); if (serial_hds[0]) { #ifdef TARGET_WORDS_BIGENDIAN serial_mm_init(MP_UART1_BASE, 2, pic[MP_UART1_IRQ], 1825000, serial_hds[0], 1, 1); #else serial_mm_init(MP_UART1_BASE, 2, pic[MP_UART1_IRQ], 1825000, serial_hds[0], 1, 0); #endif } if (serial_hds[1]) { #ifdef TARGET_WORDS_BIGENDIAN serial_mm_init(MP_UART2_BASE, 2, pic[MP_UART2_IRQ], 1825000, serial_hds[1], 1, 1); #else serial_mm_init(MP_UART2_BASE, 2, pic[MP_UART2_IRQ], 1825000, serial_hds[1], 1, 0); #endif } dinfo = drive_get(IF_PFLASH, 0, 0); if (dinfo) { flash_size = bdrv_getlength(dinfo->bdrv); if (flash_size != 8*1024*1024 && flash_size != 16*1024*1024 && flash_size != 32*1024*1024) { fprintf(stderr, "Invalid flash image size\n"); exit(1); } #ifdef TARGET_WORDS_BIGENDIAN pflash_cfi02_register(0-MP_FLASH_SIZE_MAX, qemu_ram_alloc(flash_size), dinfo->bdrv, 0x10000, (flash_size + 0xffff) >> 16, MP_FLASH_SIZE_MAX / flash_size, 2, 0x00BF, 0x236D, 0x0000, 0x0000, 0x5555, 0x2AAA, 1); #else pflash_cfi02_register(0-MP_FLASH_SIZE_MAX, qemu_ram_alloc(flash_size), dinfo->bdrv, 0x10000, (flash_size + 0xffff) >> 16, MP_FLASH_SIZE_MAX / flash_size, 2, 0x00BF, 0x236D, 0x0000, 0x0000, 0x5555, 0x2AAA, 0); #endif } sysbus_create_simple("mv88w8618_flashcfg", MP_FLASHCFG_BASE, NULL); qemu_check_nic_model(&nd_table[0], "mv88w8618"); dev = qdev_create(NULL, "mv88w8618_eth"); qdev_set_nic_properties(dev, &nd_table[0]); qdev_init_nofail(dev); sysbus_mmio_map(sysbus_from_qdev(dev), 0, MP_ETH_BASE); sysbus_connect_irq(sysbus_from_qdev(dev), 0, pic[MP_ETH_IRQ]); sysbus_create_simple("mv88w8618_wlan", MP_WLAN_BASE, NULL); musicpal_misc_init(); dev = sysbus_create_simple("musicpal_gpio", MP_GPIO_BASE, pic[MP_GPIO_IRQ]); i2c_dev = sysbus_create_simple("gpio_i2c", 0, NULL); i2c = (i2c_bus *)qdev_get_child_bus(i2c_dev, "i2c"); lcd_dev = sysbus_create_simple("musicpal_lcd", MP_LCD_BASE, NULL); key_dev = sysbus_create_simple("musicpal_key", 0, NULL); qdev_connect_gpio_out(i2c_dev, 0, qdev_get_gpio_in(dev, MP_GPIO_I2C_DATA_BIT)); qdev_connect_gpio_out(dev, 3, qdev_get_gpio_in(i2c_dev, 0)); qdev_connect_gpio_out(dev, 4, qdev_get_gpio_in(i2c_dev, 1)); for (i = 0; i < 3; i++) { qdev_connect_gpio_out(dev, i, qdev_get_gpio_in(lcd_dev, i)); } for (i = 0; i < 4; i++) { qdev_connect_gpio_out(key_dev, i, qdev_get_gpio_in(dev, i + 8)); } for (i = 4; i < 8; i++) { qdev_connect_gpio_out(key_dev, i, qdev_get_gpio_in(dev, i + 15)); } #ifdef HAS_AUDIO wm8750_dev = i2c_create_slave(i2c, "wm8750", MP_WM_ADDR); dev = qdev_create(NULL, "mv88w8618_audio"); s = sysbus_from_qdev(dev); qdev_prop_set_ptr(dev, "wm8750", wm8750_dev); qdev_init_nofail(dev); sysbus_mmio_map(s, 0, MP_AUDIO_BASE); sysbus_connect_irq(s, 0, pic[MP_AUDIO_IRQ]); #endif musicpal_binfo.ram_size = MP_RAM_DEFAULT_SIZE; musicpal_binfo.kernel_filename = kernel_filename; musicpal_binfo.kernel_cmdline = kernel_cmdline; musicpal_binfo.initrd_filename = initrd_filename; arm_load_kernel(env, &musicpal_binfo); }
1threat
Explanation for issues of type "ResourceCycle": when generate signed Apk : <p>I am getting error after update to appcompat-v7:24.0.0-alpha1 on generating the signed apk.</p> <pre><code>Error:Error: Style Resource definition cycle: TextAppearance.AppCompat.Light.SearchResult.Title =&gt; TextAppearance.AppCompat.SearchResult.Title =&gt; TextAppearance.AppCompat.SearchResult.Title [ResourceCycle] </code></pre>
0debug
Which Class should inherit a QMainWindow? : <p>I am new to Qt and this is probably a very stupid question. I am working on a Project with several sub-projects in Visual Studio (C++). The whole project has a single User-interface (UI), and for that, the Qt is used. </p> <p>Among all the sub-projects, only 2 classes are inherited from QMainWindow.</p> <p>As a newbie, I am wondering, which classes should inherit QMainWindow?</p>
0debug
PS MarkSweep is which garbage collector : <p>My jdk version is :</p> <pre><code>java version "1.8.0_102" Java(TM) SE Runtime Environment (build 1.8.0_102-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode) </code></pre> <p>this is my test code :</p> <pre><code>List&lt;GarbageCollectorMXBean&gt; beans = ManagementFactory.getGarbageCollectorMXBeans(); for (GarbageCollectorMXBean bean : beans) { System.out.println(bean.getName()); } </code></pre> <p>result is :</p> <pre><code>PS Scavenge PS MarkSweep </code></pre> <p>I know PS Scavenge is "Parallel Scavenge" of young generation garbage collector, "PS MarkSweep" is which, is it "Parallel Old"? </p>
0debug
Dart: create a list from 0 to N : <p>How can I create easily a range of consecutive integers in dart? For example:</p> <pre><code>// throws a syntax error :) var list = [1..10]; </code></pre>
0debug
static inline abi_long target_to_host_sockaddr(int fd, struct sockaddr *addr, abi_ulong target_addr, socklen_t len) { const socklen_t unix_maxlen = sizeof (struct sockaddr_un); sa_family_t sa_family; struct target_sockaddr *target_saddr; if (fd_trans_target_to_host_addr(fd)) { return fd_trans_target_to_host_addr(fd)(addr, target_addr, len); } target_saddr = lock_user(VERIFY_READ, target_addr, len, 1); if (!target_saddr) return -TARGET_EFAULT; sa_family = tswap16(target_saddr->sa_family); if (sa_family == AF_UNIX) { if (len < unix_maxlen && len > 0) { char *cp = (char*)target_saddr; if ( cp[len-1] && !cp[len] ) len++; } if (len > unix_maxlen) len = unix_maxlen; } memcpy(addr, target_saddr, len); addr->sa_family = sa_family; if (sa_family == AF_PACKET) { struct target_sockaddr_ll *lladdr; lladdr = (struct target_sockaddr_ll *)addr; lladdr->sll_ifindex = tswap32(lladdr->sll_ifindex); lladdr->sll_hatype = tswap16(lladdr->sll_hatype); } unlock_user(target_saddr, target_addr, 0); return 0; }
1threat
static void openpic_irq_raise(OpenPICState *opp, int n_CPU, IRQ_src_t *src) { int n_ci = IDR_CI0_SHIFT - n_CPU; if ((opp->flags & OPENPIC_FLAG_IDE_CRIT) && (src->ide & (1 << n_ci))) { qemu_irq_raise(opp->dst[n_CPU].irqs[OPENPIC_OUTPUT_CINT]); } else { qemu_irq_raise(opp->dst[n_CPU].irqs[OPENPIC_OUTPUT_INT]); } }
1threat
static int mb_var_thread(AVCodecContext *c, void *arg){ MpegEncContext *s= *(void**)arg; int mb_x, mb_y; for(mb_y=s->start_mb_y; mb_y < s->end_mb_y; mb_y++) { for(mb_x=0; mb_x < s->mb_width; mb_x++) { int xx = mb_x * 16; int yy = mb_y * 16; uint8_t *pix = s->new_picture.f.data[0] + (yy * s->linesize) + xx; int varc; int sum = s->dsp.pix_sum(pix, s->linesize); varc = (s->dsp.pix_norm1(pix, s->linesize) - (((unsigned)sum*sum)>>8) + 500 + 128)>>8; s->current_picture.mb_var [s->mb_stride * mb_y + mb_x] = varc; s->current_picture.mb_mean[s->mb_stride * mb_y + mb_x] = (sum+128)>>8; s->me.mb_var_sum_temp += varc; } } return 0; }
1threat
static char *SocketAddress_to_str(const char *prefix, SocketAddressLegacy *addr, bool is_listen, bool is_telnet) { switch (addr->type) { case SOCKET_ADDRESS_LEGACY_KIND_INET: return g_strdup_printf("%s%s:%s:%s%s", prefix, is_telnet ? "telnet" : "tcp", addr->u.inet.data->host, addr->u.inet.data->port, is_listen ? ",server" : ""); break; case SOCKET_ADDRESS_LEGACY_KIND_UNIX: return g_strdup_printf("%sunix:%s%s", prefix, addr->u.q_unix.data->path, is_listen ? ",server" : ""); break; case SOCKET_ADDRESS_LEGACY_KIND_FD: return g_strdup_printf("%sfd:%s%s", prefix, addr->u.fd.data->str, is_listen ? ",server" : ""); break; case SOCKET_ADDRESS_LEGACY_KIND_VSOCK: return g_strdup_printf("%svsock:%s:%s", prefix, addr->u.vsock.data->cid, addr->u.vsock.data->port); default: abort(); } }
1threat
Why doesn't the read function work in sha1 c++ implementation? : <p>I found this c++ implementation of SHA1 on this page <a href="http://www.zedwood.com/article/cpp-sha1-function" rel="nofollow noreferrer">zedwood.com</a>. Why doesn't the this function work. It says that max has to be a constant. How to get around this problem?</p> <pre><code>void SHA1::read(std::istream &amp;is, std::string &amp;s, int max) { char sbuf[max]; is.read(sbuf, max); s.assign(sbuf, is.gcount()); }`` </code></pre>
0debug
static int matroska_ebmlnum_uint(MatroskaDemuxContext *matroska, uint8_t *data, uint32_t size, uint64_t *num) { ByteIOContext pb; init_put_byte(&pb, data, size, 0, NULL, NULL, NULL, NULL); return ebml_read_num(matroska, &pb, 8, num); }
1threat
PHP split string : <p>Hey how can I split string into 2 string, exemple:</p> <pre><code>$ipadd = "192.168.1.60"; </code></pre> <p>From here I want to print 2 result, one is: 192.168.1 secend is:60</p> <p>Always split by the last point and print 2 string.</p>
0debug
int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) { int pqindex, lowquant; int status; int mbmodetab, imvtab, icbptab, twomvbptab, fourmvbptab; int scale, shift, i; v->numref=0; v->p_frame_skipped = 0; if (v->second_field) { if(v->fcm!=2 || v->field_mode!=1) return -1; v->s.pict_type = (v->fptype & 1) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (v->fptype & 4) v->s.pict_type = (v->fptype & 1) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B; v->s.current_picture_ptr->f.pict_type = v->s.pict_type; if (!v->pic_header_flag) goto parse_common_info; } v->field_mode = 0; if (v->interlace) { v->fcm = decode012(gb); if (v->fcm) { if (v->fcm == ILACE_FIELD) v->field_mode = 1; if (!v->warn_interlaced++) av_log(v->s.avctx, AV_LOG_ERROR, "Interlaced frames/fields support is incomplete\n"); } } else { v->fcm = PROGRESSIVE; } if (v->field_mode) { v->fptype = get_bits(gb, 3); v->s.pict_type = (v->fptype & 2) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if (v->fptype & 4) v->s.pict_type = (v->fptype & 2) ? AV_PICTURE_TYPE_BI : AV_PICTURE_TYPE_B; } else { switch (get_unary(gb, 0, 4)) { case 0: v->s.pict_type = AV_PICTURE_TYPE_P; break; case 1: v->s.pict_type = AV_PICTURE_TYPE_B; break; case 2: v->s.pict_type = AV_PICTURE_TYPE_I; break; case 3: v->s.pict_type = AV_PICTURE_TYPE_BI; break; case 4: v->s.pict_type = AV_PICTURE_TYPE_P; v->p_frame_skipped = 1; break; } } if (v->tfcntrflag) skip_bits(gb, 8); if (v->broadcast) { if (!v->interlace || v->psf) { v->rptfrm = get_bits(gb, 2); } else { v->tff = get_bits1(gb); v->rff = get_bits1(gb); } } if (v->panscanflag) { av_log_missing_feature(v->s.avctx, "Pan-scan", 0); } if (v->p_frame_skipped) { return 0; } v->rnd = get_bits1(gb); if (v->interlace) v->uvsamp = get_bits1(gb); if(!ff_vc1_bfraction_vlc.table) return 0; if (v->field_mode) { if (!v->refdist_flag) v->refdist = 0; else if ((v->s.pict_type != AV_PICTURE_TYPE_B) && (v->s.pict_type != AV_PICTURE_TYPE_BI)) { v->refdist = get_bits(gb, 2); if (v->refdist == 3) v->refdist += get_unary(gb, 0, 16); } if ((v->s.pict_type == AV_PICTURE_TYPE_B) || (v->s.pict_type == AV_PICTURE_TYPE_BI)) { v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index]; v->frfd = (v->bfraction * v->refdist) >> 8; v->brfd = v->refdist - v->frfd - 1; if (v->brfd < 0) v->brfd = 0; } goto parse_common_info; } if (v->fcm == PROGRESSIVE) { if (v->finterpflag) v->interpfrm = get_bits1(gb); if (v->s.pict_type == AV_PICTURE_TYPE_B) { v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index]; if (v->bfraction == 0) { v->s.pict_type = AV_PICTURE_TYPE_BI; } } } parse_common_info: if (v->field_mode) v->cur_field_type = !(v->tff ^ v->second_field); pqindex = get_bits(gb, 5); if (!pqindex) return -1; v->pqindex = pqindex; if (v->quantizer_mode == QUANT_FRAME_IMPLICIT) v->pq = ff_vc1_pquant_table[0][pqindex]; else v->pq = ff_vc1_pquant_table[1][pqindex]; v->pquantizer = 1; if (v->quantizer_mode == QUANT_FRAME_IMPLICIT) v->pquantizer = pqindex < 9; if (v->quantizer_mode == QUANT_NON_UNIFORM) v->pquantizer = 0; v->pqindex = pqindex; if (pqindex < 9) v->halfpq = get_bits1(gb); else v->halfpq = 0; if (v->quantizer_mode == QUANT_FRAME_EXPLICIT) v->pquantizer = get_bits1(gb); if (v->postprocflag) v->postproc = get_bits(gb, 2); if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_P) v->use_ic = 0; if (v->parse_only) return 0; switch (v->s.pict_type) { case AV_PICTURE_TYPE_I: case AV_PICTURE_TYPE_BI: if (v->fcm == ILACE_FRAME) { status = bitplane_decoding(v->fieldtx_plane, &v->fieldtx_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "FIELDTX plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); } status = bitplane_decoding(v->acpred_plane, &v->acpred_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "ACPRED plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); v->condover = CONDOVER_NONE; if (v->overlap && v->pq <= 8) { v->condover = decode012(gb); if (v->condover == CONDOVER_SELECT) { status = bitplane_decoding(v->over_flags_plane, &v->overflg_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "CONDOVER plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); } } break; case AV_PICTURE_TYPE_P: if (v->field_mode) { v->numref = get_bits1(gb); if (!v->numref) { v->reffield = get_bits1(gb); v->ref_field_type[0] = v->reffield ^ !v->cur_field_type; } } if (v->extended_mv) v->mvrange = get_unary(gb, 0, 3); else v->mvrange = 0; if (v->interlace) { if (v->extended_dmv) v->dmvrange = get_unary(gb, 0, 3); else v->dmvrange = 0; if (v->fcm == ILACE_FRAME) { v->fourmvswitch = get_bits1(gb); v->intcomp = get_bits1(gb); if (v->intcomp) { v->lumscale = get_bits(gb, 6); v->lumshift = get_bits(gb, 6); INIT_LUT(v->lumscale, v->lumshift, v->luty, v->lutuv); } status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); av_log(v->s.avctx, AV_LOG_DEBUG, "SKIPMB plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); mbmodetab = get_bits(gb, 2); if (v->fourmvswitch) v->mbmode_vlc = &ff_vc1_intfr_4mv_mbmode_vlc[mbmodetab]; else v->mbmode_vlc = &ff_vc1_intfr_non4mv_mbmode_vlc[mbmodetab]; imvtab = get_bits(gb, 2); v->imv_vlc = &ff_vc1_1ref_mvdata_vlc[imvtab]; icbptab = get_bits(gb, 3); v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[icbptab]; twomvbptab = get_bits(gb, 2); v->twomvbp_vlc = &ff_vc1_2mv_block_pattern_vlc[twomvbptab]; if (v->fourmvswitch) { fourmvbptab = get_bits(gb, 2); v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[fourmvbptab]; } } } v->k_x = v->mvrange + 9 + (v->mvrange >> 1); v->k_y = v->mvrange + 8; v->range_x = 1 << (v->k_x - 1); v->range_y = 1 << (v->k_y - 1); if (v->pq < 5) v->tt_index = 0; else if (v->pq < 13) v->tt_index = 1; else v->tt_index = 2; if (v->fcm != ILACE_FRAME) { int mvmode; mvmode = get_unary(gb, 1, 4); lowquant = (v->pq > 12) ? 0 : 1; v->mv_mode = ff_vc1_mv_pmode_table[lowquant][mvmode]; if (v->mv_mode == MV_PMODE_INTENSITY_COMP) { int mvmode2; mvmode2 = get_unary(gb, 1, 3); v->mv_mode2 = ff_vc1_mv_pmode_table2[lowquant][mvmode2]; if (v->field_mode) v->intcompfield = decode210(gb); v->lumscale = get_bits(gb, 6); v->lumshift = get_bits(gb, 6); INIT_LUT(v->lumscale, v->lumshift, v->luty, v->lutuv); if ((v->field_mode) && !v->intcompfield) { v->lumscale2 = get_bits(gb, 6); v->lumshift2 = get_bits(gb, 6); INIT_LUT(v->lumscale2, v->lumshift2, v->luty2, v->lutuv2); } v->use_ic = 1; } v->qs_last = v->s.quarter_sample; if (v->mv_mode == MV_PMODE_1MV_HPEL || v->mv_mode == MV_PMODE_1MV_HPEL_BILIN) v->s.quarter_sample = 0; else if (v->mv_mode == MV_PMODE_INTENSITY_COMP) { if (v->mv_mode2 == MV_PMODE_1MV_HPEL || v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN) v->s.quarter_sample = 0; else v->s.quarter_sample = 1; } else v->s.quarter_sample = 1; v->s.mspel = !(v->mv_mode == MV_PMODE_1MV_HPEL_BILIN || (v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN)); } if (v->fcm == PROGRESSIVE) { if ((v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_MIXED_MV) || v->mv_mode == MV_PMODE_MIXED_MV) { status = bitplane_decoding(v->mv_type_mb_plane, &v->mv_type_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB MV Type plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); } else { v->mv_type_is_raw = 0; memset(v->mv_type_mb_plane, 0, v->s.mb_stride * v->s.mb_height); } status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); v->s.mv_table_index = get_bits(gb, 2); v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)]; } else if (v->fcm == ILACE_FRAME) { v->qs_last = v->s.quarter_sample; v->s.quarter_sample = 1; v->s.mspel = 1; } else { mbmodetab = get_bits(gb, 3); imvtab = get_bits(gb, 2 + v->numref); if (!v->numref) v->imv_vlc = &ff_vc1_1ref_mvdata_vlc[imvtab]; else v->imv_vlc = &ff_vc1_2ref_mvdata_vlc[imvtab]; icbptab = get_bits(gb, 3); v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[icbptab]; if ((v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_MIXED_MV) || v->mv_mode == MV_PMODE_MIXED_MV) { fourmvbptab = get_bits(gb, 2); v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[fourmvbptab]; v->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[mbmodetab]; } else { v->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[mbmodetab]; } } if (v->dquant) { av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(v); } v->ttfrm = 0; if (v->vstransform) { v->ttmbf = get_bits1(gb); if (v->ttmbf) { v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)]; } } else { v->ttmbf = 1; v->ttfrm = TT_8X8; } break; case AV_PICTURE_TYPE_B: if (v->fcm == ILACE_FRAME) { v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1); v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index]; if (v->bfraction == 0) { return -1; } } if (v->extended_mv) v->mvrange = get_unary(gb, 0, 3); else v->mvrange = 0; v->k_x = v->mvrange + 9 + (v->mvrange >> 1); v->k_y = v->mvrange + 8; v->range_x = 1 << (v->k_x - 1); v->range_y = 1 << (v->k_y - 1); if (v->pq < 5) v->tt_index = 0; else if (v->pq < 13) v->tt_index = 1; else v->tt_index = 2; if (v->field_mode) { int mvmode; av_log(v->s.avctx, AV_LOG_DEBUG, "B Fields\n"); if (v->extended_dmv) v->dmvrange = get_unary(gb, 0, 3); mvmode = get_unary(gb, 1, 3); lowquant = (v->pq > 12) ? 0 : 1; v->mv_mode = ff_vc1_mv_pmode_table2[lowquant][mvmode]; v->qs_last = v->s.quarter_sample; v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV || v->mv_mode == MV_PMODE_MIXED_MV); v->s.mspel = !(v->mv_mode == MV_PMODE_1MV_HPEL_BILIN || v->mv_mode == MV_PMODE_1MV_HPEL); status = bitplane_decoding(v->forward_mb_plane, &v->fmb_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Forward Type plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); mbmodetab = get_bits(gb, 3); if (v->mv_mode == MV_PMODE_MIXED_MV) v->mbmode_vlc = &ff_vc1_if_mmv_mbmode_vlc[mbmodetab]; else v->mbmode_vlc = &ff_vc1_if_1mv_mbmode_vlc[mbmodetab]; imvtab = get_bits(gb, 3); v->imv_vlc = &ff_vc1_2ref_mvdata_vlc[imvtab]; icbptab = get_bits(gb, 3); v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[icbptab]; if (v->mv_mode == MV_PMODE_MIXED_MV) { fourmvbptab = get_bits(gb, 2); v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[fourmvbptab]; } v->numref = 1; } else if (v->fcm == ILACE_FRAME) { if (v->extended_dmv) v->dmvrange = get_unary(gb, 0, 3); get_bits1(gb); v->intcomp = 0; v->mv_mode = MV_PMODE_1MV; v->fourmvswitch = 0; v->qs_last = v->s.quarter_sample; v->s.quarter_sample = 1; v->s.mspel = 1; status = bitplane_decoding(v->direct_mb_plane, &v->dmb_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); mbmodetab = get_bits(gb, 2); v->mbmode_vlc = &ff_vc1_intfr_non4mv_mbmode_vlc[mbmodetab]; imvtab = get_bits(gb, 2); v->imv_vlc = &ff_vc1_1ref_mvdata_vlc[imvtab]; icbptab = get_bits(gb, 3); v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[icbptab]; twomvbptab = get_bits(gb, 2); v->twomvbp_vlc = &ff_vc1_2mv_block_pattern_vlc[twomvbptab]; fourmvbptab = get_bits(gb, 2); v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[fourmvbptab]; } else { v->mv_mode = get_bits1(gb) ? MV_PMODE_1MV : MV_PMODE_1MV_HPEL_BILIN; v->qs_last = v->s.quarter_sample; v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV); v->s.mspel = v->s.quarter_sample; status = bitplane_decoding(v->direct_mb_plane, &v->dmb_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); if (status < 0) return -1; av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); v->s.mv_table_index = get_bits(gb, 2); v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)]; } if (v->dquant) { av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(v); } v->ttfrm = 0; if (v->vstransform) { v->ttmbf = get_bits1(gb); if (v->ttmbf) { v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)]; } } else { v->ttmbf = 1; v->ttfrm = TT_8X8; } break; } if (v->fcm != PROGRESSIVE && !v->s.quarter_sample) { v->range_x <<= 1; v->range_y <<= 1; } v->c_ac_table_index = decode012(gb); if (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI) { v->y_ac_table_index = decode012(gb); } v->s.dc_table_index = get_bits1(gb); if ((v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI) && v->dquant) { av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); vop_dquant_decoding(v); } v->bi_type = 0; if (v->s.pict_type == AV_PICTURE_TYPE_BI) { v->s.pict_type = AV_PICTURE_TYPE_B; v->bi_type = 1; } return 0; }
1threat
Join two tables and update based upon equal and like condition : There are two tables. **table 1** A B C ================= 1 AAA AA;BB 2 BBB CC;DD 3 CCC FF;G 4 DDD E **table 2** (this table is expanded based upon columns C in above table which has ";" seperated values, these are expanded in terms of seperate rows) A B C is_valid 11 AAA AA 0 12 AAA BB 0 14 AAA CC 0 Below table is formed by checking if the expansion is correct and is_valid flag is raised to 1. So checking needs to be done - Columns B should be exactly same in both the tables and part of column C present in table2 should be available with the same Column B value combination in table1. **Expected table 2 after update query** A B C is_valid 11 AAA AA 1 12 AAA BB 1 14 AAA CC 0 17 DDD E 1 Need to get help on formation of the update query for updating the is_valid column in table2.
0debug
Sequelize - case-insensitive like : <p>How can I achieve this in Sequelize?</p> <pre><code>SELECT * FROM table where lower(column) LIKE ('abcd%'); </code></pre> <p>I can't find a way to mix <em>lower</em> function with <em>$like</em></p>
0debug
BlockDriverState *bdrv_find_node(const char *node_name) { BlockDriverState *bs; assert(node_name); QTAILQ_FOREACH(bs, &graph_bdrv_states, node_list) { if (!strcmp(node_name, bs->node_name)) { return bs; } } return NULL; }
1threat
Why am i getting this error in c: lab_6.c:(.text+0x53): undefined reference to `polyndrom' , `uppercase' and `lowercase' : include stdio.h include stdlib.h include string.h int polyndrom(char str[]); int uppercase(char ch); int lowercase(char ch); int isNumber(char str[]); int isReal(char str[]); int main(int argc, char *argv[]) { FILE *fp = fopen(argv[1],"r"); char buf[50]; //Check whether the file exists or not if(fp == NULL) { printf("check file name is proper or not\n"); } //Read string while(fscanf(fp, "%s", buf) !=EOF) { //Check if the string is a polyndrom or not if( polyndrom(buf) == 1) { printf("String %s is a palindrome\n",buf); } else { printf("String %s is not a palindrome\n",buf); } printf("Its first character is %c\n",buf[0]); printf("Its length is %u\n", strlen(buf)); int i = 0, countUpper = 0, countLower = 0; while(buf[i] !='\0') { //check if the character is uppercase or not if(uppercase(buf[i]) == 1) { countUpper++; } //check is the character is lowercase or not if(lowercase(buf[i]) == 1) { countLower++; } i++; } printf("It has %d uppercase letters\n",countUpper); printf("It has %d lowercase letters\n",countLower); printf("\n"); //check is the string is a real number or not if(isReal(buf)) { printf("String %s is a real number. \n\n",buf); } else { printf("String %s is a interger. \n\n",buf); } } } int polyndron(char str[]) { int start = 0; int end = strlen(str - 1); while(start<end) { if(str[start++] != str[end--]) { return 0; } } return 1; } int uppercas(char ch) { if(ch >= 'A' && ch <= 'Z') { return 1; } return 0; } int isRumber(char str[]) { int i; for (i=0;str[i] != '\0';i++) { if(isdigit(str[i]) !='.') { return 0; } } return 1; } int isReal(char str[]) { if (strchr(str,'.') != NULL) { return 1; } return 0; }
0debug
How to make a bottom slide in Canvas showing content with CSS, jquery and Javascript? : <p>i have this idea, having something like a slide in menu or html or even a canvas where the user can see a dynamic filled data table.</p> <p>The target is to get the "site" (<strong>bottom sheet</strong>) slide in from the bottom by click on a small visible button. The site should slide 70% to the top site. Preferable using Bootstrap 4 components, JS, jquery and CSS.</p> <p>I have absolutely no clue how to start, i would assume something similar to an hidden sidebar menu?</p> <p>Kindly want your feedback on this.</p> <p>Thanks,</p>
0debug
static int get_last_needed_nal(H264Context *h) { int nals_needed = 0; int i; for (i = 0; i < h->pkt.nb_nals; i++) { H2645NAL *nal = &h->pkt.nals[i]; GetBitContext gb; switch (nal->type) { case H264_NAL_SPS: case H264_NAL_PPS: nals_needed = i; break; case H264_NAL_DPA: case H264_NAL_IDR_SLICE: case H264_NAL_SLICE: init_get_bits(&gb, nal->data + 1, (nal->size - 1) * 8); if (!get_ue_golomb(&gb)) nals_needed = i; } } return nals_needed; }
1threat
static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index) { AVPacket out_pkt = { 0 }, flush_pkt = { 0 }; AVStream *st = s->streams[stream_index]; uint8_t *data = pkt ? pkt->data : NULL; int size = pkt ? pkt->size : 0; int ret = 0, got_output = 0; if (!pkt) { av_init_packet(&flush_pkt); pkt = &flush_pkt; got_output = 1; } else if (!size && st->parser->flags & PARSER_FLAG_COMPLETE_FRAMES) { compute_pkt_fields(s, st, st->parser, pkt, AV_NOPTS_VALUE, AV_NOPTS_VALUE); } while (size > 0 || (pkt == &flush_pkt && got_output)) { int len; int64_t next_pts = pkt->pts; int64_t next_dts = pkt->dts; av_init_packet(&out_pkt); len = av_parser_parse2(st->parser, st->codec, &out_pkt.data, &out_pkt.size, data, size, pkt->pts, pkt->dts, pkt->pos); pkt->pts = pkt->dts = AV_NOPTS_VALUE; pkt->pos = -1; data += len; size -= len; got_output = !!out_pkt.size; if (!out_pkt.size) continue; if (pkt->side_data) { out_pkt.side_data = pkt->side_data; out_pkt.side_data_elems = pkt->side_data_elems; pkt->side_data = NULL; pkt->side_data_elems = 0; } out_pkt.duration = (st->parser->flags & PARSER_FLAG_COMPLETE_FRAMES) ? pkt->duration : 0; if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { if (st->codec->sample_rate > 0) { out_pkt.duration = av_rescale_q_rnd(st->parser->duration, (AVRational) { 1, st->codec->sample_rate }, st->time_base, AV_ROUND_DOWN); } } out_pkt.stream_index = st->index; out_pkt.pts = st->parser->pts; out_pkt.dts = st->parser->dts; out_pkt.pos = st->parser->pos; if (st->need_parsing == AVSTREAM_PARSE_FULL_RAW) out_pkt.pos = st->parser->frame_offset; if (st->parser->key_frame == 1 || (st->parser->key_frame == -1 && st->parser->pict_type == AV_PICTURE_TYPE_I)) out_pkt.flags |= AV_PKT_FLAG_KEY; if (st->parser->key_frame == -1 && st->parser->pict_type ==AV_PICTURE_TYPE_NONE && (pkt->flags&AV_PKT_FLAG_KEY)) out_pkt.flags |= AV_PKT_FLAG_KEY; compute_pkt_fields(s, st, st->parser, &out_pkt, next_dts, next_pts); if ((ret = add_to_pktbuf(&s->internal->parse_queue, &out_pkt, &s->internal->parse_queue_end, 1))) { av_packet_unref(&out_pkt); goto fail; } } if (pkt == &flush_pkt) { av_parser_close(st->parser); st->parser = NULL; } fail: av_packet_unref(pkt); return ret; }
1threat
How do I sort this list in Python 3? : <p>I'm in the middle of making a leaderboard, currently I am taking data from a txt file and dumping it into a list.</p> <p>The list's format looks something like this:</p> <p><code>[['56', 'UsernameA'], ['73', 'UsernameB'], ['52', 'UsernameC'], ['10', 'UsernameD']]</code></p> <p>I would like to create a leaderboard, therefore I would like to sort the list from the highest number to the lowest, I've tried using the <code>sort()</code> function, however this only works on integers and my list contains the username and the score, so I cannot convert it into an integer, unless I'm completely wrong here.</p>
0debug
two tiny python questions : <pre><code>fn = raw_input("Enter file to open: ") fileObject = open(fn,'r+') dictionary = {} for line in fileObject: x = line.split(":") a = x[0] b = x[1] c = len(b)-1 b = b[0:c] dictionary[a] = b print dictionary </code></pre> <p>After I tested my program, I found out everything were perfect except for 2 tiny issues. Can you please tell me what is wrong?</p> <p>My text file has the following in it:</p> <p>username1:password1</p> <p>username2:password2 </p> <p>username3:password3</p> <p>username4:password4</p> <p>username5:password5</p> <p>(This is an empty line in the actual text file)</p> <p>First problem: My program reads the file into a dictionary perfectly but it is reading <strong>out of order</strong>, i tried to print the dictionary after the reading into the dictionary part and below is what I got.</p> <pre><code> {'username1': 'password1', 'username3': 'password3', 'username2': 'password2', 'username5': 'password5', 'username4': 'password4'} </code></pre> <p>Second problem:</p> <p>for the text file, after password5, I have to hit enter and save the text file to get this:</p> <pre><code> {'username1': 'password1', 'username3': 'password3', 'username2': 'password2', 'username5': 'passwor**d5'**, 'username4': 'password4'} </code></pre> <p>if I don't hit enter at the end of the text file, then it will become this:</p> <pre><code> {'username1': 'password1', 'username3': 'password3', 'username2': 'password2', 'username5': 'passwo**rd'**, 'username4': 'password4'} </code></pre>
0debug
Regex remove all text to the left of certain last character : Im trying to remove all the text which falls before the last character in a regex pattern. Example: ``` rom.com/run/login.php ``` Becomes: ``` login.php ``` How would I go about doing this in javascript? I'm new to regular expressions.
0debug
Get value of parent object base on value from another object : <p>From a json, Can I get the value base on a value of key from another object? How will I do that? using array filter or for loop?</p> <p>I have tried using array filter but it only returns the whole json object</p> <p>Here is my sample JSON:</p> <pre><code>[ { "type":1, "key": "123abc", "data": { "access": "123456" "data": { "dataValue": [ { "@attr": { "@key": "Fire" }, "@value": "Flame" }, { "@attr": { "@key": "Water" }, "@value": "Liquid" }, { "@attr": { "@key": "Earth" }, "@value": "Stone" } ] } } } ] </code></pre> <p>What I want is to get the "Liquid" value from @value by searching for "Water" from the "@key"</p> <p>Output: Liquid</p> <p>Thanks you for those who will help.</p>
0debug
How does Python determine if two strings are identical : <p>I've tried to understand when Python strings are identical (aka sharing the same memory location). However during my tests, there seems to be no obvious explanation when two string variables that are equal share the same memory:</p> <pre><code>import sys print(sys.version) # 3.4.3 # Example 1 s1 = "Hello" s2 = "Hello" print(id(s1) == id(s2)) # True # Example 2 s1 = "Hello" * 3 s2 = "Hello" * 3 print(id(s1) == id(s2)) # True # Example 3 i = 3 s1 = "Hello" * i s2 = "Hello" * i print(id(s1) == id(s2)) # False # Example 4 s1 = "HelloHelloHelloHelloHello" s2 = "HelloHelloHelloHelloHello" print(id(s1) == id(s2)) # True # Example 5 s1 = "Hello" * 5 s2 = "Hello" * 5 print(id(s1) == id(s2)) # False </code></pre> <p>Strings are immutable, and as far as I know Python tries to re-use existing immutable objects, by having other variables point to them instead of creating new objects in memory with the same value.</p> <p>With this in mind, it seems obvious that <code>Example 1</code> returns <code>True</code>.<br> It's still obvious (to me) that <code>Example 2</code> returns <code>True</code>. </p> <p>It's not obvious to me, that <code>Example 3</code> returns <code>False</code> - am I not doing the same thing as in <code>Example 2</code>?!?</p> <p>I stumbled upon this SO question:<br> <a href="https://stackoverflow.com/questions/1504717/why-does-comparing-strings-in-python-using-either-or-is-sometimes-produce/1504742#1504742">Why does comparing strings in Python using either &#39;==&#39; or &#39;is&#39; sometimes produce a different result?</a> </p> <p>and read through <a href="http://guilload.com/python-string-interning/" rel="noreferrer">http://guilload.com/python-string-interning/</a> (though I probably didn't understand it all) and thougt - okay, maybe "interned" strings depend on the length, so I used <code>HelloHelloHelloHelloHello</code> in <code>Example 4</code>. The result was <code>True</code>. </p> <p>And what the puzzled me, was doing the same as in <code>Example 2</code> just with a bigger number (but it would effectively return the same string as <code>Example 4</code>) - however this time the result was <code>False</code>?!?</p> <p>I have really no idea how Python decides whether or not to use the same memory object, or when to create a new one.</p> <p>Are the any official sources that can explain this behavior?</p>
0debug
int net_init_bridge(const NetClientOptions *opts, const char *name, NetClientState *peer, Error **errp) { const NetdevBridgeOptions *bridge; const char *helper, *br; TAPState *s; int fd, vnet_hdr; assert(opts->kind == NET_CLIENT_OPTIONS_KIND_BRIDGE); bridge = opts->bridge; helper = bridge->has_helper ? bridge->helper : DEFAULT_BRIDGE_HELPER; br = bridge->has_br ? bridge->br : DEFAULT_BRIDGE_INTERFACE; fd = net_bridge_run_helper(helper, br); if (fd == -1) { return -1; } fcntl(fd, F_SETFL, O_NONBLOCK); vnet_hdr = tap_probe_vnet_hdr(fd); s = net_tap_fd_init(peer, "bridge", name, fd, vnet_hdr); snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s,br=%s", helper, br); return 0; }
1threat
no experience, learning on my own : I have three worksheets in excel which I am using. First page is where I put all the data so it can populate in sheet 2 and sheet 3. Sheet 2 and 3 is what I am going to save as pdf. My question, is there a vba code that will name sheet 2 with the value in cell A1 with the letter "F" next to it and then page three with the cell value in A1 again but with the letter E next to it? For e.g. cell A1 has Joy Nice, worksheet 2 will be named Joy Nice-F and worksheet 3 will be named Joy Nice-E. And yes I am new to VBA and I love what it can do. Thank you.
0debug
static av_cold int fieldmatch_init(AVFilterContext *ctx) { const FieldMatchContext *fm = ctx->priv; AVFilterPad pad = { .name = av_strdup("main"), .type = AVMEDIA_TYPE_VIDEO, .filter_frame = filter_frame, .config_props = config_input, }; if (!pad.name) return AVERROR(ENOMEM); ff_insert_inpad(ctx, INPUT_MAIN, &pad); if (fm->ppsrc) { pad.name = av_strdup("clean_src"); pad.config_props = NULL; if (!pad.name) return AVERROR(ENOMEM); ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad); } if ((fm->blockx & (fm->blockx - 1)) || (fm->blocky & (fm->blocky - 1))) { av_log(ctx, AV_LOG_ERROR, "blockx and blocky settings must be power of two\n"); return AVERROR(EINVAL); } if (fm->combpel > fm->blockx * fm->blocky) { av_log(ctx, AV_LOG_ERROR, "Combed pixel should not be larger than blockx x blocky\n"); return AVERROR(EINVAL); } return 0; }
1threat
SQL Server - Select : <p>Please, how do I SELECT, to get the result column?</p> <p><a href="https://i.stack.imgur.com/N3wCZ.jpg" rel="nofollow noreferrer">columns</a></p>
0debug
static int http_parse_request(HTTPContext *c) { char *p; int post; char cmd[32]; char info[1024], *filename; char url[1024], *q; char protocol[32]; char msg[1024]; const char *mime_type; FFStream *stream; p = c->buffer; q = cmd; while (!isspace(*p) && *p != '\0') { if ((q - cmd) < sizeof(cmd) - 1) *q++ = *p; p++; } *q = '\0'; if (!strcmp(cmd, "GET")) post = 0; else if (!strcmp(cmd, "POST")) post = 1; else return -1; while (isspace(*p)) p++; q = url; while (!isspace(*p) && *p != '\0') { if ((q - url) < sizeof(url) - 1) *q++ = *p; p++; } *q = '\0'; while (isspace(*p)) p++; q = protocol; while (!isspace(*p) && *p != '\0') { if ((q - protocol) < sizeof(protocol) - 1) *q++ = *p; p++; } *q = '\0'; if (strcmp(protocol, "HTTP/1.0") && strcmp(protocol, "HTTP/1.1")) return -1; p = url; if (*p == '/') p++; filename = p; p = strchr(p, '?'); if (p) { strcpy(info, p); *p = '\0'; } else { info[0] = '\0'; } stream = first_stream; while (stream != NULL) { if (!strcmp(stream->filename, filename)) break; stream = stream->next; } if (stream == NULL) { sprintf(msg, "File '%s' not found", url); goto send_error; } c->stream = stream; { char buf1[32], buf2[32], *p; time_t ti; p = inet_ntoa(c->from_addr.sin_addr); strcpy(buf1, p); ti = time(NULL); p = ctime(&ti); strcpy(buf2, p); p = buf2 + strlen(p) - 1; if (*p == '\n') *p = '\0'; http_log("%s - - [%s] \"%s %s %s\" %d %d\n", buf1, buf2, cmd, url, protocol, 200, 1024); } if (post) { if (!stream->is_feed) { sprintf(msg, "POST command not handled"); goto send_error; } if (http_start_receive_data(c) < 0) { sprintf(msg, "could not open feed"); goto send_error; } c->http_error = 0; c->state = HTTPSTATE_RECEIVE_DATA; return 0; } if (c->stream->stream_type == STREAM_TYPE_STATUS) goto send_stats; if (open_input_stream(c, info) < 0) { sprintf(msg, "Input stream corresponding to '%s' not found", url); goto send_error; } q = c->buffer; q += sprintf(q, "HTTP/1.0 200 OK\r\n"); mime_type = c->stream->fmt->mime_type; if (!mime_type) mime_type = "application/x-octet_stream"; q += sprintf(q, "Pragma: no-cache\r\n"); if (!strcmp(c->stream->fmt->name,"asf")) { q += sprintf(q, "Server: Cougar 4.1.0.3923\r\nCache-Control: no-cache\r\nPragma: client-id=1234\r\nPragma: features=\"broadcast\"\r\n"); mime_type = "application/octet-stream"; } q += sprintf(q, "Content-Type: %s\r\n", mime_type); q += sprintf(q, "\r\n"); c->http_error = 0; c->buffer_ptr = c->buffer; c->buffer_end = q; c->state = HTTPSTATE_SEND_HEADER; return 0; send_error: c->http_error = 404; q = c->buffer; q += sprintf(q, "HTTP/1.0 404 Not Found\r\n"); q += sprintf(q, "Content-type: %s\r\n", "text/html"); q += sprintf(q, "\r\n"); q += sprintf(q, "<HTML>\n"); q += sprintf(q, "<HEAD><TITLE>404 Not Found</TITLE></HEAD>\n"); q += sprintf(q, "<BODY>%s</BODY>\n", msg); q += sprintf(q, "</HTML>\n"); c->buffer_ptr = c->buffer; c->buffer_end = q; c->state = HTTPSTATE_SEND_HEADER; return 0; send_stats: compute_stats(c); c->http_error = 200; c->state = HTTPSTATE_SEND_HEADER; return 0; }
1threat
Reading CSV file and splitting it in an array(Java-IntelliJ) : https://hastebin.com/etumuyiduf.java I'm trying to split the excel file(the URL) to a 3 element array and then find the names written in public class CSV to print they corresponding phone numbers of those names. Don't know exactly how to do that. Any advice would be appreciated.
0debug
String objects and storage : <p>How many objects will be created in the following code and where they will be stored?</p> <pre><code>String s = "abc"; // line 1 String s1 = new String("abc"); // line 2 String str1 = new String("efg"); //line 3 </code></pre>
0debug
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags) { AVDictionary *m = *pm; AVDictionaryEntry *tag = av_dict_get(m, key, NULL, flags); char *oldval = NULL, *copy_key = NULL, *copy_value = NULL; if (flags & AV_DICT_DONT_STRDUP_KEY) copy_key = (void *)key; else copy_key = av_strdup(key); if (flags & AV_DICT_DONT_STRDUP_VAL) copy_value = (void *)value; else if (copy_key) copy_value = av_strdup(value); if (!m) m = *pm = av_mallocz(sizeof(*m)); if (!m || (key && !copy_key) || (value && !copy_value)) goto err_out; if (tag) { if (flags & AV_DICT_DONT_OVERWRITE) { av_free(copy_key); av_free(copy_value); return 0; } if (flags & AV_DICT_APPEND) oldval = tag->value; else av_free(tag->value); av_free(tag->key); *tag = m->elems[--m->count]; } else { AVDictionaryEntry *tmp = av_realloc(m->elems, (m->count + 1) * sizeof(*m->elems)); if (!tmp) goto err_out; m->elems = tmp; } if (copy_value) { m->elems[m->count].key = copy_key; m->elems[m->count].value = copy_value; if (oldval && flags & AV_DICT_APPEND) { size_t len = strlen(oldval) + strlen(copy_value) + 1; char *newval = av_mallocz(len); if (!newval) goto err_out; av_strlcat(newval, oldval, len); av_freep(&oldval); av_strlcat(newval, copy_value, len); m->elems[m->count].value = newval; av_freep(&copy_value); } m->count++; } else { av_freep(&copy_key); } if (!m->count) { av_freep(&m->elems); av_freep(pm); } return 0; err_out: if (m && !m->count) { av_freep(&m->elems); av_freep(pm); } av_free(copy_key); av_free(copy_value); return AVERROR(ENOMEM); }
1threat
Derby built in functions : <p>How do I calculate equivalent POWER(base, exponent) function in Apache Derby using SELECT statement? </p>
0debug
I have an ArrayIndexOutOfBoundsExeption error can someone help me fix it please : <p>This error keeps occurring Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 131071</p> <p>I'm trying to create an array of 131071 integers with no duplicates.</p> <pre><code>public class array { public static void main(String[] args) { populateArray(); } public static void populateArray(){ int [] numbers = new int [131071]; int k = 0; Random r = new Random(); for (int i = 0; i &lt; 131070 ; i++) { int random=r.nextInt(13071)+1; for (int h = 0; h &lt;= i; h++) { if (random != numbers[h]) { numbers [k] = random; k=k+1; } } } for (int j = 0; j &lt; 131071; j++) { Arrays.sort(numbers); System.out.println(numbers[j]); } } } </code></pre>
0debug
Error obtaining UI hierarchy Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist : <p>I am testing my app with adb, but i get this error when i execute "dump view hierarchy for uiautomator":</p> <blockquote> <p>Error obtaining UI hierarchy Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!</p> </blockquote> <p>My adb version is 1.0.36 and my android version is 6.0.1.</p> <p>This error comes launched only when in the interface there is a dynamic element that is in motion.</p> <p>thank you in advance.</p>
0debug
int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, void *log_ctx) { char *tail, color_string2[128]; const ColorEntry *entry; int len, hex_offset = 0; if (color_string[0] == '#') { hex_offset = 1; } else if (!strncmp(color_string, "0x", 2)) hex_offset = 2; if (slen < 0) slen = strlen(color_string); av_strlcpy(color_string2, color_string + hex_offset, FFMIN(slen-hex_offset+1, sizeof(color_string2))); if ((tail = strchr(color_string2, ALPHA_SEP))) *tail++ = 0; len = strlen(color_string2); rgba_color[3] = 255; if (!av_strcasecmp(color_string2, "random") || !av_strcasecmp(color_string2, "bikeshed")) { int rgba = av_get_random_seed(); rgba_color[0] = rgba >> 24; rgba_color[1] = rgba >> 16; rgba_color[2] = rgba >> 8; rgba_color[3] = rgba; } else if (hex_offset || strspn(color_string2, "0123456789ABCDEFabcdef") == len) { char *tail; unsigned int rgba = strtoul(color_string2, &tail, 16); if (*tail || (len != 6 && len != 8)) { av_log(log_ctx, AV_LOG_ERROR, "Invalid 0xRRGGBB[AA] color string: '%s'\n", color_string2); return AVERROR(EINVAL); } if (len == 8) { rgba_color[3] = rgba; rgba >>= 8; } rgba_color[0] = rgba >> 16; rgba_color[1] = rgba >> 8; rgba_color[2] = rgba; } else { entry = bsearch(color_string2, color_table, FF_ARRAY_ELEMS(color_table), sizeof(ColorEntry), color_table_compare); if (!entry) { av_log(log_ctx, AV_LOG_ERROR, "Cannot find color '%s'\n", color_string2); return AVERROR(EINVAL); } memcpy(rgba_color, entry->rgb_color, 3); } if (tail) { unsigned long int alpha; const char *alpha_string = tail; if (!strncmp(alpha_string, "0x", 2)) { alpha = strtoul(alpha_string, &tail, 16); } else { alpha = 255 * strtod(alpha_string, &tail); } if (tail == alpha_string || *tail || alpha > 255) { av_log(log_ctx, AV_LOG_ERROR, "Invalid alpha value specifier '%s' in '%s'\n", alpha_string, color_string); return AVERROR(EINVAL); } rgba_color[3] = alpha; } return 0; }
1threat