problem
stringlengths
26
131k
labels
class label
2 classes
Javascript: false && false is false? : <p>So, I've done some searching, looks like it hasn't been asked yet but I could be wrong. </p> <p>Logically</p> <pre><code>false &amp;&amp; false === true false &amp;&amp; true === false true &amp;&amp; false === false true &amp;&amp; true === true </code></pre> <p><strong>HOWEVER</strong></p> <p>It does not seem like this is the case for <code>javascript</code>. I ran the above in the <code>console</code> and this is what I get from FireFox &amp;&amp; Chrome:</p> <pre><code>false &amp;&amp; false //console output: false false &amp;&amp; true //console output: false true &amp;&amp; false //console output: false true &amp;&amp; true //console output: true </code></pre> <p>I've already found a <a href="https://stackoverflow.com/questions/35941501/java-false-false-work-around">solution</a> but seriously? Why? I would think this to be standard behavior.</p> <p>It even says in <a href="https://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html" rel="nofollow noreferrer"><code>Java</code> documentation</a> that <code>logical AND | &amp;&amp;</code>.</p>
0debug
Get Age in Days old in Javascript : <p>I want to know how to calculate the age to display it in "days old".</p> <p>Example Please enter your birthdate dd/mm/yyyy You are XXXX days old</p>
0debug
Finding number of methods used in a java program after selecting the file : <p>Are there any specific methods or functions to calculate the number of methods and not the constructors in java?</p> <p>Very important, please share if you know something.</p>
0debug
Scikit learn linier SVC : i'm using LinearSVC for document classification. for example the simple thing of svm (support vector machine) work is seperate data by Hyperplane, for example data to be class A if a **value** < -1 and B for > 1, my question is how to show that **value** ?
0debug
terraform.tfvars vs variables.tf difference : <p>I've been researching this but can't find the distinction. A variables.tf file can store variable defaults/values, like a terraform.tfvars file.</p> <p>What's the difference between these two and the need for one over the other? My understanding is if you pass in the var file as an argument in terraform via the command line.</p> <p>There is a thread about this already and the only benefit seems to be passing in the tfvars file as an argument, as you can "potentially" do assignment of variables in a variable.tf file.</p> <p>Is this the correct thinking?</p>
0debug
static int net_tap_init(VLANState *vlan, const char *model, const char *name, const char *ifname1, const char *setup_script, const char *down_script) { TAPState *s; int fd; char ifname[128]; if (ifname1 != NULL) pstrcpy(ifname, sizeof(ifname), ifname1); else ifname[0] = '\0'; TFR(fd = tap_open(ifname, sizeof(ifname))); if (fd < 0) return -1; if (!setup_script || !strcmp(setup_script, "no")) setup_script = ""; if (setup_script[0] != '\0') { if (launch_script(setup_script, ifname, fd)) return -1; } s = net_tap_fd_init(vlan, model, name, fd); if (!s) return -1; snprintf(s->vc->info_str, sizeof(s->vc->info_str), "ifname=%s,script=%s,downscript=%s", ifname, setup_script, down_script); if (down_script && strcmp(down_script, "no")) snprintf(s->down_script, sizeof(s->down_script), "%s", down_script); return 0; }
1threat
Android - how to create POS (Point Of Sale) system : <p>I'm trying to make a prototype Android POS System. I know how to code but don't have much knowledge about commerce, trade, transactions or what is the financial flew in restaurants, mobile shops or super markets. this would help creating a robust database and app functions. So, here are some questions..</p> <ol> <li>how could I get some knowledge about trade functions needed to be applied into the POS System?</li> <li>what is needed to jump start and boost developing the system?</li> <li>is there a plugins that I can make use of? and how to use if "yes"?</li> </ol> <p>Your Advice is highly appreciated! </p>
0debug
def sum_range_list(list1, m, n): sum_range = 0 for i in range(m, n+1, 1): sum_range += list1[i] return sum_range
0debug
Validation of a text field in Java : <p>I need to validate a text field in Java so as the user may only fill this field with numbers (no letters, no empty field). </p>
0debug
Command not found: systemctl on Amazon Linux 2018.03 : <p>I am following <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/SSL-on-an-instance.html" rel="noreferrer">this Amazon AWS guide to install SSL certificates</a>. I am running Apache on AWS EC2 using the Amazon Linux AMI 2018.03. The first step in the guide is to run:</p> <pre><code>sudo systemctl is-enabled httpd </code></pre> <p>I get "bash: systemctl: command not found". I suspect maybe I am running Amazon Linux, not Amazon Linux 2.</p>
0debug
Counter Dosn't count up : while True: def update(): global counter global points counter = points counter = 0 points = counter + 1 print(points) First off I am very new to this im wonder my my Simple Counter only prints 1 instead of counting up
0debug
toPromise() says Module not found : <p>Error in ./scr/app/git-search.service.ts</p> <p>Module not found: Error: Can't resolve 'rxjs/add/operator/toPromise' in 'C:\Users\funky\angular-fundamentals\src\app</p>
0debug
int64_t migrate_xbzrle_cache_size(void) { MigrationState *s; s = migrate_get_current(); return s->xbzrle_cache_size; }
1threat
Explanation needed about Parallel Full GC for G1 : <p>As part of the java JDK10 JEP307 was <a href="http://openjdk.java.net/jeps/307" rel="noreferrer">Parallel Full GC for G1</a> realsed.</p> <p>I've tried to grasp its description, but I am still not confident that I got the idea properly.</p> <p>my doubt was is it related to <strong>Concurrent Garbage</strong></p>
0debug
get position of marker in google maps : I am trying to get the current position that mean longitude and latitude of the marker. First a marker becomes created at the users location and when the user click on the map the previous one becomes deleted and a new one becomes created at the users clickpoint. I tried it by my own with `var lat1 = markers.position.lat(); var lng1 = markers.position.lng();` but that havent work and I get with this the error message `Uncaught TypeError: Cannot read property 'lat' of undefined`. How can I get the current position of the marker and save it in a variable? var markers = []; // This event listener will call addMarker() when the map is clicked. map.addListener('click', function(event) { addMarkers(event.latLng); }); //draw a marker at the position of the user addMarkers(pos); // Adds a marker to the map and push to the array. function addMarkers(location) { var marker = new google.maps.Marker({ position: location, map: map }); markers.push(marker); } // Sets the map on all markers in the array. function setMapOnAll(map) { for (var i = 0; i < markers.length; i++) { markers[i].setMap(map); } } // Removes the markers from the map, but keeps them in the array. function clearMarkers() { setMapOnAll(null); } // Deletes all markers in the array by removing references to them. function deleteMarkers() { clearMarkers(); marker = []; }
0debug
static int parse_icy(HTTPContext *s, const char *tag, const char *p) { int len = 4 + strlen(p) + strlen(tag); int is_first = !s->icy_metadata_headers; int ret; if (s->icy_metadata_headers) len += strlen(s->icy_metadata_headers); if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0) return ret; av_strlcatf(s->icy_metadata_headers, len, "%s: %s\n", tag, p); return 0; }
1threat
Is it safe to reinstall Python on El Capitan? : <p>Is it safe to reinstall Python 2.7.10 on El Capitan Mac OS X? I reinstalled my Python 2.7.10, and updated to Python 2.7.11 I reinstalled with command 'brew reinstall python' Thank you</p>
0debug
What is the (kind of) inverse operation to Java's Stream.flatMap()? : <p>The <code>Stream.flatMap()</code> operation transforms a stream of </p> <pre><code>a, b, c </code></pre> <p>into a stream that contains zero or more elements for each input element, e.g. </p> <pre><code>a1, a2, c1, c2, c3 </code></pre> <p>Is there the opposite operations that batches up a few elements into one new one?</p> <ul> <li>It is not .reduce(), because this produces only one result</li> <li>It is not collect(), because this only fills a container (afaiu)</li> <li>It is not forEach(), because this has returns just <code>void</code> and works with side effects</li> </ul> <p>Does it exist? can I simulate it in any way?</p>
0debug
How to write ng repeat for below Json Data ? : My data is coming as below from service. I have tried key, value but its not working. I want to display all Product_Groups using ng-repeat in a dropdown. I am using ng-repeat="value.Product_Group for (key, value) in pgroup track by $index" [My data is coming like this in console][1] [1]: https://i.stack.imgur.com/JH815.png
0debug
How do I use an if statement in monogame that checks if two sprites are overlapping/touching? : I am trying to check for overlapping in VS, monogame. I have no idea for the code. All I know is that it should look like if (?????) { ... } I need help FAST!
0debug
Could not find com.android.tools.build:gradle:2.2.2 : <p>A friend of mine copy pasted a libgdx project folder on his pc and sent the project to me(through google drive). We are both using Android Studio. I downloaded and imported the project and it is working properly on the emulator. However it is not working on the desktop. On his pc, it works both in desktop and in the emulator.</p> <p>When I try to run it in the desktop, Android Studio gives me this error message:</p> <pre><code>Error:Gradle: A problem occurred configuring root project 'bouncerGDX - Copy'. &gt; Could not resolve all dependencies for configuration ':classpath'. &gt; Could not find com.android.tools.build:gradle:2.2.2. Searched in the following locations: https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.2/gradle-2.2.2.pom https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.2/gradle-2.2.2.jar https://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/gradle/2.2.2/gradle-2.2.2.pom https://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/gradle/2.2.2/gradle-2.2.2.jar Required by: :bouncerGDX - Copy:unspecified </code></pre> <p>How can I fix this? I have no experience with Gradle.</p>
0debug
how do i generate a python timestamp to a particular format : <p>in python how would i generate a timestamp to this specific format?</p> <p>2010-03-20T10:33:22-07</p> <p>I've searched high and low but couldn't the correct term that describes generating this specific format</p>
0debug
How can I compile a library with Carthage using the latest beta of Xcode? : <p>I am testing out Swift 3 with Xcode 8 Beta (8S128d), which leads me to a situation where my Carthage-built libraries are not compatible with the source base.</p> <p><code>Module file was created by an older version of the compiler; rebuild 'SwiftValidator' and try again</code>.</p> <p>How can I configure Carthage so that <code>carthage update</code> uses the Beta compiler rathe rthan the standard one?</p>
0debug
sql add sort by : Actually i try to sort my sql but it's not sorting where i need to add SORT BY TSTATUS $sql=" ( SELECT tt.tstatus, tt.ticketnbr, tt.col1, tt.col2, NULL as col3, tt.col4, tt.col5, tt.col6, tt.col7, tt.col8, 'cmg' as tickettype, CASE WHEN cl.parentid IS NOT NULL THEN 1 ELSE 0 END as has_log FROM aradmin.cmg_troubleticket tt LEFT JOIN ARADMIN.TT_CUSTOMERLOGENTRY cl ON ( tt.ticketnbr=cl.parentid AND cl.schema='AR:TroubleTicket' AND cl.status=0 ) WHERE ( tt.TSTATUS < 9 ) {$customer_list} ) UNION ( SELECT tt.tstatus, tt.ticketnbr, tt.col1, tt.col2, tt.col3, tt.col4, tt.col5, tt.col6, tt.col7, tt.col8, 'ar' as tickettype, CASE WHEN cl.parentid IS NOT NULL THEN 1 ELSE 0 END as has_log FROM aradmin.ar_troubleticket tt LEFT JOIN ARADMIN.TT_CUSTOMERLOGENTRY cl ON ( tt.ticketnbr=cl.parentid AND cl.schema='AR:TroubleTicket' AND cl.status=0 ) WHERE ( tt.TSTATUS < 10 ) {$customer_list} ) ";
0debug
What is "EC2-Other" filter in "Cost Explorer" mean? : <p>While investigating AWS Bill using Cost Explorer tool, I selected EC2-Other filter under services and it showed an amount around 5k monthly but I still don’t know what services are costing all this amount. What does EC2-Other include in Cost Explorer?</p>
0debug
How do i loop and make an array like this : I'm getting a data via scrapping , The data source is a table , and i need to get the data for every (tr). the table has 3 (td) which is : title date link so here is the simplyfied code that i use foreach($html->find('#middle table tr td') as $data){ #this will run until no td left } the problem : How can i insert it to an array something like : Array ( [0] => Array ( [title] => "" [date] => "" [link] => "" ) [1] => Array ( [title] => "" [date] => "" [link] => "" ) )
0debug
int ff_h263_decode_mb(MpegEncContext *s, int16_t block[6][64]) { int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant; int16_t *mot_val; const int xy= s->mb_x + s->mb_y * s->mb_stride; int cbpb = 0, pb_mv_count = 0; assert(!s->h263_pred); if (s->pict_type == AV_PICTURE_TYPE_P) { do{ if (get_bits1(&s->gb)) { s->mb_intra = 0; for(i=0;i<6;i++) s->block_last_index[i] = -1; s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->current_picture.mb_type[xy] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; s->mb_skipped = !(s->obmc | s->loop_filter); goto end; } cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2); if (cbpc < 0){ av_log(s->avctx, AV_LOG_ERROR, "cbpc damaged at %d %d\n", s->mb_x, s->mb_y); return -1; } }while(cbpc == 20); s->dsp.clear_blocks(s->block[0]); dquant = cbpc & 8; s->mb_intra = ((cbpc & 4) != 0); if (s->mb_intra) goto intra; if(s->pb_frame && get_bits1(&s->gb)) pb_mv_count = h263_get_modb(&s->gb, s->pb_frame, &cbpb); cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1); if(s->alt_inter_vlc==0 || (cbpc & 3)!=3) cbpy ^= 0xF; cbp = (cbpc & 3) | (cbpy << 2); if (dquant) { h263_decode_dquant(s); } s->mv_dir = MV_DIR_FORWARD; if ((cbpc & 16) == 0) { s->current_picture.mb_type[xy] = MB_TYPE_16x16 | MB_TYPE_L0; s->mv_type = MV_TYPE_16X16; ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y); if (s->umvplus) mx = h263p_decode_umotion(s, pred_x); else mx = ff_h263_decode_motion(s, pred_x, 1); if (mx >= 0xffff) return -1; if (s->umvplus) my = h263p_decode_umotion(s, pred_y); else my = ff_h263_decode_motion(s, pred_y, 1); if (my >= 0xffff) return -1; s->mv[0][0][0] = mx; s->mv[0][0][1] = my; if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1) skip_bits1(&s->gb); } else { s->current_picture.mb_type[xy] = MB_TYPE_8x8 | MB_TYPE_L0; s->mv_type = MV_TYPE_8X8; for(i=0;i<4;i++) { mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y); if (s->umvplus) mx = h263p_decode_umotion(s, pred_x); else mx = ff_h263_decode_motion(s, pred_x, 1); if (mx >= 0xffff) return -1; if (s->umvplus) my = h263p_decode_umotion(s, pred_y); else my = ff_h263_decode_motion(s, pred_y, 1); if (my >= 0xffff) return -1; s->mv[0][i][0] = mx; s->mv[0][i][1] = my; if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1) skip_bits1(&s->gb); mot_val[0] = mx; mot_val[1] = my; } } } else if(s->pict_type==AV_PICTURE_TYPE_B) { int mb_type; const int stride= s->b8_stride; int16_t *mot_val0 = s->current_picture.motion_val[0][2 * (s->mb_x + s->mb_y * stride)]; int16_t *mot_val1 = s->current_picture.motion_val[1][2 * (s->mb_x + s->mb_y * stride)]; mot_val0[0 ]= mot_val0[2 ]= mot_val0[0+2*stride]= mot_val0[2+2*stride]= mot_val0[1 ]= mot_val0[3 ]= mot_val0[1+2*stride]= mot_val0[3+2*stride]= mot_val1[0 ]= mot_val1[2 ]= mot_val1[0+2*stride]= mot_val1[2+2*stride]= mot_val1[1 ]= mot_val1[3 ]= mot_val1[1+2*stride]= mot_val1[3+2*stride]= 0; do{ mb_type= get_vlc2(&s->gb, h263_mbtype_b_vlc.table, H263_MBTYPE_B_VLC_BITS, 2); if (mb_type < 0){ av_log(s->avctx, AV_LOG_ERROR, "b mb_type damaged at %d %d\n", s->mb_x, s->mb_y); return -1; } mb_type= h263_mb_type_b_map[ mb_type ]; }while(!mb_type); s->mb_intra = IS_INTRA(mb_type); if(HAS_CBP(mb_type)){ s->dsp.clear_blocks(s->block[0]); cbpc = get_vlc2(&s->gb, cbpc_b_vlc.table, CBPC_B_VLC_BITS, 1); if(s->mb_intra){ dquant = IS_QUANT(mb_type); goto intra; } cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1); if (cbpy < 0){ av_log(s->avctx, AV_LOG_ERROR, "b cbpy damaged at %d %d\n", s->mb_x, s->mb_y); return -1; } if(s->alt_inter_vlc==0 || (cbpc & 3)!=3) cbpy ^= 0xF; cbp = (cbpc & 3) | (cbpy << 2); }else cbp=0; assert(!s->mb_intra); if(IS_QUANT(mb_type)){ h263_decode_dquant(s); } if(IS_DIRECT(mb_type)){ s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; mb_type |= ff_mpeg4_set_direct_mv(s, 0, 0); }else{ s->mv_dir = 0; s->mv_type= MV_TYPE_16X16; if(USES_LIST(mb_type, 0)){ int16_t *mot_val= ff_h263_pred_motion(s, 0, 0, &mx, &my); s->mv_dir = MV_DIR_FORWARD; mx = ff_h263_decode_motion(s, mx, 1); my = ff_h263_decode_motion(s, my, 1); s->mv[0][0][0] = mx; s->mv[0][0][1] = my; mot_val[0 ]= mot_val[2 ]= mot_val[0+2*stride]= mot_val[2+2*stride]= mx; mot_val[1 ]= mot_val[3 ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my; } if(USES_LIST(mb_type, 1)){ int16_t *mot_val= ff_h263_pred_motion(s, 0, 1, &mx, &my); s->mv_dir |= MV_DIR_BACKWARD; mx = ff_h263_decode_motion(s, mx, 1); my = ff_h263_decode_motion(s, my, 1); s->mv[1][0][0] = mx; s->mv[1][0][1] = my; mot_val[0 ]= mot_val[2 ]= mot_val[0+2*stride]= mot_val[2+2*stride]= mx; mot_val[1 ]= mot_val[3 ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my; } } s->current_picture.mb_type[xy] = mb_type; } else { do{ cbpc = get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2); if (cbpc < 0){ av_log(s->avctx, AV_LOG_ERROR, "I cbpc damaged at %d %d\n", s->mb_x, s->mb_y); return -1; } }while(cbpc == 8); s->dsp.clear_blocks(s->block[0]); dquant = cbpc & 4; s->mb_intra = 1; intra: s->current_picture.mb_type[xy] = MB_TYPE_INTRA; if (s->h263_aic) { s->ac_pred = get_bits1(&s->gb); if(s->ac_pred){ s->current_picture.mb_type[xy] = MB_TYPE_INTRA | MB_TYPE_ACPRED; s->h263_aic_dir = get_bits1(&s->gb); } }else s->ac_pred = 0; if(s->pb_frame && get_bits1(&s->gb)) pb_mv_count = h263_get_modb(&s->gb, s->pb_frame, &cbpb); cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1); if(cbpy<0){ av_log(s->avctx, AV_LOG_ERROR, "I cbpy damaged at %d %d\n", s->mb_x, s->mb_y); return -1; } cbp = (cbpc & 3) | (cbpy << 2); if (dquant) { h263_decode_dquant(s); } pb_mv_count += !!s->pb_frame; } while(pb_mv_count--){ ff_h263_decode_motion(s, 0, 1); ff_h263_decode_motion(s, 0, 1); } for (i = 0; i < 6; i++) { if (h263_decode_block(s, block[i], i, cbp&32) < 0) return -1; cbp+=cbp; } if(s->pb_frame && h263_skip_b_part(s, cbpb) < 0) return -1; if(s->obmc && !s->mb_intra){ if(s->pict_type == AV_PICTURE_TYPE_P && s->mb_x+1<s->mb_width && s->mb_num_left != 1) preview_obmc(s); } end: { int v= show_bits(&s->gb, 16); if (get_bits_left(&s->gb) < 16) { v >>= 16 - get_bits_left(&s->gb); } if(v==0) return SLICE_END; } return SLICE_OK; }
1threat
void avcodec_set_dimensions(AVCodecContext *s, int width, int height){ s->coded_width = width; s->coded_height= height; s->width = width; s->height = height; }
1threat
I map from lists of lists in java, where in elements of first list will be keys of map and rest other lists will be values to those : Suppose this list example `[[a,b,c],[1, ,3],[12,34, ]]` is list of lists. Trying to convert this into map where in map would be like this. a=1,12 b=null,34 c=3,null Please note i have already created above list of list from string of below type NOTE:Learning java > a:b:c|1::3|12:34:| Approach here was to convert this string first to list of lists and then make the first list elements as keys and rest other as values to this keys. if someone can please help me on this?
0debug
PHP: Find highest index of numeric array that has missing elements : <p>Say I have the following array:</p> <pre><code>$n[5] = "hello"; $n[10]= "goodbye";` </code></pre> <p>I would like to find out the highest index of this array. In Javascript, I could do <code>$n.length - 1</code> which would return <code>10</code>. In PHP, though, <code>count($n)</code> returns 2, which is the number of elements in the array.</p> <p>So how to get the highest index of the array?</p>
0debug
Compare strings doesn't work well : Why my comparation doesn't work well? I would expect that return would be True, but it wasn't. "LC08_L1TP_215068_20151114_20170402_01_T1_B1"=="LC08*_B[1-7]"
0debug
Scoped CSS not being applied within the component : <p>I have the following form component:</p> <pre><code>&lt;template&gt; &lt;div&gt; &lt;form&gt; &lt;input placeholder="Recipe Name"&gt; &lt;textarea placeholder="Recipe Description..." rows="10"&gt;&lt;/textarea&gt; &lt;/form&gt; &lt;/div&gt; &lt;/template&gt; &lt;script&gt; export default { name: 'AddRecipeForm' } &lt;/script&gt; &lt;style scoped&gt; form { display: flex; flex-direction: column; } &lt;/style&gt; </code></pre> <p>The <code>&lt;style&gt;</code> uses the <code>scoped</code> attribute.</p> <p>When applied, the CSS <strong>does not</strong> get loaded in. When <code>scoped</code> is removed, it <strong><em>does</em></strong> get applied.</p> <p>However I want to keep it local to the component.</p> <p>Why is the CSS not getting applied when the <code>scoped</code> attribute is present?</p>
0debug
document.location = 'http://evil.com?username=' + user_input;
1threat
install pip3 for conda : <p>Python2.6 was installed by default in my old centos server. Now I want to create a Python3 environment to install python3 specific module by conda </p> <pre><code>conda create -n py3 python=3.5.3 source activate py3 </code></pre> <p>After activate the py3, I try to install hovercraft by <code>pip3 install hovercraft</code>, the shell tells "command not found: pip3". At first I thought pip3 was installed with Python3, but the result was not the case.<br> So I think I can install it manually. The package gzip file was downloaded from <a href="https://pypi.python.org/packages/18/ce/a39cdc0c467098a1c274b6cd3a62115f831340e45731d64bc7cc08fcdfc6/hovercraft-2.3.tar.gz" rel="noreferrer">python package index</a>, and install by <code>conda install --file hovercraft-2.3.tar.gz</code>. But it doesn't work.<br> Now I have two problems:</p> <ol> <li>how to install pip3 for virtual-env create by conda? </li> <li>Is it possible to install python package index downloaded package locally in conda?</li> </ol>
0debug
i want to find the largest Word using 2 dimentional array in java? : package largestvalue; import java.util.*; public class LargestValue { public static void main(String[] args) { String array[][]={{"renas","Mahdy","Rezhwan"}, {"HRashid","Barham","Harem"}, {"zalamek","Mustafa","Sarbast"}}; String Largest=array[0][0]; for (int i=0;i<array.length;i++){ for(int j=0;j<array[i].length;j++){ ** > if(Largest<array[i][j]) **{ [This is the error][1] Largest=array[i][j]+""; } } } System.out.println("The Largest Number int the Array is :"+Largest); } } [1]: http://i.stack.imgur.com/m71Zv.png
0debug
Convert following code (foreach and if) into linq in c# : Convert the below for each to Linq and if possible include the If statement into the Linq also. public class InvalidDataType { public string ViewName { get; set; } public string ControlName { get; set; } public string DataValue { get; set; } } foreach (InvalidDataType invalidField in DataObjectManager.GetInvalidFields()) { if (invalidField.ControlName == "tbMCBNumber") { fieldToRemove = invalidField; break; } } if (fieldToRemove != null) { DataObjectManager.GetInvalidFields().Remove(fieldToRemove); }
0debug
How to configure webpack dev server with react router dom v4? : <p>This is the code of my webpack configuration: </p> <pre><code>const compiler = webpack({ entry: ['whatwg-fetch', path.resolve(__dirname, 'js', 'app.js')], module: { loaders: [ { exclude: /node_modules/, test: /\.js$/, loader: 'babel', }, ], }, output: {filename: 'app.js', path: '/'}, }); const app = new WebpackDevServer(compiler, { contentBase: '/public/', proxy: {'/graphql': `http://localhost:${GRAPHQL_PORT}`}, publicPath: '/js/', stats: {colors: true}, }); app.use('/', express.static(path.resolve(__dirname, 'public'))); </code></pre> <p>Works fine, the app runs on localhost:3000/index.html but when I try to implement React Router dom v4. It doesn't work. This is the code:</p> <pre><code>const About = () =&gt; &lt;div&gt; &lt;h1&gt;About&lt;/h1&gt; &lt;/div&gt; ReactDOM.render( &lt;BrowserRouter&gt; &lt;div&gt; &lt;Route exact path='/' component={App}/&gt; &lt;Route path='/about' component={About}/&gt; &lt;/div&gt; &lt;/BrowserRouter&gt;, mountNode ); </code></pre> <p>This is the result on localhost:3000/ <a href="https://i.stack.imgur.com/SFFGk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/SFFGk.png" alt="build.min.js"></a> And on localhost:3000/about. I get an error: Cannot GET /about . Not what I'm expecting, why would this not render? <h1>About</h1> </p>
0debug
static void truncpasses(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile) { int precno, compno, reslevelno, bandno, cblkno, lev; Jpeg2000CodingStyle *codsty = &s->codsty; for (compno = 0; compno < s->ncomponents; compno++){ Jpeg2000Component *comp = tile->comp + compno; for (reslevelno = 0, lev = codsty->nreslevels-1; reslevelno < codsty->nreslevels; reslevelno++, lev--){ Jpeg2000ResLevel *reslevel = comp->reslevel + reslevelno; for (precno = 0; precno < reslevel->num_precincts_x * reslevel->num_precincts_y; precno++){ for (bandno = 0; bandno < reslevel->nbands ; bandno++){ int bandpos = bandno + (reslevelno > 0); Jpeg2000Band *band = reslevel->band + bandno; Jpeg2000Prec *prec = band->prec + precno; for (cblkno = 0; cblkno < prec->nb_codeblocks_height * prec->nb_codeblocks_width; cblkno++){ Jpeg2000Cblk *cblk = prec->cblk + cblkno; cblk->ninclpasses = getcut(cblk, s->lambda, (int64_t)dwt_norms[codsty->transform == FF_DWT53][bandpos][lev] * (int64_t)band->i_stepsize >> 16); } } } } } }
1threat
How can I disable source maps in production for a vue.js app? : <p>My app is created with the <code>vue cli</code>. I can't find any option to disable source maps in production. The <code>npm build</code> step in my <code>package.json</code> looks like this:</p> <pre><code>"build": "vue-cli-service build", </code></pre> <p>In angular, i can just add <code>--prod</code> to my build step to make it work. Is there any such option for <code>vue.js</code>? Or do I have to change the <code>webpack</code> config (which is hidden by the cli)?</p>
0debug
How to notify an object that an event of another object? Java : <p>I have a Java class, named Main, which instances several classes with name Subscriber. Subscriber obtains data from the internet and when it obtains a new data it stores it in a variable. When a new data is saved I want it to notify Main, or that it detects it. How could I do it?</p> <p>I have thought about using the Observer pattern but in my case I have an observer and many observed</p>
0debug
A simple JavaScript If query. If one "if" is used I don't want the others to be used. If I type 18 the following answers from the other ifs show up : var age = prompt("please enter your age") var letters = /^[A-Za-z]+$/; if (age== 18) { alert("welcome to our website") } if (age > 18) { alert("welcome to our website") } if (age < 18) { alert("you aren't allowed to visit this website") window.close() } if (age= letters){ alert("please enter a valid number") prompt("please enter your age") }
0debug
static void core_prop_set_core_id(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { CPUCore *core = CPU_CORE(obj); Error *local_err = NULL; int64_t value; visit_type_int(v, name, &value, &local_err); if (local_err) { error_propagate(errp, local_err); core->core_id = value;
1threat
TensorFlow: how is dataset.train.next_batch defined? : <p>I am trying to learn TensorFlow and studying the example at: <a href="https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/autoencoder.ipynb" rel="noreferrer">https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/3_NeuralNetworks/autoencoder.ipynb</a></p> <p>I then have some questions in the code below:</p> <pre><code>for epoch in range(training_epochs): # Loop over all batches for i in range(total_batch): batch_xs, batch_ys = mnist.train.next_batch(batch_size) # Run optimization op (backprop) and cost op (to get loss value) _, c = sess.run([optimizer, cost], feed_dict={X: batch_xs}) # Display logs per epoch step if epoch % display_step == 0: print("Epoch:", '%04d' % (epoch+1), "cost=", "{:.9f}".format(c)) </code></pre> <p>Since mnist is just a dataset, what exactly does <code>mnist.train.next_batch</code> mean? How was the <code>dataset.train.next_batch</code> defined?</p> <p>Thanks!</p>
0debug
stop loop after 2nd times word in arraylist : Hello guys i wrote program to add a name to array list but if you wrote 2nd times the same word the loop stop and write You gave the word twice. but i dont know where is problem. can you help me somebody? package recurring.word; import java.util.ArrayList; import java.util.Scanner; public class RecurringWord { public static void main(String[] args) { ArrayList<String> words = new ArrayList<String>(); Scanner reader = new Scanner(System.in); while(true){ System.out.print("Type a word: "); String name = reader.nextLine(); words.add(name); if (words.contains(name)) { break; } System.out.println("You gave the word " + name + "twice"); } } }
0debug
static void net_vhost_user_event(void *opaque, int event) { VhostUserState *s = opaque; switch (event) { case CHR_EVENT_OPENED: vhost_user_start(s); net_vhost_link_down(s, false); error_report("chardev \"%s\" went up", s->chr->label); break; case CHR_EVENT_CLOSED: net_vhost_link_down(s, true); vhost_user_stop(s); error_report("chardev \"%s\" went down", s->chr->label); break; } }
1threat
int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter) { int i, j; int usesVFilter, usesHFilter; int unscaled; SwsFilter dummyFilter= {NULL, NULL, NULL, NULL}; int srcW= c->srcW; int srcH= c->srcH; int dstW= c->dstW; int dstH= c->dstH; int dst_stride = FFALIGN(dstW * sizeof(int16_t)+66, 16); int flags, cpu_flags; enum PixelFormat srcFormat= c->srcFormat; enum PixelFormat dstFormat= c->dstFormat; cpu_flags = av_get_cpu_flags(); flags = c->flags; emms_c(); if (!rgb15to16) sws_rgb2rgb_init(); unscaled = (srcW == dstW && srcH == dstH); handle_jpeg(&srcFormat); handle_jpeg(&dstFormat); if(srcFormat!=c->srcFormat || dstFormat!=c->dstFormat){ av_log(c, AV_LOG_WARNING, "deprecated pixel format used, make sure you did set range correctly\n"); c->srcFormat= srcFormat; c->dstFormat= dstFormat; } if (!sws_isSupportedInput(srcFormat)) { av_log(c, AV_LOG_ERROR, "%s is not supported as input pixel format\n", av_get_pix_fmt_name(srcFormat)); return AVERROR(EINVAL); } if (!sws_isSupportedOutput(dstFormat)) { av_log(c, AV_LOG_ERROR, "%s is not supported as output pixel format\n", av_get_pix_fmt_name(dstFormat)); return AVERROR(EINVAL); } i= flags & ( SWS_POINT |SWS_AREA |SWS_BILINEAR |SWS_FAST_BILINEAR |SWS_BICUBIC |SWS_X |SWS_GAUSS |SWS_LANCZOS |SWS_SINC |SWS_SPLINE |SWS_BICUBLIN); if(!i || (i & (i-1))) { av_log(c, AV_LOG_ERROR, "Exactly one scaler algorithm must be chosen\n"); return AVERROR(EINVAL); } if (srcW<4 || srcH<1 || dstW<8 || dstH<1) { av_log(c, AV_LOG_ERROR, "%dx%d -> %dx%d is invalid scaling dimension\n", srcW, srcH, dstW, dstH); return AVERROR(EINVAL); } if (!dstFilter) dstFilter= &dummyFilter; if (!srcFilter) srcFilter= &dummyFilter; c->lumXInc= ((srcW<<16) + (dstW>>1))/dstW; c->lumYInc= ((srcH<<16) + (dstH>>1))/dstH; c->dstFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[dstFormat]); c->srcFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[srcFormat]); c->vRounder= 4* 0x0001000100010001ULL; usesVFilter = (srcFilter->lumV && srcFilter->lumV->length>1) || (srcFilter->chrV && srcFilter->chrV->length>1) || (dstFilter->lumV && dstFilter->lumV->length>1) || (dstFilter->chrV && dstFilter->chrV->length>1); usesHFilter = (srcFilter->lumH && srcFilter->lumH->length>1) || (srcFilter->chrH && srcFilter->chrH->length>1) || (dstFilter->lumH && dstFilter->lumH->length>1) || (dstFilter->chrH && dstFilter->chrH->length>1); getSubSampleFactors(&c->chrSrcHSubSample, &c->chrSrcVSubSample, srcFormat); getSubSampleFactors(&c->chrDstHSubSample, &c->chrDstVSubSample, dstFormat); if (isAnyRGB(dstFormat) && !(flags&SWS_FULL_CHR_H_INT)) { if (dstW&1) { av_log(c, AV_LOG_DEBUG, "Forcing full internal H chroma due to odd output size\n"); flags |= SWS_FULL_CHR_H_INT; c->flags = flags; } else c->chrDstHSubSample = 1; } c->vChrDrop= (flags&SWS_SRC_V_CHR_DROP_MASK)>>SWS_SRC_V_CHR_DROP_SHIFT; c->chrSrcVSubSample+= c->vChrDrop; if (isAnyRGB(srcFormat) && !(flags&SWS_FULL_CHR_H_INP) && srcFormat!=PIX_FMT_RGB8 && srcFormat!=PIX_FMT_BGR8 && srcFormat!=PIX_FMT_RGB4 && srcFormat!=PIX_FMT_BGR4 && srcFormat!=PIX_FMT_RGB4_BYTE && srcFormat!=PIX_FMT_BGR4_BYTE && ((dstW>>c->chrDstHSubSample) <= (srcW>>1) || (flags&SWS_FAST_BILINEAR))) c->chrSrcHSubSample=1; c->chrSrcW= -((-srcW) >> c->chrSrcHSubSample); c->chrSrcH= -((-srcH) >> c->chrSrcVSubSample); c->chrDstW= -((-dstW) >> c->chrDstHSubSample); c->chrDstH= -((-dstH) >> c->chrDstVSubSample); if (unscaled && !usesHFilter && !usesVFilter && (c->srcRange == c->dstRange || isAnyRGB(dstFormat))) { ff_get_unscaled_swscale(c); if (c->swScale) { if (flags&SWS_PRINT_INFO) av_log(c, AV_LOG_INFO, "using unscaled %s -> %s special converter\n", av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat)); return 0; } } c->srcBpc = 1 + av_pix_fmt_descriptors[srcFormat].comp[0].depth_minus1; if (c->srcBpc < 8) c->srcBpc = 8; c->dstBpc = 1 + av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1; if (c->dstBpc < 8) c->dstBpc = 8; if (isAnyRGB(srcFormat) || srcFormat == PIX_FMT_PAL8) c->srcBpc = 16; if (c->dstBpc == 16) dst_stride <<= 1; FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW*2+78, 16) * 2, fail); if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2 && c->srcBpc == 8 && c->dstBpc <= 10) { c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0; if (!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) { if (flags&SWS_PRINT_INFO) av_log(c, AV_LOG_INFO, "output width is not a multiple of 32 -> no MMX2 scaler\n"); } if (usesHFilter || isNBPS(c->srcFormat) || is16BPS(c->srcFormat) || isAnyRGB(c->srcFormat)) c->canMMX2BeUsed=0; } else c->canMMX2BeUsed=0; c->chrXInc= ((c->chrSrcW<<16) + (c->chrDstW>>1))/c->chrDstW; c->chrYInc= ((c->chrSrcH<<16) + (c->chrDstH>>1))/c->chrDstH; if (flags&SWS_FAST_BILINEAR) { if (c->canMMX2BeUsed) { c->lumXInc+= 20; c->chrXInc+= 20; } else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX && c->dstBpc <= 10) { c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20; c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20; } } { #if HAVE_MMX2 if (c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) { c->lumMmx2FilterCodeSize = initMMX2HScaler( dstW, c->lumXInc, NULL, NULL, NULL, 8); c->chrMmx2FilterCodeSize = initMMX2HScaler(c->chrDstW, c->chrXInc, NULL, NULL, NULL, 4); #ifdef MAP_ANONYMOUS c->lumMmx2FilterCode = mmap(NULL, c->lumMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); c->chrMmx2FilterCode = mmap(NULL, c->chrMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); #elif HAVE_VIRTUALALLOC c->lumMmx2FilterCode = VirtualAlloc(NULL, c->lumMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE); c->chrMmx2FilterCode = VirtualAlloc(NULL, c->chrMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE); #else c->lumMmx2FilterCode = av_malloc(c->lumMmx2FilterCodeSize); c->chrMmx2FilterCode = av_malloc(c->chrMmx2FilterCodeSize); #endif #ifdef MAP_ANONYMOUS if (c->lumMmx2FilterCode == MAP_FAILED || c->chrMmx2FilterCode == MAP_FAILED) #else if (!c->lumMmx2FilterCode || !c->chrMmx2FilterCode) #endif { av_log(c, AV_LOG_ERROR, "Failed to allocate MMX2FilterCode\n"); return AVERROR(ENOMEM); } FF_ALLOCZ_OR_GOTO(c, c->hLumFilter , (dstW /8+8)*sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(c, c->hChrFilter , (c->chrDstW /4+8)*sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(c, c->hLumFilterPos, (dstW /2/8+8)*sizeof(int32_t), fail); FF_ALLOCZ_OR_GOTO(c, c->hChrFilterPos, (c->chrDstW/2/4+8)*sizeof(int32_t), fail); initMMX2HScaler( dstW, c->lumXInc, c->lumMmx2FilterCode, c->hLumFilter, (uint32_t*)c->hLumFilterPos, 8); initMMX2HScaler(c->chrDstW, c->chrXInc, c->chrMmx2FilterCode, c->hChrFilter, (uint32_t*)c->hChrFilterPos, 4); #ifdef MAP_ANONYMOUS mprotect(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize, PROT_EXEC | PROT_READ); mprotect(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize, PROT_EXEC | PROT_READ); #endif } else #endif { const int filterAlign= (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? 4 : (HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) ? 8 : 1; if (initFilter(&c->hLumFilter, &c->hLumFilterPos, &c->hLumFilterSize, c->lumXInc, srcW , dstW, filterAlign, 1<<14, (flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags, cpu_flags, srcFilter->lumH, dstFilter->lumH, c->param) < 0) goto fail; if (initFilter(&c->hChrFilter, &c->hChrFilterPos, &c->hChrFilterSize, c->chrXInc, c->chrSrcW, c->chrDstW, filterAlign, 1<<14, (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags, cpu_flags, srcFilter->chrH, dstFilter->chrH, c->param) < 0) goto fail; } } { const int filterAlign= (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? 2 : (HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) ? 8 : 1; if (initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize, c->lumYInc, srcH , dstH, filterAlign, (1<<12), (flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags, cpu_flags, srcFilter->lumV, dstFilter->lumV, c->param) < 0) goto fail; if (initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc, c->chrSrcH, c->chrDstH, filterAlign, (1<<12), (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags, cpu_flags, srcFilter->chrV, dstFilter->chrV, c->param) < 0) goto fail; #if HAVE_ALTIVEC FF_ALLOC_OR_GOTO(c, c->vYCoeffsBank, sizeof (vector signed short)*c->vLumFilterSize*c->dstH, fail); FF_ALLOC_OR_GOTO(c, c->vCCoeffsBank, sizeof (vector signed short)*c->vChrFilterSize*c->chrDstH, fail); for (i=0;i<c->vLumFilterSize*c->dstH;i++) { int j; short *p = (short *)&c->vYCoeffsBank[i]; for (j=0;j<8;j++) p[j] = c->vLumFilter[i]; } for (i=0;i<c->vChrFilterSize*c->chrDstH;i++) { int j; short *p = (short *)&c->vCCoeffsBank[i]; for (j=0;j<8;j++) p[j] = c->vChrFilter[i]; } #endif } c->vLumBufSize= c->vLumFilterSize; c->vChrBufSize= c->vChrFilterSize; for (i=0; i<dstH; i++) { int chrI= (int64_t)i*c->chrDstH / dstH; int nextSlice= FFMAX(c->vLumFilterPos[i ] + c->vLumFilterSize - 1, ((c->vChrFilterPos[chrI] + c->vChrFilterSize - 1)<<c->chrSrcVSubSample)); nextSlice>>= c->chrSrcVSubSample; nextSlice<<= c->chrSrcVSubSample; if (c->vLumFilterPos[i ] + c->vLumBufSize < nextSlice) c->vLumBufSize= nextSlice - c->vLumFilterPos[i]; if (c->vChrFilterPos[chrI] + c->vChrBufSize < (nextSlice>>c->chrSrcVSubSample)) c->vChrBufSize= (nextSlice>>c->chrSrcVSubSample) - c->vChrFilterPos[chrI]; } FF_ALLOC_OR_GOTO(c, c->lumPixBuf, c->vLumBufSize*2*sizeof(int16_t*), fail); FF_ALLOC_OR_GOTO(c, c->chrUPixBuf, c->vChrBufSize*2*sizeof(int16_t*), fail); FF_ALLOC_OR_GOTO(c, c->chrVPixBuf, c->vChrBufSize*2*sizeof(int16_t*), fail); if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat) && isALPHA(c->dstFormat)) FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf, c->vLumBufSize*2*sizeof(int16_t*), fail); for (i=0; i<c->vLumBufSize; i++) { FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i+c->vLumBufSize], dst_stride+16, fail); c->lumPixBuf[i] = c->lumPixBuf[i+c->vLumBufSize]; } c->uv_off = (dst_stride>>1) + 64 / (c->dstBpc &~ 7); c->uv_offx2 = dst_stride + 16; for (i=0; i<c->vChrBufSize; i++) { FF_ALLOC_OR_GOTO(c, c->chrUPixBuf[i+c->vChrBufSize], dst_stride*2+32, fail); c->chrUPixBuf[i] = c->chrUPixBuf[i+c->vChrBufSize]; c->chrVPixBuf[i] = c->chrVPixBuf[i+c->vChrBufSize] = c->chrUPixBuf[i] + (dst_stride >> 1) + 8; } if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) for (i=0; i<c->vLumBufSize; i++) { FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i+c->vLumBufSize], dst_stride+16, fail); c->alpPixBuf[i] = c->alpPixBuf[i+c->vLumBufSize]; } for (i=0; i<c->vChrBufSize; i++) if(av_pix_fmt_descriptors[c->dstFormat].comp[0].depth_minus1 == 15){ av_assert0(c->dstBpc > 10); for(j=0; j<dst_stride/2+1; j++) ((int32_t*)(c->chrUPixBuf[i]))[j] = 1<<18; } else for(j=0; j<dst_stride+1; j++) ((int16_t*)(c->chrUPixBuf[i]))[j] = 1<<14; assert(c->chrDstH <= dstH); if (flags&SWS_PRINT_INFO) { if (flags&SWS_FAST_BILINEAR) av_log(c, AV_LOG_INFO, "FAST_BILINEAR scaler, "); else if (flags&SWS_BILINEAR) av_log(c, AV_LOG_INFO, "BILINEAR scaler, "); else if (flags&SWS_BICUBIC) av_log(c, AV_LOG_INFO, "BICUBIC scaler, "); else if (flags&SWS_X) av_log(c, AV_LOG_INFO, "Experimental scaler, "); else if (flags&SWS_POINT) av_log(c, AV_LOG_INFO, "Nearest Neighbor / POINT scaler, "); else if (flags&SWS_AREA) av_log(c, AV_LOG_INFO, "Area Averaging scaler, "); else if (flags&SWS_BICUBLIN) av_log(c, AV_LOG_INFO, "luma BICUBIC / chroma BILINEAR scaler, "); else if (flags&SWS_GAUSS) av_log(c, AV_LOG_INFO, "Gaussian scaler, "); else if (flags&SWS_SINC) av_log(c, AV_LOG_INFO, "Sinc scaler, "); else if (flags&SWS_LANCZOS) av_log(c, AV_LOG_INFO, "Lanczos scaler, "); else if (flags&SWS_SPLINE) av_log(c, AV_LOG_INFO, "Bicubic spline scaler, "); else av_log(c, AV_LOG_INFO, "ehh flags invalid?! "); av_log(c, AV_LOG_INFO, "from %s to %s%s ", av_get_pix_fmt_name(srcFormat), #ifdef DITHER1XBPP dstFormat == PIX_FMT_BGR555 || dstFormat == PIX_FMT_BGR565 || dstFormat == PIX_FMT_RGB444BE || dstFormat == PIX_FMT_RGB444LE || dstFormat == PIX_FMT_BGR444BE || dstFormat == PIX_FMT_BGR444LE ? "dithered " : "", #else "", #endif av_get_pix_fmt_name(dstFormat)); if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2) av_log(c, AV_LOG_INFO, "using MMX2\n"); else if (HAVE_AMD3DNOW && cpu_flags & AV_CPU_FLAG_3DNOW) av_log(c, AV_LOG_INFO, "using 3DNOW\n"); else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) av_log(c, AV_LOG_INFO, "using MMX\n"); else if (HAVE_ALTIVEC && cpu_flags & AV_CPU_FLAG_ALTIVEC) av_log(c, AV_LOG_INFO, "using AltiVec\n"); else av_log(c, AV_LOG_INFO, "using C\n"); av_log(c, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", srcW, srcH, dstW, dstH); av_log(c, AV_LOG_DEBUG, "lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n", c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc); av_log(c, AV_LOG_DEBUG, "chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n", c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc); } c->swScale= ff_getSwsFunc(c); return 0; fail: return -1; }
1threat
How to put something on the screen? : <p>I use <strong>Ubuntu Studio 15.10</strong> and I want to learn to program in <strong>C++</strong>.</p> <p>I'm absolutely new into the <strong>C++</strong> programming world.</p> <p>I wrote my first "code", with <strong>gedit</strong>.</p> <p>In simple words, I want to put on the screen some text (like the old Basic: PRINT "Hello!").</p> <p>So, I wrote:</p> <pre><code>#include &lt;iostream&gt; using namespace std; #include &lt;cmath&gt; #include &lt;cstdlib&gt; const double PI = atan(1) * 4; int main() { cout &lt;&lt; "Hello" &lt;&lt; std::endl; cout &lt;&lt; "This is my first code with C++." &lt;&lt; std::endl; cout &lt;&lt; "Let's see what happen." &lt;&lt; std::endl; cout &lt;&lt; "2 * 3 = "; cout &lt;&lt; 2 * 3 &lt;&lt; std::endl; cout &lt;&lt; "Constante pi = "; cout &lt;&lt; PI &lt;&lt; std::endl; cout &lt;&lt; "Seno de 45º = "; cout &lt;&lt; sin((45*PI)/180) &lt;&lt; std::endl; cout &lt;&lt; "Coseno de 30º = "; cout &lt;&lt; cos((30*PI)/180) &lt;&lt; std::endl; cout &lt;&lt; "Tangente de 45º = "; cout &lt;&lt; tan((45*PI)/180) &lt;&lt; std::endl; return 0; } </code></pre> <p>Then, I used <strong>Codelite</strong> to compile it and... I get a lot of files and folders.</p> <p>The supposed executable file is called <strong>main.cc</strong>.</p> <p>BUT... When I ask the system to run that file... Nothing happen!!!</p> <p>I mean, there is not any text into any screen pane, any new window... Nothing, just Nothing!!!</p> <p>What's wrong, here?</p> <p>How can I get to see what I want to see into the screen?</p>
0debug
PYTHON READING DATA FROM INPUT FILE : i want to read specific data fro input file . how can i read. for example my file has data like: this is my first line this is my second line. so i just want to read 'first'from first line and 'secon' fromsecond line. please help me out . thanks
0debug
How to use IPFS from Javascript app without running ipfs node? : <p>I have javascript app (ReactJs) which will run as an android hybrid app on mobile devices. I do not want to run full IPFS node on a mobile device, because it will consume a lot of its memory and energy. How can I connect my app to IPFS then?</p> <p>I saw <a href="https://github.com/ipfs/js-ipfs-api#importing-the-module-and-usage" rel="noreferrer">https://github.com/ipfs/js-ipfs-api#importing-the-module-and-usage</a>, but it does not look usable for a mobile device again as it runs as a separated service.</p> <p>Probably I have to connect to some IPFS node at the internet through IPFS API (<a href="https://ipfs.io/docs/api/" rel="noreferrer">https://ipfs.io/docs/api/</a>), however is there a way to discover running nodes on the runtime and also to choose the fastest/closest one?</p>
0debug
Check if WorkRequest has been previously enquequed by WorkManager Android : <p>I am using PeriodicWorkRequest to perform a task for me every 15 minutes. I would like to check, if this periodic work request has been previously scheduled. If not, schedule it.</p> <pre><code> if (!PreviouslyScheduled) { PeriodicWorkRequest dataupdate = new PeriodicWorkRequest.Builder( DataUpdateWorker.class , 15 , TimeUnit.MINUTES).build(); WorkManager.getInstance().enqueue(dataupdate); } </code></pre> <p>Previously when I was performing task using JobScheduler, I used to use </p> <pre><code>public static boolean isJobServiceScheduled(Context context, int JOB_ID ) { JobScheduler scheduler = (JobScheduler) context.getSystemService( Context.JOB_SCHEDULER_SERVICE ) ; boolean hasBeenScheduled = false ; for ( JobInfo jobInfo : scheduler.getAllPendingJobs() ) { if ( jobInfo.getId() == JOB_ID ) { hasBeenScheduled = true ; break ; } } return hasBeenScheduled ; } </code></pre> <p>Need help constructing a similar module for work request to help find scheduled/active workrequests.</p>
0debug
copy column from table to table with condition : ALTER proc [dbo].[Timesheet_update] as begin declare @sql2 nvarchar(max),@status nvarchar(1) set @sql2='insert into s21022020 (s21_stfno) select m_stfno from master where m_status<>'D'' execute (@sql2) end execute Timesheet_update Msg 207, Level 16, State 1, Line 23 Invalid column name 'D'. m_status column contain data =D
0debug
How to know what's going to compile in this situation? : I have this problem in particular which I don't know why is 30 the answer, int h(int x) { if (x < 1) { return 0; } else { return x + h(x - 1); } } int main() { cout << 2 * h(5); return 0; } 30, is the result, but I don't know why.
0debug
PHP script wont perform query : So I'm having a bit of trouble on this. I'm not sure if this information is important but this script was working at one point, but it kept making multiple records for every submission (It seemed like it was making a submission for every inputted form value) eg. if first name and last name were entered, 2 records would be created. Besides that though, this is the code I'm having trouble with right now: **(connection.php)** <?php $host = "localhost"; $dbusername = "root"; $dbpassword = ""; $dbname = "contacts"; $conn = new mysqli($host, $dbusername, $dbpassword, $dbname); if($conn) { echo "Connection OK!"; } else { die("Connection failed"); } ?> **(index.html)** <?php include ("connection.php"); $fn = isset ($_GET['first_name'])? $_GET['first_name'] : null; $ln = isset ($_GET['last_name'])? $_GET['last_name'] : null; $query = "INSERT INTO contact VALUES ('fn','ln')"; $data = mysqli_query($conn, $query); if($data) { echo "Data inserted!"; } ?> the connection seems to be working just fine because i'm getting a "Connection OK" message, and the variables also seem to change based on the form values... but the query will not work no matter what I do now (I'm trying to fill a table with the above values if that isn't obvious)... I'm using Apollo 2.435 in case there is a plugin issue and you know how I could fix that (That also seems to be working seeing as all of the above code is working within an HTML document) Thanks for your help.
0debug
Calculate distance by longitude and latitude : <p>I have a code for calculate distance by latitude and longitude selected form a database, the executed result returns mistakes, it shows: </p> <p>[53, 190] The left expression is not an arithmetic expression.</p> <p>[193, 256] The right expression is not an arithmetic expression</p> <p>Here is my code:</p> <pre><code>@GET @Path("returnNearbyFriends/{studentid}/{longitude}/{latitude}") @Produces({"application/json"}) public JsonArray returnNearbyFriends(@PathParam("studentid") Integer studentid, @PathParam("longitude") Double longitude, @PathParam("latitude") Double latitude) { TypedQuery q = em.createQuery("select distinct(l.studentid.studentid), l.date, (ACOS(SIN((:latitude * 3.1415) / 180 ) *SIN((l.latitude * 3.1415) / 180 ) +COS((:latitude * 3.1415) / 180 ) * COS((l.latitude) * 3.1415) / 180 ) *COS((:longitude * 3.1415) / 180 - (l.longitude * 3.1415) / 180) * 6380) as Distance " + "from Location l " + "where l.date in (select max(l.date) FROM Location l group by l.studentid) " + "order by l.date;", Location.class); q.setParameter("studentid", studentid); q.setParameter("longitude", longitude); q.setParameter("latitude", latitude); List&lt;Object[]&gt; list = q.getResultList(); JsonArrayBuilder builder = Json.createArrayBuilder(); for (Object[] obj : list){ String sid = (String) obj[0]; String ldate = (String) obj[1]; String distance = (String) obj[2]; JsonObject jsObject = Json.createObjectBuilder() .add("StudentID", sid) .add("LocationDate", ldate) .add("Distance", distance) .build(); builder.add(jsObject); } JsonArray result = builder.build(); return result; } </code></pre> <p>Who can help me to solve the problem?</p>
0debug
Tensorflow Different ways to Export and Run graph in C++ : <p>For importing your trained network to the C++ you need to export your network to be able to do so. After searching a lot and finding almost no information about it, it was clarified that we should use <a href="https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/freeze_graph.py" rel="noreferrer">freeze_graph()</a> to be able to do it.</p> <p>Thanks to the new 0.7 version of Tensorflow, they added <a href="https://www.tensorflow.org/versions/r0.7/api_docs/python/train.html#export_meta_graph" rel="noreferrer">documentation</a> of it. </p> <p>After looking into documentations, I found that there are few similar methods, can you tell what is the difference between <code>freeze_graph()</code> and: <code>tf.train.export_meta_graph</code> as it has similar parameters, but it seems it can also be used for importing models to C++ (I just guess the difference is that for using the file output by this method you can only use <code>import_graph_def()</code> or it's something else?)</p> <p>Also one question about how to use <code>write_graph()</code>: In documentations the <code>graph_def</code> is given by <code>sess.graph_def</code> but in examples in <code>freeze_graph()</code> it is <code>sess.graph.as_graph_def()</code>. What is the difference between these two? </p> <p>This question is related to <a href="https://github.com/tensorflow/tensorflow/issues/615" rel="noreferrer">this issue.</a></p> <p>Thank you!</p>
0debug
static bool tb_invalidate_phys_page(tb_page_addr_t addr, uintptr_t pc) { TranslationBlock *tb; PageDesc *p; int n; #ifdef TARGET_HAS_PRECISE_SMC TranslationBlock *current_tb = NULL; CPUState *cpu = current_cpu; CPUArchState *env = NULL; int current_tb_modified = 0; target_ulong current_pc = 0; target_ulong current_cs_base = 0; uint32_t current_flags = 0; #endif assert_memory_lock(); addr &= TARGET_PAGE_MASK; p = page_find(addr >> TARGET_PAGE_BITS); if (!p) { return false; } tb_lock(); tb = p->first_tb; #ifdef TARGET_HAS_PRECISE_SMC if (tb && pc != 0) { current_tb = tb_find_pc(pc); } if (cpu != NULL) { env = cpu->env_ptr; } #endif while (tb != NULL) { n = (uintptr_t)tb & 3; tb = (TranslationBlock *)((uintptr_t)tb & ~3); #ifdef TARGET_HAS_PRECISE_SMC if (current_tb == tb && (current_tb->cflags & CF_COUNT_MASK) != 1) { current_tb_modified = 1; cpu_restore_state_from_tb(cpu, current_tb, pc); cpu_get_tb_cpu_state(env, &current_pc, &current_cs_base, &current_flags); } #endif tb_phys_invalidate(tb, addr); tb = tb->page_next[n]; } p->first_tb = NULL; #ifdef TARGET_HAS_PRECISE_SMC if (current_tb_modified) { tb_gen_code(cpu, current_pc, current_cs_base, current_flags, 1 | curr_cflags()); return true; } #endif tb_unlock(); return false; }
1threat
Java getInstance() with a Generic class using Singleton pattern : I'm new to Generics and the Singleton pattern in Java. I have the following questions: -Is a Generic class compatible with the Singleton Pattern, namely having a static instance? -If so, I have the following Generic class that I want to convert to a Singleton. What is the best practice? -(Noob question) Is there a good way to de-generify an instance of the class in runtime? passing the class as parameter in getInstance()? class GenFooSingleton <T> { private T t; // Prevent direct instantiation private GenFooSingleton(T o){ this.t = o; } private static GenFooSingleton INSTANCE = null; // Returns the single instance of this class, creating it if necessary static synchronized <T> GenFooSingleton<T> getInstance(T tClass) { if (INSTANCE == null) { INSTANCE = new GenFooSingleton<>(tClass); } return INSTANCE; } } Thank you so much for your time.
0debug
PHP Codeigniter: Convert multidimensional array to single dimensional array : I have a multidimensional array like below Array ( [0] => Array ( [0] => manoj [1] => karthi ) [1] => Array ( [0] => kumar ) ) I want to merge two array like this Array ( [0] => manoj [1] => karthi [2] => kumar )
0debug
What is a concise way to create a 2D slice in Go? : <p>I am learning Go by going through <a href="https://tour.golang.org/list" rel="noreferrer">A Tour of Go</a>. One of the exercises there asks me to create a 2D slice of <code>dy</code> rows and <code>dx</code> columns containing <code>uint8</code>. My current approach, which works, is this: </p> <pre><code>a:= make([][]uint8, dy) // initialize a slice of dy slices for i:=0;i&lt;dy;i++ { a[i] = make([]uint8, dx) // initialize a slice of dx unit8 in each of dy slices } </code></pre> <p>I think that iterating through each slice to initialize it is too verbose. And if the slice had more dimensions, the code would become unwieldy. Is there a concise way to initialize 2D (or n-dimensional) slices in Go? </p>
0debug
how to get the x position of element in javascript : <p>I need to Find the X of div in animation process by transformX, when click on the page. by javascript code without Jquery. (x in pixels). Thanks</p>
0debug
static int get_std_framerate(int i) { if (i < 60 * 12) return i * 1001; else return ((const int[]) { 24, 30, 60, 12, 15 })[i - 60 * 12] * 1000 * 12; }
1threat
what is the difference between import and const and which is preferred in commonjs : <p>I have noticed a bit of switching between using const and import for referencing libraries in node.js applications using es6 syntax with Babel.</p> <p>What is the preferred method and what is the difference between using const and import? Assuming you may be importing the same library in many files/components.</p> <p><strong>const</strong></p> <pre><code>const React = require('react') </code></pre> <p><strong>import</strong></p> <pre><code>import React from 'react' </code></pre> <p>Here are the definitions of each but I am still not sure which to use.</p> <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import">import</a></p> <p>The import statement is used to import functions, objects or primitives that have been exported from an external module, another script, etc.</p> <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const">const</a></p> <p>The const declaration creates a read-only reference to a value. It does not mean the value it holds is immutable, just that the variable identifier cannot be reassigned.</p>
0debug
Using `instanceof` on objects created with constructors from deep npm dependencies : <h2>Background:</h2> <p>I have an npm module that I have common error handling code in, including a custom error:</p> <pre><code>function CustomError () { /* ... */ } CustomError.prototype = Object.create(Error.prototype); CustomError.prototype.constructor = CustomError; module.exports = CustomError; </code></pre> <p>I have some other modules (let's call them <strong>'module-a'</strong> and <strong>'module-b'</strong>) which both depend on the error handling module.</p> <p>I also have some code with uses Bluebirds "filtered catch" functionality:</p> <pre><code>doSomething .catch(CustomError, () =&gt; { /* ... */ }); </code></pre> <h2>The issue:</h2> <p>After some debugging I've discovered (somewhat obviously in hindsight) that errors created in <strong>'module-a'</strong> are not instances of errors created by <strong>'module-b'</strong>. This is because both modules have their own copy of the JS file containing the <code>CustomError</code> constructor, which are both run independently.</p> <p>I would rather not have to resort to my current solution, which is basically:</p> <pre><code>CustomError.isCustomError = e =&gt; e.constructor.toString() === CustomError.toString(); </code></pre> <p>and then:</p> <pre><code>doSomething .then(CustomError.isCustomError, () =&gt; { /* ... */ }); </code></pre> <p>This is clearly flimsy, and will fall apart if the versions fall out of sync.</p> <h2>So...</h2> <p>Is there some way to ensure that <strong>'module-a'</strong> and <strong>'module-b'</strong> both use the same instance of the constructor? Or another, less fragile solution.</p>
0debug
Strange black box appearing in wpf application : <p><a href="https://i.stack.imgur.com/YUiOz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/YUiOz.png" alt="enter image description here"></a></p> <p>Hi!</p> <p>I am new in wpf application development. I just create a demo application and I see that the black box appearing in the top of my application. Can anyone tell me how can I remove this ? </p> <p>I am sorry, I don't even know the name of it.</p>
0debug
Convert two array in one multidimensional : <p>I have two array : </p> <pre><code>a = [a,b,c,d] b = [1,2,3,4] </code></pre> <p>And I would like to convert in this </p> <pre><code>c = [[a,1], [b,2],[c,3],[d,4]] </code></pre> <p>I tried <code>a &lt;&lt; b</code> but this does not work, any idea how to convert this ?</p>
0debug
Mute Check Event Android? : I have a mute switch on my android application, I am now in my code wanting to check for if the switch is checked or unchecked, how would i do this? Thank you.
0debug
static void pty_chr_update_read_handler_locked(CharDriverState *chr) { PtyCharDriver *s = chr->opaque; GPollFD pfd; pfd.fd = g_io_channel_unix_get_fd(s->fd); pfd.events = G_IO_OUT; pfd.revents = 0; g_poll(&pfd, 1, 0); if (pfd.revents & G_IO_HUP) { pty_chr_state(chr, 0); } else { pty_chr_state(chr, 1); } }
1threat
HttpClient keeps receiving bad request : <p>I'm having a hard time resolving my Bad Request responses from a REST api when I'm creating a client using C#. I tested the REST api using Fiddler 2 and executing it there, but when I'm creating the same thing programmatically I get 400 response. Here is my Fiddler composer test:</p> <p>URL:</p> <pre><code>https://&lt;third-party-rest-client&gt;/api/v2/job </code></pre> <p>Here are my Headers</p> <pre><code>User-Agent: Fiddler Content-Type: application/json Accept: application/json icSessionId: PomCSBCVU4VgXCJ5 Content-Length: 123 </code></pre> <p>And here is the body I'm sending a POST request with</p> <pre><code>{ "@type": "job", "taskId":"0000G20G000000000002", "taskName":"TestReplication", "taskType":"DRS", "callbackURL":"" } </code></pre> <p>This POST comes back with a 200 response and a response body, which is perfect, but when I try to simulate the same thing in C# with this code:</p> <pre><code>public JobResponse RunJob(JobRequest jobRequest) { try { client = new HttpClient(); client.BaseAddress = new Uri(loggedUser.serverUrl + "/"); client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.TryAddWithoutValidation("icSessionId", icSessionId); string message = JsonConvert.SerializeObject(jobRequest); message = message.Insert(1, "\"@type\": \"job\","); Console.WriteLine(message); var response = client.PostAsJsonAsync("api/v2/job", message).Result; if (response.IsSuccessStatusCode) { return response.Content.ReadAsAsync&lt;JobResponse&gt;().Result; } else { var result = response.Content.ReadAsStringAsync().Result; Console.WriteLine(result); } } catch (Exception ex) { Console.WriteLine(ex); } return null; } </code></pre> <p>This comes back as a 400. Does anybody have any ideas what's wrong with my code?</p>
0debug
What takes less time to complete, comparing two variables, or assigning a new value to a variable? : <p>Basically what I'm saying is, which operation takes less time to complete? I know the time it takes to complete 1 of these operations is too fast to measure, but I would assume that there would be some way to explain what happens that could explain which one is faster.</p> <p>Also, I would assume that comparing two variables would be more taxing on the CPU and assigning a value would be more RAM taxing. Is that correct?</p>
0debug
How to get only number from text in MIT app Inventor : <p>E.g. "Ganeshkhind, Pune, Maharashtra 411007" from this string I want extract only pincode i.e. 411007</p>
0debug
How do i filter out 'items' that doesn't match search result? : Show items with the same value as the search input, and hide if the value isn't the same. function Search() { var z = document.getElementById('inputSearch').value; if (z == itemTitle) }
0debug
static int swf_write_audio(AVFormatContext *s, AVCodecContext *enc, const uint8_t *buf, int size) { SWFContext *swf = s->priv_data; int c = 0; if ( swf->swf_frame_number >= 16000 ) { return 0; } if (enc->codec_id == CODEC_ID_MP3 ) { for (c=0; c<size; c++) { swf->audio_fifo[(swf->audio_out_pos+c)%AUDIO_FIFO_SIZE] = buf[c]; } swf->audio_size += size; swf->audio_out_pos += size; swf->audio_out_pos %= AUDIO_FIFO_SIZE; } if ( swf->video_type == 0 ) { swf_write_video(s, enc, 0, 0); } return 0; }
1threat
Telegram working with editable data : I was wondering which way is the best to implement the following in telegram bot: some catalog that containts some type of items with descriptions. For example, Types - phones, cars, laptops. Items - in phones: iphone, samsung, LG In cars: BMW, Nissan In laptops: lenovo, MSI, Dell. Each of them has a description. I want a user to navigate through buttons, I already know how to add buttons with pre-written categories, but I want it to make editable not only through IDE but only through some commands in my bot. Overall my bot will perform the following: a user enters and writes /start here he receives three buttons - phones, cars, laptops then, let's imagine, he clicks phones. Now he has iphone, samsung, LG and back button. Then he clicks iphone and now he gets an image with a description. Then clicks samsung and gets another image w/ description, etc. I want all this to be saveable and readable from a file or database so that it was easy for another people to edit in future. Which way should I go? Should I implement some graph? Or just an input.txt files with categories and names? Or should I go harder w/ MySQL database? And how to implement it? Thanks in advance!
0debug
static int mov_write_gmhd_tag(AVIOContext *pb) { avio_wb32(pb, 0x20); ffio_wfourcc(pb, "gmhd"); avio_wb32(pb, 0x18); ffio_wfourcc(pb, "gmin"); avio_wb32(pb, 0); avio_wb16(pb, 0x40); avio_wb16(pb, 0x8000); avio_wb16(pb, 0x8000); avio_wb16(pb, 0x8000); avio_wb16(pb, 0); avio_wb16(pb, 0); return 0x20; }
1threat
Disable animation on notifyItemRangeInserted() : <p>I'm using a RecyclerView. After adding items to the RecyclerView, I need to call:</p> <pre><code>notifyItemRangeInserted(int positionStart, int itemCount); </code></pre> <p>However, this shows a sort of "slide down" animation. Is there a way that I can disable this animation?</p> <p>Thanks.</p>
0debug
static int draw_text(AVFilterContext *ctx, AVFilterBufferRef *picref, int width, int height) { DrawTextContext *dtext = ctx->priv; uint32_t code = 0, prev_code = 0; int x = 0, y = 0, i = 0, ret; int text_height; char *text = dtext->text; uint8_t *p; int str_w = 0, len; int y_min = 32000, y_max = -32000; FT_Vector delta; Glyph *glyph = NULL, *prev_glyph = NULL; Glyph dummy = { 0 }; time_t now = time(0); struct tm ltime; uint8_t *buf = dtext->expanded_text; int buf_size = dtext->expanded_text_size; if(dtext->basetime != AV_NOPTS_VALUE) now= picref->pts*av_q2d(ctx->inputs[0]->time_base) + dtext->basetime/1000000; if (!buf) { buf_size = 2*strlen(dtext->text)+1; buf = av_malloc(buf_size); } #if HAVE_LOCALTIME_R localtime_r(&now, &ltime); #else if(strchr(dtext->text, '%')) ltime= *localtime(&now); #endif do { *buf = 1; if (strftime(buf, buf_size, dtext->text, &ltime) != 0 || *buf == 0) break; buf_size *= 2; } while ((buf = av_realloc(buf, buf_size))); if (!buf) return AVERROR(ENOMEM); text = dtext->expanded_text = buf; dtext->expanded_text_size = buf_size; if ((len = strlen(text)) > dtext->nb_positions) { if (!(dtext->positions = av_realloc(dtext->positions, len*sizeof(*dtext->positions)))) return AVERROR(ENOMEM); dtext->nb_positions = len; } x = dtext->x; y = dtext->y; for (i = 0, p = text; *p; i++) { GET_UTF8(code, *p++, continue;); dummy.code = code; glyph = av_tree_find(dtext->glyphs, &dummy, glyph_cmp, NULL); if (!glyph) load_glyph(ctx, &glyph, code); y_min = FFMIN(glyph->bbox.yMin, y_min); y_max = FFMAX(glyph->bbox.yMax, y_max); } text_height = y_max - y_min; glyph = NULL; for (i = 0, p = text; *p; i++) { GET_UTF8(code, *p++, continue;); if (prev_code == '\r' && code == '\n') continue; prev_code = code; if (is_newline(code)) { str_w = FFMAX(str_w, x - dtext->x); y += text_height; x = dtext->x; continue; } prev_glyph = glyph; dummy.code = code; glyph = av_tree_find(dtext->glyphs, &dummy, glyph_cmp, NULL); if (dtext->use_kerning && prev_glyph && glyph->code) { FT_Get_Kerning(dtext->face, prev_glyph->code, glyph->code, ft_kerning_default, &delta); x += delta.x >> 6; } if (x + glyph->bbox.xMax >= width) { str_w = FFMAX(str_w, x - dtext->x); y += text_height; x = dtext->x; } dtext->positions[i].x = x + glyph->bitmap_left; dtext->positions[i].y = y - glyph->bitmap_top + y_max; if (code == '\t') x = (x / dtext->tabsize + 1)*dtext->tabsize; else x += glyph->advance; } str_w = FFMIN(width - dtext->x - 1, FFMAX(str_w, x - dtext->x)); y = FFMIN(y + text_height, height - 1); if (dtext->draw_box) drawbox(picref, dtext->x, dtext->y, str_w, y-dtext->y, dtext->box_line, dtext->pixel_step, dtext->boxcolor_rgba, dtext->hsub, dtext->vsub, dtext->is_packed_rgb, dtext->rgba_map); if (dtext->shadowx || dtext->shadowy) { if ((ret = draw_glyphs(dtext, picref, width, height, dtext->shadowcolor_rgba, dtext->shadowcolor, dtext->shadowx, dtext->shadowy)) < 0) return ret; } if ((ret = draw_glyphs(dtext, picref, width, height, dtext->fontcolor_rgba, dtext->fontcolor, 0, 0)) < 0) return ret; return 0; }
1threat
How to decompress string in haffman coding : I compressed the "abc" word into "01100111" using haffman coding algorithm . I built the tree . According to tree a=01, b=100 , c=111 . how to decompress this word ?
0debug
static int thread_execute2(AVCodecContext *avctx, action_func2* func2, void *arg, int *ret, int job_count) { ThreadContext *c= avctx->thread_opaque; c->func2 = func2; return thread_execute(avctx, NULL, arg, ret, job_count, 0); }
1threat
System architecture : design considerations. Java vs Django vs RoR : <p>I'd like to designing new web application with few requirements and considering which language/framework I should choose.</p> <p>Requirements: </p> <ul> <li>Web based solution (web UI and backed)</li> <li><p>Fast deployment and setup &lt;- by this I mean just run by single command, no configuration needed for total beginner. Similar to Jenkins</p> <p>java -jar jenkins.war</p> <p>or Gerrit.</p></li> <li>Some kind of que to run tasks asynchronously.</li> <li>No code protection</li> </ul> <p>Due to the fact that I want to be simple to run and deploy (without initial configuration needed) I am considering using <strong>Java EE/Spring</strong> framework. Initially I was considering <strong>Django or RoR</strong> since deploy is pretty easy and development is way faster than Java but those frameworks need some kind of scheduling framework like <strong>Celery + some kind of broker</strong> so additional configuration is needed. I am not limited to any language,(besides PHP since I just do not like it :P)</p> <p>If any of you have any thoughts about my design and want to share let's do it.</p> <p>Thanks a lot for any kind of question/ answers.</p>
0debug
find element and click via 'name attribute' : I have the below html mark-up I am trying to access and click via python... for some reason copying the xpath and doing this is **not** working: self.driver.find_element(By.XPATH, '//*`[@id="isc_8D"]/table/tbody/tr/td/table/tbody/tr/td[2]/img')` It seems the 'name' attribute is the only unique identifier below; how could I find element by name attribute and click in python? i.e. **name="isc_NXicon"** <img src="http://website:8080/DBWEBSITE/ui/sc/skins/Enterprise/images/TabSet/close.png" width="12" height="12" align="absmiddle" style="vertical-align:middle" name="isc_NXicon" eventpart="icon" border="0" suppress="TRUE" draggable="true">
0debug
How do you delete 1st 7 lines of several *.txt files in a folder using python? : <p>I have a folder with nearly 150 *.txt files. I need to delete the 1st seven lines of every .txt file in that folder using python3.5.2 </p>
0debug
Is there a way to tell flow to typecheck every file, not just the ones with /* flow */? : <p>In the official examples they always have <code>/* @flow */</code> at the top of the page. Now that's nice and helpful for an existing project, where I want to opt-in to flow for each file. Building a new project from scratch I would like to just have flow type checking everywhere, without having to type <code>/* @flow */</code> every time. Is it possible?</p>
0debug
connection.query('SELECT * FROM users WHERE username = ' + input_string)
1threat
How the two list traversal output : <pre><code> List&lt;String&gt; list1=new ArrayList&lt;String&gt;(); list1.add("1"); list1.add("2"); list1.add("3"); list1.add("4"); List&lt;String&gt; list2=new ArrayList&lt;String&gt;(); list2.add("5"); list2.add("6"); list2.add("7"); list2.add("8"); </code></pre> <p>//How the two list traversal output 1 5 2 6 3 7 4 8 </p>
0debug
Django Rest Framework How to update SerializerMethodField : <p>I have a serializer like this:</p> <pre><code>class PersonSerializer(serializers.ModelSerializer): gender = serializers.SerializerMethodField() bio = BioSerializer() class Meta: model = Person fields = UserSerializer.Meta.fields + ('gender', 'bio',) def get_gender(self, obj): return obj.get_gender_display() </code></pre> <p>I used this to display "Male" and "Female"(insted of "M" of "F") while performing GET request. </p> <p>This works fine. </p> <p>But now I am writing an patch method for the model and <code>SerializerMethodField()</code> has <code>read_only=True</code>. So I am not getting value passed for gender field in <code>serializer.validated_data()</code>. How to overcome this issue?</p>
0debug
How can I encrypt data so that a web application can read it, but someone with access to the web server cannot? : <p>I am building a system to store survey data where one of the requirements is that if a hacker gets access to the web server, they are not able to view any of the data. But, the web application does need to be able to decrypt the data and display it (for instance an authenticated user might need to see a table containing survey responses in plain text).</p> <p>I am having trouble figuring out how the web server could decrypt data without a hacker also being able to do it. Obviously if the decryption key is stored on the server access to the server also entails access to the decryption key.</p> <p>The only thing I can think of so far is to distribute a decryption key to the users, have them enter it as part of the authentication process, store it in a cookie, and then submit the key with every web request so that it's never stored on the server and instead only in memory for limited periods of time. Obviously this would be served over HTTPS so that the key is also encrypted at transmission time. </p> <p>I have never seen a system that requires a private key as part of the authentication process, so I'm assuming there is a much better way to do this. </p> <p>While this is more of a theoretical question, the application will be written in PHP, likely using the Laravel framework, hosted on an Ubuntu server. </p>
0debug
Python: Printing a set amount of characters : I have a query about python. This is for a project at school, and I'm quite new to coding in python. Basically, I am making a program that prints a set amount of 'X's and spaces, like x x x x x... However, I want the user to choose how many 'X's and spaces they want to print. This is all I've done so far: ```xnum = input("Choose the amount of 'X's you would like to be printed") xnum = xnum.upper() spacenum = input("Choose the amount of spaces you would like to be printed") linenum = input("Choose how many characters you would like to be displayed on one line")``` I want to find out how to make the program print the number of 'X's the user asks for, and same with the spaces. Thank you very much! PS: I already have the code for how many characters per line, I just need some help on printing the set amount of 'X's and spaces.
0debug
How to push Android Project to existing private empty repository in github with Android Studio? : <p>I am trying to push android project to private empty repo with android studio . But I cannot find simple solution. How can I do this ? </p>
0debug
static inline void out_reg(IVState *s, enum Reg reg, unsigned v) { const char *name = reg2str(reg); QTestState *qtest = global_qtest; global_qtest = s->qtest; g_test_message("%x -> *%s\n", v, name); qpci_io_writel(s->dev, s->reg_base + reg, v); global_qtest = qtest; }
1threat
How should I customize DropdownButtons and DropdownMenuItems in Flutter? : <p>The default <a href="https://docs.flutter.io/flutter/material/DropdownButton-class.html" rel="noreferrer">DropdownButton</a> with DropdownMenuItems returns a light-grey dropdown. How should I customize the dropdown (e.g. background color, dropdown width)? I can change the <code>style</code> property in both DropdownButton and DropdownMenuItem, like this:</p> <pre><code>return new DropdownButton( value: ..., items: ..., onChanged: ..., style: new TextStyle( color: Colors.white, ), ); </code></pre> <p>but this doesn't change the dropdown's background color.</p> <p>Should I copy DropdownMenu and extend it? Does Flutter plan to add customization for this widget in the near future?</p>
0debug
from itertools import combinations_with_replacement def combinations_colors(l, n): return list(combinations_with_replacement(l,n))
0debug
I would like to delete all incoming links to specified module with dxl. Something went wrong I got no error but links are not deleted. : Link l Object o for o in document current Module do { for l in all ((o) <- ("/GMH/test4")) do { void delete(Link l) } }
0debug
Java Unable to add a new list item : <p>I am generating a list from the Registery using the code below.</p> <pre><code> List&lt;String&gt; options = Arrays.asList(Advapi32Util.registryGetStringArray(HKEY_LOCAL_MACHINE, key, value) </code></pre> <p>Later on in the code I want to add to this list However the add method is not working.</p> <p>The following code below give me an java.lang.unsupportedOperationException.</p> <pre><code> options.add("Test"); Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException at java.util.AbstractList.add(AbstractList.java:148) at java.util.AbstractList.add(AbstractList.java:108) </code></pre> <p>Any ideas.</p>
0debug
Bootstrap website working well in PC but not in mobile : <p>My webpage is working fine in PC browser, and when I resize the browser, it will turn in to bootstrap icon, but in mobile, it does not working properly. Need help. What is wrong here. I need the mobile view by bootstrap.</p> <pre><code>&lt;link rel="stylesheet" href="user/assets/css/style.css&lt;?php echo "?v= " . date("h:i:sa"); ?&gt;"&gt; &lt;link rel="stylesheet" href="user/assets/css/bootstrap.min.css" type="text/css" /&gt; &lt;link rel="stylesheet" href="user/assets/css/bootstrap-responsive.css" type="text/css" /&gt; &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"&gt;&lt;/script&gt; &lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"&gt; &lt;?php session_start(); ?&gt; &lt;nav class="navbar navbar-inverse"&gt; &lt;div class="container-fluid"&gt; &lt;div class="navbar-header"&gt; &lt;button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar"&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt; &lt;/button&gt; &lt;a class="navbar-brand" href="#"&gt;RedCellBD&lt;/a&gt; &lt;/div&gt; &lt;div class="collapse navbar-collapse" id="myNavbar"&gt; &lt;ul class="nav navbar-nav"&gt; &lt;?php if(!isset($_SESSION['user'])) { echo '&lt;li&gt;&lt;a href="index.php" class="hbut"&gt;&lt;span class="glyphicon glyphicon-home"&gt;&lt;/span&gt; Home&lt;/a&gt;&lt;/li&gt;'; echo '&lt;li&gt;&lt;a href="donar.php" class="hbut"&gt;&lt;span class="glyphicon glyphicon-search"&gt;&lt;/span&gt; Donar&lt;/a&gt;&lt;/li&gt;'; echo '&lt;li&gt;&lt;a href="login.php" class="hbut"&gt;&lt;span class="glyphicon glyphicon-log-in"&gt;&lt;/span&gt; Login&lt;/a&gt;&lt;/li&gt;'; echo '&lt;li&gt;&lt;a href="signup.php" class="hbut"&gt;&lt;span class="glyphicon glyphicon-user"&gt;&lt;/span&gt; Be a Member&lt;/a&gt;&lt;/li&gt;'; echo '&lt;li&gt;&lt;a href="offer.php" class="hbut"&gt;&lt;span class="glyphicon glyphicon-bullhorn"&gt;&lt;/span&gt; Campaign&lt;/a&gt;&lt;/li&gt;'; echo '&lt;li&gt;&lt;a href="faq.php" class="hbut"&gt;&lt;span class="glyphicon glyphicon-question-sign"&gt;&lt;/span&gt; FAQ&lt;/a&gt;&lt;/li&gt;'; } else { echo '&lt;li&gt;&lt;a href="index.php" class="hbut"&gt;&lt;span class="glyphicon glyphicon-home"&gt;&lt;/span&gt; Home&lt;/a&gt;&lt;/li&gt;'; echo '&lt;li&gt;&lt;a href="donar.php" class="hbut"&gt;&lt;span class="glyphicon glyphicon-search"&gt;&lt;/span&gt; Donar&lt;/a&gt;&lt;/li&gt;'; echo '&lt;li&gt;&lt;a href="home.php" class="hbut"&gt;&lt;span class="glyphicon glyphicon-user"&gt;&lt;/span&gt; Profile&lt;/a&gt;&lt;/li&gt;'; echo '&lt;li&gt;&lt;a href="logout.php?logout" class="hbut"&gt;&lt;span class="glyphicon glyphicon-log-out"&gt;&lt;/span&gt;Logout&lt;/a&gt;&lt;/li&gt;'; echo '&lt;li&gt;&lt;a href="offer.php" class="hbut"&gt;&lt;span class="glyphicon glyphicon-bullhorn"&gt;&lt;/span&gt; Campaign&lt;/a&gt;&lt;/li&gt;'; echo '&lt;li&gt;&lt;a href="faq.php" class="hbut"&gt;&lt;span class="glyphicon glyphicon-question-sign"&gt;&lt;/span&gt; FAQ&lt;/a&gt;&lt;/li&gt;'; } ?&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/nav&gt; </code></pre>
0debug
how reduce memory project console application c# : This is program memory 36.50 MB but I want be less than 32 MB ............................................................................................................................................................... public static void CreateText(string text) { if (Convert.ToInt32(text.Length) <= 80) { int n; string str = ""; string count = ""; char[] mas = text.ToCharArray(); for (int i = 0; i < Convert.ToInt32(mas.Length); i++) { if (int.TryParse(mas[i].ToString(), out n)) { count += mas[i].ToString(); } else { if (String.IsNullOrEmpty(count)) { str += mas[i].ToString(); } else { for (int j = 0; j < Convert.ToInt32(count); j++) { str += mas[i].ToString(); } count = ""; } } } Console.WriteLine(str); } else { Console.WriteLine("Error"); } } } }
0debug
int load_image_targphys(const char *filename, target_phys_addr_t addr, uint64_t max_sz) { int size; size = get_image_size(filename); if (size > max_sz) { return -1; } if (size > 0) { rom_add_file_fixed(filename, addr, -1); } return size; }
1threat
What affects the time for a function to return to the caller. : <p>I measure the run time of two algorithms. </p> <p>my main() function calls two algorithms and measures the time respectively. </p> <p>Assume A() and B() are the names for the algorithms. </p> <p>what I did was like (please ignore details here)</p> <pre><code>begin = A(); end = cout &lt;&lt; "time A : " &lt;&lt; end-begin &lt;&lt; endl; begin = B(); end = cout &lt;&lt; "time B : " &lt;&lt; end-begin &lt;&lt; endl; </code></pre> <p>and I also measure the time inside of each function. for example, </p> <pre><code>A() { begin = ..... end = cout &lt;&lt; "time inside A : " &lt;&lt; end - begin &lt;&lt; endl; return ..; } B() { begin = ..... end = cout &lt;&lt; "time inside B : " &lt;&lt; end - begin &lt;&lt; endl; return ..; } </code></pre> <p>It seems the time measuring in main() function and inside of A() function has very little difference. (like 150 milliseconds) but for the B(), it has more than 1500 milliseconds difference. </p> <p>So, I would like to know what can affect this big difference between two functions call.</p>
0debug
void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst, const int dst_pitch, const int num_bands) { int x, y, indx; int32_t p0, p1, p2, p3, tmp0, tmp1, tmp2; int32_t b0_1, b0_2, b1_1, b1_2, b1_3, b2_1, b2_2, b2_3, b2_4, b2_5, b2_6; int32_t b3_1, b3_2, b3_3, b3_4, b3_5, b3_6, b3_7, b3_8, b3_9; int32_t pitch, back_pitch; const IDWTELEM *b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr; pitch = plane->bands[0].pitch; back_pitch = 0; b0_ptr = plane->bands[0].buf; b1_ptr = plane->bands[1].buf; b2_ptr = plane->bands[2].buf; b3_ptr = plane->bands[3].buf; for (y = 0; y < plane->height; y += 2) { if (y+2 >= plane->height) pitch= 0; if (num_bands > 0) { b0_1 = b0_ptr[0]; b0_2 = b0_ptr[pitch]; } if (num_bands > 1) { b1_1 = b1_ptr[back_pitch]; b1_2 = b1_ptr[0]; b1_3 = b1_1 - b1_2*6 + b1_ptr[pitch]; } if (num_bands > 2) { b2_2 = b2_ptr[0]; b2_3 = b2_2; b2_5 = b2_ptr[pitch]; b2_6 = b2_5; } if (num_bands > 3) { b3_2 = b3_ptr[back_pitch]; b3_3 = b3_2; b3_5 = b3_ptr[0]; b3_6 = b3_5; b3_8 = b3_2 - b3_5*6 + b3_ptr[pitch]; b3_9 = b3_8; } for (x = 0, indx = 0; x < plane->width; x+=2, indx++) { b2_1 = b2_2; b2_2 = b2_3; b2_4 = b2_5; b2_5 = b2_6; = b2[x+1,y+1] b3_1 = b3_2; b3_2 = b3_3; = b3[x+1,y-1] b3_4 = b3_5; b3_5 = b3_6; = b3[x+1,y ] b3_7 = b3_8; b3_8 = b3_9; p0 = p1 = p2 = p3 = 0; if (num_bands > 0) { tmp0 = b0_1; tmp2 = b0_2; b0_1 = b0_ptr[indx+1]; b0_2 = b0_ptr[pitch+indx+1]; tmp1 = tmp0 + b0_1; p0 = tmp0 << 4; p1 = tmp1 << 3; p2 = (tmp0 + tmp2) << 3; p3 = (tmp1 + tmp2 + b0_2) << 2; } if (num_bands > 1) { tmp0 = b1_2; tmp1 = b1_1; b1_2 = b1_ptr[indx+1]; b1_1 = b1_ptr[back_pitch+indx+1]; tmp2 = tmp1 - tmp0*6 + b1_3; b1_3 = b1_1 - b1_2*6 + b1_ptr[pitch+indx+1]; p0 += (tmp0 + tmp1) << 3; p1 += (tmp0 + tmp1 + b1_1 + b1_2) << 2; p2 += tmp2 << 2; p3 += (tmp2 + b1_3) << 1; } if (num_bands > 2) { b2_3 = b2_ptr[indx+1]; b2_6 = b2_ptr[pitch+indx+1]; tmp0 = b2_1 + b2_2; tmp1 = b2_1 - b2_2*6 + b2_3; p0 += tmp0 << 3; p1 += tmp1 << 2; p2 += (tmp0 + b2_4 + b2_5) << 2; p3 += (tmp1 + b2_4 - b2_5*6 + b2_6) << 1; } if (num_bands > 3) { b3_6 = b3_ptr[indx+1]; b3_3 = b3_ptr[back_pitch+indx+1]; tmp0 = b3_1 + b3_4; tmp1 = b3_2 + b3_5; tmp2 = b3_3 + b3_6; b3_9 = b3_3 - b3_6*6 + b3_ptr[pitch+indx+1]; p0 += (tmp0 + tmp1) << 2; p1 += (tmp0 - tmp1*6 + tmp2) << 1; p2 += (b3_7 + b3_8) << 1; p3 += b3_7 - b3_8*6 + b3_9; } dst[x] = av_clip_uint8((p0 >> 6) + 128); dst[x+1] = av_clip_uint8((p1 >> 6) + 128); dst[dst_pitch+x] = av_clip_uint8((p2 >> 6) + 128); dst[dst_pitch+x+1] = av_clip_uint8((p3 >> 6) + 128); } dst += dst_pitch << 1; back_pitch = -pitch; b0_ptr += pitch; b1_ptr += pitch; b2_ptr += pitch; b3_ptr += pitch; } }
1threat
static bool main_loop_should_exit(void) { RunState r; ShutdownCause request; if (qemu_debug_requested()) { vm_stop(RUN_STATE_DEBUG); } if (qemu_suspend_requested()) { qemu_system_suspend(); } request = qemu_shutdown_requested(); if (request) { qemu_kill_report(); qapi_event_send_shutdown(&error_abort); if (no_shutdown) { vm_stop(RUN_STATE_SHUTDOWN); } else { return true; } } request = qemu_reset_requested(); if (request) { pause_all_vcpus(); qemu_system_reset(request); resume_all_vcpus(); if (!runstate_check(RUN_STATE_RUNNING) && !runstate_check(RUN_STATE_INMIGRATE)) { runstate_set(RUN_STATE_PRELAUNCH); } } if (qemu_wakeup_requested()) { pause_all_vcpus(); qemu_system_reset(SHUTDOWN_CAUSE_NONE); notifier_list_notify(&wakeup_notifiers, &wakeup_reason); wakeup_reason = QEMU_WAKEUP_REASON_NONE; resume_all_vcpus(); qapi_event_send_wakeup(&error_abort); } if (qemu_powerdown_requested()) { qemu_system_powerdown(); } if (qemu_vmstop_requested(&r)) { vm_stop(r); } return false; }
1threat
I want to identify the public ip of the terraform execution environment and add it to the security group : <p>I want to identify the public IP of the terraform execution environment and add it to aws security group inbound to prevent access from other environments.</p> <p>Currently, I am manually editing the values in the variables.tf file.</p> <p>variables.tf</p> <pre><code>variable public_ip_address { default = "xx" } </code></pre> <p>I would like to execute the "curl ifconfig.co" command on the local host and automatically set the security group based on the result</p> <p>Is there a way to do such things?</p> <p>I could do it by putting the result of local-exec in some variable but I don't know how to do it.</p> <p>Thank you for reading my question.</p>
0debug