problem
stringlengths
26
131k
labels
class label
2 classes
How to pass data from one view controller to another in container view? : <p>Here I am displaying view controllers in a container view and here I need to pass the multiple data but here nothing had been passed from the view controller to another can anyone help me how to implement this ?</p> <p>here is my code shown below</p> <pre><code>let controller:PaymentViewController = self.storyboard!.instantiateViewController(withIdentifier: "paymentPage") as! PaymentViewController controller.view.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: self.view.frame.size.height) controller.carrierCode = self.responseData[0].carrierCode controller.methodCode = self.responseData[0].methodCode controller.willMove(toParentViewController: self) self.view.addSubview(controller.view) self.addChildViewController(controller) controller.didMove(toParentViewController: self) controller.guestShippingAddressModel = self.guestShippingAddressModel </code></pre> <p>and I tried to pass model class data to another using user defaults but it was not successful and I used below data</p> <p>here is my code </p> <pre><code> if let jsonData = try? JSONEncoder().encode(self.guestShippingAddressModel) { print("To Save:", jsonData) //Save as data UserDefaults.standard.set(jsonData,forKey: "guestAddress") } </code></pre> <p>to decode model class data I was using below code</p> <pre><code>if let data = UserDefaults.standard.data(forKey: "guestAddress"), let sorts = try? JSONDecoder().decode(GuestAddress.self, from: data) { print("Retrieved:", sorts) self.guestShippingAddressModel = sorts } </code></pre>
0debug
PHP check if a word consists of only three repeated characters : I retrieve results from a MySQL database, basically just a list of words. Occasionally a word will consist of only three repeated characters. How do I detect these words and strip off the two additional characters? My best bet is using strlen to find three letter words, then explode and compare, then substr to strip off the extra characters, but that seems cumbersome. Is there an easy way? Sample data: house, dog, tree, aaa, cat, computer, sss, pink Expected output: house, dog, tree, a, cat, computer, s, pink Help appreciated!
0debug
TypeScript enum to object array : <p>I have an enum defined this way:</p> <pre><code>export enum GoalProgressMeasurements { Percentage = 1, Numeric_Target = 2, Completed_Tasks = 3, Average_Milestone_Progress = 4, Not_Measured = 5 } </code></pre> <p>However, I'd like it to be represented as an object array/list from our API like below:</p> <pre><code>[{id: 1, name: 'Percentage'}, {id: 2, name: 'Numeric Target'}, {id: 3, name: 'Completed Tasks'}, {id: 4, name: 'Average Milestone Progress'}, {id: 5, name: 'Not Measured'}] </code></pre> <p>Is there are easy and native way to do this or do I have to build a function that casts the enum to both an int and a string, and build the objects into an array?</p>
0debug
Angular 6 View is not updated after changing a variable within subscribe : <p>Why is the view not being updated when a variable changes within a subscribe?</p> <p>I have this code:</p> <p><strong>example.component.ts</strong></p> <pre><code>testVariable: string; ngOnInit() { this.testVariable = 'foo'; this.someService.someObservable.subscribe( () =&gt; console.log('success'), (error) =&gt; console.log('error', error), () =&gt; { this.testVariable += '-bar'; console.log('completed', this.testVariable); // prints: foo-Hello-bar } ); this.testVariable += '-Hello'; } </code></pre> <p><strong>example.component.html</strong></p> <pre><code>{{testVariable}} </code></pre> <p>But the view displays: <em>foo-Hello</em>.</p> <p>Why won't it display: <em>foo-Hello-bar</em>?</p> <p>If I call <code>ChangeDetectorRef.detectChanges()</code> within the subscribe it will display the proper value, but why do I have to do this?</p> <p>I shouldn't be calling this method from every subscribe, or, at all (angular should handle this). Is there a right way?</p> <p>Did I miss something in the update from Angular/rxjs 5 to 6?</p> <p>Right now I have Angular version 6.0.2 and rxjs 6.0.0. The same code works ok in Angular 5.2 and rxjs 5.5.10 without the need of calling <code>detectChanges</code>.</p>
0debug
static inline bool use_goto_tb(DisasContext *s, int n, uint64_t dest) { if (s->base.singlestep_enabled || s->ss_active || (s->base.tb->cflags & CF_LAST_IO)) { return false; } #ifndef CONFIG_USER_ONLY if ((s->base.tb->pc & TARGET_PAGE_MASK) != (dest & TARGET_PAGE_MASK)) { return false; } #endif return true; }
1threat
I am wring program that sorts three integers.But I am not getting result for the input {1,3,2}.Probably some logic mistake in the 4th if statement : // program to sorting 3 double. import java.util.*; public class Sorting { public static void main ( String [] args){ Scanner in= new Scanner(System.in); System.out.println("Input the numbers for sorting"); double num1=in.nextDouble(); double num2=in.nextDouble(); double num3=in.nextDouble(); double a=0; double b=0; double c=0; if((num1>num2)&&(num2>num3)){ a=num1; b=num2; c=num3; } if ((num1>num2)&&(num3>num2)){ a=num1; b=num3; c=num2; } if ((num2>num1)&&(num1>num3)){ a=num2; b=num1; c=num3; } if ((num2>num1)&&(num3>num1)){ a=num2; b=num3; c=num1; } if ((num3>num1)&&(num1>num2)){ a=num3; b=num1; c=num2; } if ((num3>num1)&&(num2>num1)){ a=num3; b=num2; c=num1; } System.out.println(" The numbers are in" +c+"< "+b+ "< " +a); } }
0debug
Condition and & or : I have a problem with my condition. I would like the variable (tabPoint) must be inferior to 5 and superior to 100. Can you help me please ? Here is my code: Thank you to advance def demand(nb): tabName = []; tabPoint = []; for i in range(nb): tabName.append(raw_input("Name of the jumper " + str(i+1) + " : ")) tabPoint.append(input("1st jump " + tabName [i] + " The number must be between 10 and 100: " )); if int (tabPoint[i] < 5 ) and int (tabPoint[i] > 100): tabPoint.append(input("The number must be between 10 and 100 " )); return tabName, tabPoint; name, point = demand(3) print(name, point);
0debug
How to call a function with some return type from function of Main class in Java? : <p>I am writing a java program to search a character/word in multiple files, so I am accepting the list of Keywords to search in command line argument i.e. String[] args, and I want to store there values in a ArrayList object.</p> <p>I have main class name : <strong>CharSearchTool</strong>, Another class in same package : <strong>ArrayListFromParameters</strong></p> <pre><code>package com.charsearchtool; public class CharSearchTool { public static void main(String[] args) { ArrayListFromParameters arrayList = new ArrayListFromParameters(args); System.out.println(arrayList.list); } } package com.charsearchtool; import java.util.ArrayList; public class ArrayListFromParameters { ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); public ArrayList&lt;String&gt; ArrayListFromParameters(String[] argument) { for (int i = 0; i &lt; argument.length; i++) { list.add(argument[i]); } return (list); } } </code></pre> <p>I am getting error on below line :</p> <pre><code>ArrayListFromParameters arrayList = new ArrayListFromParameters(args); </code></pre> <p><strong>Error : The constructor ArrayListParameters(String[]) is undefined.</strong></p>
0debug
void rgb8tobgr8(const uint8_t *src, uint8_t *dst, unsigned int src_size) { unsigned i; unsigned num_pixels = src_size; for(i=0; i<num_pixels; i++) { unsigned b,g,r; register uint8_t rgb; rgb = src[i]; r = (rgb&0x07); g = (rgb&0x38)>>3; b = (rgb&0xC0)>>6; dst[i] = ((b<<1)&0x07) | ((g&0x07)<<3) | ((r&0x03)<<6); } }
1threat
alert('Hello ' + user_input);
1threat
React Native for small size apk with low internet bandwidth : <p>I am planning to develop an app for emerging market with low internet bandwidth. The app heavily requires an internet connection to function. <br /> I need this app to have a small apk size (not more than <strong>10mb</strong>) and work on <strong>3G</strong> network. <br /> Based on my research if I remove <strong>x86</strong> JS binary files from React Native the apk size could be as small as 4mb. I suppose the 4mb does not include the JS files and images so client needs to download that first time when he/she opens the app, is that correct?<br /> Would it in general be a good idea for me to use React Native if I want an app with less than 10mb apk size that works on 3G and what are the best practices to make it efficient?</p>
0debug
how to extract an array with two different id's using PHP : how to extract an array with to different id's image below show sample [image sample below][1] [1]: https://i.stack.imgur.com/aWWbk.jpg
0debug
My first Prime Faces Responsive project : <p>For my bachelor degree I need to develop a responsive Web Application using JSF and Prime Faces. My problem is that I have no clue of how to start it. Can you recommend me what tools should I use (all of them)? Where can I find a "Hello world!" like tutorial, explained for users with no experience? From where can I get UI components like buttons, menus, etc? Thank you very much. PS: English is not my native language.</p>
0debug
How to query nested Embeded objects using Room Persistance Library in android? : <p>Consider I have 3 classes User, Address, Location </p> <pre><code>class Address { public String street; public String state; public String city; @ColumnInfo(name = "post_code") public int postCode; @Embedded(prefix = "home_") public Location homeLocation; @Embedded(prefix = "office_") public Location officeLocation; } class Location{ public long lat; public long lng; } @Entity class User { @PrimaryKey public int id; public String firstName; @Embedded(prefix = "addr_") public Address address; } </code></pre> <p>How should i write the query to get the users whose home location is between certain latitude and longitude boundary ? </p> <p>Ex: If i want to find all users whose home location is between these two points Location1(13.135795,77.360348) &amp; Location2(12.743639, 77.901424). My query would look something like this -</p> <blockquote> <p>select * from User where address.homelocation.lat &lt; :l1_latitude &amp;&amp; address.homelocation.lat > l2_latitude &amp;&amp; address.homelocation.lng > :l1_longitude &amp;&amp; address.homelocation.lng &lt; :l2_longitude</p> </blockquote> <p>If i have to use prefix in the embedded location from my understanding, correct me if am wrong, all the fields inside address will get appended with prefix. So i can query city as addr_city and if i have to query lat inside the homeLocation then will it become addr_home_lat ?</p> <p>Is nested embedded objects permitted in room database? If yes then how do i query the nested embedded objects? </p> <p>Need some help here. Thank you. </p>
0debug
OCaml main fuction : I a bit new in OCaml and I am finishing my card game program. I need a main function to run the others functions. I try this: let main () = let deck = make_mazo in let jugadores = players [] 0 in dothemagic deck jugadores 0 [] [] [];; But i get this error: File "game.ml", line 329, characters 37-39: Error: Syntax error I think ;; is the problem and I need a different way to end the code. Also try with only ; and the problem is the same.
0debug
static int jp2_find_codestream(Jpeg2000DecoderContext *s) { uint32_t atom_size, atom, atom_end; int search_range = 10; while (search_range && bytestream2_get_bytes_left(&s->g) >= 8) { atom_size = bytestream2_get_be32u(&s->g); atom = bytestream2_get_be32u(&s->g); atom_end = bytestream2_tell(&s->g) + atom_size - 8; if (atom == JP2_CODESTREAM) return 1; if (bytestream2_get_bytes_left(&s->g) < atom_size || atom_end < atom_size) return 0; if (atom == JP2_HEADER && atom_size >= 16) { uint32_t atom2_size, atom2, atom2_end; do { atom2_size = bytestream2_get_be32u(&s->g); atom2 = bytestream2_get_be32u(&s->g); atom2_end = bytestream2_tell(&s->g) + atom2_size - 8; if (atom2_size < 8 || atom2_end > atom_end || atom2_end < atom2_size) break; atom2_size -= 8; if (atom2 == JP2_CODESTREAM) { return 1; } else if (atom2 == MKBETAG('c','o','l','r') && atom2_size >= 7) { int method = bytestream2_get_byteu(&s->g); bytestream2_skipu(&s->g, 2); if (method == 1) { s->colour_space = bytestream2_get_be32u(&s->g); } else if (atom2 == MKBETAG('p','c','l','r') && atom2_size >= 6) { int i, size, colour_count, colour_channels, colour_depth[3]; uint32_t r, g, b; colour_count = bytestream2_get_be16u(&s->g); colour_channels = bytestream2_get_byteu(&s->g); colour_depth[0] = (bytestream2_get_byteu(&s->g) & 0x7f) + 1; colour_depth[1] = (bytestream2_get_byteu(&s->g) & 0x7f) + 1; colour_depth[2] = (bytestream2_get_byteu(&s->g) & 0x7f) + 1; size = (colour_depth[0] + 7 >> 3) * colour_count + (colour_depth[1] + 7 >> 3) * colour_count + (colour_depth[2] + 7 >> 3) * colour_count; if (colour_count > 256 || colour_channels != 3 || colour_depth[0] > 16 || colour_depth[1] > 16 || colour_depth[2] > 16 || atom2_size < size) { avpriv_request_sample(s->avctx, "Unknown palette"); s->pal8 = 1; for (i = 0; i < colour_count; i++) { if (colour_depth[0] <= 8) { r = bytestream2_get_byteu(&s->g) << 8 - colour_depth[0]; r |= r >> colour_depth[0]; } else { r = bytestream2_get_be16u(&s->g) >> colour_depth[0] - 8; if (colour_depth[1] <= 8) { g = bytestream2_get_byteu(&s->g) << 8 - colour_depth[1]; r |= r >> colour_depth[1]; } else { g = bytestream2_get_be16u(&s->g) >> colour_depth[1] - 8; if (colour_depth[2] <= 8) { b = bytestream2_get_byteu(&s->g) << 8 - colour_depth[2]; r |= r >> colour_depth[2]; } else { b = bytestream2_get_be16u(&s->g) >> colour_depth[2] - 8; s->palette[i] = 0xffu << 24 | r << 16 | g << 8 | b; } else if (atom2 == MKBETAG('c','d','e','f') && atom2_size >= 2) { int n = bytestream2_get_be16u(&s->g); for (; n>0; n--) { int cn = bytestream2_get_be16(&s->g); int av_unused typ = bytestream2_get_be16(&s->g); int asoc = bytestream2_get_be16(&s->g); if (cn < 4 && asoc < 4) s->cdef[cn] = asoc; } else if (atom2 == MKBETAG('r','e','s',' ') && atom2_size >= 18) { int64_t vnum, vden, hnum, hden, vexp, hexp; uint32_t resx; bytestream2_skip(&s->g, 4); resx = bytestream2_get_be32u(&s->g); if (resx != MKBETAG('r','e','s','c') && resx != MKBETAG('r','e','s','d')) { vnum = bytestream2_get_be16u(&s->g); vden = bytestream2_get_be16u(&s->g); hnum = bytestream2_get_be16u(&s->g); hden = bytestream2_get_be16u(&s->g); vexp = bytestream2_get_byteu(&s->g); hexp = bytestream2_get_byteu(&s->g); if (vexp > hexp) { vexp -= hexp; hexp = 0; } else { hexp -= vexp; vexp = 0; if ( INT64_MAX / (hnum * vden) > pow(10, hexp) && INT64_MAX / (vnum * hden) > pow(10, vexp)) av_reduce(&s->sar.den, &s->sar.num, hnum * vden * pow(10, hexp), vnum * hden * pow(10, vexp), INT32_MAX); } while (atom_end - atom2_end >= 8); } else { search_range--; bytestream2_seek(&s->g, atom_end, SEEK_SET); return 0;
1threat
How could I use const in vue template? : <p>I tried to defined a const in a <code>*.vue</code> file </p> <pre><code>&lt;script&gt; export const CREATE_ACTION = 1 export const UPDATE_ACTION = 2 &lt;script&gt; </code></pre> <p>and use them in template</p> <pre><code>&lt;template&gt; ... &lt;select :disabled="mode === UPDATE_ACTION"&gt; .... &lt;/template&gt; </code></pre> <p>but it seems not work. So, how could I use const in vue template?</p>
0debug
Non Responsive Webpage (Mobile) : <p>hey guys i'm relatively new to css/html/responsiveness design so sorry if this is a basic question. i'm trying to make a certain page take the full width on mobile devices.</p> <p>the issue being, on the following page, the largest container still only takes 3/4's of viewport in mobile: </p> <p><a href="http://stkildafitnesstrainer.com.au/our-trainers.html" rel="nofollow noreferrer">http://stkildafitnesstrainer.com.au/our-trainers.html</a></p> <p>i've tried: width = device-width, height = device-height, user-scalable = no, which works as a quick fix but obviously is by no means ideal as it alienates those who need zoom so am not going to use this. </p> <p>the rest of the pages (like: <a href="http://stkildafitnesstrainer.com.au/about-us.html" rel="nofollow noreferrer">http://stkildafitnesstrainer.com.au/about-us.html</a>) take up the full width. i'm not really sure how else i should tackle this.</p>
0debug
Swift Hello World on appcelerator : im appcelerator new sorry. I just Want to know how hyperloop works. how can i put this in appcelrator? or need to be javascript? println(&quot;Hello world&quot;)
0debug
Virtual Memory,Page size,Maximum Virtual address : In a paging system a virtual address consists of 24 bits in which 16 bits are displacement and 8 bits for page number. Calculate (a) Page size (b) Maximum number of pages (c) Maximum virtual address space
0debug
C++ code to Java, few questions : <p>I got a code but it's C++ which I don't know. But there are many similarities between C++ and Java in my opinion. The only things I don't know what they mean / how to write them in Java are these:</p> <pre><code>u = getNextUglyNumber(twoQ, threeQ, fiveQ, &amp;q); //and what is &amp;q, the &amp;? twoQ.push(u &lt;&lt; 1); //what is &lt;&lt; ? std::cout &lt;&lt; u &lt;&lt; ' '; //this i dont understand at all *q = 2; // same as q = 2*q? if (fiveQ.front() &lt; u) { u = fiveQ.front(); //whats front? </code></pre> <p>Thanks a lot in advance for any kind of help!</p> <p>Here is also the full code:</p> <pre><code>typedef std::queue&lt;int&gt; Queue; int findNthUglyNumber(int n) { Queue twoQ, threeQ, fiveQ; twoQ.push(2); threeQ.push(3); fiveQ.push(5); int u, q; while (n) { u = getNextUglyNumber(twoQ, threeQ, fiveQ, &amp;q); switch (q) { case 2: twoQ.push(u &lt;&lt; 1); /// u * 2 case 3: threeQ.push(u &lt;&lt; 2 - u); /// u * 3 case 5: fiveQ.push(u &lt;&lt; 2 + u); /// u * 5 } n--; std::cout &lt;&lt; u &lt;&lt; ' '; } return u; } int getNextUglyNumber(Queue &amp;twoQ, Queue &amp;threeQ, Queue &amp;fiveQ, int &amp;q) { int u = twoQ.front(); *q = 2; if (threeQ.front() &lt; u) { u = threeQ.front(); *q = 3; } if (fiveQ.front() &lt; u) { u = fiveQ.front(); *q = 5; } switch (*q) { case 2: twoQ.pop(); break; case 3: threeQ.pop(); break; case 5: fiveQ.pop(); break; } return u; } </code></pre>
0debug
block_crypto_create_opts_init(QCryptoBlockFormat format, QemuOpts *opts, Error **errp) { Visitor *v; QCryptoBlockCreateOptions *ret = NULL; Error *local_err = NULL; ret = g_new0(QCryptoBlockCreateOptions, 1); ret->format = format; v = opts_visitor_new(opts); visit_start_struct(v, NULL, NULL, 0, &local_err); if (local_err) { goto out; } switch (format) { case Q_CRYPTO_BLOCK_FORMAT_LUKS: visit_type_QCryptoBlockCreateOptionsLUKS_members( v, &ret->u.luks, &local_err); break; default: error_setg(&local_err, "Unsupported block format %d", format); break; } if (!local_err) { visit_check_struct(v, &local_err); } visit_end_struct(v, NULL); out: if (local_err) { error_propagate(errp, local_err); qapi_free_QCryptoBlockCreateOptions(ret); ret = NULL; } visit_free(v); return ret; }
1threat
Diff between commits in Visual Studio 2015 using git : <p>Using Visual Studio 2015 Update 2 and git as source control, how do you diff between 2 commits on a branch? Note that I am not talking about diff on the granular <strong>file level</strong> (ie. view history of file and comparing), but rather for entire commits. </p> <p>I would expect to be able to compare when looking at the history of a branch, but the option does not exist. Here's the right click menu I see when I right click on a commit when viewing the history of a branch:</p> <p><a href="https://i.stack.imgur.com/DpMuC.png"><img src="https://i.stack.imgur.com/DpMuC.png" alt="enter image description here"></a></p> <p>Where's the compare??</p>
0debug
using java script How to print the star pattern? : i want print the below star pattern using java script ***** *** * *** ***** and i am trying this code and i am getting off triangle below is my js code <!doctype html> <html> <head></head> <body> <script> for(i = 3;i>= 1; i--) { /* Printing spaces */ for(j = 0; j <= 3-i; j++) { document.write("&nbsp"); } /* Printing stars */ k = 0; while(k != (2*i - 1)) { document.write("*"); k++; } document.write("<br/>") } </script> </body> </html>
0debug
static void scsi_dma_complete(void *opaque, int ret) { SCSIDiskReq *r = (SCSIDiskReq *)opaque; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); if (r->req.aiocb != NULL) { r->req.aiocb = NULL; bdrv_acct_done(s->qdev.conf.bs, &r->acct); } if (ret < 0) { if (scsi_handle_rw_error(r, -ret)) { goto done; } } r->sector += r->sector_count; r->sector_count = 0; if (r->req.cmd.mode == SCSI_XFER_TO_DEV) { scsi_write_do_fua(r); return; } else { scsi_req_complete(&r->req, GOOD); } done: if (!r->req.io_canceled) { scsi_req_unref(&r->req); } }
1threat
How to compair NString when it is converted from NSArray in objective c : I am new in iOS. And I am facing a problem in a code array=[[NSMutableArray alloc] init]; array =[responsedict valueForKey:@"Type"]; NSLog(@"Type Array =%@",array); for (int i =0; i<[array count]; i++) { if (array.count>0) { typeString = [NSMutableString stringWithFormat:@"%@", [array objectAtIndex:i]]; NSLog(@"Type String =%@",typeString); } } I am getting the value in String as Type String =1 Type String =2 Now I need to compair the String in cellForRowAtIndexPath if ([typeString isEqual:@"1"]) { cell.IBTiconlbl.textColor = [UIColor blueColor]; } if ([typeString isEqual:@"2"]) { cell.IBTiconlbl.textColor = [UIColor redColor]; } But it convert the textcolour only in readColor not in blue colour.String contain both the value 1 and 2.I need to convert the text colour in blue when string value is 1 and in red when string value is 2.But it only perform the one operation. Please help!!
0debug
static void xenfb_copy_mfns(int mode, int count, unsigned long *dst, void *src) { uint32_t *src32 = src; uint64_t *src64 = src; int i; for (i = 0; i < count; i++) dst[i] = (mode == 32) ? src32[i] : src64[i]; }
1threat
CSS architecture with React that also can be themed : <p>I'm currently building out a large React app. Css, has never been my strong point. But now CSS has sass / cssNext / inline styles with React. I've been using BEM with sass, but as my other applications have grown huge even that starts to break down. Especially when you had on the ability to "re-skin" or "theme" the pages outside of the primary color schemes etc..</p> <p>so -- can someone point me to a proven way to create css with react that can scale very well, and allows for custome theme'ing when people want to borrow my components. For instance, </p> <pre><code>&lt;MyComponent /&gt; // this component has its styles but lets say Joe Schmoe wants be import // it? But, Joe wants to overlay his custom styles? // Is there a new paradigm that allows for an overlay or reskin within the component? </code></pre> <p>Or even the idea of the whole application being skinnable some time down the line. I know this is sorta a very base question, but whenever I build out projects my pain points also seem to be the CSS - so I want to know what really works.</p>
0debug
When should be the condition of my loop : <p>In my program, when my two rectangles match, the score increments by one. But it only works once. I understand that I need to put a loop in my program, I'm just having some trouble what the condition should be. Instead of an if statement I put a while() loop and it still didn't work. Please help. You will see where the problem starts, I'll put a comment.</p> <pre><code>import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.layout.Pane; import javafx.scene.control.*; import javafx.event.Event; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.shape.*; import javafx.scene.paint.Color; import javafx.animation.PathTransition; import javafx.animation.Timeline; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import javafx.util.Duration; import java.lang.*; import java.util.logging.Level; import java.util.logging.Logger; import javafx.animation.FadeTransition; import javafx.geometry.Bounds; public class TransoFo extends Application{ public void start(Stage stage) { Pane p = new Pane(); Button b = new Button("Play"); b.setStyle("-fx-background-radius: 3em;" + "-fx-background-color: #66a3ff;" + "-fx-min-width: 120;" + "-fx-min-height: 40;" + "-fx-max-width: 120;" + "-fx-min-height: 40;" + "-fx-cursor: hand;" + "-fx-text-fill: white;"); b.setLayoutX(307); b.setLayoutY(400); Circle bi = new Circle(); Rectangle biRec = new Rectangle(); Circle circle = new Circle(); Rectangle rec = new Rectangle(); rec.setWidth(20); rec.setHeight(30); rec.setArcWidth(5); rec.setArcHeight(5); rec.setStyle("-fx-fill: #ff9933;" + "-fix-stroke-width: 20;" + "-fix-stroke: #ff4d4d;"); circle.setStyle("-fx-fill: #88ff4d;" + "-fx-stroke-width: 12;" + "-fx-stroke: #3399ff;"); circle.setCenterX(370); circle.setCenterY(250); circle.setRadius(50); biRec.setWidth(30); biRec.setHeight(20); biRec.setArcWidth(5); biRec.setArcHeight(5); biRec.setStyle("-fx-fill: #ff9933;" + "-fix-stroke-width: 20;" + "-fix-stroke: #ff4d4d;"); bi.setStyle("-fx-fill: #88ff4d;" + "-fx-stroke-width: 12;" + "-fx-stroke: #3399ff;"); bi.setCenterX(370); bi.setCenterY(250); bi.setRadius(100); p.getChildren().addAll(bi, biRec, circle, rec); // transition for small circle and rectangle PathTransition pt1 = new PathTransition(); pt1.setDuration(Duration.millis(1200)); pt1.setPath(bi); pt1.setNode(biRec); pt1.setOrientation(PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT); pt1.setCycleCount(Timeline.INDEFINITE); pt1.setAutoReverse(false); pt1.play(); // next path transition PathTransition pt3 = new PathTransition(); pt3.setDuration(Duration.millis(800)); pt3.setPath(circle); pt3.setNode(rec); pt3.setOrientation(PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT); pt3.setCycleCount(Timeline.INDEFINITE); pt3.setAutoReverse(false); pt3.play(); b.setOnAction((ActionEvent event) -&gt; { bi.setVisible(false); biRec.setVisible(false); circle.setVisible(false); rec.setVisible(false); b.setVisible(false); Circle big = new Circle(); Rectangle bigRec = new Rectangle(); Circle circ = new Circle(); Rectangle r = new Rectangle(); r.setWidth(20); r.setHeight(30); r.setArcWidth(5); r.setArcHeight(5); r.setStyle("-fx-fill: #ff9933;" + "-fix-stroke-width: 20;" + "-fix-stroke: #ff4d4d;"); circ.setStyle("-fx-fill: #88ff4d;" + "-fx-stroke-width: 12;" + "-fx-stroke: #3399ff;"); circ.setCenterX(370); circ.setCenterY(300); circ.setRadius(50); bigRec.setWidth(30); bigRec.setHeight(20); bigRec.setArcWidth(5); bigRec.setArcHeight(5); bigRec.setStyle("-fx-fill: #ff9933;" + "-fix-stroke-width: 20;" + "-fix-stroke: #ff4d4d;"); big.setStyle("-fx-fill: #88ff4d;" + "-fx-stroke-width: 12;" + "-fx-stroke: #3399ff;"); big.setCenterX(370); big.setCenterY(300); big.setRadius(100); PathTransition pt2 = new PathTransition(); pt2.setDuration(Duration.millis(1200)); pt2.setPath(big); pt2.setNode(bigRec); pt2.setOrientation(PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT); pt2.setCycleCount(Timeline.INDEFINITE); pt2.setAutoReverse(true); pt2.play(); PathTransition pt = new PathTransition(); pt.setDuration(Duration.millis(800)); pt.setPath(circ); pt.setNode(r); pt.setOrientation(PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT); pt.setCycleCount(Timeline.INDEFINITE); pt.setAutoReverse(false); pt.play(); Button b2 = new Button(" | | "); b2.setStyle("-fx-background-radius: 3em;" + "-fx-background-color: #66a3ff;" + "-fx-min-width: 70;" + "-fx-min-height: 40;" + "-fx-max-width: 700;" + "-fx-min-height: 40;" + "-fx-cursor: cursor;" + "-fx-text-fill: white;"); b2.setLayoutX(670); b2.setLayoutY(10); b2.setOnAction((ActionEvent event1) -&gt; { pt2.stop(); pt.stop(); }); Button b3 = new Button(" ▶ "); b3.setStyle("-fx-background-radius: 3em;" + "-fx-background-color: #66a3ff;" + "-fx-min-width: 70;" + "-fx-min-height: 40;" + "-fx-max-width: 700;" + "-fx-min-height: 40;" + "-fx-cursor: hand;" + "-fx-text-fill: white;"); b3.setLayoutX(590); b3.setLayoutY(10); b3.setOnAction((ActionEvent event2) -&gt; { pt.play(); pt2.play(); }); Button match = new Button(" Match "); match.setStyle("-fx-background-radius: 3em;" + "-fx-background-color: #66a3ff;" + "-fx-min-width: 120;" + "-fx-min-height: 40;" + "-fx-max-width: 120;" + "-fx-min-height: 40;" + "-fx-cursor: hand;" + "-fx-text-fill: white;"); match.setLayoutX(310); match.setLayoutY(450); match.setOnAction((ActionEvent evt) -&gt; { Bounds bBounds = bigRec.getBoundsInParent(); Bounds bounds = r.getBoundsInParent(); // problem starts here int total = 0; if (bounds.getMinY() &lt;= bBounds.getMaxY() &amp;&amp; bounds.getMaxY() &gt;= bBounds.getMinY()) { total += 1; String str = Integer.toString(total); Label score = new Label(str); score.setFont(new Font("Courier New bold", 20)); score.setLayoutX(100); score.setLayoutY(200); p.getChildren().add(score); pt.stop(); pt2.stop(); try { Thread.sleep(1000); pt.play(); pt2.play(); } catch (Exception e) {} } // end the event }); p.getChildren().addAll(big, bigRec, circ, r, b2, b3, match); FadeTransition ft = new FadeTransition(Duration.millis(1500), big); ft.setFromValue(0.1); ft.setToValue(1); ft.play(); //transition for big rec FadeTransition ft2 = new FadeTransition(Duration.millis(1500), bigRec); ft2.setFromValue(0.1); ft2.setToValue(1); ft2.play(); //transition for circ FadeTransition ft3 = new FadeTransition(Duration.millis(1500), circ); ft3.setFromValue(0.1); ft3.setToValue(1); ft3.play(); //transition for r FadeTransition ft4 = new FadeTransition(Duration.millis(1500), r); ft4.setFromValue(0.1); ft4.setToValue(1); ft4.play(); //transition for match FadeTransition ft5 = new FadeTransition(Duration.millis(1500), match); ft5.setFromValue(0.1); ft5.setToValue(1); ft5.play(); //transition for pause button FadeTransition ft6 = new FadeTransition(Duration.millis(3000), b2); ft6.setFromValue(0.1); ft6.setToValue(1); ft6.play(); //transtion for play button FadeTransition ft7 = new FadeTransition(Duration.millis(3000), b3); ft7.setFromValue(0.1); ft7.setToValue(1); ft7.play(); }); p.getChildren().add(b); p.setStyle("-fx-background-color: #88ff4d;"); Scene s = new Scene(p, 750, 650); stage.setResizable(false); stage.setScene(s); stage.show(); } // launch Application public static void main(String[] args) { Application.launch(args); } } </code></pre>
0debug
static void apply_dependent_coupling_fixed(AACContext *ac, SingleChannelElement *target, ChannelElement *cce, int index) { IndividualChannelStream *ics = &cce->ch[0].ics; const uint16_t *offsets = ics->swb_offset; int *dest = target->coeffs; const int *src = cce->ch[0].coeffs; int g, i, group, k, idx = 0; if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP) { av_log(ac->avctx, AV_LOG_ERROR, "Dependent coupling is not supported together with LTP\n"); return; } for (g = 0; g < ics->num_window_groups; g++) { for (i = 0; i < ics->max_sfb; i++, idx++) { if (cce->ch[0].band_type[idx] != ZERO_BT) { const int gain = cce->coup.gain[index][idx]; int shift, round, c, tmp; if (gain < 0) { c = -cce_scale_fixed[-gain & 7]; shift = (-gain-1024) >> 3; } else { c = cce_scale_fixed[gain & 7]; shift = (gain-1024) >> 3; } if (shift < -31) { } else if (shift < 0) { shift = -shift; round = 1 << (shift - 1); for (group = 0; group < ics->group_len[g]; group++) { for (k = offsets[i]; k < offsets[i + 1]; k++) { tmp = (int)(((int64_t)src[group * 128 + k] * c + \ (int64_t)0x1000000000) >> 37); dest[group * 128 + k] += (tmp + round) >> shift; } } } else { for (group = 0; group < ics->group_len[g]; group++) { for (k = offsets[i]; k < offsets[i + 1]; k++) { tmp = (int)(((int64_t)src[group * 128 + k] * c + \ (int64_t)0x1000000000) >> 37); dest[group * 128 + k] += tmp << shift; } } } } } dest += ics->group_len[g] * 128; src += ics->group_len[g] * 128; } }
1threat
static inline int get_cabac_cbf_ctx( H264Context *h, int cat, int idx ) { int nza, nzb; int ctx = 0; if( cat == 0 ) { nza = h->left_cbp&0x100; nzb = h-> top_cbp&0x100; } else if( cat == 1 || cat == 2 ) { nza = h->non_zero_count_cache[scan8[idx] - 1]; nzb = h->non_zero_count_cache[scan8[idx] - 8]; } else if( cat == 3 ) { nza = (h->left_cbp>>(6+idx))&0x01; nzb = (h-> top_cbp>>(6+idx))&0x01; } else { assert(cat == 4); nza = h->non_zero_count_cache[scan8[16+idx] - 1]; nzb = h->non_zero_count_cache[scan8[16+idx] - 8]; } if( nza > 0 ) ctx++; if( nzb > 0 ) ctx += 2; return ctx + 4 * cat; }
1threat
How can Variant Outputs be manipulated using the Android Gradle Plugin 3.0.0+? : <p>The latest version (3.0.0) of the Android Plugin for Gradle has broken its API for manipulating <a href="https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#variant_api" rel="noreferrer">Variant Outputs</a>. This API was used for manipulating files creating during builds (such as AndroidManifest.xml), and has been removed to improve configuration times.</p> <p>What new APIs are available to manipulate Variant Outputs, and how do they differ to the 2.X APIs?</p>
0debug
static int qemu_dup_flags(int fd, int flags) { int ret; int serrno; int dup_flags; int setfl_flags; #ifdef F_DUPFD_CLOEXEC ret = fcntl(fd, F_DUPFD_CLOEXEC, 0); #else ret = dup(fd); if (ret != -1) { qemu_set_cloexec(ret); } #endif if (ret == -1) { goto fail; } dup_flags = fcntl(ret, F_GETFL); if (dup_flags == -1) { goto fail; } if ((flags & O_SYNC) != (dup_flags & O_SYNC)) { errno = EINVAL; goto fail; } setfl_flags = O_APPEND | O_ASYNC | O_NONBLOCK; #ifdef O_NOATIME setfl_flags |= O_NOATIME; #endif #ifdef O_DIRECT setfl_flags |= O_DIRECT; #endif dup_flags &= ~setfl_flags; dup_flags |= (flags & setfl_flags); if (fcntl(ret, F_SETFL, dup_flags) == -1) { goto fail; } if (flags & O_TRUNC || ((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))) { if (ftruncate(ret, 0) == -1) { goto fail; } } return ret; fail: serrno = errno; if (ret != -1) { close(ret); } errno = serrno; return -1; }
1threat
static void setup_rt_frame(int sig, struct target_sigaction *ka, target_siginfo_t *info, target_sigset_t *set, CPUM68KState *env) { struct target_rt_sigframe *frame; abi_ulong frame_addr; abi_ulong retcode_addr; abi_ulong info_addr; abi_ulong uc_addr; int err = 0; int i; frame_addr = get_sigframe(ka, env, sizeof *frame); if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) goto give_sigsegv; __put_user(sig, &frame->sig); info_addr = frame_addr + offsetof(struct target_rt_sigframe, info); __put_user(info_addr, &frame->pinfo); uc_addr = frame_addr + offsetof(struct target_rt_sigframe, uc); __put_user(uc_addr, &frame->puc); copy_siginfo_to_user(&frame->info, info); __put_user(0, &frame->uc.tuc_flags); __put_user(0, &frame->uc.tuc_link); __put_user(target_sigaltstack_used.ss_sp, &frame->uc.tuc_stack.ss_sp); __put_user(sas_ss_flags(env->aregs[7]), &frame->uc.tuc_stack.ss_flags); __put_user(target_sigaltstack_used.ss_size, &frame->uc.tuc_stack.ss_size); err |= target_rt_setup_ucontext(&frame->uc, env); if (err) goto give_sigsegv; for(i = 0; i < TARGET_NSIG_WORDS; i++) { if (__put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i])) goto give_sigsegv; } retcode_addr = frame_addr + offsetof(struct target_sigframe, retcode); __put_user(retcode_addr, &frame->pretcode); __put_user(0x70004600 + ((TARGET_NR_rt_sigreturn ^ 0xff) << 16), (long *)(frame->retcode + 0)); __put_user(0x4e40, (short *)(frame->retcode + 4)); if (err) goto give_sigsegv; env->aregs[7] = frame_addr; env->pc = ka->_sa_handler; unlock_user_struct(frame, frame_addr, 1); return; give_sigsegv: unlock_user_struct(frame, frame_addr, 1); force_sig(TARGET_SIGSEGV); }
1threat
R: merge two data frame with replacing the common rows and col : I have two data. frame (suppose a,b having a size of 3172*1323, 3067*21), I want to merge both of them however, 21 columns are common in both and 3067 rows also common in both. I want to merge both data frame such that the common rows and common cols replaced and the final size will be 3172*1323 only I tried merge ( a,b, by =0) but it's not going to help me to get the data which I am looking for that. Please help me
0debug
Unable to build react native project after updating to xcode 11.0 : <p>I have a react native project running on react native version 0.59.8 , and xcode version 10.3. Somehow my xcode got updated to version 11.0 and after that i am unable to build the project using <code>react-native run-ios</code> command.</p> <p>I have tried cleaning up the build and building again. But that doesn't help.</p> <p>I am getting the following error:</p> <pre><code>CoreData: annotation: Failed to load optimized model at path '/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPackaging.framework/Versions/A/Resources/XRPackageModel.momd/XRPackageModel 9.0.omo' error Could not find iPhone X simulator. </code></pre> <p>How to fix this issue?</p>
0debug
Connecting client-server Java : <p>How do I connect 2 java classes client-server shown in the link below:</p> <p><a href="https://systembash.com/a-simple-java-tcp-server-and-tcp-client/" rel="nofollow">https://systembash.com/a-simple-java-tcp-server-and-tcp-client/</a></p> <p>It says i need to compile using TCPserver, I have tried finding the compiling option in my IDE, which is Netbeans, but I cant seem to locate it anywhere. Could I ask for some tips of how to connect those 2 files so that server file responds to client app ?</p>
0debug
Java for android in android studio : Assalam-O-Alaikum guys.I'm beginner in android development just a novice.But i'm facing problems in my first attempt to use log files in a program.See this... package com.example.mrunique.myapplicationforexmaple; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; //THIS HERE import android.util.Log; import android.view.View; import android.widget.TextView; public class MainActivity extends AppCompatActivity { TextView mTextView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setupUI(); } private void setupUI() { setContentView( R.layout.activity_main ); mTextView = ( TextView ) findViewById( R.id.textView ); } //Create a local variable for identifying the class where the log statements come from private final static String LOG_TAG = MainActivity.class.getSimpleName(); /** This method is called when the on screen button is passed. * @param view */ public void buttonPressed( View view ) { //An 'info' log statement Log.i( LOG_TAG , "buttonPressed( View ) called" ); //The string we wish to be displayed String stringValue = "Hello World!"; //Change the text of the TextView on the screen mTextView.setText( stringValue ); Log.v( LOG_TAG , "text changed to: " +stringValue ) ; //A debug log statement Log.d( LOG_TAG , "buttonPrssed( View ) finished" ); } } But the problem is [In this image that textView in the red cannot be resolved why?? & TextView highlights as gray why?][1] [1]: https://i.stack.imgur.com/pH2vp.png
0debug
Error using Jack compiler - app/build/intermediates/packaged/debug/classes.zip' is an invalid library : <p>I am getting these errors while using Jack compiler, but I don't understand what is the problem:</p> <pre><code>Error:Library reading phase: file '/Users/daniele.vitali/Development/android-studio/INTROCKAND/app/build/intermediates/packaged/debug/classes.zip' is an invalid library com.android.jack.api.v01.CompilationException: Library reading phase: file '/Users/daniele.vitali/Development/android-studio/INTROCKAND/app/build/intermediates/packaged/debug/classes.zip' is an invalid library at com.android.jack.api.v01.impl.Api01ConfigImpl$Api01CompilationTaskImpl.run(Api01ConfigImpl.java:113) at com.android.builder.core.AndroidBuilder.convertByteCodeUsingJackApis(AndroidBuilder.java:1821) at com.android.builder.core.AndroidBuilder.convertByteCodeUsingJack(AndroidBuilder.java:1694) at com.android.build.gradle.internal.transforms.JackTransform.runJack(JackTransform.java:222) at com.android.build.gradle.internal.transforms.JackTransform.transform(JackTransform.java:196) at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:174) at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:170) at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55) at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47) at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:169) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:244) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:231) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110) at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43) at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30) at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154) at org.gradle.internal.Factories$1.create(Factories.java:22) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151) at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82) at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94) at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:46) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:58) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48) at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72) at org.gradle.util.Swapper.swap(Swapper.java:38) at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50) at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54) at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Error:com.android.jack.JackAbortException: Library reading phase: file '/Users/daniele.vitali/Development/android-studio/INTROCKAND/app/build/intermediates/packaged/debug/classes.zip' is an invalid library at com.android.jack.incremental.IncrementalInputFilter.&lt;init&gt;(IncrementalInputFilter.java:201) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.android.sched.util.config.ReflectFactory.create(ReflectFactory.java:90) at com.android.jack.Jack.buildSession(Jack.java:846) at com.android.jack.Jack.run(Jack.java:475) at com.android.jack.api.v01.impl.Api01ConfigImpl$Api01CompilationTaskImpl.run(Api01ConfigImpl.java:102) ... 93 more Error:com.android.jack.library.LibraryReadingException: Library reading phase: file '/Users/daniele.vitali/Development/android-studio/INTROCKAND/app/build/intermediates/packaged/debug/classes.zip' is an invalid library at com.android.jack.incremental.IncrementalInputFilter.&lt;init&gt;(IncrementalInputFilter.java:199) ... 101 more Error:com.android.jack.library.LibraryFormatException: file '/Users/daniele.vitali/Development/android-studio/INTROCKAND/app/build/intermediates/packaged/debug/classes.zip' is an invalid library ... 102 more :app:transformJackWithJackForDebug FAILED Error:Execution failed for task ':app:transformJackWithJackForDebug'. &gt; com.android.build.api.transform.TransformException: com.android.jack.api.v01.CompilationException: Library reading phase: file '/Users/daniele.vitali/Development/android-studio/INTROCKAND/app/build/intermediates/packaged/debug/classes.zip' is an invalid library Information:BUILD FAILED Information:Total time: 1 mins 53.934 secs Information:5 errors Information:0 warnings Information:See complete output in console </code></pre> <p>I am using Android Studio 2.2 Preview 2 with the following dependencies:</p> <pre><code>ext { //Android config compileSdkVersion = 23 buildToolsVersion = '24.0.0 rc4' minSdkVersion = 16 targetSdkVersion = 23 //Libraries supportLibrariesVersion = '24.0.0-beta1' lombokVersion = '1.16.8' guavaVersion = '19.0' gsonVersion = '2.6.2' butterKnifeVersion = '8.0.1' rxAndroidVersion = '1.2.0' firebaseVersion = '9.0.1' frescoVersion = '0.10.0' jUnitVersion = '4.12' mockitoVersion = '2.0.54-beta' hamcrestVersion = '2.0.0.0' daggerVersion = '2.4' googlePlayServicesVersion = '9.0.1' circularImageViewVersion = '2.0.0' bottomBarVersion = '1.3.4' } </code></pre> <p>I am using also Gradle plugin 2.2.0 alpha 2 and com.google.gms:google-services:3.0.0</p> <p>Any help is highly appreciated.</p>
0debug
static void reset_all_temps(int nb_temps) { int i; for (i = 0; i < nb_temps; i++) { temps[i].state = TCG_TEMP_UNDEF; temps[i].mask = -1; } }
1threat
static inline bool gluster_supports_zerofill(void) { return 0; }
1threat
int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode, Error **errp) { FILE *fh; Error *local_err = NULL; int fd; int64_t ret = -1, handle; if (!has_mode) { mode = "r"; } slog("guest-file-open called, filepath: %s, mode: %s", path, mode); fh = safe_open_or_create(path, mode, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); return -1; } fd = fileno(fh); ret = fcntl(fd, F_GETFL); ret = fcntl(fd, F_SETFL, ret | O_NONBLOCK); if (ret == -1) { error_setg_errno(errp, errno, "failed to make file '%s' non-blocking", path); fclose(fh); return -1; } handle = guest_file_handle_add(fh, errp); if (error_is_set(errp)) { fclose(fh); return -1; } slog("guest-file-open, handle: %" PRId64, handle); return handle; }
1threat
sudo yum install installs only JRE not JDK - Centos : <p>I tried installing open-jdk in Centos using the below command,</p> <pre><code>sudo yum install java-1.8.0-openjdk-1.8.0.131-3.b12.el7_3.x86_64 </code></pre> <p>It installs only the JRE by not JDK. </p> <p>After installation,</p> <ol> <li><p>The folder <code>/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-3.b12.el7_3.x86_64</code> only jre</p></li> <li><p><code>javac</code> is not recognized.</p></li> </ol>
0debug
How to give non-root user in Docker container access to a volume mounted on the host : <p>I am running my application in a Docker container as a non-root user. I did this since it is one of the best practices. However, while running the container I mount a host volume to it <code>-v /some/folder:/some/folder</code> . I am doing this because my application running inside the docker container needs to write files to the mounted host folder. But since I am running my application as a non-root user, it doesn't have permission to write to that folder</p> <p><strong>Question</strong></p> <p>Is it possible to give a nonroot user in a docker container access to the hosted volume?</p> <p>If not, is my only option to run the process in docker container as root?</p>
0debug
void HELPER(cas2l)(CPUM68KState *env, uint32_t regs, uint32_t a1, uint32_t a2) { uint32_t Dc1 = extract32(regs, 9, 3); uint32_t Dc2 = extract32(regs, 6, 3); uint32_t Du1 = extract32(regs, 3, 3); uint32_t Du2 = extract32(regs, 0, 3); uint32_t c1 = env->dregs[Dc1]; uint32_t c2 = env->dregs[Dc2]; uint32_t u1 = env->dregs[Du1]; uint32_t u2 = env->dregs[Du2]; uint32_t l1, l2; uintptr_t ra = GETPC(); #if defined(CONFIG_ATOMIC64) && !defined(CONFIG_USER_ONLY) int mmu_idx = cpu_mmu_index(env, 0); TCGMemOpIdx oi; #endif if (parallel_cpus) { #ifdef CONFIG_ATOMIC64 uint64_t c, u, l; if ((a1 & 7) == 0 && a2 == a1 + 4) { c = deposit64(c2, 32, 32, c1); u = deposit64(u2, 32, 32, u1); #ifdef CONFIG_USER_ONLY l = helper_atomic_cmpxchgq_be(env, a1, c, u); #else oi = make_memop_idx(MO_BEQ, mmu_idx); l = helper_atomic_cmpxchgq_be_mmu(env, a1, c, u, oi, ra); #endif l1 = l >> 32; l2 = l; } else if ((a2 & 7) == 0 && a1 == a2 + 4) { c = deposit64(c1, 32, 32, c2); u = deposit64(u1, 32, 32, u2); #ifdef CONFIG_USER_ONLY l = helper_atomic_cmpxchgq_be(env, a2, c, u); #else oi = make_memop_idx(MO_BEQ, mmu_idx); l = helper_atomic_cmpxchgq_be_mmu(env, a2, c, u, oi, ra); #endif l2 = l >> 32; l1 = l; } else #endif { cpu_loop_exit_atomic(ENV_GET_CPU(env), ra); } } else { l1 = cpu_ldl_data_ra(env, a1, ra); l2 = cpu_ldl_data_ra(env, a2, ra); if (l1 == c1 && l2 == c2) { cpu_stl_data_ra(env, a1, u1, ra); cpu_stl_data_ra(env, a2, u2, ra); } } if (c1 != l1) { env->cc_n = l1; env->cc_v = c1; } else { env->cc_n = l2; env->cc_v = c2; } env->cc_op = CC_OP_CMPL; env->dregs[Dc1] = l1; env->dregs[Dc2] = l2; }
1threat
I want read content of a list tag under the ul tag. But I'm not able to read using the below code. : <p>URL: <a href="https://www.amazon.in/s/ref=sr_pg_2?rh=n%3A1571271031%2Cn%3A%211571272031%2Cn%3A1968024031%2Cn%3A1968093031%2Cp_n_pct-off-with-tax%3A70-%2Cp_98%3A10440597031&amp;page=2&amp;bbn=1968093031&amp;ie=UTF8&amp;qid=1501915937&amp;lo=apparel" rel="nofollow noreferrer">https://www.amazon.in/s/ref=sr_pg_2?rh=n%3A1571271031%2Cn%3A%211571272031%2Cn%3A1968024031%2Cn%3A1968093031%2Cp_n_pct-off-with-tax%3A70-%2Cp_98%3A10440597031&amp;page=2&amp;bbn=1968093031&amp;ie=UTF8&amp;qid=1501915937&amp;lo=apparel</a> </p> <p>Code is listed as Fallows:</p> <pre><code>try{ //WebElement e1 = driver.findElement(By.cssSelector("#atfResults &gt; ul")); WebElement e1 = driver.findElement(By.id("s-results-list-atf")); System.out.println(e1); List&lt;WebElement&gt; links = e1.findElements(By.cssSelector("#atfResults &gt; ul"));; for (int i = 1; i &lt; links.size(); i++) { System.out.println(links.get(i).getText()); } } catch(Exception e){ System.out.println(e.getMessage()); } } </code></pre> <p>Please let me know if any one get solution.</p>
0debug
async/await in Angular `ngOnInit` : <p>I’m currently evaluating the pros ‘n’ cons of replacing Angular’s resp. RxJS’ <code>Observable</code> with plain <code>Promise</code> so that I can use <code>async</code> and <code>await</code> and get a more intuitive code style.</p> <p>One of our typical scenarios: Load some data within <code>ngOnInit</code>. Using <code>Observables</code>, we do:</p> <pre><code>ngOnInit () { this.service.getData().subscribe(data =&gt; { this.data = this.modifyMyData(data); }); } </code></pre> <p>When I return a <code>Promise</code> from <code>getData()</code> instead, and use <code>async</code> and <code>await</code>, it becomes:</p> <pre><code>async ngOnInit () { const data = await this.service.getData(); this.data = this.modifyMyData(data); } </code></pre> <p>Now, obviously, Angular will not “know”, that <code>ngOnInit</code> has become <code>async</code>. I feel that this is not a problem: My app still works as before. But when I look at the <code>OnInit</code> interface, the function is obviously not declared in such a way which would suggest that it can be declared <code>async</code>:</p> <pre><code>ngOnInit(): void; </code></pre> <p>So -- bottom line: Is it reasonable what I’m doing here? Or will I run into any unforseen problems?</p>
0debug
Non-blocking multiprocessing.connection.Listener? : <p>I use multiprocessing.connection.Listener for communication between processes, and it works as a charm for me. Now i would really love my mainloop to do something else between commands from client. Unfortunately listener.accept() blocks execution until connection from client process is established.</p> <p>Is there a simple way of managing non blocking check for multiprocessing.connection? Timeout? Or shall i use a dedicated thread?</p> <pre><code> # Simplified code: from multiprocessing.connection import Listener def mainloop(): listener = Listener(address=(localhost, 6000), authkey=b'secret') while True: conn = listener.accept() # &lt;--- This blocks! msg = conn.recv() print ('got message: %r' % msg) conn.close() </code></pre>
0debug
Trouble with my troubleshooting guide(python) : Okay I'm having some issues with my code, after the point I tried to make my code a little bit more advanced after phone not turning on solution, it started to glitch out, need some help on this, got no idea how I can avoid this. print("Welcome to Bobby Dazler's trobleshooting for mobile phones. Please answer the questions concerning your issue with yes or no, unless specified to write something else. If your issue is none of these listed please enter other or don't know") solutions1="Place the phone into rice for 24 hours if this does not fix the issue please contact your manufacturer for a repair." solutions2="Check the battery is in correctly and attempt to charge the phone for atleast one hour, if this fails please contact your manufacturer." solutions3="Move to a different area, turn the phone on and off, if this fails please contact your service provider." solutions4="Turn the phone off silent mode, do this by either; manually going into the your phone's settings or use the buttons on the side of the phone to turn it off silent mode." solutions5="Use the buttons on the side of the phone to adjust the volume accordingly." solutions6="Contact your manufacturer to arrange a time to fix your cracked phone." solutions7="Delete some applications(apps) to make some more space for your phone." solutions8="Contact your manufacturer/insurance company to get your buttons replaced" solutions9="Charge your phone fully and hold down the button to attempt to turn it on, if this fails please contact your manufacturer to arrange for a repair." solutions10="Contact your manufacturer to fix your problem" solutions11="Reinsert the sim card and make sure the sim card is placed the right way upon entering the phone." print("cracked screen, phone not turning on, bad reception, phone doesn't ring, low volume, can't take photos or download applications, broken/missing buttons, sim card not working, water damage") questions = input("What problem are you having with your mobile phone? Please select one, please choose on the options and reply in a lower case") if questions== "cracked screen": print(solutions6) if questions=="low volume": print(solutions5) if questions=="phone not turning on": print(solutions2) questions = input("Did that fix your issue?") if questions=="no" or "No": print("Okay here's another solution") print(solutions9) questions=input("Did that fix your issue?") if questions=="no" or "No": print("Okay please try this") print(solutions10) if questions=="bad reception": print(solutions3) if questions=="phone doesn't ring": print(solutions4) if questions=="can't take photos or download applications": print(solutions7) if questions=="broken/missing buttons": print(solutions8) if questions=="sim card not working": print(solutions11) if questions=="water damage": print(solutions11) else: questions=input("Does the phone turn on?") if questions=="Yes" or "yes": print("Okay here is another question") if questions=="No" or "no": print(solutions10)
0debug
SQL compare date (access97 database) : i'm trying to compare 2 date with an SQL Query, My query is this : "SELECT table.toto FROM table WHERE table.date < $date" In my table, my date is formatted like this : `dd/mm/YYYY` unfortunately, it doesn't work like expected, it returns only one result (it's supposed to return way more results), which date is : `1312-09-15 00:00:00` but in database, the date is formatted like dd/mm/YYYY. If someone knows how to resolve my problem, I would be thankful. PS: If my question is unclear, please tell me
0debug
puppeteer element.click() not working and not throwing an error : <p>I have a situation where a button, on a form, that is animated into view, if the element.click() happens while the animation is in progress, it doesn't work.</p> <p>element.click() doesn't throw an error, doesn't return a failed status (it returns undefined) it just silently doesn't work.</p> <p>I have tried ensuring the element being clicked is not disabled, and is displayed (visible) but even though both those tests succeed, the click fails.</p> <p>If I wait 0.4s before clicking, it works because the animation has finished.</p> <p>I don't want to have to add delays (which are unreliable, and a bodge to be frank), if I can detect when a click worked, and if not automatically retry.</p> <p>Is there a generic way to detect if a click() has actually been actioned so I can use a retry loop until it does? </p>
0debug
Docker-compose: Database is uninitialized : <p>I have a problem with docker-compose and mysql:</p> <p>docker-compose.yml</p> <pre><code>version: '2' services: db: image: mysql volumes: - "./sito/db/:/var/lib/mysql" ports: - "3306:3306" restart: always environment: MYSQL_ROOT_PASSWORD: app: depends_on: - db image: eboraas/apache-php links: - db ports: - "80:80" volumes: - ./sito/:/var/www/html/ </code></pre> <p>An error occurred when I compose this container:</p> <pre><code>Recreating phpapp_phpapache_1 Attaching to phpapp_db_1, phpapp_phpapache_1 db_1 | error: database is uninitialized and password option is not specified db_1 | You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD phpapache_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.30.0.3. Set the 'ServerName' directive globally to suppress this message phpapp_db_1 exited with code 1 db_1 | error: database is uninitialized and password option is not specified db_1 | You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD db_1 | error: database is uninitialized and password option is not specified db_1 | You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD db_1 | error: database is uninitialized and password option is not specified db_1 | You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD db_1 | error: database is uninitialized and password option is not specified </code></pre> <p>But the database don't have a password. How can I solve it?</p>
0debug
int do_sigaction(int sig, const struct target_sigaction *act, struct target_sigaction *oact) { struct emulated_sigaction *k; if (sig < 1 || sig > TARGET_NSIG) return -EINVAL; k = &sigact_table[sig - 1]; #if defined(DEBUG_SIGNAL) && 0 fprintf(stderr, "sigaction sig=%d act=0x%08x, oact=0x%08x\n", sig, (int)act, (int)oact); #endif if (oact) { oact->_sa_handler = tswapl(k->sa._sa_handler); oact->sa_flags = tswapl(k->sa.sa_flags); oact->sa_restorer = tswapl(k->sa.sa_restorer); oact->sa_mask = k->sa.sa_mask; } if (act) { k->sa._sa_handler = tswapl(act->_sa_handler); k->sa.sa_flags = tswapl(act->sa_flags); k->sa.sa_restorer = tswapl(act->sa_restorer); k->sa.sa_mask = act->sa_mask; } return 0; }
1threat
static int mxf_timestamp_to_str(uint64_t timestamp, char **str) { struct tm time = { 0 }; time.tm_year = (timestamp >> 48) - 1900; time.tm_mon = (timestamp >> 40 & 0xFF) - 1; time.tm_mday = (timestamp >> 32 & 0xFF); time.tm_hour = (timestamp >> 24 & 0xFF); time.tm_min = (timestamp >> 16 & 0xFF); time.tm_sec = (timestamp >> 8 & 0xFF); *str = av_mallocz(32); if (!*str) return AVERROR(ENOMEM); strftime(*str, 32, "%Y-%m-%d %H:%M:%S", &time); return 0; }
1threat
qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds, Error **errp) { char *cacert = NULL, *cacrl = NULL, *cert = NULL, *key = NULL, *dhparams = NULL; int ret; int rv = -1; trace_qcrypto_tls_creds_x509_load(creds, creds->parent_obj.dir ? creds->parent_obj.dir : "<nodir>"); if (creds->parent_obj.endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) { if (qcrypto_tls_creds_get_path(&creds->parent_obj, QCRYPTO_TLS_CREDS_X509_CA_CERT, true, &cacert, errp) < 0 || qcrypto_tls_creds_get_path(&creds->parent_obj, QCRYPTO_TLS_CREDS_X509_CA_CRL, false, &cacrl, errp) < 0 || qcrypto_tls_creds_get_path(&creds->parent_obj, QCRYPTO_TLS_CREDS_X509_SERVER_CERT, true, &cert, errp) < 0 || qcrypto_tls_creds_get_path(&creds->parent_obj, QCRYPTO_TLS_CREDS_X509_SERVER_KEY, true, &key, errp) < 0 || qcrypto_tls_creds_get_path(&creds->parent_obj, QCRYPTO_TLS_CREDS_DH_PARAMS, false, &dhparams, errp) < 0) { } else { if (qcrypto_tls_creds_get_path(&creds->parent_obj, QCRYPTO_TLS_CREDS_X509_CA_CERT, true, &cacert, errp) < 0 || qcrypto_tls_creds_get_path(&creds->parent_obj, QCRYPTO_TLS_CREDS_X509_CLIENT_CERT, false, &cert, errp) < 0 || qcrypto_tls_creds_get_path(&creds->parent_obj, QCRYPTO_TLS_CREDS_X509_CLIENT_KEY, false, &key, errp) < 0) { ret = gnutls_certificate_allocate_credentials(&creds->data); if (ret < 0) { error_setg(errp, "Cannot allocate credentials: '%s'", gnutls_strerror(ret)); ret = gnutls_certificate_set_x509_trust_file(creds->data, cacert, GNUTLS_X509_FMT_PEM); if (ret < 0) { error_setg(errp, "Cannot load CA certificate '%s': %s", cacert, gnutls_strerror(ret)); if (cert != NULL && key != NULL) { ret = gnutls_certificate_set_x509_key_file(creds->data, cert, key, GNUTLS_X509_FMT_PEM); if (ret < 0) { error_setg(errp, "Cannot load certificate '%s' & key '%s': %s", cert, key, gnutls_strerror(ret)); if (cacrl != NULL) { ret = gnutls_certificate_set_x509_crl_file(creds->data, cacrl, GNUTLS_X509_FMT_PEM); if (ret < 0) { error_setg(errp, "Cannot load CRL '%s': %s", cacrl, gnutls_strerror(ret)); if (creds->parent_obj.endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) { if (qcrypto_tls_creds_get_dh_params_file(&creds->parent_obj, dhparams, &creds->parent_obj.dh_params, errp) < 0) { gnutls_certificate_set_dh_params(creds->data, creds->parent_obj.dh_params); rv = 0; cleanup: g_free(cacert); g_free(cacrl); g_free(cert); g_free(key); g_free(dhparams); return rv;
1threat
dotnet publish with /p:PublishProfile=? : <p>I'm trying to call "dotnet publish" with a specific publish profile pubxml file as documented here :</p> <p><a href="https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/visual-studio-publish-profiles?view=aspnetcore-2.1&amp;tabs=aspnetcore2x" rel="noreferrer">https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/visual-studio-publish-profiles?view=aspnetcore-2.1&amp;tabs=aspnetcore2x</a></p> <p>However, everything I try seems to result in the default behaviour, and the /p:PublishProfile part is ignored. </p> <pre><code>dotnet publish /p:PublishProfile="MyFolderProfile" </code></pre> <p>Doesn't work, and logs no error, building to the default location under "/obj".</p> <p>I do note that an intentionally incorrect command has the same result though, eg: </p> <pre><code>dotnet publish /p:PublishProfile="MyFolderProfile-XXXXX" </code></pre> <p>What am I doing wrong? - Any pointers would be greatly appreciated! </p>
0debug
static void coroutine_fn backup_run(void *opaque) { BackupBlockJob *job = opaque; BackupCompleteData *data; BlockDriverState *bs = job->common.bs; BlockDriverState *target = job->target; BlockdevOnError on_target_error = job->on_target_error; NotifierWithReturn before_write = { .notify = backup_before_write_notify, }; int64_t start, end; int ret = 0; QLIST_INIT(&job->inflight_reqs); qemu_co_rwlock_init(&job->flush_rwlock); start = 0; end = DIV_ROUND_UP(job->common.len / BDRV_SECTOR_SIZE, BACKUP_SECTORS_PER_CLUSTER); job->bitmap = hbitmap_alloc(end, 0); bdrv_set_enable_write_cache(target, true); bdrv_set_on_error(target, on_target_error, on_target_error); bdrv_iostatus_enable(target); bdrv_add_before_write_notifier(bs, &before_write); if (job->sync_mode == MIRROR_SYNC_MODE_NONE) { while (!block_job_is_cancelled(&job->common)) { job->common.busy = false; qemu_coroutine_yield(); job->common.busy = true; } } else { for (; start < end; start++) { bool error_is_read; if (block_job_is_cancelled(&job->common)) { break; } if (job->common.speed) { uint64_t delay_ns = ratelimit_calculate_delay( &job->limit, job->sectors_read); job->sectors_read = 0; block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, delay_ns); } else { block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, 0); } if (block_job_is_cancelled(&job->common)) { break; } if (job->sync_mode == MIRROR_SYNC_MODE_TOP) { int i, n; int alloced = 0; for (i = 0; i < BACKUP_SECTORS_PER_CLUSTER;) { alloced = bdrv_is_allocated(bs, start * BACKUP_SECTORS_PER_CLUSTER + i, BACKUP_SECTORS_PER_CLUSTER - i, &n); i += n; if (alloced == 1 || n == 0) { break; } } if (alloced == 0) { continue; } } ret = backup_do_cow(bs, start * BACKUP_SECTORS_PER_CLUSTER, BACKUP_SECTORS_PER_CLUSTER, &error_is_read); if (ret < 0) { BlockErrorAction action = backup_error_action(job, error_is_read, -ret); if (action == BLOCK_ERROR_ACTION_REPORT) { break; } else { start--; continue; } } } } notifier_with_return_remove(&before_write); qemu_co_rwlock_wrlock(&job->flush_rwlock); qemu_co_rwlock_unlock(&job->flush_rwlock); hbitmap_free(job->bitmap); bdrv_iostatus_disable(target); data = g_malloc(sizeof(*data)); data->ret = ret; block_job_defer_to_main_loop(&job->common, backup_complete, data); }
1threat
Is this correct in PHP : <p>I was wondering if below is correct, I have tested it is working, I just want an opinion.</p> <p>file a.php:</p> <pre><code>namespace MyNamespace; class MyClass { public function ShowMessage($s) { echo $s; } } </code></pre> <p>file b.php</p> <pre><code>require_once 'a.php'; use MyNamespace\MyClass as MyAlias; $class = new MyAlias; $class-&gt;ShowMessage('Hello World!'); /* I have same results if I use this */ $class2 = new MyNamespace\MyClass(); $class2-&gt;ShowMessage('Hello World!'); </code></pre> <p>Thank you.</p>
0debug
static void blk_mig_reset_dirty_cursor(void) { BlkMigDevState *bmds; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { bmds->cur_dirty = 0; } }
1threat
Android - How to read and write file in internal storage? : I'm trying to create a directory in internal storage and then write my files in that directory. I'm able to create the directory in internal storage but it is not showing. When I create new file in that directory and write in that file, I get an error of null pointer exception. File.createNewFile() method is ignored and my file is not created. I'm using printwriter to write in file and buffered reader to read. How to read and write files in internal storage? Plz help! My application needs a lot of file handling.
0debug
static int set_expr(AVExpr **pexpr, const char *expr, void *log_ctx) { int ret; AVExpr *old = NULL; if (*pexpr) old = *pexpr; ret = av_expr_parse(pexpr, expr, var_names, NULL, NULL, NULL, NULL, 0, log_ctx); if (ret < 0) { av_log(log_ctx, AV_LOG_ERROR, "Error when evaluating the expression '%s'\n", expr); *pexpr = old; return ret; } av_expr_free(old); return 0; }
1threat
How to read quoted CSV with NULL values into Amazon Athena : <p>I'm trying to create an external table in Athena using quoted CSV file stored on S3. The problem is, that my CSV contain missing values in columns that should be read as INTs. Simple example:</p> <p>CSV:</p> <pre><code>id,height,age,name 1,,26,"Adam" 2,178,28,"Robert" </code></pre> <p>CREATE TABLE DEFINITION:</p> <pre><code>CREATE EXTERNAL TABLE schema.test_null_unquoted ( id INT, height INT, age INT, name STRING ) ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde' WITH SERDEPROPERTIES ( 'separatorChar' = ",", 'quoteChar' = '"', 'skip.header.line.count' = '1' ) STORED AS TEXTFILE LOCATION 's3://mybucket/test_null/unquoted/' </code></pre> <p><code>CREATE TABLE</code> statement runs fine but as soon as I try to query the table, I'm getting <code>HIVE_BAD_DATA: Error parsing field value ''</code>.</p> <p>I tried making the CSV look like this (quote empty string):</p> <pre><code>"id","height","age","name" 1,"",26,"Adam" 2,178,28,"Robert" </code></pre> <p>But it's not working.</p> <p>Tried specifying <code>'serialization.null.format' = ''</code> in <code>SERDEPROPERTIES</code> - not working.</p> <p>Tried specifying the same via <code>TBLPROPERTIES ('serialization.null.format'='')</code> - still nothing.</p> <p>It works, when you specify all columns as <code>STRING</code> but that's not what I need.</p> <p>Therefore, the question is, is there <strong>any way</strong> to read a quoted CSV (quoting is important as my real data is much more complex) to Athena with correct column specification?</p>
0debug
Replace every occurnce of the regular expression matching with a perticular in VI editor? : suppose i have a text file as follows. create table "kevin".tb1 { col1, col2 } create table "jhone".tb2 { col1, col2 } create table "jake".tb3 { col1, col2 } I need to obtain that text file as follows by replaceing every table owner name occernces raplace witha same name called "informix". out put should be like create table "informix".tb1 { col1, col2 } create table "informix".tb2 { col1, col2 } create table "informix".tb3 { col1, col2 }
0debug
Is there a way of extracting xpath and text from webpage and save to file? : <p>I am looking for handy tool to extract UIElement's Object Type and Xpath/ID/Name from webpage or any alternative instead of Inspecting the element from Browser? Also any alternative to extract text from Webpage. I want to save this in a separate Excel or Text file. Any suggestion how to go about it?</p> <p>I am saving it manually by inspecting the UIElement object on the webpage and saving it (space separated) on to file. Then reading it using a dictionary.</p>
0debug
Prediction option put and call : I have to predict the purchase or not of the sp500 put and call options, however I do not understand some parts of the code that was provided to me. In addition can you explain to me what each option of the data does (example: option clothing price, option settle price , optiontype ,optionstrike, optionhighprice ,optionlowprice ,optionvol , optionopenint ) and their utility? We try to use Arima for the prediction but do you have any other solution to offer me? Thank you in advance and here is the piece of code that I do not understand: ` mutate(optiontype = as.double(optiontype == "put")) %>% mutate(buy_gain = (optionstrike - settle_sp_price)*(optiontype*2 - 1)) %>% mutate(bet_price = optionstrike - optionclosingprice*(optiontype*2 - 1)) prices <- options %>% select(todaydate, today_sp_price) %>% unique() %>% mutate(lag_one = lag(today_sp_price), lag_three = lag(today_sp_price, 3), lag_five = lag(today_sp_price, 5) ) %>% select(-(today_sp_price)) ` What is bet price ?
0debug
static void *qemu_kvm_cpu_thread_fn(void *arg) { CPUState *env = arg; int r; qemu_mutex_lock(&qemu_global_mutex); qemu_thread_self(env->thread); r = kvm_init_vcpu(env); if (r < 0) { fprintf(stderr, "kvm_init_vcpu failed: %s\n", strerror(-r)); exit(1); } qemu_kvm_init_cpu_signals(env); env->created = 1; qemu_cond_signal(&qemu_cpu_cond); while (!qemu_system_ready) qemu_cond_timedwait(&qemu_system_cond, &qemu_global_mutex, 100); while (1) { if (cpu_can_run(env)) qemu_cpu_exec(env); qemu_kvm_wait_io_event(env); } return NULL; }
1threat
C# Calculate how long it will take a loop to finish : So i have the following loop: for (int i = 1; i < numRows + 2; i++) //numRows was +4, now +2 { Console.Clear(); Console.WriteLine("Number of rows: " + numRows); Console.Write("Checking Row #: " + currRowNumber); //We want to skip every row that is null and continue looping until we have more than 3 rows in a row that are null, then break if (i > 1) { i -= 1; } //Create Worksheet Range Microsoft.Office.Interop.Excel.Range range = (Microsoft.Office.Interop.Excel.Range)excelWorkbookWorksheet.Cells[i, 2]; string cellValue = Convert.ToString(range.Value); if (nullCounter == 3) //was 5 { Console.WriteLine("\nNull row detected...breaking"); Console.WriteLine("Number of rows deleted: " + numRowsDeleted); break; } if (cellValue != null) { if (cellValue.Contains(searchText)) { //Console.WriteLine("Deleting Row: " + Convert.ToString(cellValue)); ((Range)excelWorkbookWorksheet.Rows[i]).Delete(XlDeleteShiftDirection.xlShiftUp); numRowsDeleted++; //Console.WriteLine("Number of rows deleted: " + numRowsDeleted); nullCounter = 0; i--; currRowNumber++; rowsPerSecond = i; } else { currRowNumber++; nullCounter = 0; } } else { nullCounter++; //Console.WriteLine("NullCounter: " + nullCounter); } i++; } I want to calculate how many rows im looping through per second, then calculate from that number how long it will take to complete the entire loop, based on how many rows there are. Again, any help is appreciated, thanks!
0debug
int av_open_input_stream(AVFormatContext **ic_ptr, ByteIOContext *pb, const char *filename, AVInputFormat *fmt, AVFormatParameters *ap) { int err; AVFormatContext *ic; AVFormatParameters default_ap; if(!ap){ ap=&default_ap; memset(ap, 0, sizeof(default_ap)); } if(!ap->prealloced_context) ic = avformat_alloc_context(); else ic = *ic_ptr; if (!ic) { err = AVERROR(ENOMEM); goto fail; } ic->iformat = fmt; ic->pb = pb; ic->duration = AV_NOPTS_VALUE; ic->start_time = AV_NOPTS_VALUE; av_strlcpy(ic->filename, filename, sizeof(ic->filename)); if (fmt->priv_data_size > 0) { ic->priv_data = av_mallocz(fmt->priv_data_size); if (!ic->priv_data) { err = AVERROR(ENOMEM); goto fail; } } else { ic->priv_data = NULL; } if (ic->iformat->read_header) { err = ic->iformat->read_header(ic, ap); if (err < 0) goto fail; } if (pb && !ic->data_offset) ic->data_offset = url_ftell(ic->pb); #if LIBAVFORMAT_VERSION_MAJOR < 53 ff_metadata_demux_compat(ic); #endif ic->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE; *ic_ptr = ic; return 0; fail: if (ic) { int i; av_freep(&ic->priv_data); for(i=0;i<ic->nb_streams;i++) { AVStream *st = ic->streams[i]; if (st) { av_free(st->priv_data); av_free(st->codec->extradata); } av_free(st); } } av_free(ic); *ic_ptr = NULL; return err; }
1threat
int ff_rtsp_send_cmd_with_content(AVFormatContext *s, const char *method, const char *url, const char *header, RTSPMessageHeader *reply, unsigned char **content_ptr, const unsigned char *send_content, int send_content_length) { RTSPState *rt = s->priv_data; HTTPAuthType cur_auth_type; int ret; retry: cur_auth_type = rt->auth_state.auth_type; if ((ret = ff_rtsp_send_cmd_with_content_async(s, method, url, header, send_content, send_content_length))) return ret; if ((ret = ff_rtsp_read_reply(s, reply, content_ptr, 0, method) ) < 0) return ret; if (reply->status_code == 401 && cur_auth_type == HTTP_AUTH_NONE && rt->auth_state.auth_type != HTTP_AUTH_NONE) goto retry; if (reply->status_code > 400){ av_log(s, AV_LOG_ERROR, "method %s failed: %d%s\n", method, reply->status_code, reply->reason); av_log(s, AV_LOG_DEBUG, "%s\n", rt->last_reply); } return 0; }
1threat
C# - How to send search keywords like google : <p>I want to send search keywords with QueryString like google, atc... and i need a function which convert text like this</p> <blockquote> <p>Metallica nimes concert 2009 :)</p> </blockquote> <p>to this:</p> <pre><code>Metallica+nimes+concert+2009+%3A%29 </code></pre> <p>and retrieve it</p> <p>Thanks and advance</p>
0debug
int spapr_h_cas_compose_response(sPAPRMachineState *spapr, target_ulong addr, target_ulong size, bool cpu_update) { void *fdt, *fdt_skel; sPAPRDeviceTreeUpdateHeader hdr = { .version_id = 1 }; sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(qdev_get_machine()); size -= sizeof(hdr); fdt_skel = g_malloc0(size); _FDT((fdt_create(fdt_skel, size))); _FDT((fdt_begin_node(fdt_skel, ""))); _FDT((fdt_end_node(fdt_skel))); _FDT((fdt_finish(fdt_skel))); fdt = g_malloc0(size); _FDT((fdt_open_into(fdt_skel, fdt, size))); g_free(fdt_skel); if (cpu_update) { _FDT((spapr_fixup_cpu_dt(fdt, spapr))); } if (spapr_ovec_test(spapr->ov5_cas, OV5_DRCONF_MEMORY)) { g_assert(smc->dr_lmb_enabled); _FDT((spapr_populate_drconf_memory(spapr, fdt))); } _FDT((fdt_pack(fdt))); if (fdt_totalsize(fdt) + sizeof(hdr) > size) { trace_spapr_cas_failed(size); return -1; } cpu_physical_memory_write(addr, &hdr, sizeof(hdr)); cpu_physical_memory_write(addr + sizeof(hdr), fdt, fdt_totalsize(fdt)); trace_spapr_cas_continue(fdt_totalsize(fdt) + sizeof(hdr)); g_free(fdt); return 0; }
1threat
How do I safely remove items from an array in a for loop? : <p>Full disclose, this is for a homework question:</p> <blockquote> <p>It should have a private property of type [Circle]. An array of circles. The method should remove any circles that have a radius larger than the minimum requirement, and smaller than the max requirement.</p> </blockquote> <p>It seems obvious that I should use <code>removeAtIndex()</code> to remove array items that don't meet a condition determined in the loop. However, many have pointed out before the perils of removing items in a loop because of what I guess is a "iterator/index mismatch".</p> <p>Ultimately I ended up creating an empty array and using <code>.append()</code> to push the values that meet the "good" condition to a <code>filteredCircles</code> array, but I can't help but to feel that this this doesn't meet the criteria for the assignment.</p> <p>Is there a solution that actually removes the items from the array in a loop?</p>
0debug
Slicing complex dictionary in python : <p>I want to be able to print out just a single character from this dictionary but I haven't been able to figure out the syntax or find it anywhere. Is there a way to do this in vanilla Python 2.7.x given the code below?</p> <pre><code>dct = {"c":[["1","1","0"],["0","0","0"]], "d":[["1","1","0"],["1","0","0"]],} for x in dct: print [x][0][0] </code></pre> <p>I want the output to be: 11</p> <p>Any help is much appreciated!</p>
0debug
static void patch_reloc(uint8_t *code_ptr, int type, intptr_t value, intptr_t addend) { value += addend; switch(type) { case R_386_PC32: value -= (uintptr_t)code_ptr; if (value != (int32_t)value) { tcg_abort(); } *(uint32_t *)code_ptr = value; break; case R_386_PC8: value -= (uintptr_t)code_ptr; if (value != (int8_t)value) { tcg_abort(); } *(uint8_t *)code_ptr = value; break; default: tcg_abort(); } }
1threat
Add a Button in Status Bar Android : I'm developing an android application where I want to add a Phone Button in Status Bar. Can I add a Phone button in Status Bar? [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/xp0W6.jpg I want to add button like showing in the above Image. I tried to do with the notification but notification icon size is too small. How can I do it? Any Idea?
0debug
Java Replace All? : <p>I´m trying to replace some characters in my string but it isnt working. Can you please help me? </p> <p>My code is:</p> <pre><code>String test = "ABC?!"; test = test.replaceAll("\\?",""); test= test.replaceAll("\\!, ""); </code></pre> <p>Thank you so much for helping me.</p>
0debug
Find the longest palindromic substring : <p>Given a string S, find the longest palindromic substring. For example:</p> <p>Input: "aaaabaaa" Output: "aaabaaa"</p>
0debug
how do I convert text to jsonB : <p>What is the proper way to convert any text (or varchar) to <code>jsonB</code> type in Postgres (version 9.6) ?</p> <p>For example, here I am using two methods and I am getting different results:</p> <p>Method 1:</p> <pre><code>dev=# select '[{"field":15,"operator":0,"value":"1"},{"field":15,"operator":0,"value":"2"},55]'::jsonb; jsonb ---------------------------------------------------------------------------------------------- [{"field": 15, "value": "1", "operator": 0}, {"field": 15, "value": "2", "operator": 0}, 55] (1 row) </code></pre> <p>Method 2 , which doesn't produce the desired results, btw:</p> <pre><code>dev=# select to_jsonb('[{"field":15,"operator":0,"value":"1"},{"field":15,"operator":0,"value":"2"},55]'::text); to_jsonb ---------------------------------------------------------------------------------------------------- "[{\"field\":15,\"operator\":0,\"value\":\"1\"},{\"field\":15,\"operator\":0,\"value\":\"2\"},55]" (1 row) dev=# </code></pre> <p>Here, it was converted to a string, not an array. Why doesn't the second method creates an array ?</p>
0debug
Download video file from youtube to internal storage : <p>I have a youtube video link, like this <a href="https://www.youtube.com/watch?v=UCysW3PCzvo" rel="nofollow">https://www.youtube.com/watch?v=UCysW3PCzvo</a> I want to get list of video source urls (for diffrent qualities). I have this method in php. How i can do that trick in android?</p> <p>Thanks in advance and sorry for my english.</p>
0debug
WARNING as java.io.EOFException when ActiveMQ starts : <p>am trying to start the ActiveMQ 5.11 and I see a <code>WARNING</code> as below:</p> <pre><code> WARN | Transport Connection to: tcp://127.0.0.1:40890 failed: java.io.EOFException </code></pre> <p>My <code>activemq.xml</code> is as below:</p> <pre><code>&lt;transportConnectors&gt; &lt;transportConnector name="openwire" uri="tcp://0.0.0.0:${JMS_PORT}" /&gt; &lt;transportConnector name="stomp" uri="stomp://0.0.0.0:${JMS_STOMP_PORT}"/&gt; &lt;transportConnector name="ssl" uri="ssl://0.0.0.0:${JMS_SSL_PORT}"/&gt; &lt;/transportConnectors&gt; &lt;sslContext&gt; &lt;sslContext keyStore="file:${JMS_KEY_STORE}" keyStorePassword="${JMS_KEY_STORE_PASSWORD}" trustStore="file:${JMS_TRUST_STORE}" trustStorePassword="${JMS_TRUST_STORE_PASSWORD}" /&gt; &lt;/sslContext&gt; &lt;networkConnectors&gt; &lt;networkConnector name="host1 and host2" uri="static://(${JMS_X_SITE_CSV_URL})?wireFormat=ssl&amp;amp;wireFormat.maxInactivityDuration=30000" dynamicOnly="true" suppressDuplicateQueueSubscriptions = "true" networkTTL="1" /&gt; &lt;/networkConnectors&gt; </code></pre> <p>Here is the entire console log for this.</p> <pre><code>Java Runtime: Oracle Corporation 1.7.0_05 /usr/java/jdk1.7.0_05/jre Heap sizes: current=1004928k free=994439k max=1004928k JVM args: -Xmx1G -Dorg.apache.activemq.UseDedicatedTaskRunner=true -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/home/dragon/activemq/conf/login.config -Dcom.sun.management.jmxremote -Djava.io.tmpdir=/home/dragon/activemq/tmp -Dactivemq.classpath=/home/dragon/activemq/conf; -Dactivemq.home=/home/dragon/activemq -Dactivemq.base=/home/dragon/activemq -Dactivemq.conf=/home/dragon/activemq/conf -Dactivemq.data=/home/dragon/activemq/data Extensions classpath: [/home/dragon/activemq/lib,/home/dragon/activemq/lib/camel,/home/dragon/activemq/lib/optional,/home/dragon/activemq/lib/web,/home/dragon/activemq/lib/extra] ACTIVEMQ_HOME: /home/dragon/activemq ACTIVEMQ_BASE: /home/dragon/activemq ACTIVEMQ_CONF: /home/dragon/activemq/conf ACTIVEMQ_DATA: /home/dragon/activemq/data Loading message broker from: xbean:activemq.xml INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@a842913: startup date [Fri Oct 07 08:14:02 IST 2016]; root of context hierarchy INFO | PListStore:[/home/dragon/activemq/data/divinedragonbox/tmp_storage] started INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[/home/dragon/jms_store] INFO | JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:15526/jmxrmi INFO | KahaDB is version 5 INFO | Recovering from the journal ... INFO | Recovery replayed 76 operations from the journal in 0.032 seconds. INFO | Apache ActiveMQ 5.11.1 (divinedragonbox, ID:divinedragonbox-60914-1475824445361-0:1) is starting INFO | Listening for connections at: tcp://divinedragonbox:15511 INFO | Connector openwire started INFO | Listening for connections at: stomp://divinedragonbox:15512 INFO | Connector stomp started INFO | Listening for connections at: ssl://divinedragonbox:15571 INFO | Connector ssl started INFO | Establishing network connection from vm://divinedragonbox?async=false&amp;network=true to ssl://localhost:15571 INFO | Connector vm://divinedragonbox started INFO | Network Connector DiscoveryNetworkConnector:host1 and host2:BrokerService[divinedragonbox] started INFO | Apache ActiveMQ 5.11.1 (divinedragonbox, ID:divinedragonbox-60914-1475824445361-0:1) started INFO | For help or more information please see: http://activemq.apache.org INFO | divinedragonbox Shutting down INFO | Connector vm://divinedragonbox stopped INFO | divinedragonbox bridge to Unknown stopped WARN | Transport Connection to: tcp://127.0.0.1:40890 failed: java.io.EOFException INFO | ActiveMQ WebConsole available at http://localhost:15521/ INFO | Initializing Spring FrameworkServlet 'dispatcher' INFO | jolokia-agent: No access restrictor found at classpath:/jolokia-access.xml, access to all MBeans is allowed </code></pre> <p>I enabled the TRACE for the messages and I got the following snippets of exceptions in the log file.</p> <pre><code>2016-10-07 08:15:45,378 | TRACE | Execute[ActiveMQ ForwardingBridge StopTask] runnable: org.apache.activemq.network.DemandForwardingBridgeSupport$4@b3f451d | org.apache.activemq.thread.TaskRunnerFactory | ActiveMQ BrokerService[divinedragonbox] Task-4 2016-10-07 08:15:45,378 | TRACE | Created and running thread[ActiveMQ ForwardingBridge StopTask-5]: Thread[ActiveMQ ForwardingBridge StopTask-5,5,main] | org.apache.activemq.thread.TaskRunnerFactory | ActiveMQ BrokerService[divinedragonbox] Task-4 2016-10-07 08:15:45,379 | DEBUG | Caught exception sending shutdown | org.apache.activemq.network.DemandForwardingBridgeSupport | ActiveMQ ForwardingBridge StopTask-5 org.apache.activemq.transport.TransportDisposedIOException: Transport disposed. at org.apache.activemq.transport.vm.VMTransport.oneway(VMTransport.java:82)[activemq-broker-5.11.1.jar:5.11.1] at org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:68)[activemq-client-5.11.1.jar:5.11.1] at org.apache.activemq.transport.ResponseCorrelator.oneway(ResponseCorrelator.java:60)[activemq-client-5.11.1.jar:5.11.1] at org.apache.activemq.network.DemandForwardingBridgeSupport$4.run(DemandForwardingBridgeSupport.java:288)[activemq-broker-5.11.1.jar:5.11.1] at java.lang.Thread.run(Thread.java:722)[:1.7.0_05] 2016-10-07 08:15:45,380 | DEBUG | Stopping transport ssl://localhost/127.0.0.1:15571 | org.apache.activemq.transport.tcp.TcpTransport | ActiveMQ BrokerService[divinedragonbox] Task-4 2016-10-07 08:15:45,381 | DEBUG | Initialized TaskRunnerFactory[ActiveMQ Task] using ExecutorService: null | org.apache.activemq.thread.TaskRunnerFactory | ActiveMQ BrokerService[divinedragonbox] Task-4 2016-10-07 08:15:45,381 | TRACE | Execute[ActiveMQ Task] runnable: org.apache.activemq.transport.tcp.TcpTransport$1@a1848dc | org.apache.activemq.thread.TaskRunnerFactory | ActiveMQ BrokerService[divinedragonbox] Task-4 2016-10-07 08:15:45,381 | TRACE | Created and running thread[ActiveMQ Task-1]: Thread[ActiveMQ Task-1,5,main] | org.apache.activemq.thread.TaskRunnerFactory | ActiveMQ BrokerService[divinedragonbox] Task-4 2016-10-07 08:15:45,382 | TRACE | Closing socket 2a9a5d77[TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: Socket[addr=localhost/127.0.0.1,port=15571,localport=40999]] | org.apache.activemq.transport.tcp.TcpTransport | ActiveMQ Task-1 2016-10-07 08:15:45,383 | DEBUG | Closed socket 2a9a5d77[TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: Socket[addr=localhost/127.0.0.1,port=15571,localport=40999]] | org.apache.activemq.transport.tcp.TcpTransport | ActiveMQ Task-1 2016-10-07 08:15:45,384 | INFO | divinedragonbox bridge to Unknown stopped | org.apache.activemq.network.DemandForwardingBridgeSupport | ActiveMQ BrokerService[divinedragonbox] Task-4 2016-10-07 08:15:45,384 | TRACE | serviceLocalException: disposed true ex | org.apache.activemq.network.DemandForwardingBridgeSupport | ActiveMQ BrokerService[divinedragonbox] Task-4 org.apache.activemq.transport.TransportDisposedIOException: peer (vm://divinedragonbox#1) stopped. at org.apache.activemq.transport.vm.VMTransport.stop(VMTransport.java:207)[activemq-broker-5.11.1.jar:5.11.1] at org.apache.activemq.transport.TransportFilter.stop(TransportFilter.java:65)[activemq-client-5.11.1.jar:5.11.1] at org.apache.activemq.transport.TransportFilter.stop(TransportFilter.java:65)[activemq-client-5.11.1.jar:5.11.1] at org.apache.activemq.transport.ResponseCorrelator.stop(ResponseCorrelator.java:132)[activemq-client-5.11.1.jar:5.11.1] at org.apache.activemq.broker.TransportConnection.doStop(TransportConnection.java:1151)[activemq-broker-5.11.1.jar:5.11.1] at org.apache.activemq.broker.TransportConnection$4.run(TransportConnection.java:1117)[activemq-broker-5.11.1.jar:5.11.1] at java.lang.Thread.run(Thread.java:722)[:1.7.0_05] 2016-10-07 08:15:45,384 | DEBUG | Stopped transport: vm://divinedragonbox#0 | org.apache.activemq.broker.TransportConnection | ActiveMQ BrokerService[divinedragonbox] Task-4 2016-10-07 08:15:45,384 | TRACE | Shutdown timeout: 1 task: Transport Connection to: vm://divinedragonbox#0 | org.apache.activemq.thread.DedicatedTaskRunner | ActiveMQ BrokerService[divinedragonbox] Task-4 2016-10-07 08:15:45,385 | TRACE | Run task done: Transport Connection to: vm://divinedragonbox#0 | org.apache.activemq.thread.DedicatedTaskRunner | ActiveMQ Connection Dispatcher: vm://divinedragonbox#0 2016-10-07 08:15:45,385 | DEBUG | Connection Stopped: vm://divinedragonbox#0 | org.apache.activemq.broker.TransportConnection | ActiveMQ BrokerService[divinedragonbox] Task-4 2016-10-07 08:15:45,385 | TRACE | Shutdown of ExecutorService: java.util.concurrent.ThreadPoolExecutor@dfe196a[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] with await termination: 0 millis | org.apache.activemq.util.ThreadPoolUtils | ActiveMQ Transport: ssl:///127.0.0.1:40999 2016-10-07 08:15:45,385 | DEBUG | Shutting down VM connectors for broker: divinedragonbox | org.apache.activemq.transport.vm.VMTransportFactory | triggerStartAsyncNetworkBridgeCreation: remoteBroker=ssl://localhost/127.0.0.1:15571, localBroker= vm://divinedragonbox#0 2016-10-07 08:15:45,385 | INFO | Connector vm://divinedragonbox stopped | org.apache.activemq.broker.TransportConnector | triggerStartAsyncNetworkBridgeCreation: remoteBroker=ssl://localhost/127.0.0.1:15571, localBroker= vm://divinedragonbox#0 2016-10-07 08:15:45,400 | DEBUG | Shutdown of ExecutorService: java.util.concurrent.ThreadPoolExecutor@dfe196a[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] is shutdown: true and terminated: true took: 0.001 seconds. | org.apache.activemq.util.ThreadPoolUtils | ActiveMQ Transport: ssl:///127.0.0.1:40999 2016-10-07 08:15:45,400 | DEBUG | Transport Connection to: tcp://127.0.0.1:40999 failed: java.io.EOFException | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: ssl:///127.0.0.1:40999 java.io.EOFException at java.io.DataInputStream.readInt(DataInputStream.java:392)[:1.7.0_05] at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:258)[activemq-client-5.11.1.jar:5.11.1] at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:221)[activemq-client-5.11.1.jar:5.11.1] at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:213)[activemq-client-5.11.1.jar:5.11.1] at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:196)[activemq-client-5.11.1.jar:5.11.1] at java.lang.Thread.run(Thread.java:722)[:1.7.0_05] 2016-10-07 08:15:45,401 | DEBUG | Unregistering MBean org.apache.activemq:type=Broker,brokerName=divinedragonbox,connector=clientConnectors,connectorName=ssl,connectionViewType=remoteAddress,connectionName=tcp_//127.0.0.1_40999 | org.apache.activemq.broker.jmx.ManagementContext | ActiveMQ Transport: ssl:///127.0.0.1:40999 2016-10-07 08:15:45,401 | TRACE | Execute[ActiveMQ BrokerService[divinedragonbox] Task] runnable: org.apache.activemq.broker.TransportConnection$4@5039f4d3 | org.apache.activemq.thread.TaskRunnerFactory | ActiveMQ Transport: ssl:///127.0.0.1:40999 2016-10-07 08:15:45,401 | TRACE | Created and running thread[ActiveMQ BrokerService[divinedragonbox] Task-6]: Thread[ActiveMQ BrokerService[divinedragonbox] Task-6,8,main] | org.apache.activemq.thread.TaskRunnerFactory | ActiveMQ Transport: ssl:///127.0.0.1:40999 </code></pre> <blockquote> <p>Can somebody tell me why are these exceptions thrown?</p> </blockquote> <p>I can provide the entire log file if anybody needs for a deeper look.</p>
0debug
Regex if then to return if found else look for next item : Not sure, but haven't found the right answer for this using Regex. I have three words which may all be present in the text - say 'one two three'. I want to use regex to search for 'one' and return if found and stop so I get 'one' only. If 'one' is not found look for 'two' and finally if not found simply match 'three'. PCRE format will work.
0debug
static int init_input_threads(void) { int i, ret; if (nb_input_files == 1) return 0; for (i = 0; i < nb_input_files; i++) { InputFile *f = input_files[i]; if (f->ctx->pb ? !f->ctx->pb->seekable : strcmp(f->ctx->iformat->name, "lavfi")) f->non_blocking = 1; ret = av_thread_message_queue_alloc(&f->in_thread_queue, 8, sizeof(AVPacket)); if (ret < 0) return ret; if ((ret = pthread_create(&f->thread, NULL, input_thread, f))) return AVERROR(ret); } return 0; }
1threat
train['Gender'].fillna(train['Gender'].mode()[0], inplace=True) : <pre><code> train['Gender'].fillna(train['Gender'].mode()[0], inplace=True) </code></pre> <p>I got this code in one of my basic data science course. I wanted to understand, what is the significance of "[0]" after mode() in this. I would really appreciate the answer. Thanks!</p>
0debug
What CSS do you use to style a table CELL? : <p>I want to make increase <strong>cell padding</strong> via CSS (so I don't have to set <em>each</em> table on the page).</p> <p>I can't see how to do that.</p>
0debug
int avio_check(const char *url, int flags) { URLContext *h; int ret = ffurl_alloc(&h, url, flags, NULL); if (ret) return ret; if (h->prot->url_check) { ret = h->prot->url_check(h, flags); } else { ret = ffurl_connect(h, NULL); if (ret >= 0) ret = flags; } ffurl_close(h); return ret; }
1threat
Interface for associative object array in TypeScript : <p>I have an object like so:</p> <pre><code>var obj = { key1: "apple", key2: true, key3: 123, . . . key{n}: ... } </code></pre> <p>So <code>obj</code> can contain any number of named keys, but the values must all be either string, bool, or number.</p> <p>How do I declare the type of <code>obj</code> as an interface in TypeScript? Can I declare an associative array (or variadic tuple) of a union type or something similar?</p>
0debug
def Check_Solution(a,b,c): if (2*b*b == 9*a*c): return ("Yes"); else: return ("No");
0debug
bootstrap-sass multiselect event conflict : <p>I've got a strange issue using <strong>bootstrap-sass</strong> and <strong>bootstrap-multiselect</strong>. Seems like bootstrap-sass event handlers block multiselect handlers for dropdown etc.</p> <p>This packages installed via bower:</p> <pre><code>'bootstrap-sass-official#3.3.1', 'bootstrap-multiselect' </code></pre> <p>App built on django and python, so template that binds scripts to the page:</p> <pre><code>{% compress js %} &lt;script src="{% static 'jquery/dist/jquery.js' %}"&gt;&lt;/script&gt; &lt;script src="{% static 'bootstrap-sass/assets/javascripts/bootstrap.js' %}"&gt;&lt;/script&gt; {% endcompress %} </code></pre> <p>binding script on a specific page using:</p> <pre><code>{% block extrajs %} &lt;script src="{{ STATIC_URL }}bower_components/bootstrap-multiselect/dist/js/bootstrap-multiselect.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt; {% endblock %} </code></pre> <p>crearing multiselect control:</p> <pre><code>$('.multiselect').multiselect() </code></pre> <p>Nothing special. But when i try to use multiselect control on UI it doesn't drop down. No errors in console.</p> <p>After some surfing through the code i figured that there are some event handlers that preventing multiselect handlers from executing:</p> <pre><code> // APPLY TO STANDARD DROPDOWN ELEMENTS // =================================== $(document) .on('click.bs.dropdown.data-api', clearMenus) .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown) .on('keydown.bs.dropdown.data-api', '[role="menu"]', Dropdown.prototype.keydown) .on('keydown.bs.dropdown.data-api', '[role="listbox"]', Dropdown.prototype.keydown) </code></pre> <p>so, the tricky solution was to switch off the standard event handlers first on the page where multiselect used:</p> <pre><code>$(document) .off('click.bs.dropdown.data-api') .off('keydown.bs.dropdown.data-api') </code></pre> <p>Which seems a bit hacky and not the best solution to me.</p> <p>Are there native ways to resolve this conflict? Thanx.</p>
0debug
How to apply aggregations in spark scala? : I have a data set `test1.txt`. It contain data like below 2::1::3 1::1::2 1::2::2 2::1::5 2::1::4 3::1::2 3::1::1 3::2::2 I have created data-frame using the below code. case class Test(userId: Int, movieId: Int, rating: Float) def pRating(str: String): Rating = { val fields = str.split("::") assert(fields.size == 3) Test(fields(0).toInt, fields(1).toInt, fields(2).toFloat) } val ratings = spark.read.textFile("C:/Users/test/Desktop/test1.txt").map(pRating).toDF() 2,1,3 1,1,2 1,2,2 2,1,5 2,1,4 3,1,2 3,1,1 3,2,2 But I want to print output like below I.e. removing duplicate combinations and instead of `field(2) value 1.0`. 1,1,2.0 1,2,2.0 2,1,12.0 3,1,3.0 3,2,2.0 Please help me on this, how can achieve this.
0debug
How to install build tools for v141_xp for VC 2017? : <p>I'm using the newest release of MSVC 2017 community with platform toolset v141, but I'd like the executables still work on XP, so I assume I need to use the v141_xp toolset, which however results in:</p> <p><em>Error MSB8020: The build tools for v141_xp (Platform Toolset = 'v141_xp') cannot be found. To build using the v141_xp build tools, please install v141_xp build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution".</em></p> <p>I didn't find anything like that in the MSVC installer. Any ideas?</p>
0debug
static void shix_init(MachineState *machine) { const char *cpu_model = machine->cpu_model; int ret; SuperHCPU *cpu; struct SH7750State *s; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *rom = g_new(MemoryRegion, 1); MemoryRegion *sdram = g_new(MemoryRegion, 2); if (!cpu_model) cpu_model = "any"; cpu = SUPERH_CPU(cpu_generic_init(TYPE_SUPERH_CPU, cpu_model)); if (cpu == NULL) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } memory_region_init_ram(rom, NULL, "shix.rom", 0x4000, &error_fatal); memory_region_set_readonly(rom, true); memory_region_add_subregion(sysmem, 0x00000000, rom); memory_region_init_ram(&sdram[0], NULL, "shix.sdram1", 0x01000000, &error_fatal); memory_region_add_subregion(sysmem, 0x08000000, &sdram[0]); memory_region_init_ram(&sdram[1], NULL, "shix.sdram2", 0x01000000, &error_fatal); memory_region_add_subregion(sysmem, 0x0c000000, &sdram[1]); if (bios_name == NULL) bios_name = BIOS_FILENAME; ret = load_image_targphys(bios_name, 0, 0x4000); if (ret < 0 && !qtest_enabled()) { error_report("Could not load SHIX bios '%s'", bios_name); exit(1); } s = sh7750_init(cpu, sysmem); tc58128_init(s, "shix_linux_nand.bin", NULL); }
1threat
static void icount_warp_rt(void) { unsigned seq; int64_t warp_start; do { seq = seqlock_read_begin(&timers_state.vm_clock_seqlock); warp_start = vm_clock_warp_start; } while (seqlock_read_retry(&timers_state.vm_clock_seqlock, seq)); if (warp_start == -1) { return; } seqlock_write_begin(&timers_state.vm_clock_seqlock); if (runstate_is_running()) { int64_t clock = REPLAY_CLOCK(REPLAY_CLOCK_VIRTUAL_RT, cpu_get_clock_locked()); int64_t warp_delta; warp_delta = clock - vm_clock_warp_start; if (use_icount == 2) { int64_t cur_icount = cpu_get_icount_locked(); int64_t delta = clock - cur_icount; warp_delta = MIN(warp_delta, delta); } timers_state.qemu_icount_bias += warp_delta; } vm_clock_warp_start = -1; seqlock_write_end(&timers_state.vm_clock_seqlock); if (qemu_clock_expired(QEMU_CLOCK_VIRTUAL)) { qemu_clock_notify(QEMU_CLOCK_VIRTUAL); } }
1threat
SQL ERROR in Syntax when using WITH : <p>I want to use a SQL Query with the WITH clause an I get a Syntax Error.</p> <p>I´m using MySQL Version 5.6.28</p> <p>Here a simple Code example</p> <pre><code>WITH alias_test AS (SELECT id, title FROM `tips_locations`) SELECT id, title FROM alias_test </code></pre> <p>Here the error I get in my SQL Tool</p> <blockquote> <p>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'alias_test AS (SELECT id, title FROM <code>tips_locations</code>) SELECT id, title FROM ali' at line 1</p> </blockquote> <p>Can you Help me?</p>
0debug
converting only two rows into columns through pivot in sql : please find attach image, i need general sql query i mean not hard coded. Thanks[table structure attach][1] [1]: http://i.stack.imgur.com/vUsYV.png
0debug
how do i display my string? : i am new to c++. i want to know why i cant print record[i][1] using puts (record[i][1]); if i do cout<< record[i][1]; then only the first letter of the string appers, not the rest. i really want help ASAP. its my school project and i gotta submit it real soon. i code on Turbo C++ (TC4). #include< fstream.h> #include< strstream.h> #include< conio.h> #include< dos.h> #include< graphics.h> #include< string.h> #include< stdio.h> #include< stdlib.h> #include< string.h> #include< ctype.h> #include< iomanip.h> #include< iostream.h> char record[500][5]; //array to store 500 entries each consisting of //name,cell no, agesex, crime and sentenced. int cricode=1; char name[35]; char criminalno[10]; char agesex[5]; char sentenced[3]; char crime[20]; char passwordU[30]; int checkpass(char[]); void menu(int); void advmenu(int); void inputdata(); void report(int) ; void searchrecN(char [][5], int); void searchrecC(char [][5], int); void selectcrime(char []); void changepass(); void displaydata(int); void main() { clrscr(); ifstream fp; fp.open("criminal.txt"); do {char a; fp.getline(&record[cricode][1],30,'!') ; //name fp.getline(&record[cricode][2],10,'@'); //cellno fp.getline(&record[cricode][3],7,'%'); //agesex fp.getline(&record[cricode][4],20,'^'); //crime fp.getline(&record[cricode][5],3,'\n'); //sentenced cricode++ ; }while (fp.eof() == 0); cricode--; //final value of cricode fp.close(); menu(cricode); getch(); } void menu(int code) { fstream fp; int hell; clrscr(); cout<<"\n\n"; cout<<"______________________________________\n"; cout<<" L O C A L M E N U \n"; cout<<"______________________________________\n"; cout<<"\n\n"; cout<<"\t\t\t"<<"\n\n[1] Create a Record."; cout<<"\t\t\t"<<"\n\n[2] Search for a record."; cout<<"\t\t\t"<<"\n\n[3] Advance Options."; cout<<"\t\t\t"<<"\n\n[4] Display all entries."; cout<<"\t\t\t"<<"\n\n[5] Exit \n :"; cin>>hell; switch(hell) { case 1: clrscr(); inputdata(); system("pause"); menu(code); break; case 2: clrscr(); char na[30]; int ch; clrscr(); cout<<"\t\t\t"<<"\nSearch by -> "; cout<<"\t\t\t\t"<<"\n[1] Name : "; cout<<"\t\t\t\t"<<"\n[2] Cell No. : "; cin>>ch; switch(ch) { case 1: cout<<"\n Please Enter Name : "; //gets(na); searchrecN(record,code); break; case 2: cout<<"\n Please Enter Cell No. : "; //gets(na); searchrecC(record,code); break; default : cout<<"invalid"; } menu(code); break; case 4: clrscr(); for(int i=0;i<code;i++) { cout<<"\nName \t Cellno \t age/sex \t crime \t sentenced \n"; cout<<record[i][1]; //only one character is displayed of the // entire word. // if i do //puts(record[i][1]); // Error: cannot convert 'int' to 'const char *' } cout<<"\n"; system("pause"); menu(code); break; case 5: //clrscr(); //intro(); break; default: cout<<"\a"; } } int i; void report(int cc) { cout <<record[cc][1]<<"\t" <<record[cc][2]<<"\t" <<record[cc][3]<<"\t" <<record[cc][4]<<"\t" <<record[cc][5]<<"\n"; } void inputdata() { char ch; char recname[30],reccell[10],recagex[7],recrime[20],recsent[3]; ofstream fp; fp.open("criminal.txt", ios::app); do { cout<<"\n[.] Name : "; gets(recname); cout<<"\n[.] Criminal Number : "; gets(reccell); cout<<"\n[.] Age/Sex {eg: 21/M} : "; gets(recagex); cout<<"\n[.] Select Crime : "; selectcrime(recrime); cout<<"\n[.] Sentenced For : "; gets(recsent); fp <<recname <<"!"<<reccell <<"@"<<recagex <<"%"<<recrime <<"^"<<recsent <<"\n"; cout<<"Do you Want to Continue(Y/N): "; cin>>ch; }while((ch=='y')||(ch=='Y')); system("pause"); } void searchrecN(char record[][5], int cricode) { int cnt; char search[30]; cout<<"Enter Cellno.: "; gets(search); for(i=0;i<cricode;i++) { if (strcmpi(search,&record[i][1])==0) { clrscr(); cout<<"\nRecord Found."; cout<<"\nLoading Info......"; system("pause"); report(i); cnt=1; break; } } if(cnt==0) { clrscr(); cout<<"\n ***Record does not exist*** "; cout<<"\n ***Redirecting***\n"; system("pause"); } } void searchrecC(char record[][5], int cricode) { int cnt; char search[10]; cout<<"Enter Cellno.: "; gets(search); for(i=0;i<cricode;i++) { if (strcmpi(search,&record[i][2])==0) { clrscr(); cout<<"\nRecord Found."; cout<<"\nLoading Info......"; system("pause"); report(i); cnt=1; break; } } if(cnt==0) { clrscr(); cout<<"\n ***Record does not exist*** "; cout<<"\n ***Redirecting***\n"; system("pause"); } } void displaydata(int c) { clrscr(); fstream fp; for(i=0;i<c;i++) { cout<<"Name\tCellno\tage/sex\tcrime\tsentenced"; cout <<record[i][1]<<"\t"<<record[i][2]<<"\t" <<record[i][3]<<"\t"<<record[i][4]<<"\t" <<record[i][5]<<"\n"; } /* cout<<setw(100)<<"\n[.] Criminal No. : "; puts(record[i][2]); cout<<setw(100)<<"\n[.] Age/Sex : "; puts(record[i][3]); cout<<setw(100)<<"\n[.] Alleged for : : "; // puts(obj[i].category); cout<<setw(100)<<"\n[.] Crime : "; puts(record[i][4]); // cout<<setw(100)<<"\n[.] Expenses per month : "; puts(record[i][4]); /* cout<<setw(100)<<"\n[.] Expenses per Month : "; cout<<exp; cout<<setw(100)<<"\n[.] Sentenced for : "; puts(record[i][5]); */ }
0debug
Invalid form inputs - Red border with ONLY HTML, CSS, JAVASCRIPT : <p>I'd want to make a red border around invalid input elements after clicking the "Check" button. The problem is <strong>I can't use frameworks or plugins, just HTML, CSS and JavaScript</strong>. I've tried to search for some hours on the web and all I found was to use <code>:valid</code> and <code>:invalid</code> pseudo-classes. They work fine, but <strong>I'd want to display the red border only AFTER clicking the "Check" button</strong>.</p> <p>This is my code</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-css lang-css prettyprint-override"><code>input:invalid { border: 1px solid red; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Invalid Form Test&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;form id="login" method="post"&gt; &lt;div&gt; &lt;label for="username"&gt;Username&lt;/label&gt; &lt;input type="text" id="username" placeholder="Username" name="username" required /&gt; &lt;/div&gt; &lt;div&gt; &lt;label for="password"&gt;Password&lt;/label&gt; &lt;input type="password" id="password" placeholder="Password" name="password" required /&gt; &lt;/div&gt; &lt;div&gt; &lt;button id="check-btn"&gt;Check&lt;/button&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> </p> <p>If possible, I'd also want to remove the default browser tooltip and red outline (i.e. I'd want just my style for unvalid elements).</p> <p>Thank you in advance for your help!</p>
0debug
VB:System.InvalidCastException: 'Conversion from string "United States of America (USA)" to type 'Boolean' is not valid.' : Partial Class Default2 Inherits System.Web.UI.Page Private Sub form1_Load(sender As Object, e As EventArgs) Handles form1.Load Dim Flagimageurl(6) As String ' creating the flag image url array' Flagimageurl(0) = "https://www.cia.gov/library/publications/the-world-factbook/graphics/flags/large/uk-lgflag.gif" Flagimageurl(1) = "https://upload.wikimedia.org/wikipedia/en/thumb/c/c3/Flag_of_France.svg/800px-Flag_of_France.svg.png" Flagimageurl(2) = "https://upload.wikimedia.org/wikipedia/en/thumb/0/05/Flag_of_Brazil.svg/720px-Flag_of_Brazil.svg.png" Flagimageurl(3) = "https://upload.wikimedia.org/wikipedia/en/thumb/9/9a/Flag_of_Spain.svg/750px-Flag_of_Spain.svg.png" Flagimageurl(4) = "https://upload.wikimedia.org/wikipedia/en/thumb/a/a4/Flag_of_the_United_States.svg/1235px-Flag_of_the_United_States.svg.png" Flagimageurl(5) = "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a2/Flag_of_Russia_%28Kremlin.ru%29.svg/1024px-Flag_of_Russia_%28Kremlin.ru%29.svg.png" Dim CountryNames(6) As String 'creating the country names array' CountryNames(0) = "United Kingdom" CountryNames(1) = "France" CountryNames(2) = "Brazil" CountryNames(3) = "Spain" CountryNames(4) = "United States of America (USA)" CountryNames(5) = "Russia" flag.ImageUrl = Flagimageurl(6 * Rnd()) 'Choosing a random flag' RadioButton1.Text = CountryNames(5 * Rnd()) 'Randomly picks the country according to the CountryNames array' RadioButton2.Text = CountryNames(5 * Rnd()) ' with random * 6 you get blanks so you need to use random * 5' RadioButton3.Text = CountryNames(5 * Rnd()) RadioButton4.Text = CountryNames(5 * Rnd()) If RadioButton1.Text = RadioButton2.Text Then 'Makes sure that the radiobuttons don't show duplicate answers' RadioButton2.Text = CountryNames(5 * Rnd()) End If If RadioButton2.Text = RadioButton1.Text Then RadioButton1.Text = CountryNames(5 * Rnd()) End If If RadioButton3.Text = RadioButton1.Text Or RadioButton2.Text Then RadioButton3.Text = CountryNames(5 * Rnd()) End If If RadioButton4.Text = RadioButton1.Text Or RadioButton2.Text Or RadioButton3.Text Then RadioButton4.Text = CountryNames(5 * Rnd()) End If End Sub End Class This problem has been annoying me for days when you run the code it say conversion not valid. Thanks in advance. I really want to solve this issue as soon as possible so that I can carry on with writing the code.
0debug
Random time Xcode : So when a UIButton is pressed I want a random 1 of 4 images to pop up but I want one of the images to pop up at a random time after the button has been pressed. I'm using Xcode and swift 2. Your help is greatly appreciated
0debug
Search engine friendly html meta tag needed : <p>My Six month old Website is not listed in google page rank well. Is there any modification required?</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;title&gt;&lt;?php echo $page_title; ?&gt;&lt;/title&gt; &lt;meta http-equiv="description" content="&lt;?php echo $page_description; ?&gt;" /&gt; &lt;meta name="robots" content="index, follow" &gt; &lt;meta name="keywords" content=" site key words" &gt; &lt;meta name="classification" content="site classification" &gt; &lt;meta name="rating" content="general" &gt; &lt;meta name="distribution" content="global" &gt; &lt;meta name="author" content="site author" &gt; &lt;/head&gt; </code></pre>
0debug
static void sbr_qmf_deint_bfly_c(INTFLOAT *v, const INTFLOAT *src0, const INTFLOAT *src1) { int i; for (i = 0; i < 64; i++) { v[ i] = AAC_SRA_R((src0[i] - src1[63 - i]), 5); v[127 - i] = AAC_SRA_R((src0[i] + src1[63 - i]), 5); } }
1threat