problem
stringlengths
26
131k
labels
class label
2 classes
void kvm_set_phys_mem(target_phys_addr_t start_addr, ram_addr_t size, ram_addr_t phys_offset) { KVMState *s = kvm_state; ram_addr_t flags = phys_offset & ~TARGET_PAGE_MASK; KVMSlot *mem; phys_offset &= ~IO_MEM_ROM; mem = kvm_lookup_slot(s, start_addr); if (mem) { if (flags == IO_MEM_UNASSIGNED) { mem->memory_size = 0; mem->guest_phys_addr = start_addr; mem->userspace_addr = 0; mem->flags = 0; kvm_vm_ioctl(s, KVM_SET_USER_MEMORY_REGION, mem); } else if (start_addr >= mem->guest_phys_addr && (start_addr + size) <= (mem->guest_phys_addr + mem->memory_size)) return; } if (flags >= IO_MEM_UNASSIGNED) return; mem = kvm_alloc_slot(s); mem->memory_size = size; mem->guest_phys_addr = start_addr; mem->userspace_addr = (unsigned long)(phys_ram_base + phys_offset); mem->flags = 0; kvm_vm_ioctl(s, KVM_SET_USER_MEMORY_REGION, mem); }
1threat
php mysql query returns empty set, but phpmyadmin returns result : I have set up a query as such: $query = 'SELECT SGC.sys_id, TBL.semester, SGC.bonus, SGC.exam, SGC.ca FROM SubjectGradeComponent AS SGC, '; $query .= '(SELECT `sys_id`, `semester` FROM AcademicYearTerm AS AYT, SubjectYearTermLevel AS SYTL WHERE academic_year = "' . $academic_year . '" AND SYTL.subject_id = ' . $subject_id . ' AND SYTL.form_level = ' . $form_level. ' AND SYTL.yearTerm_id = AYT.yearTerm_id) AS TBL '; $query .= 'WHERE SGC.sys_id = TBL.sys_id;'; However when I run the query, `$mysql->query($query);`it returns an empty result with 0 rows. Running the same query on phpmyadmin shows the desired result. I have looked around but do not understand the problem. `$mysql->error` does not show any error message either
0debug
lab11b - how do i call a class into another class? : i do not get how to put the Card class into the Deck. please help me. this is very urgent-i need to turn this in by tomorrow.. (also, could you please explain what you did? thank you very much!!) Here are the instructions: You need to rewrite the constructor so that all 52 cards of a normal card deck are assigned to the cards array. Keep in mind that card information needs to be stored inside the Deck class and is not passed by parameter. Additionally, you need to re-define the toString method for the Deck class so that it can be used to display the attribute values in a convenient manner. Make sure to take advantage of the toString method that already exists in the Card class. You also need to add a shuffle method, which is called from the constructor. The shuffle method is a private helper method in the Deck class. For this version you need to shuffle the deck by swapping the cards. Generate two random numbers in the [0..51] number range that will represent the indexes of the cards array and swap the cards. Make 1000 swaps and then display the cards. Use Math.random to generate random numbers. public class Lab11bvst { public static void main(String[] args) { Deck deck = new Deck(); System.out.println(deck); } } class Deck { private Card[] cards; private int size; private String[ ] suits = {"Clubs","Diamonds","Hearts","Spades"}; public Deck() { size = 52; cards = new Card[size]; } private shuffle(){ } } the Card class: public class Card { private String suit; private String rank; private int value; public Card(String s, String r, int v) { suit = s; rank = r; value = v; } public String getSuit() { return suit; } public String getRank() { return rank; } public int getValue() { return value; } public void setSuit(String s) { suit = s; } public void setRank(String r) { rank = r; } public void setValue(int v) { value = v; } public String toString() { return "[" + suit + ", " + rank + ", " + value + "]"; } public boolean matches(Card otherCard) { return otherCard.getSuit().equals(this.suit) && otherCard.getRank().equals(this.rank) && otherCard.getValue() == this.value; } }
0debug
How can I resolve in Linux with printf this issue? : <p>I need to make a table in Shell. So, I thought that firstly I search the longest string, after that I will format, that every column to have that length. My issue is that I can't insert in printf a variable. Here is my code:</p> <pre><code>while read line do printf "%-$longestfile s" $line done &lt; fajlok.txt </code></pre>
0debug
java unable to compare a string with array javascript : I have try different solutions and am unable to figure out why I can't compare a string with array string is beyond my belief here is what I have tried function checkWin(){ let emptyword =["h,","e,","l,","l","o"] let computerword= "hello"; var a = emptyword.join(""); let b = computerword.toString(); let c = a.toString(); console.log("computerword :" + b); console.log("emptyword is:" + c ); if(b === c) { console.log("someone has won"); } else if ( b != c) { console.log("b is not same as c"); } } I am unable to get to "someone has won" as the condition is never true however when printing the values out in console mode both are the same values ie hello and hello any support is most welcome
0debug
Restricting Firebase API Keys : <p>I've been toying around with Firebase, and after reading the documentation (and other SO questions), I'm still confused on some of the API keys. I'm using Firebase for Analytics, Crashlytics, and Performance. But also have it linked to Google Play and AdMob. </p> <p>When I set it up for the first time, 3 API keys were created in the developer console.</p> <ol> <li>Browser key (auto created by Google Service)</li> <li>Android key (auto created by Google Service)</li> <li>Server key (auto created by Google Service)</li> </ol> <p>I tried reading through the documentation to find where it is described how these keys are used, but I wasn't able to find it. From looking around the Firebase application, it looks like the <code>Android Key</code> is used as the <code>Web API Key</code>, and the <code>Server Key</code> is used as the <code>Cloud Message Legacy Server Key</code> (Although, I don't use Cloud Messaging). I'm not sure how Firebase is using the <code>Browser Key</code>.</p> <p><strong>What I'm trying to do is restrict these keys as much as possible to prevent any malicious use of them.</strong></p> <p>I added the following API restrictions</p> <ol> <li>Android Key <ul> <li>Firebase Services API</li> </ul></li> <li>Server Key <ul> <li>Firebase Cloud Messaging API</li> </ul></li> <li>Browser Key <ul> <li>Firebase Services API</li> </ul></li> </ol> <p>I'm not entirely sure if these restrictions are correct for what I am using them for, but it worked for the <code>Android Key</code> and the <code>Server Key</code>, at least as far as I can tell. However, the <code>Browser Key</code> restrictions appear to not work as Firebase is creating a new <code>Browser Key</code> when I redeploy my application.</p> <p>To sum up my question, I can see that Firebase is auto creating API keys for me, but I cannot find any documentation that talks about how these keys are used for the basic features of Firebase that I'm using. I'm also not entirely sure how I can restrict these keys, especially the <code>Browser Key</code>.</p>
0debug
Take snapshot from webcam and save it in variable by C# & Emgu CV : <p>Hello How can I take a snapshot from the Webcam and save it in a variable by using C# and Emgu CV</p>
0debug
how to delete installed library form react native project : <p>I have installed a third party library in my project but it is not working , so I want to delete that library from my project , How can I do that ?</p>
0debug
ASP.Net Core 2 ServiceProviderOptions.ValidateScopes Property : <p>What is <strong>ServiceProviderOptions.ValidateScopes</strong> exactly? I feel I couldn't understand completely what it does under the hood. I've come across this with a tutorial, but no explanation.</p>
0debug
segmantaion fault occurs in c program : I'm solving a problem in hacker rank, when I'm running the following code in my local system it's not showing any error but when i submit it's showing segmentation fault. it accepted the first test case but remaining test cases it is showing segmentation fault. #include<stdio.h> #include<stdlib.h> int main(void) { int n,q,i,j; scanf("%d %d",&n,&q); int k,l,m,seq,lastAns=0; int **arr; arr=(int **) malloc(sizeof(int )*n); if(!arr) return 0; arr[0] = (int *) malloc(sizeof(int )*q*n); for(i = 0; i < n; i++) arr[i] = *arr + i*q ; if(!*arr) return 0; for(i = 0; i < q ; i++) { scanf("%d%d%d",&k,&l,&m); switch (k) { case 1: seq= (l^lastAns)%n; for(j = 0 ; j < q; j++) { if(!arr[seq][j]) { arr[seq][j]=m; break; } } break; case 2: seq= (l^lastAns)%n; lastAns = arr[seq][m % n]; printf("%d\n", lastAns); break; } } free(arr[0]); free(arr); return 0; } thanks in advance.
0debug
I want to compare the rows in table and find mismatches in SQL server 2008 : [enter image description here][1] [1]: http://i.stack.imgur.com/SnhyU.png I want the query which can pull last three rows with all columns and with another column which specifies type of mismatch i.e. accounting, currency..etc. can any one help me with this?
0debug
static void dchip_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { }
1threat
how to write xpath for web element on eBay web page having exactly same tags and attibutes : I am trying to write xapath for electronics link on eBay page but there seems to be two links with exactly same tags and attributes <a class="rt" _sp="p2057337.m1381.l3250" href="http://www.ebay.com/rpp/electronics">Electronics</a> I am using this xpath **//a[Text()='Electronics'] this path is giving me 2 nodes and i am not sure what else to use plzz help kindly refer to image attached for reference [electronics link][1] [electronics link][2] [1]: http://i.stack.imgur.com/0UGKM.png [2]: http://i.stack.imgur.com/URP6k.png
0debug
Type error while deviding in Haskell : <p>I am trying to write a function in Haskell to devide to Integers. Here is my Code:</p> <pre><code>div :: Int -&gt; Int -&gt; Double div a b =a/b </code></pre> <p>However, when I try to complie it i always get the error:</p> <pre><code>baby.hs:20:10: Couldn't match expected type ‘Double’ with actual type ‘Int’ In the first argument of ‘(/)’, namely ‘a’ In the expression: a / b baby.hs:20:12: Couldn't match expected type ‘Double’ with actual type ‘Int’ In the second argument of ‘(/)’, namely ‘b’ In the expression: a / b Failed, modules loaded: none. </code></pre>
0debug
static int mov_seek_stream(AVStream *st, int64_t timestamp, int flags) { MOVStreamContext *sc = st->priv_data; int sample, time_sample; int i; sample = av_index_search_timestamp(st, timestamp, flags); dprintf(st->codec, "stream %d, timestamp %"PRId64", sample %d\n", st->index, timestamp, sample); if (sample < 0) return -1; sc->current_sample = sample; dprintf(st->codec, "stream %d, found sample %d\n", st->index, sc->current_sample); if (sc->ctts_data) { time_sample = 0; for (i = 0; i < sc->ctts_count; i++) { time_sample += sc->ctts_data[i].count; if (time_sample >= sc->current_sample) { sc->sample_to_ctime_index = i; sc->sample_to_ctime_sample = time_sample - sc->current_sample; break; } } } return sample; }
1threat
static void gen_rev16(TCGv var) { TCGv tmp = new_tmp(); tcg_gen_shri_i32(tmp, var, 8); tcg_gen_andi_i32(tmp, tmp, 0x00ff00ff); tcg_gen_shli_i32(var, var, 8); tcg_gen_andi_i32(var, var, 0xff00ff00); tcg_gen_or_i32(var, var, tmp); dead_tmp(tmp); }
1threat
How to locate the data column instead of character position in Perl and Bash? : I have research data shown below FRAM_# 20000000 5000000(fs) CN= 1 PRMRYTGT 16652 O 16654 H 1.036 8140 CA 2.586 7319 AL 1.963 Where, there are O,H,CA,and AL atoms. The first atom is target atom oxygen, and the rest of them are neighbors which bond with the target oxygen. Except for the first atom (oxygen), the integer number before each atom is the atom ID, and the float number after it is the bond length with the first atom O(ID=16652). $line="FRAM_# 20000000 5000000(fs) CN= 1 PRMRYTGT 16652 O 16654 H 1.036 8140 CA 2.586 7319 AL 1.963"; @values=split(/\s+/,$line); I can use loop to search the position of H in the array @values. However, is there any other way (not loop), like regex or BASH scripts, to get the position of H in the array? I highly appreciate it if you could provide me extra suggestion and help. NOTE: I have data lines more than 1 million, thus, I have to consider the code efficiency. H is my target atom in this example. In the data lines, the amount of H may be various.
0debug
Momento design patern with composite patern : I have a rectangle class that extend a form class, I have a composite class that extend form class, I have a momento class to do a roll back on x and y atrribut of the form. I have a canvas and I am drawing some shapes on it. by moving one shape it's ok I can undo that move by installing the momento. The problem is when I group shapes in a composit object of forms, and I move them, I can't find the way to roll back the move action by installing a momento. Does anyone know how to do that?
0debug
Why is the intel x86 emulator accelerator (HAXM installer) is showing not compatible with windows? : <p>Why is the intel x86 emulator accelerator (HAXM installer) is showing not compatible with windows. I have windows 10 ,64 bit.</p> <p><a href="https://i.stack.imgur.com/KbquN.png"><img src="https://i.stack.imgur.com/KbquN.png" alt="enter image description here"></a></p>
0debug
Working with batch files might need some help (; : <p>I made a simple batch script for tech support scam baiting but i want it too run it when a scammer runs dir /s or tree /s how would i do this?</p>
0debug
static int kvm_put_xsave(X86CPU *cpu) { CPUX86State *env = &cpu->env; struct kvm_xsave* xsave = env->kvm_xsave_buf; uint16_t cwd, swd, twd; int i, r; if (!kvm_has_xsave()) { return kvm_put_fpu(cpu); } memset(xsave, 0, sizeof(struct kvm_xsave)); twd = 0; swd = env->fpus & ~(7 << 11); swd |= (env->fpstt & 7) << 11; cwd = env->fpuc; for (i = 0; i < 8; ++i) { twd |= (!env->fptags[i]) << i; } xsave->region[XSAVE_FCW_FSW] = (uint32_t)(swd << 16) + cwd; xsave->region[XSAVE_FTW_FOP] = (uint32_t)(env->fpop << 16) + twd; memcpy(&xsave->region[XSAVE_CWD_RIP], &env->fpip, sizeof(env->fpip)); memcpy(&xsave->region[XSAVE_CWD_RDP], &env->fpdp, sizeof(env->fpdp)); memcpy(&xsave->region[XSAVE_ST_SPACE], env->fpregs, sizeof env->fpregs); memcpy(&xsave->region[XSAVE_XMM_SPACE], env->xmm_regs, sizeof env->xmm_regs); xsave->region[XSAVE_MXCSR] = env->mxcsr; *(uint64_t *)&xsave->region[XSAVE_XSTATE_BV] = env->xstate_bv; memcpy(&xsave->region[XSAVE_YMMH_SPACE], env->ymmh_regs, sizeof env->ymmh_regs); memcpy(&xsave->region[XSAVE_BNDREGS], env->bnd_regs, sizeof env->bnd_regs); memcpy(&xsave->region[XSAVE_BNDCSR], &env->bndcs_regs, sizeof(env->bndcs_regs)); memcpy(&xsave->region[XSAVE_OPMASK], env->opmask_regs, sizeof env->opmask_regs); memcpy(&xsave->region[XSAVE_ZMM_Hi256], env->zmmh_regs, sizeof env->zmmh_regs); #ifdef TARGET_X86_64 memcpy(&xsave->region[XSAVE_Hi16_ZMM], env->hi16_zmm_regs, sizeof env->hi16_zmm_regs); #endif r = kvm_vcpu_ioctl(CPU(cpu), KVM_SET_XSAVE, xsave); return r; }
1threat
Feign logging not working : <p>I'm trying to get logging working for each request from a Feign rest client. However I cannot get the logging to work, while 'standard' Slf4j logging does work.</p> <p>I have the following:</p> <pre><code>public MyClient() { initConnectionProperties(); this.service = Feign.builder() .contract(new JAXRSContract()) .decoder(getJacksonDecoder()) .encoder(getJacksonEncoder()) .requestInterceptor(new BasicAuthRequestInterceptor(user, password)) //.client(new OkHttpClient()) .logger(new Slf4jLogger(MyClient.class)) //not working .logLevel(feign.Logger.Level.BASIC) .target(MyClient.class, this.url); logger.info("Connection parameters: url = " + url + ", user = " + user); //Is working } </code></pre>
0debug
ObjectClass *object_class_dynamic_cast_assert(ObjectClass *class, const char *typename, const char *file, int line, const char *func) { ObjectClass *ret; trace_object_class_dynamic_cast_assert(class ? class->type->name : "(null)", typename, file, line, func); #ifdef CONFIG_QOM_CAST_DEBUG int i; for (i = 0; i < OBJECT_CLASS_CAST_CACHE; i++) { if (class->cast_cache[i] == typename) { ret = class; goto out; } } #else if (!class->interfaces) { return class; } #endif ret = object_class_dynamic_cast(class, typename); if (!ret && class) { fprintf(stderr, "%s:%d:%s: Object %p is not an instance of type %s\n", file, line, func, class, typename); abort(); } #ifdef CONFIG_QOM_CAST_DEBUG if (ret == class) { for (i = 1; i < OBJECT_CLASS_CAST_CACHE; i++) { class->cast_cache[i - 1] = class->cast_cache[i]; } class->cast_cache[i - 1] = typename; } out: #endif return ret; }
1threat
How do i get the value of the neural network predicted for a single image? : <p>I am trying to create a simple python script that will allow you to put in picture of a handwritten digit and the NN model will try to make a guess as to what digit it is so far I have successfully made the model as well as tested it but when it comes to testing a single image i get an output like this.</p> <p><a href="https://i.imgur.com/0GNMUPR.png" rel="nofollow noreferrer">https://i.imgur.com/0GNMUPR.png</a></p> <pre class="lang-py prettyprint-override"><code>def make_pred(): Tk().withdraw() filename = askopenfilename() #the array that will hold the values of image image = np.zeros(784) #read image gray = cv2.imread(filename, cv2.IMREAD_GRAYSCALE ) #resize image and set background to black gray = cv2.resize(255-gray, (28,28)) #making the image a one dimensional array of 784 flatten = gray.flatten() / 255.0 cv2.imshow("heh",gray) cv2.waitKey(0) cv2.destroyAllWindows() #saving the image and the correct value image = flatten prediction = neural_network_model(x) n_save = tf.train.Saver() with tf.Session() as sess2: n_save.restore(sess2, './nn_test/nnmodel') print(sess2.run(prediction,feed_dict={x: [image], y:[7]})) </code></pre> <p>The <code>y</code> value is 7 because that's the digit i am trying this with.</p> <p>So how do I get the value that the NN thinks the character is?</p>
0debug
Java printing patterns : <p>I'm new in Java. I have next code:</p> <pre><code>public static void main(String[] args) { for(int k = 10; k &gt; 0; k--) { for(int l=0; l &lt; k-1; l++) { System.out.print(' '); } for(int n=10; n &gt; k-1; n--) { System.out.print('*'); } System.out.println(); } } </code></pre> <p>It prints this:</p> <pre><code> * ** *** **** ***** ****** ******* ******** ********* ********** </code></pre> <p>But I want to print it with empty inside like this:</p> <pre><code> * ** * * * * * * * * * * * * * * ********** </code></pre> <p>Can anyone to explane me how to do it. I understand that this is not a place where solve homework tasks. But can somebody tell me the algorithm for solving the problem in words. I do not need a ready solution because I want to understand and solve it by myself. So how I can put spaces inside?</p>
0debug
How to achieve buttonX.setOnClickListener(this) in KOTLIN? : <p>I want to bind "<strong>this</strong>" context to listener in kotlin</p>
0debug
Deleting specific rows with a pattern[start and end indicators] from a dataframe : <p><a href="https://i.stack.imgur.com/LxBbp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LxBbp.png" alt="Sample Dataset"></a></p> <p>I want to remove all rows between "5. Demand Disputed" and "Total Demand Disputed" from their respective columns. I have tried </p> <pre><code> grepl gsub </code></pre> <p>but not able to achieve the desire output.Kindly guide. </p>
0debug
Arrow function should not return assignment? : <p>My code is working correctly in the app however, my eslint isn't liking it and is saying I should not return assignment. What is wrong with this?</p> <pre><code>&lt;div ref={(el) =&gt; this.myCustomEl = el} /&gt; </code></pre>
0debug
static int roq_decode_init(AVCodecContext *avctx) { RoqContext *s = avctx->priv_data; s->avctx = avctx; s->width = avctx->width; s->height = avctx->height; s->last_frame = &s->frames[0]; s->current_frame = &s->frames[1]; avctx->pix_fmt = PIX_FMT_YUV444P; dsputil_init(&s->dsp, avctx); return 0; }
1threat
Difference of sys.path : <p>The following two python runs don't print the same output. Does anybody know why there is a difference? Thanks.</p> <pre><code>$ pwd /tmp $ cat main.py import sys print("\n".join(sys.path)) $ python3 -c 'import sys; print("\n".join(sys.path))' | head -n 1 $ python3 ./main.py | head -n 1 /private/tmp </code></pre>
0debug
int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps, const int *ref_count, int slice_type_nos, H264PredWeightTable *pwt, void *logctx) { int list, i, j; int luma_def, chroma_def; pwt->use_weight = 0; pwt->use_weight_chroma = 0; pwt->luma_log2_weight_denom = get_ue_golomb(gb); if (sps->chroma_format_idc) pwt->chroma_log2_weight_denom = get_ue_golomb(gb); if (pwt->luma_log2_weight_denom > 7U) { av_log(logctx, AV_LOG_ERROR, "luma_log2_weight_denom %d is out of range\n", pwt->luma_log2_weight_denom); pwt->luma_log2_weight_denom = 0; } if (pwt->chroma_log2_weight_denom > 7U) { av_log(logctx, AV_LOG_ERROR, "chroma_log2_weight_denom %d is out of range\n", pwt->chroma_log2_weight_denom); pwt->chroma_log2_weight_denom = 0; } luma_def = 1 << pwt->luma_log2_weight_denom; chroma_def = 1 << pwt->chroma_log2_weight_denom; for (list = 0; list < 2; list++) { pwt->luma_weight_flag[list] = 0; pwt->chroma_weight_flag[list] = 0; for (i = 0; i < ref_count[list]; i++) { int luma_weight_flag, chroma_weight_flag; luma_weight_flag = get_bits1(gb); if (luma_weight_flag) { pwt->luma_weight[i][list][0] = get_se_golomb(gb); pwt->luma_weight[i][list][1] = get_se_golomb(gb); if (pwt->luma_weight[i][list][0] != luma_def || pwt->luma_weight[i][list][1] != 0) { pwt->use_weight = 1; pwt->luma_weight_flag[list] = 1; } } else { pwt->luma_weight[i][list][0] = luma_def; pwt->luma_weight[i][list][1] = 0; } if (sps->chroma_format_idc) { chroma_weight_flag = get_bits1(gb); if (chroma_weight_flag) { int j; for (j = 0; j < 2; j++) { pwt->chroma_weight[i][list][j][0] = get_se_golomb(gb); pwt->chroma_weight[i][list][j][1] = get_se_golomb(gb); if ((int8_t)pwt->chroma_weight[i][list][j][0] != pwt->chroma_weight[i][list][j][0] || (int8_t)pwt->chroma_weight[i][list][j][1] != pwt->chroma_weight[i][list][j][1]) if (pwt->chroma_weight[i][list][j][0] != chroma_def || pwt->chroma_weight[i][list][j][1] != 0) { pwt->use_weight_chroma = 1; pwt->chroma_weight_flag[list] = 1; } } } else { int j; for (j = 0; j < 2; j++) { pwt->chroma_weight[i][list][j][0] = chroma_def; pwt->chroma_weight[i][list][j][1] = 0; } } } pwt->luma_weight[16 + 2 * i][list][0] = pwt->luma_weight[16 + 2 * i + 1][list][0] = pwt->luma_weight[i][list][0]; pwt->luma_weight[16 + 2 * i][list][1] = pwt->luma_weight[16 + 2 * i + 1][list][1] = pwt->luma_weight[i][list][1]; for (j = 0; j < 2; j++) { pwt->chroma_weight[16 + 2 * i][list][j][0] = pwt->chroma_weight[16 + 2 * i + 1][list][j][0] = pwt->chroma_weight[i][list][j][0]; pwt->chroma_weight[16 + 2 * i][list][j][1] = pwt->chroma_weight[16 + 2 * i + 1][list][j][1] = pwt->chroma_weight[i][list][j][1]; } } if (slice_type_nos != AV_PICTURE_TYPE_B) break; } pwt->use_weight = pwt->use_weight || pwt->use_weight_chroma; return 0; out_range_weight: avpriv_request_sample(logctx, "Out of range weight\n"); return AVERROR_INVALIDDATA; }
1threat
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
1threat
ConstraintLayout - centering views with next to each other vertically or horizontally : <p>How to center align 3 buttons with next to each other vertically using <a href="https://developer.android.com/reference/android/support/constraint/ConstraintLayout.html" rel="noreferrer"><code>ConstraintLayout</code></a>?</p> <p>To be clear, i want to convert this simple layout structure into flat UI using <a href="https://developer.android.com/reference/android/support/constraint/ConstraintLayout.html" rel="noreferrer"><code>ConstraintLayout</code></a></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:orientation="vertical"&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;/LinearLayout&gt; &lt;/FrameLayout&gt; </code></pre> <p>I have obtained a nearest solution as follows</p> <pre><code>&lt;android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toTopOf="@+id/button2" /&gt; &lt;Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintLeft_toLeftOf="parent" tools:layout_conversion_absoluteHeight="48dp" tools:layout_conversion_absoluteWidth="88dp" tools:layout_conversion_absoluteX="148dp" tools:layout_conversion_absoluteY="259dp" app:layout_constraintBottom_toTopOf="@+id/button3" app:layout_constraintTop_toBottomOf="@+id/button" app:layout_constraintRight_toRightOf="parent"/&gt; &lt;Button android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_constraintLeft_toLeftOf="parent" tools:layout_conversion_absoluteHeight="48dp" tools:layout_conversion_absoluteWidth="88dp" tools:layout_conversion_absoluteX="148dp" tools:layout_conversion_absoluteY="307dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toBottomOf="@+id/button2" app:layout_constraintRight_toRightOf="parent"/&gt; &lt;/android.support.constraint.ConstraintLayout&gt; </code></pre> <p><a href="https://i.stack.imgur.com/VsnbC.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/VsnbC.jpg" alt=""></a></p> <p>But clearly, you can see that the obtained output does not match to the required one. i don't want any margin or space in between the 3 buttons, all i want is to center align those 3 buttons next to each other vertically just like they are in a <code>LinearLayout</code> which has a vertical orientation. </p>
0debug
Using filesystem in node.js with async / await : <p>I would like to use async/await with some filesystem operations. Normally async/await works fine because I use <code>babel-plugin-syntax-async-functions</code>.</p> <p>But with this code I run into the if case where <code>names</code> is undefined:</p> <pre><code>import fs from 'fs'; async function myF() { let names; try { names = await fs.readdir('path/to/dir'); } catch (e) { console.log('e', e); } if (names === undefined) { console.log('undefined'); } else { console.log('First Name', names[0]); } } myF(); </code></pre> <p>When I rebuild the code into the callback hell version everything is OK and I get the filenames. Thanks for your hints.</p>
0debug
(405) Method Not Allowed. WCF WebService : <p>Introduction:</p> <p>Hello, I am trying to set up a WCF web service on my local IIS 7.5 server, however after I finish the basic configurations I am unable to send data with a WinForms test client and it returns the error mentioned in the titles. I have already searched similar threads on this problem but i did not find anything that would fit my problem.</p> <p>Data:</p> <p>-Both the Wcf WebService and the test client where provided from a 3rd party</p> <p>-They already work on another server and I am using the same versions</p> <p>-I am probably doing something wrong when I enable or configure IIS</p> <p>Request:</p> <p>-I need to know what IIS features I need to enable/disable in order to install it correctly so I can use the Wcf WebService.(If that's the case).</p> <p>-How to correctly configure the server in order to solve the above mentioned error.</p> <p>My Configurations:</p> <p>-After Installing IIS I changed the DefaulAppPool to .NET Framework v4.0.30.319; pipeline mode: Integrated. -Advanced Settings: Load User profile = False.</p> <p>-Created a new Website named "WcfMicrocontrollerService" using DefaultAppPool.Binding; Type:http, IP adress: , port: 80</p> <p>At this point I can access it trough a web browser, however when I use the test client to POST data to the service I get the following error: <em>"The remote server returned an unexpected response:(405) Method Not Allowed."</em></p> <p>Here are the data packets sent as recorded by Fiddler: Sent:</p> <pre><code>POST http://192.168.0.102/MicroControllerComSvc.svc HTTP/1.1 Content-Type: text/xml; charset=utf-8 SOAPAction: "http://tempuri.org/IMicroControllerComSvc/GetMicrocontrollerData" Host: 192.168.0.102 Content-Length: 237 Expect: 100-continue Accept-Encoding: gzip, deflate Connection: Keep-Alive &lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;s:Body&gt;&lt;GetMicrocontrollerData xmlns="http://tempuri.org/"&gt;&lt;microControllerData&gt;1,1,1,1,2,2,1,0,100,300&lt;/microControllerData&gt;&lt;/GetMicrocontrollerData&gt;&lt;/s:Body&gt;&lt;/s:Envelope&gt; </code></pre> <p>Received: </p> <pre><code>HTTP/1.1 405 Method Not Allowed Cache-Control: private Allow: GET, HEAD, OPTIONS, TRACE Content-Type: text/html; charset=utf-8 Server: Microsoft-IIS/7.5 X-Powered-By: ASP.NET Date: Tue, 01 Mar 2016 10:44:44 GMT Content-Length: 5671 </code></pre> <p>And here's the body: <a href="https://dl.dropboxusercontent.com/u/2237590/405.html" rel="noreferrer">https://dl.dropboxusercontent.com/u/2237590/405.html</a></p> <p>This seems to indicate that I should take a look in handler mappings but I have no idea what to edit there.</p>
0debug
static int roq_decode_end(AVCodecContext *avctx) { RoqContext *s = avctx->priv_data; avctx->release_buffer(avctx, &s->last_frame); return 0; }
1threat
File's string dont match : <p>here's the problem: i have a file ,,file.txt''.It is compossed by 11 words. Good. Now i have the code :</p> <pre><code>with open('/root/file.txt', 'r') as f: data = f.readlines() print data[10] </code></pre> <p>It outputs :</p> <pre><code>Password </code></pre> <p>But when i enter :</p> <pre><code>if data[10] == 'Password': print 'yes' else: print 'no' </code></pre> <p>It outputs:</p> <pre><code>no </code></pre> <p>Can i know why ?I alredy tried to do ,,str(data[10])" but i get the same output : no. How i can do to get the yes answere ?</p>
0debug
Swift: move UIView on slide gesture : <p>I am trying to move a UIView on slide up gesture from its initial position to a fixed final position. The image should move with the hand gesture, and not animate independently. </p> <p>I haven't tried anything as I have no clue where to start, which gesture class to use. </p> <p><a href="https://i.stack.imgur.com/oLe32.png" rel="noreferrer"><img src="https://i.stack.imgur.com/oLe32.png" alt="enter image description here"></a></p>
0debug
static int ffserver_opt_preset(const char *arg, AVCodecContext *avctx, int type, enum AVCodecID *audio_id, enum AVCodecID *video_id) { FILE *f=NULL; char filename[1000], tmp[1000], tmp2[1000], line[1000]; int ret = 0; AVCodec *codec = avcodec_find_encoder(avctx->codec_id); if (!(f = get_preset_file(filename, sizeof(filename), arg, 0, codec ? codec->name : NULL))) { fprintf(stderr, "File for preset '%s' not found\n", arg); return 1; } while(!feof(f)){ int e= fscanf(f, "%999[^\n]\n", line) - 1; if(line[0] == '#' && !e) continue; e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2; if(e){ fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line); ret = 1; break; } if(!strcmp(tmp, "acodec")){ *audio_id = opt_codec(tmp2, AVMEDIA_TYPE_AUDIO); }else if(!strcmp(tmp, "vcodec")){ *video_id = opt_codec(tmp2, AVMEDIA_TYPE_VIDEO); }else if(!strcmp(tmp, "scodec")){ }else if(ffserver_opt_default(tmp, tmp2, avctx, type) < 0){ fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2); ret = 1; break; } } fclose(f); return ret; }
1threat
Silence PyLint warning about unused variables for string interpolation : <p>The <code>say</code> module brings string interpolation to Python, like this:</p> <pre><code>import say def f(a): return say.fmt("The value of 'a' is {a}") </code></pre> <p>However, PyLint complains that the variable 'a' is never used. This is a problem because my code uses <code>say.fmt</code> extensively. How can I silence this warning?</p>
0debug
how to print the value of a function-pointer from a structure : <p>The value contained in the function-pointer " *fun " from the structure below is wrong printed and i can not find the way to print it right. What's the right code for it? The code:</p> <pre><code>struct t { //structure definition int a; int (*fun) (int a);}; int get_a (int a) { //function definition a = a*2; return a;} int main () { t test; //variable creation get_a(5); //function activating test.fun = &amp;get_a; //assignation to the pointer function printf ("%d\n",*(test.fun)); //THE NUMBER 4199360 IS WRITTEN INSTEAD OF '10'. return 0; } </code></pre>
0debug
set color of windows titlebar - electron.js : <p>I would like to change the color of the titlebar for the windows version of my electron app. currently it is white, how do I change it to, for example, blue? <a href="https://i.stack.imgur.com/fhjXW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/fhjXW.png" alt="enter image description here"></a></p>
0debug
R ggplot, plot one column against another column in the dataframe : <p>I have a simple dataframe with 2 columns <code>date_booking</code> and <code>price</code> . I tried the simple default plot function:</p> <p><code>plot(codedf$date_booking,codedf$price)</code></p> <p>, which gave me this:</p> <p><a href="https://i.stack.imgur.com/YHjxe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YHjxe.png" alt="enter image description here"></a></p> <p>This is my first time using R and picked R for the plotting stuff. I learned ggplot provides better visualizations, so I installed it and just changed the above code to:</p> <p><code>ggplot( aes(x=codedf$date_booking,y=codedf$price) )</code></p> <p>which gave me this error : <strong>ggplot2 doesn't know how to deal with data of class uneval</strong></p> <p>I thought this may be because my x axis is a datetime string and I didn't specify any conversion format. So I tried plotting only the price (against itself) , which is of type int:</p> <p><code>ggplot( aes(x=codedf$price,y=codedf$price) )</code></p> <p>And this again gave the same error.</p> <p>What is the easiest way to plot one column against another in ggplot?</p>
0debug
HttpInterceptor in Angular 4.3: Intercepting 400 error responses : <p>I would like <strong>to intercept 401 and other errors</strong> in order to react accordingly. This is my interceptor:</p> <pre><code>import { LoggingService } from './../logging/logging.service'; import { Injectable } from '@angular/core'; import { HttpInterceptor, HttpHandler, HttpRequest, HttpEvent, HttpResponse, HttpErrorResponse } from '@angular/common/http'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/do'; @Injectable() export class TwsHttpInterceptor implements HttpInterceptor { constructor(private logger: LoggingService) { } intercept(request: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; { this.logger.logDebug(request); return next.handle(request) .do(event =&gt; { if (event instanceof HttpResponse) { this.logger.logDebug(event); } }); } } </code></pre> <p>While this works well for 200 requests, <strong>it does not intercept the error respsonses</strong></p> <p>All I see in chrome's dev console is this:</p> <blockquote> <p>zone.js:2616 GET <a href="http://localhost:8080/backend/rest/wrongurl" rel="noreferrer">http://localhost:8080/backend/rest/wrongurl</a> 404 (Not Found)</p> </blockquote> <p>Or this</p> <blockquote> <p>zone.js:2616 GET <a href="http://localhost:8080/backend/rest/url" rel="noreferrer">http://localhost:8080/backend/rest/url</a> 401 (Unauthorized)</p> </blockquote> <p>I would like my interceptor to deal with this. What am I missing ?</p>
0debug
static int omap_intc_init(SysBusDevice *sbd) { DeviceState *dev = DEVICE(sbd); struct omap_intr_handler_s *s = OMAP_INTC(dev); if (!s->iclk) { hw_error("omap-intc: clk not connected\n"); } s->nbanks = 1; sysbus_init_irq(sbd, &s->parent_intr[0]); sysbus_init_irq(sbd, &s->parent_intr[1]); qdev_init_gpio_in(dev, omap_set_intr, s->nbanks * 32); memory_region_init_io(&s->mmio, OBJECT(s), &omap_inth_mem_ops, s, "omap-intc", s->size); sysbus_init_mmio(sbd, &s->mmio); return 0; }
1threat
Create Number Counter that increments by 1 per the last number assigned : <p>I am looking to assign a variable called "quoteIdentifier" to an incrementing integer. My use case is that everytime someone submits a quote to my firestore database, the quote automatically will assign an integer as an ID of sorts. </p> <p>So if my first user entered their information into the form - it would assign integer 1 then the second user enters their information, and the code references the last integer assigned, and increments up by 1.. so something like lastEntryInt ++. Is this even possible to reference a last assigned value? Perhaps I read from the firestore field the last assigned? Any help would be appreciated!</p>
0debug
Power Shell Command : I am trying to run a powershell command to get the total disk space of all drives for all our Remote servers, when I run the command I am getting the following error, I have a text file which has names of the servers and I have also confirmed that WinRM is configured and is running can someone help thanks this is my PS command and error PS C:\WINDOWS\system32> $Servers = Get-Content "C:\users\anorris\desktop\DR\servers1.txt" Foreach ($s in $Servers) {Invoke-Command -ComputerName $s {Get-PSDrive}} [ahv-a2acortst02] Connecting to remote server failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo : OpenError: (:) [], PSRemotingTransportException + FullyQualifiedErrorId : PSSessionStateBroken
0debug
why does't my title center when I use margin: 0 auto? : <p>I have set the div to inline-block and set the margin to (0 auto). Why doesn't it work? <a href="https://i.stack.imgur.com/bQXEr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bQXEr.png" alt="enter image description here"></a></p>
0debug
How to re initialize sub component in angular2? : <p>I have a component inside another component, added by tag. At some point, i would like to reinitialize this sub-component, like the first it was invoke. Is there any way to do that?</p>
0debug
static void sdhci_do_data_transfer(void *opaque) { SDHCIState *s = (SDHCIState *)opaque; SDHCI_GET_CLASS(s)->data_transfer(s); }
1threat
static void do_pci_unregister_device(PCIDevice *pci_dev) { pci_dev->bus->devices[pci_dev->devfn] = NULL; pci_config_free(pci_dev); memory_region_del_subregion(&pci_dev->bus_master_container_region, &pci_dev->bus_master_enable_region); address_space_destroy(&pci_dev->bus_master_as); }
1threat
Transform info in json valid : <p>Transform this result in json valid.</p> <pre><code>"{\"name\":\"log\",\"hostname\":\"denis-Latitude-E7470\",\"pid\":1007,\"level\":30,\"conextion\":\"DBA MongDB: \[32m%s\[0m\",\"msg\":\"online\",\"time\":\"2019-12-06T13:50:42.510Z\",\"v\":0}" </code></pre>
0debug
Python code to remove duplicates in a 2D list : <p>Suppose I have a list [[1,0], [14,12], [13,6], [1,0], [12,8], [13,6]] I want the output as [[1,0], [14,12], [13,6], [12,8]]</p> <p>Please help me out with a solution code in python.</p>
0debug
static void gen_divu(DisasContext *dc, TCGv dest, TCGv srca, TCGv srcb) { TCGv sr_cy = tcg_temp_new(); TCGv t0 = tcg_temp_new(); tcg_gen_setcondi_tl(TCG_COND_EQ, sr_cy, srcb, 0); tcg_gen_or_tl(t0, srcb, sr_cy); tcg_gen_divu_tl(dest, srca, t0); tcg_temp_free(t0); tcg_gen_deposit_tl(cpu_sr, cpu_sr, sr_cy, ctz32(SR_CY), 1); gen_ove_cy(dc, sr_cy); tcg_temp_free(sr_cy); }
1threat
static void uhci_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); UHCIPCIDeviceClass *u = container_of(k, UHCIPCIDeviceClass, parent_class); UHCIInfo *info = data; k->init = info->initfn ? info->initfn : usb_uhci_common_initfn; k->exit = info->unplug ? usb_uhci_exit : NULL; k->vendor_id = info->vendor_id; k->device_id = info->device_id; k->revision = info->revision; k->class_id = PCI_CLASS_SERIAL_USB; dc->vmsd = &vmstate_uhci; dc->props = uhci_properties; u->info = *info; }
1threat
static ImageInfoSpecific *vmdk_get_specific_info(BlockDriverState *bs) { int i; BDRVVmdkState *s = bs->opaque; ImageInfoSpecific *spec_info = g_new0(ImageInfoSpecific, 1); ImageInfoList **next; *spec_info = (ImageInfoSpecific){ .type = IMAGE_INFO_SPECIFIC_KIND_VMDK, { .vmdk = g_new0(ImageInfoSpecificVmdk, 1), }, }; *spec_info->u.vmdk = (ImageInfoSpecificVmdk) { .create_type = g_strdup(s->create_type), .cid = s->cid, .parent_cid = s->parent_cid, }; next = &spec_info->u.vmdk->extents; for (i = 0; i < s->num_extents; i++) { *next = g_new0(ImageInfoList, 1); (*next)->value = vmdk_get_extent_info(&s->extents[i]); (*next)->next = NULL; next = &(*next)->next; } return spec_info; }
1threat
void cpu_breakpoint_remove_all(CPUState *cpu, int mask) { #if defined(TARGET_HAS_ICE) CPUBreakpoint *bp, *next; QTAILQ_FOREACH_SAFE(bp, &cpu->breakpoints, entry, next) { if (bp->flags & mask) { cpu_breakpoint_remove_by_ref(cpu, bp); } } #endif }
1threat
What do the blue blocks in spark stage DAG visualisation UI mean? : <p>in the following snip for the application UI, what do the blue blocks in each stage represent? </p> <p>What do "Exchange" and "WholeStageCodeGen", etc mean? </p> <p>Where can I find a resource to interpret what spark is doing here?</p> <p>Many thanks</p> <p><a href="https://i.stack.imgur.com/znTrx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/znTrx.png" alt="What are the blue blocks? What do their names represent?"></a></p>
0debug
How to detect API modifications when mocking e2e tests? : <p>I'd like to setup a solid e2e testing foundation on our team's project but I can't find a simple solution to that question :</p> <p><strong>When you are mocking all of your calls, what is the best way to detect if the actual model of the objects returned by your server has been modified ?</strong></p> <p>Your tests would still pass because they're testing an outdated version of the model but the app is potentially broken.</p> <p>For example, if a mock assumes that <code>/api/users/1</code> returns <code>null</code> if the user doesn't exist, when it actually returns an empty object, then although the tests may pass, the behaviour being tested relies on incorrect assumptions and may therefore fail in unexpected ways.</p> <p>Or maybe the backend is somehow providing static json files with the latest up-to-date model and the frontend relies on this ?</p> <p>This of course supposes that the people working on the backend and the people working on the frontend are separate teams.</p> <p>I am using Angular 1.x and Protractor here but this doesn't really depend on the technology.</p>
0debug
How to write Sales tax calculation vbscript code for a function which will return 2 values and write to excel when it is called? : My Question is How to write Sales tax calculation vbscript code for a function which will return 2 values and write to excel when it is called? Please help me as i started to learn recently. thanks
0debug
static void count_frame_bits(AC3EncodeContext *s) { AC3EncOptions *opt = &s->options; int blk, ch; int frame_bits = 0; if (s->eac3) { if (s->channel_mode > AC3_CHMODE_MONO) { frame_bits++; for (blk = 1; blk < AC3_MAX_BLOCKS; blk++) { AC3Block *block = &s->blocks[blk]; frame_bits++; if (block->new_cpl_strategy) frame_bits++; } } for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) frame_bits += 2 * s->blocks[blk].cpl_in_use; } else { if (opt->audio_production_info) frame_bits += 7; if (s->bitstream_id == 6) { if (opt->extended_bsi_1) frame_bits += 14; if (opt->extended_bsi_2) frame_bits += 14; } } for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { AC3Block *block = &s->blocks[blk]; if (!s->eac3) frame_bits++; if (block->new_cpl_strategy) { if (!s->eac3) frame_bits++; if (block->cpl_in_use) { if (s->eac3) frame_bits++; if (!s->eac3 || s->channel_mode != AC3_CHMODE_STEREO) frame_bits += s->fbw_channels; if (s->channel_mode == AC3_CHMODE_STEREO) frame_bits++; frame_bits += 4 + 4; if (s->eac3) frame_bits++; else frame_bits += s->num_cpl_subbands - 1; } } if (block->cpl_in_use) { for (ch = 1; ch <= s->fbw_channels; ch++) { if (block->channel_in_cpl[ch]) { if (!s->eac3 || block->new_cpl_coords != 2) frame_bits++; if (block->new_cpl_coords) { frame_bits += 2; frame_bits += (4 + 4) * s->num_cpl_bands; } } } } if (s->channel_mode == AC3_CHMODE_STEREO) { if (!s->eac3 || blk > 0) frame_bits++; if (s->blocks[blk].new_rematrixing_strategy) frame_bits += block->num_rematrixing_bands; } for (ch = 1; ch <= s->fbw_channels; ch++) { if (s->exp_strategy[ch][blk] != EXP_REUSE) { if (!block->channel_in_cpl[ch]) frame_bits += 6; frame_bits += 2; } } if (!s->eac3 && block->cpl_in_use) frame_bits += 2; if (!s->eac3) { frame_bits++; if (block->new_snr_offsets) frame_bits += 6 + (s->channels + block->cpl_in_use) * (4 + 3); } if (block->cpl_in_use) { if (!s->eac3 || block->new_cpl_leak != 2) frame_bits++; if (block->new_cpl_leak) frame_bits += 3 + 3; } } s->frame_bits = s->frame_bits_fixed + frame_bits; }
1threat
Cannot display Toast because of a runtime error. please help me : badd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub String s1 = e1.getText()+"hi".toString(); Log.i("add",s1); if(e1.getText()==null) { Toast.makeText(getApplicationContext(), "Please Enter A Number First", Toast.LENGTH_SHORT).show(); } else { num1 = Float.parseFloat(e1.getText()+""); i=1; e1.setText(null); } } }); I am making a simple calculator app, there is a Button badd(button to perform addition) and an EditText e1. when this button is clicked; first it'll be checked if the textbox is empty or not if it is empty it'll display a Toast telling user to enter a number. if the number is already entered that number will be stored in a variable num1 and textbox will get empty so that user can input another number and addition will be performed on the two numbers. When i entered a number and pressed badd addition was done successfully. But my problem is that when i leave the edit text box empty (null) i get a runtime error and instead of displaying toast it shows an error "your application is unfortunately closed". I created a string variable s1 also that takes the string entered in e1 and concate that string with another string "hi" so that if the string is empty it'll at least display a hi message in log cat. It is to check if there is some error in anonymous inner class. but it is cleared that there is no problem the anonymous inner class and else block. I think the bug is in the if block. Please Help Me! Following are my LogCat errors that will help you to find the bug. 03-05 16:37:00.601: I/add(1569): hi 03-05 16:37:00.663: E/AndroidRuntime(1569): FATAL EXCEPTION: main 03-05 16:37:00.663: E/AndroidRuntime(1569): java.lang.NumberFormatException: Invalid float: "" 03-05 16:37:00.663: E/AndroidRuntime(1569): at java.lang.StringToReal.invalidReal(StringToReal.java:63) 03-05 16:37:00.663: E/AndroidRuntime(1569): at java.lang.StringToReal.parseFloat(StringToReal.java:289) 03-05 16:37:00.663: E/AndroidRuntime(1569): at java.lang.Float.parseFloat(Float.java:300) 03-05 16:37:00.663: E/AndroidRuntime(1569): at com.example.mycalculator.MainActivity$13.onClick(MainActivity.java:171) 03-05 16:37:00.663: E/AndroidRuntime(1569): at android.view.View.performClick(View.java:4202) 03-05 16:37:00.663: E/AndroidRuntime(1569): at android.view.View$PerformClick.run(View.java:17340) 03-05 16:37:00.663: E/AndroidRuntime(1569): at android.os.Handler.handleCallback(Handler.java:725) 03-05 16:37:00.663: E/AndroidRuntime(1569): at android.os.Handler.dispatchMessage(Handler.java:92) 03-05 16:37:00.663: E/AndroidRuntime(1569): at android.os.Looper.loop(Looper.java:137) 03-05 16:37:00.663: E/AndroidRuntime(1569): at android.app.ActivityThread.main(ActivityThread.java:5039) 03-05 16:37:00.663: E/AndroidRuntime(1569): at java.lang.reflect.Method.invokeNative(Native Method) 03-05 16:37:00.663: E/AndroidRuntime(1569): at java.lang.reflect.Method.invoke(Method.java:511) 03-05 16:37:00.663: E/AndroidRuntime(1569): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 03-05 16:37:00.663: E/AndroidRuntime(1569): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 03-05 16:37:00.663: E/AndroidRuntime(1569): at dalvik.system.NativeStart.main(Native Method)
0debug
static void virtio_blk_complete_request(VirtIOBlockReq *req, unsigned char status) { VirtIOBlock *s = req->dev; VirtIODevice *vdev = VIRTIO_DEVICE(s); trace_virtio_blk_req_complete(req, status); stb_p(&req->in->status, status); virtqueue_push(s->vq, req->elem, req->qiov.size + sizeof(*req->in)); virtio_notify(vdev, s->vq); }
1threat
static void put_swf_matrix(ByteIOContext *pb, int a, int b, int c, int d, int tx, int ty) { PutBitContext p; uint8_t buf[256]; init_put_bits(&p, buf, sizeof(buf)); put_bits(&p, 1, 1); put_bits(&p, 5, 20); put_bits(&p, 20, a); put_bits(&p, 20, d); put_bits(&p, 1, 1); put_bits(&p, 5, 20); put_bits(&p, 20, c); put_bits(&p, 20, b); put_bits(&p, 5, 20); put_bits(&p, 20, tx); put_bits(&p, 20, ty); flush_put_bits(&p); put_buffer(pb, buf, pbBufPtr(&p) - p.buf); }
1threat
NavigationLink Works Only for Once : <p>I was working on an application with login and after login there are categories listed. And under each category there are some items listed horizontally. The thing is after login, main page appears and everything is listed great. When you click on an item it goes to detailed screen but when you try to go back it just crashes. I found this flow <a href="https://stackoverflow.com/questions/58404725/why-does-my-swiftui-app-crash-when-navigating-backwards-after-placing-a-navigat">Why does my SwiftUI app crash when navigating backwards after placing a `NavigationLink` inside of a `navigationBarItems` in a `NavigationView`?</a> but i could not solve my problem. Since my project become complicated, I just wanted to practice navigation in swiftui and I created a new project. By the way I downloaded the latest xcode version 11.3. I wrote a simple code as follows: </p> <pre><code>NavigationView{ NavigationLink(destination: Test()) { Text("Show Detail View") } .navigationBarTitle("title1") </code></pre> <p>And Test() view is as follows:</p> <pre><code>import SwiftUI struct Test: View { var body: some View { Text("Hello, World!") } } struct Test_Previews: PreviewProvider { static var previews: some View { Test() } } </code></pre> <p>As you can see it is really simple. I also tried similar examples on the internet but it does not work the way it suppose to work. When I run the project, I click the navigation link and it navigates to Test() view. Then I click back button and it navigates to the main page. However, when I click the navigation link second time, nothing happens. Navigation link works only once and after that nothing happens. It does not navigate, it des not throw any error. I am new to swiftui and everything is great but the navigation. I tried many examples and suggested solutions on the internet, but nothing seems to fix my issues. </p>
0debug
How to remove duplicates automatically : I have two files. I copied File A Column A data into File B Column A but I want to remove Duplicate Values from Column A when I paste into File B (without using VBA would be much better). Thank you
0debug
SQL SERVER - TO NOT DISPLAY NAULL VALUES : I'm using a prodedure with parametres, as showed in the code below. I want a solution that the query don't bring me the null values. [enter image description here][1] [1]: https://i.stack.imgur.com/5XS5K.png
0debug
How set in mysql query a variable? : <p>What i have:</p> <pre><code>$table_name_arcticles = 'arcticles'; $arcticles_count = mysqli_query($connection, "SELECT * FROM `articles` WHERE `categories_id` =" . $data['id']); </code></pre> <p>What i need, something like this:</p> <pre><code>$table_name_arcticles = 'arcticles'; $arcticles_count = mysqli_query($connection, "SELECT * FROM $table_name_arcticles WHERE `categories_id` =" . $data['id']); </code></pre>
0debug
Vue.js in Chrome extension : <h2>Vue.js in Chrome extension</h2> <p>Hi! I'm trying to make a Chrome extension using Vue.js but when I write</p> <pre><code>&lt;input v-model="email" type="email" class="form-control" placeholder="Email"&gt; </code></pre> <p>Chrome removes the v-model-part of the code and makes it</p> <pre><code>&lt;input type="email" class="form-control" placeholder="Email"&gt; </code></pre> <p>Is there a way to prevent this?</p>
0debug
removing space between columns : want to remove space between columns. Check site and links below http://jaipur.onlinewebshop.net/ https://codepen.io/nhui77777777/pen/pqMOyZ how to reduce space
0debug
What does 'fileprivate' keyword means in Swift? : <p>I'm starting in swift and opening a project created using swift2 from xcode 8 beta, the <code>private</code> modifier were changed to <code>fileprivate</code>. what does this keyword means? and how is different from <code>private</code> ?</p>
0debug
Run function when cicking off a div thats Contenteditable : <p>I currently have a table that has a couble od tds, the tds contain divs that allows the user to change the value within it. If the user presses enter a function is called but I would now like to make it so the user only has to click away from the div for the function to run. is this possible?</p>
0debug
Reset USB port power with Windows command prompt : <p>I have an USB equipment that stops working when my computer reboots. The only solution is to kill the power of the port. Is there a command in the Windows Prompt that can kill the USB power? </p> <p>Any tip will be very helpful,</p> <p>Thanks</p>
0debug
Identify negative sentence By using NLP : <p>I want to check below sentence is either positive or negative please help me </p> <p>Sentence -I don't remember anything </p>
0debug
How to center the editor window back on the cursor in VSCode? : <p>I'm using VSCode as my text editor. I'm curious, is there a keybinding for centering the editor window on the cursor, when the window is a lot of lines below/above it such that it's not visible on the screen? I've tried looking at the default keybindings by going to <em>FIle > Preferences > Keyboard Shortcuts</em>, but I see no such options for centering the window.</p>
0debug
static int disas_coproc_insn(DisasContext *s, uint32_t insn) { int cpnum, is64, crn, crm, opc1, opc2, isread, rt, rt2; const ARMCPRegInfo *ri; cpnum = (insn >> 8) & 0xf; if (arm_dc_feature(s, ARM_FEATURE_XSCALE) && (cpnum < 2)) { if (extract32(s->c15_cpar, cpnum, 1) == 0) { return 1; } if (arm_dc_feature(s, ARM_FEATURE_IWMMXT)) { return disas_iwmmxt_insn(s, insn); } else if (arm_dc_feature(s, ARM_FEATURE_XSCALE)) { return disas_dsp_insn(s, insn); } return 1; } is64 = (insn & (1 << 25)) == 0; if (!is64 && ((insn & (1 << 4)) == 0)) { return 1; } crm = insn & 0xf; if (is64) { crn = 0; opc1 = (insn >> 4) & 0xf; opc2 = 0; rt2 = (insn >> 16) & 0xf; } else { crn = (insn >> 16) & 0xf; opc1 = (insn >> 21) & 7; opc2 = (insn >> 5) & 7; rt2 = 0; } isread = (insn >> 20) & 1; rt = (insn >> 12) & 0xf; ri = get_arm_cp_reginfo(s->cp_regs, ENCODE_CP_REG(cpnum, is64, s->ns, crn, crm, opc1, opc2)); if (ri) { if (!cp_access_ok(s->current_el, ri, isread)) { return 1; } if (ri->accessfn || (arm_dc_feature(s, ARM_FEATURE_XSCALE) && cpnum < 14)) { TCGv_ptr tmpptr; TCGv_i32 tcg_syn; uint32_t syndrome; switch (cpnum) { case 14: if (is64) { syndrome = syn_cp14_rrt_trap(1, 0xe, opc1, crm, rt, rt2, isread, s->thumb); } else { syndrome = syn_cp14_rt_trap(1, 0xe, opc1, opc2, crn, crm, rt, isread, s->thumb); } break; case 15: if (is64) { syndrome = syn_cp15_rrt_trap(1, 0xe, opc1, crm, rt, rt2, isread, s->thumb); } else { syndrome = syn_cp15_rt_trap(1, 0xe, opc1, opc2, crn, crm, rt, isread, s->thumb); } break; default: assert(!arm_dc_feature(s, ARM_FEATURE_V8)); syndrome = syn_uncategorized(); break; } gen_set_pc_im(s, s->pc); tmpptr = tcg_const_ptr(ri); tcg_syn = tcg_const_i32(syndrome); gen_helper_access_check_cp_reg(cpu_env, tmpptr, tcg_syn); tcg_temp_free_ptr(tmpptr); tcg_temp_free_i32(tcg_syn); } switch (ri->type & ~(ARM_CP_FLAG_MASK & ~ARM_CP_SPECIAL)) { case ARM_CP_NOP: return 0; case ARM_CP_WFI: if (isread) { return 1; } gen_set_pc_im(s, s->pc); s->is_jmp = DISAS_WFI; return 0; default: break; } if ((s->tb->cflags & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) { gen_io_start(); } if (isread) { if (is64) { TCGv_i64 tmp64; TCGv_i32 tmp; if (ri->type & ARM_CP_CONST) { tmp64 = tcg_const_i64(ri->resetvalue); } else if (ri->readfn) { TCGv_ptr tmpptr; tmp64 = tcg_temp_new_i64(); tmpptr = tcg_const_ptr(ri); gen_helper_get_cp_reg64(tmp64, cpu_env, tmpptr); tcg_temp_free_ptr(tmpptr); } else { tmp64 = tcg_temp_new_i64(); tcg_gen_ld_i64(tmp64, cpu_env, ri->fieldoffset); } tmp = tcg_temp_new_i32(); tcg_gen_trunc_i64_i32(tmp, tmp64); store_reg(s, rt, tmp); tcg_gen_shri_i64(tmp64, tmp64, 32); tmp = tcg_temp_new_i32(); tcg_gen_trunc_i64_i32(tmp, tmp64); tcg_temp_free_i64(tmp64); store_reg(s, rt2, tmp); } else { TCGv_i32 tmp; if (ri->type & ARM_CP_CONST) { tmp = tcg_const_i32(ri->resetvalue); } else if (ri->readfn) { TCGv_ptr tmpptr; tmp = tcg_temp_new_i32(); tmpptr = tcg_const_ptr(ri); gen_helper_get_cp_reg(tmp, cpu_env, tmpptr); tcg_temp_free_ptr(tmpptr); } else { tmp = load_cpu_offset(ri->fieldoffset); } if (rt == 15) { gen_set_nzcv(tmp); tcg_temp_free_i32(tmp); } else { store_reg(s, rt, tmp); } } } else { if (ri->type & ARM_CP_CONST) { return 0; } if (is64) { TCGv_i32 tmplo, tmphi; TCGv_i64 tmp64 = tcg_temp_new_i64(); tmplo = load_reg(s, rt); tmphi = load_reg(s, rt2); tcg_gen_concat_i32_i64(tmp64, tmplo, tmphi); tcg_temp_free_i32(tmplo); tcg_temp_free_i32(tmphi); if (ri->writefn) { TCGv_ptr tmpptr = tcg_const_ptr(ri); gen_helper_set_cp_reg64(cpu_env, tmpptr, tmp64); tcg_temp_free_ptr(tmpptr); } else { tcg_gen_st_i64(tmp64, cpu_env, ri->fieldoffset); } tcg_temp_free_i64(tmp64); } else { if (ri->writefn) { TCGv_i32 tmp; TCGv_ptr tmpptr; tmp = load_reg(s, rt); tmpptr = tcg_const_ptr(ri); gen_helper_set_cp_reg(cpu_env, tmpptr, tmp); tcg_temp_free_ptr(tmpptr); tcg_temp_free_i32(tmp); } else { TCGv_i32 tmp = load_reg(s, rt); store_cpu_offset(tmp, ri->fieldoffset); } } } if ((s->tb->cflags & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) { gen_io_end(); gen_lookup_tb(s); } else if (!isread && !(ri->type & ARM_CP_SUPPRESS_TB_END)) { gen_lookup_tb(s); } return 0; } if (is64) { qemu_log_mask(LOG_UNIMP, "%s access to unsupported AArch32 " "64 bit system register cp:%d opc1: %d crm:%d " "(%s)\n", isread ? "read" : "write", cpnum, opc1, crm, s->ns ? "non-secure" : "secure"); } else { qemu_log_mask(LOG_UNIMP, "%s access to unsupported AArch32 " "system register cp:%d opc1:%d crn:%d crm:%d opc2:%d " "(%s)\n", isread ? "read" : "write", cpnum, opc1, crn, crm, opc2, s->ns ? "non-secure" : "secure"); } return 1; }
1threat
error when connection mysql with vaadin : I'm trying to make a connection between mysql and vaadin, when implementing the project, the current browser show error as picture [enter image description here][1] [1]: https://i.stack.imgur.com/Fe2nl.png because I do not know how to insert my code, I posted it to google drriver https://drive.google.com/open?id=1VlcOAiZ1ecYY6SYT6fNBi0IpspVHIJpa
0debug
alert('Hello ' + user_input);
1threat
Generating AWS signature in groovy for soapui : am new to groovy scripting and i required to test AWS Rest API for which Authorization(consist of access_key and signature) is required, Request if anyone have working code available. It is PUT call on AWS S3. I have tried searching and unable to find the same
0debug
How to generate with Dictionary about duplicate values? : public class DataClass { public int Number1 {get; set;} public int Number2 {get; set;} } List<DataClass> list = new List<DataClass>(); list.Add(new DataClass {Number1= 1, Number2 = 100}); list.Add(new DataClass {Number1= 2, Number2 = 100}); list.Add(new DataClass {Number1= 3, Number2 = 101}); list.Add(new DataClass {Number1= 4, Number2 = 102}); list.Add(new DataClass {Number1= 5, Number2 = 103}); list.Add(new DataClass {Number1= 6, Number2 = 104}); list.Add(new DataClass {Number1= 7, Number2 = 104}); I have duplicate value about number2 and I want to generate a Dictionary like to below expect a result. Key = 1, value = {Number1 = 1, Number2 = 100} Key = 1, value = {Number1 = 3, Number2 = 101} Key = 1, value = {Number1 = 4, Number2 = 102} Key = 1, value = {Number1 = 5, Number2 = 103} Key = 1, value = {Number1 = 6, Number2 = 104} Key = 2, value = {Number1 = 2, Number2 = 100} Key = 2, value = {Number1 = 7, Number2 = 104} I would like to receive an optimal algorithm.
0debug
Build google chart by using google script and query function : <p>From a spreadsheet and using google script, </p> <p>I'm trying to select a range of data from a specific sheet with conditions (where) by using 'query' function. But I don't want to regenerate another sheet with the new range of selected data.</p> <p>Next after I would like build/update a chart in another sheet from the same spreadsheet.</p> <p>I didn't find a way to do it.</p> <p>Thank you</p>
0debug
static int mmu_translate_asc(CPUS390XState *env, target_ulong vaddr, uint64_t asc, target_ulong *raddr, int *flags, int rw, bool exc) { uint64_t asce = 0; int level; int r; switch (asc) { case PSW_ASC_PRIMARY: PTE_DPRINTF("%s: asc=primary\n", __func__); asce = env->cregs[1]; break; case PSW_ASC_SECONDARY: PTE_DPRINTF("%s: asc=secondary\n", __func__); asce = env->cregs[7]; break; case PSW_ASC_HOME: PTE_DPRINTF("%s: asc=home\n", __func__); asce = env->cregs[13]; break; } if (asce & _ASCE_REAL_SPACE) { *raddr = vaddr; return 0; } level = asce & _ASCE_TYPE_MASK; switch (level) { case _ASCE_TYPE_REGION1: if ((vaddr >> 62) > (asce & _ASCE_TABLE_LENGTH)) { trigger_page_fault(env, vaddr, PGM_REG_FIRST_TRANS, asc, rw, exc); return -1; } break; case _ASCE_TYPE_REGION2: if (vaddr & 0xffe0000000000000ULL) { DPRINTF("%s: vaddr doesn't fit 0x%16" PRIx64 " 0xffe0000000000000ULL\n", __func__, vaddr); trigger_page_fault(env, vaddr, PGM_TRANS_SPEC, asc, rw, exc); return -1; } if ((vaddr >> 51 & 3) > (asce & _ASCE_TABLE_LENGTH)) { trigger_page_fault(env, vaddr, PGM_REG_SEC_TRANS, asc, rw, exc); return -1; } break; case _ASCE_TYPE_REGION3: if (vaddr & 0xfffffc0000000000ULL) { DPRINTF("%s: vaddr doesn't fit 0x%16" PRIx64 " 0xfffffc0000000000ULL\n", __func__, vaddr); trigger_page_fault(env, vaddr, PGM_TRANS_SPEC, asc, rw, exc); return -1; } if ((vaddr >> 40 & 3) > (asce & _ASCE_TABLE_LENGTH)) { trigger_page_fault(env, vaddr, PGM_REG_THIRD_TRANS, asc, rw, exc); return -1; } break; case _ASCE_TYPE_SEGMENT: if (vaddr & 0xffffffff80000000ULL) { DPRINTF("%s: vaddr doesn't fit 0x%16" PRIx64 " 0xffffffff80000000ULL\n", __func__, vaddr); trigger_page_fault(env, vaddr, PGM_TRANS_SPEC, asc, rw, exc); return -1; } if ((vaddr >> 29 & 3) > (asce & _ASCE_TABLE_LENGTH)) { trigger_page_fault(env, vaddr, PGM_SEGMENT_TRANS, asc, rw, exc); return -1; } break; } r = mmu_translate_region(env, vaddr, asc, asce, level, raddr, flags, rw, exc); if ((rw == 1) && !(*flags & PAGE_WRITE)) { trigger_prot_fault(env, vaddr, asc, rw, exc); return -1; } return r; }
1threat
Python map element with character : <p>I am new to python and i am trying to understand the map() function. Is there a better way of doing this</p> <pre><code> map(lambda x: x+"+" ,map(str,range(5))) output : ['0+', '1+', '2+', '3+', '4+'] </code></pre>
0debug
int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); int max_step [4]; int max_step_comp[4]; if ((unsigned)pix_fmt >= AV_PIX_FMT_NB || desc->flags & AV_PIX_FMT_FLAG_HWACCEL) return AVERROR(EINVAL); av_image_fill_max_pixsteps(max_step, max_step_comp, desc); return image_get_linesize(width, plane, max_step[plane], max_step_comp[plane], desc); }
1threat
golang variable change visibility : i was disturbed by a question, > should we add lock if only one thread write variable, and other thread just read variable? so i write such code to test it package main import ( "fmt" "runtime" "sync" "time" ) var lock sync.RWMutex var i = 0 func main() { runtime.GOMAXPROCS(2) go func() { for { fmt.Println("i am here", i) time.Sleep(time.Second) } }() for { i += 1 } } result is keep print `i am here 0` even after second of time. i know a little about Memory barrier or cpu cache. but how could it be cache for such a long time? i think after a few time, it should read variable i already changed. anyone who master go or computer system could help answer pls? really appreciate!
0debug
void select_soundhw(const char *optarg) { }
1threat
How to trigger off callback after updating state in Redux? : <p>In React, state is not be updated instantly, so we can use callback in <code>setState(state, callback)</code>. But how to do it in Redux?</p> <p>After calling the <code>this.props.dispatch(updateState(key, value))</code>, I need to do something with the updated state immediately.</p> <p>Is there any way I can call a callback with the latest state like what I do in React?</p>
0debug
Global variable not recognized in For loop : <p>I have the following C# script for managing some particle system physics in Unity:</p> <pre><code>//PS Variables ParticleSystem myPS; public List&lt;ParticleCollisionEvent&gt; collisisonEvents; //Physics variables public float effect; // Use this for initialization void Start () { myPS = GetComponent&lt;ParticleSystem&gt;(); collisisonEvents = new List&lt;ParticleCollisionEvent&gt;(); } void OnParticleCollision (GameObject other) { //Checking if the hit object is indeed the ball bool isBall = other.tag.Equals("Player"); if (isBall) { Rigidbody2D hitObject = other.GetComponent&lt;Rigidbody2D&gt;(); //Getting the number of collisions that have occured this frame int numOfCollisions = myPS.GetCollisionEvents(other, collisisonEvents); Vector3 particleDirection = new Vector2(0,0); //Iterating through all the events for (int i = 0; i &lt; numOfCollisions; i++) { //Calculating a resultant direction particleDirection += collisionEvents[i].velocity; } //Applying the resultant force hitObject.AddForce(particleDirection.normalized * effect * numOfCollisions); } } </code></pre> <p>There seems to be a problem with the scope of the <strong>collisionsEvents</strong> list though, as I cannot use it in the for loop in the OnParticleCollision co-routine. I keep on getting the error that "collisionsEvents does not exist in this current context." The variable myPS doesn't have this problem though, and it was declared in the same place as collisionsEvents.</p> <p>Could anyone please help me here?</p>
0debug
Show previous/next only when there is a previous/next page : <p>I am trying to get a pagination on the <code>index.php</code> working. What I come up with yet looks something like this:</p> <pre><code>&lt;nav&gt; &lt;a href="&lt;?php previous_posts(); ?&gt;" class="btn prev-page"&gt;Previous Page&lt;/a&gt; &lt;a href="&lt;?php next_posts(); ?&gt;" class="btn next-page"&gt;Next Page&lt;/a&gt; &lt;/nav&gt; </code></pre> <p>However, I'd like to show the Previous/Next buttons only, when there actually exists a previous/next page. How can I achieve that?</p> <p>Thanks!</p>
0debug
assembly-c from windows 10 command prompt : <p>I'm trying learning assembly language and i need to know how to read the assembly varsion of a c program from the windows 10 command prompt. I've tried using <code>C:\users\prete\Desktop\booksrc$ gcc -g firstprog.c</code> but it doesn't work</p> <p>please help me thank you!</p>
0debug
Failed to link folders with its *.html extension files in perl? : Here is my code and folder. Folder structure: Mus |-- Mus.config |-- Mus.html `-- Mus_Digital |-- Digi_Verification | |-- Digi_Verification.config | |-- Digital_Verification.html | `-- rev1 | |-- _projects_Mus_Mus_Digi_Digi_Verification_rev1.config | `-- _projects_Mus_Mus_Digi_Digi_Verification_rev1.html |-- Mus_Digital.config `-- Mus_Digital.html The above is my obtained directory struture from $output_dir.Here i my code what i really tried is conversion of .config to .html format. Now the problem is if i click Mus folder it should open Mus.html.If i click Mus_Digital it should open Mus_Digital.html and so on.The same procedure should apply for all folders and sub folders and also for href links. Now in my code the href links are not pointing to its *.html(here * denotes anyname before .html).Help to point directly to its html file when the folder is clicked. My code: print"Converting the .config files to .html files at destination location \n"; ##HTML CONVERSION## my @files = File::Find::Rule->file ->name('*.config') ->prune ->in($output_dir); foreach my $file (@files) { my ($name, $root, $ext) = $file =~ m|(.*)/(.*)\.(.*)|; my $outfile = "$name/$root.html"; open my $fh_out, '>', $outfile or die "Can't open $outfile: $!","\n"; my $head = " <!doctype html> <html lang=\"en\"> <head> <meta charset=\"utf-8\"> <title>DCMS_CHECKLIST</title><tr><td></td></tr> </head> <body> <table> <th>SL.NO</th><th>CHECKLIST ITEM</th><th>VALUE</th><th>COMMENTS</th><th>CONFIRMATION</th> <style> .bold { font-weight: bold; } .bold td { border: 0px; } table, th, td { border: 1px solid black; } </style>"; print $fh_out $head ; # write the header open my $fh, '<', $file or die "Can't open $file: $!"; while (my $line=<$fh>) { chomp $line; for($line) { s/\&//g; #s/[\\\_\@\_]//g; s/COMMENT//g; } my @data = split /:/, $line; my $class = $data[0] ? 'normal' : 'bold'; print $fh_out qq[<tr class="$class">]; # my $href="http://iad.sd.aog.com/cps/dev/kb/cms/cms_prects/"; my $check=0; my $dolink=$data[0] !~ m/[\=\%]/; for my $word(@data){ $check++; print $fh_out '<td>'; if($check==1 && $dolink ) { print $fh_out '<a href=".">'.$word.'</a>'; } else { print $fh_out $word;} print $fh_out '</td>'; } } } Here $href variable is the default output directory location.All the output directories will be under this path.
0debug
Editor that supports embedded terminal cross platform? : <p>I use Python a lot across different platforms and I find it very convenient to have a terminal embedded inside the text editor mainly for running Python interactively. I used Atom with the platformio-ide-terminal package for a while, but the terminal crashes a lot on Windows. </p> <p>I also looked at Geany which offers an embedded terminal on Linux and Mac, but not on Windows.</p> <p>Do you know of some other options?</p>
0debug
static void usb_ohci_init(OHCIState *ohci, DeviceState *dev, int num_ports, dma_addr_t localmem_base, char *masterbus, uint32_t firstport, AddressSpace *as, Error **errp) { Error *err = NULL; int i; ohci->as = as; if (usb_frame_time == 0) { #ifdef OHCI_TIME_WARP usb_frame_time = NANOSECONDS_PER_SECOND; usb_bit_time = NANOSECONDS_PER_SECOND / (USB_HZ / 1000); #else usb_frame_time = NANOSECONDS_PER_SECOND / 1000; if (NANOSECONDS_PER_SECOND >= USB_HZ) { usb_bit_time = NANOSECONDS_PER_SECOND / USB_HZ; } else { usb_bit_time = 1; #endif trace_usb_ohci_init_time(usb_frame_time, usb_bit_time); ohci->num_ports = num_ports; if (masterbus) { USBPort *ports[OHCI_MAX_PORTS]; for(i = 0; i < num_ports; i++) { ports[i] = &ohci->rhport[i].port; usb_register_companion(masterbus, ports, num_ports, firstport, ohci, &ohci_port_ops, USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL, &err); if (err) { error_propagate(errp, err); } else { usb_bus_new(&ohci->bus, sizeof(ohci->bus), &ohci_bus_ops, dev); for (i = 0; i < num_ports; i++) { usb_register_port(&ohci->bus, &ohci->rhport[i].port, ohci, i, &ohci_port_ops, USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL); memory_region_init_io(&ohci->mem, OBJECT(dev), &ohci_mem_ops, ohci, "ohci", 256); ohci->localmem_base = localmem_base; ohci->name = object_get_typename(OBJECT(dev)); usb_packet_init(&ohci->usb_packet); ohci->async_td = 0; ohci->eof_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ohci_frame_boundary, ohci);
1threat
void ff_put_h264_qpel8_mc13_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hv_qrt_8w_msa(src + stride - 2, src - (stride * 2), stride, dst, stride, 8); }
1threat
static int lag_decode_zero_run_line(LagarithContext *l, uint8_t *dst, const uint8_t *src, const uint8_t *src_end, int width, int esc_count) { int i = 0; int count; uint8_t zero_run = 0; const uint8_t *src_start = src; uint8_t mask1 = -(esc_count < 2); uint8_t mask2 = -(esc_count < 3); uint8_t *end = dst + (width - 2); output_zeros: if (l->zeros_rem) { count = FFMIN(l->zeros_rem, width - i); if (end - dst < count) { av_log(l->avctx, AV_LOG_ERROR, "Too many zeros remaining.\n"); return AVERROR_INVALIDDATA; } memset(dst, 0, count); l->zeros_rem -= count; dst += count; } while (dst < end) { i = 0; while (!zero_run && dst + i < end) { i++; if (i+2 >= src_end - src) return AVERROR_INVALIDDATA; zero_run = !(src[i] | (src[i + 1] & mask1) | (src[i + 2] & mask2)); } if (zero_run) { zero_run = 0; i += esc_count; memcpy(dst, src, i); dst += i; l->zeros_rem = lag_calc_zero_run(src[i]); src += i + 1; goto output_zeros; } else { memcpy(dst, src, i); src += i; dst += i; } } return src - src_start; }
1threat
int ff_h264_decode_picture_parameter_set(GetBitContext *gb, AVCodecContext *avctx, H264ParamSets *ps, int bit_length) { AVBufferRef *pps_buf; const SPS *sps; unsigned int pps_id = get_ue_golomb(gb); PPS *pps; int qp_bd_offset; int bits_left; int ret; if (pps_id >= MAX_PPS_COUNT) { av_log(avctx, AV_LOG_ERROR, "pps_id %u out of range\n", pps_id); return AVERROR_INVALIDDATA; pps_buf = av_buffer_allocz(sizeof(*pps)); if (!pps_buf) return AVERROR(ENOMEM); pps = (PPS*)pps_buf->data; pps->data_size = gb->buffer_end - gb->buffer; if (pps->data_size > sizeof(pps->data)) { av_log(avctx, AV_LOG_WARNING, "Truncating likely oversized PPS " "(%"SIZE_SPECIFIER" > %"SIZE_SPECIFIER")\n", pps->data_size, sizeof(pps->data)); pps->data_size = sizeof(pps->data); memcpy(pps->data, gb->buffer, pps->data_size); pps->sps_id = get_ue_golomb_31(gb); if ((unsigned)pps->sps_id >= MAX_SPS_COUNT || !ps->sps_list[pps->sps_id]) { av_log(avctx, AV_LOG_ERROR, "sps_id %u out of range\n", pps->sps_id); sps = (const SPS*)ps->sps_list[pps->sps_id]->data; if (sps->bit_depth_luma > 14) { av_log(avctx, AV_LOG_ERROR, "Invalid luma bit depth=%d\n", sps->bit_depth_luma); } else if (sps->bit_depth_luma == 11 || sps->bit_depth_luma == 13) { av_log(avctx, AV_LOG_ERROR, "Unimplemented luma bit depth=%d\n", sps->bit_depth_luma); ret = AVERROR_PATCHWELCOME; pps->cabac = get_bits1(gb); pps->pic_order_present = get_bits1(gb); pps->slice_group_count = get_ue_golomb(gb) + 1; if (pps->slice_group_count > 1) { pps->mb_slice_group_map_type = get_ue_golomb(gb); av_log(avctx, AV_LOG_ERROR, "FMO not supported\n"); switch (pps->mb_slice_group_map_type) { case 0: #if 0 | for (i = 0; i <= num_slice_groups_minus1; i++) | | | | run_length[i] |1 |ue(v) | #endif break; case 2: #if 0 | for (i = 0; i < num_slice_groups_minus1; i++) { | | | | top_left_mb[i] |1 |ue(v) | | bottom_right_mb[i] |1 |ue(v) | | } | | | #endif break; case 3: case 4: case 5: #if 0 | slice_group_change_direction_flag |1 |u(1) | | slice_group_change_rate_minus1 |1 |ue(v) | #endif break; case 6: #if 0 | slice_group_id_cnt_minus1 |1 |ue(v) | | for (i = 0; i <= slice_group_id_cnt_minus1; i++)| | | | slice_group_id[i] |1 |u(v) | #endif break; pps->ref_count[0] = get_ue_golomb(gb) + 1; pps->ref_count[1] = get_ue_golomb(gb) + 1; if (pps->ref_count[0] - 1 > 32 - 1 || pps->ref_count[1] - 1 > 32 - 1) { av_log(avctx, AV_LOG_ERROR, "reference overflow (pps)\n"); qp_bd_offset = 6 * (sps->bit_depth_luma - 8); pps->weighted_pred = get_bits1(gb); pps->weighted_bipred_idc = get_bits(gb, 2); pps->init_qp = get_se_golomb(gb) + 26 + qp_bd_offset; pps->init_qs = get_se_golomb(gb) + 26 + qp_bd_offset; pps->chroma_qp_index_offset[0] = get_se_golomb(gb); if (pps->chroma_qp_index_offset[0] < -12 || pps->chroma_qp_index_offset[0] > 12) { pps->deblocking_filter_parameters_present = get_bits1(gb); pps->constrained_intra_pred = get_bits1(gb); pps->redundant_pic_cnt_present = get_bits1(gb); pps->transform_8x8_mode = 0; memcpy(pps->scaling_matrix4, sps->scaling_matrix4, sizeof(pps->scaling_matrix4)); memcpy(pps->scaling_matrix8, sps->scaling_matrix8, sizeof(pps->scaling_matrix8)); bits_left = bit_length - get_bits_count(gb); if (bits_left > 0 && more_rbsp_data_in_pps(sps, avctx)) { pps->transform_8x8_mode = get_bits1(gb); decode_scaling_matrices(gb, sps, pps, 0, pps->scaling_matrix4, pps->scaling_matrix8); pps->chroma_qp_index_offset[1] = get_se_golomb(gb); } else { pps->chroma_qp_index_offset[1] = pps->chroma_qp_index_offset[0]; build_qp_table(pps, 0, pps->chroma_qp_index_offset[0], sps->bit_depth_luma); build_qp_table(pps, 1, pps->chroma_qp_index_offset[1], sps->bit_depth_luma); init_dequant_tables(pps, sps); if (pps->chroma_qp_index_offset[0] != pps->chroma_qp_index_offset[1]) pps->chroma_qp_diff = 1; if (avctx->debug & FF_DEBUG_PICT_INFO) { av_log(avctx, AV_LOG_DEBUG, "pps:%u sps:%u %s slice_groups:%d ref:%u/%u %s qp:%d/%d/%d/%d %s %s %s %s\n", pps_id, pps->sps_id, pps->cabac ? "CABAC" : "CAVLC", pps->slice_group_count, pps->ref_count[0], pps->ref_count[1], pps->weighted_pred ? "weighted" : "", pps->init_qp, pps->init_qs, pps->chroma_qp_index_offset[0], pps->chroma_qp_index_offset[1], pps->deblocking_filter_parameters_present ? "LPAR" : "", pps->constrained_intra_pred ? "CONSTR" : "", pps->redundant_pic_cnt_present ? "REDU" : "", pps->transform_8x8_mode ? "8x8DCT" : ""); remove_pps(ps, pps_id); ps->pps_list[pps_id] = pps_buf; return 0; fail: av_buffer_unref(&pps_buf); return ret;
1threat
How to use fastScrollEnabled in RecyclerView? : <p>I am new to RecyclerView and I want to implement the fast scroll feature in RecyclerView like google contact application and search on the internet and i found that now Android provide officially New <code>fastScrollEnabled</code> boolean flag for RecyclerView. So my question is can someone provide the sample implementation of it.</p> <p>Here is the official document from google <a href="https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-0" rel="noreferrer">https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-0</a></p>
0debug
How to show dropdown Animation for a list(RecyclerView) under Edittext? : <p>I am trying to show drop-down list using recycler view under edit text.</p> <p>Recycler view supposed to slide down from behind Edit-text but it gets visible before sliding down.<a href="https://i.stack.imgur.com/HTgQm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HTgQm.png" alt="As you can see recycler view is sliding down from behind the edit text but it is also visible before the edit text"></a><a href="https://i.stack.imgur.com/OSFht.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OSFht.png" alt="Recycler view is completely visible in the second picture as a drop-down list "></a></p>
0debug
Something going wrong in mysqli_query : <p>I am newbie and learning php yet. I am trying to run some mysqli_query but its giving me some errors. My code is like below.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php ob_start(); include("db.php"); $result = mysqli_query($conn,"SELECT * FROM contest"); while($row = $result-&gt;fetch_assoc()){ if($row['automated'] ==1){ echo 'Atomatic is enabled'; $result1 = mysqli_query($conn,"UPDATE `contest` SET automated =0" $new = mysqli_query($conn,$result1); echo 'Atomatic is Disabled'; } else{ echo 'Atomatic is Disabled'; } }</code></pre> </div> </div> </p> <p>can somebody check and please suggest me whats wrong in this query ? its giving me error like <strong>Parse error: syntax error, unexpected '$new'</strong> and similar if I change it. Thanks</p>
0debug
static void termsig_handler(int signum) { state = TERMINATE; qemu_notify_event(); }
1threat