problem
stringlengths
26
131k
labels
class label
2 classes
how to make a pause in c# form? : hi every one i'm trying to write a recursion program (tower of hanoi) and each step must shown in windows form one by one with a little delay but sleep and task.delay didn't work for me :( here's my code: public void solve(int a,int b,int c,int n,PictureBox[] arr) { if (n == 1) { h[c].Push(h[a].Pop()); print(arr); return; } solve(a, c, b, n - 1,arr); h[c].Push(h[a].Pop()); solve(b, a, c, n - 1, arr); print(arr); // System.Threading.Thread.Sleep(); }
0debug
parsing the shell program output using golang : i am trying to call a shell program using golang (os/exec) but the output i am getting is in bytes and i need to convert it into float64 but it is showing error? error: cannot convert out (type []byte) to type float64 func Cpu_usage_data() (cpu_predict float64, err error) { out,err1 := exec.Command("/bin/sh","data_cpu.sh").Output() if err1 != nil { fmt.Println(err1.Error()) } return float64(out), err1 } data_cpu.sh is: top -b n 1 | egrep -w 'apache2|mysqld|php' | awk '{cpu += $9}END{print cpu/NR}'
0debug
int64_t qemu_get_clock(QEMUClock *clock) { switch(clock->type) { case QEMU_TIMER_REALTIME: return get_clock() / 1000000; default: case QEMU_TIMER_VIRTUAL: if (use_icount) { return cpu_get_icount(); } else { return cpu_get_clock(); } } }
1threat
PHP Imploding Multidimention Array : i need to implode an multidimentional array in a string using implode, i tried using the array_map shown here http://stackoverflow.com/a/16710869/2717182 but i failed. my array is as below : Array ( [0] => Array ( [code] => IRBK1179 [qty] => 1 ) [1] => Array ( [code] => IRBK1178 [qty] => 1 ) [2] => Array ( [code] => IRBK1177 [qty] => 1 ) ) i need to implode the array into string formatted like : IRBK1179:1|IRBK1178:1|IRBK1177:1 TQ
0debug
can't allocate region; abort trap: 6 compiler error : I am reading in a text file. and adding them to a array. I am able to get past the first if statement (category == "Ticket:"). The program doesn't print my statement telling me I'm in the Size category if (category == "Size:"). Im assuming this is where the error is pointing me to. I am passing in a tickets[2] which is declared in main, I need assistance, please :D void WaitList::load(Ticket tickets[]) { string a; int ticketCount = -1, seatCount; //Ticket tickets[2]; // try to open the waitlist.txt file as input mode //inputFile.open("hi.txt"); ifstream inputFile("hi.txt"); // cannot open the file if (!inputFile.is_open()) cout << "Cannot open the file.\n"; // open successfuly else { string category = "", data = "", name = "", flightCode = ""; int age = 0, seatNumber = 0; int c; double price = 0; inputFile >> category; inputFile >> data; // keep reading till the end of the file while (!inputFile.eof()) { if (category == "Ticket:") { /* * Here we increment the index of the ticket in the array. * But in our actual Airplane Project we will use LinkedList * to store the Tickets, so we will dynamically allocate * memory whenever we read the word "Ticket:" in the file. * Other than that, the way of reading the file will be the same. */ c = stoi(data); tickets[++ticketCount].setTicketNum(c); seatCount = 0; cout << "Finished Ticket catagory"<< endl; } else if (category == "Size:") { cout << "Inside Size Catagory"; c = stoi(data); tickets[ticketCount].setgroupSize(c); tickets[ticketCount].seatInfo = new Seat[tickets[ticketCount].getSize()]; // allocate space for the seat array; Seat[tickets[ticketCount].groupSize]; } /*else if (category == "Flight:") { flightCode = data; } */ else if (category == "Name:") { name = data; /* * keep reading data for name because it may contain white spaces * stop whenever the data is "Age:" (new category) */ inputFile >> data; while (data != "Age:") { name += " " + data; inputFile >> data; } /* * done reading the name * set the category to be the current data, * then go to the READ_DATA label to read in the new data */ category = data; goto READ_DATA; } else if (category == "Age:") age = stoi(data); else if (category == "Seat:") seatNumber = stoi(data); else if (category == "Price:") { price = stod(data); // fill the seat in the array //tickets[ticketCount].seatInfo = new Seat(); //tickets[ticketCount].seatInfo = new Seat[tickets[ticketCount].getSize()]; Seat *seat = new Seat(seatNumber, price, new Person(name, age)); tickets[ticketCount].seatInfo[seatCount].getReserver().setName(name); tickets[ticketCount].seatInfo[seatCount].getReserver().setAge(age); tickets[ticketCount].getSeat() = seatNumber; tickets[ticketCount].getSeat().setPrice(price); //tickets[ticketCount].setSeat(seat); } inputFile >> category; READ_DATA: // label to jump to inputFile >> data; } // close the file after finish reading inputFile.close(); } } this is there error when compiling with g++ in mac OS X terminal Finished Ticket catagory a.out(15552,0x7fff717ae000) malloc: *** mach_vm_map(size=10416984889535361024) failed (error code=3) *** error: can't allocate region *** set a breakpoint in malloc_error_break to debug libc++abi.dylib: terminating with uncaught exception of type std::bad_alloc: std::bad_alloc Abort trap: 6
0debug
Fill a complex Java Object with dummy values : <p>If A, B, C, D are classes. Suppose a class A is structured as below.</p> <pre><code> class A{ private List&lt;B&gt; bList; private String name; private boolean dude; private C c; private D d; //Getter and Setter Methods } </code></pre> <p>B , C and D have some properties like String, boolean etc. say</p> <pre><code>class B{ private String e; private boolean b; ..... //Getter and Setter Methods } </code></pre> <p>Now I want to create an object of A with its property B, C and D not being null but filled with Dummy values say <code>"abc"</code> for <code>String</code>, <code>1</code> for <code>int</code> , <code>false</code> for <code>boolean</code>.</p> <p>So the aim is to create an object <code>A</code> with dummy values. How can this be achieved ?</p>
0debug
Visualize DynamoDB data in AWS Quicksight : <p>I am looking for an AWS-centric solution (avoiding 3rd party stuff if possible) for visualizing data that is in a very simple DynamoDB table.</p> <p>We use AWS Quicksight for many other reports and dashboards for our clients so that is goal to have visualizations made available there. </p> <p>I was very surprised to see that DynamoDB was not a supported source for Quicksight although many other things are like S3, Athena, Redshift, RDS, etc.</p> <p>Does anyone have any experience for creating a solution for this?</p> <p>I am thinking that I will just create a job that will dump the DynamoDB table to S3 every so often and then use the S3 or Athena integrations with Quicksight to read/display it. It would be nice to have a simple solution for more live data.</p>
0debug
MPU6050 issue explain working : can anubody pls explain me these code to me i didnt understand I2C protocol well via these code but plz altleast give em basic idea how it is working #include<Wire.h> const int MPU=0x68; // I2C address of the MPU-6050 int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ; //int16_t is a 16bit integer. uint16_t is an unsigned 16bit integer void setup(){ Wire.begin(); Wire.beginTransmission(MPU); Wire.write(0x6B); // PWR_MGMT_1 register Wire.write(0); // set to zero (wakes up the MPU-6050) Wire.endTransmission(true); Serial.begin(9600); } void loop(){ Wire.beginTransmission(MPU); Wire.write(0x3B); // starting with register 0x3B (ACCEL_XOUT_H) Wire.endTransmission(false); Wire.requestFrom(MPU,14,true); // request a total of 14 registers AcX=Wire.read()<<8|Wire.read(); // 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L) AcY=Wire.read()<<8|Wire.read(); // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L) AcZ=Wire.read()<<8|Wire.read(); // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L) Tmp=Wire.read()<<8|Wire.read(); // 0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L) GyX=Wire.read()<<8|Wire.read(); // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L) GyY=Wire.read()<<8|Wire.read(); // 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L) GyZ=Wire.read()<<8|Wire.read(); // 0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L) Serial.print("AcX = "); Serial.print(AcX); Serial.print(" | AcY = "); Serial.print(AcY); Serial.print(" | AcZ = "); Serial.print(AcZ); Serial.print(" | Tmp = "); Serial.print(Tmp/340.00+36.53); //equation for temperature in degrees C from datasheet Serial.print(" | GyX = "); Serial.print(GyX); Serial.print(" | GyY = "); Serial.print(GyY); Serial.print(" | GyZ = "); Serial.println(GyZ); delay(333); }
0debug
npm solc: AssertionError [ERR_ASSERTION]: Invalid callback specified : <p>I am trying to compile solidity smart contract using npm solc. I tried to follow different examples. Link to example: <a href="https://medium.com/coinmonks/how-to-compile-a-solidity-smart-contract-using-node-js-51ea7c6bf440" rel="noreferrer">https://medium.com/coinmonks/how-to-compile-a-solidity-smart-contract-using-node-js-51ea7c6bf440</a></p> <p>I wrote my code like following:</p> <pre><code>const path = require('path'); const fs = require('fs'); const solc = require('solc'); const helloPath = path.resolve(__dirname, 'contracts', 'hello.sol'); console.log("First" + helloPath); const source = fs.readFileSync(helloPath, 'UTF-8'); console.log("Second" + source); console.log(solc.compile(source, 1)); </code></pre> <p>I am getting following error when running the above code.</p> <pre><code>AssertionError [ERR_ASSERTION]: Invalid callback specified. at wrapCallback (C:\Users\mouazzamj058\solc_example\node_modules\solc\wrapper.js:16:5) at runWithReadCallback (C:\Users\mouazzamj058\solc_example\node_modules\solc\wrapper.js:37:42) at compileStandard (C:\Users\mouazzamj058\solc_example\node_modules\solc\wrapper.js:78:14) at Object.compileStandardWrapper (C:\Users\mouazzamj058\solc_example\node_modules\solc\wrapper.js:85:14) at Object.&lt;anonymous&gt; (C:\Users\mouazzamj058\solc_example\example.js:4:19) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) </code></pre> <p>Please help.</p>
0debug
static int get_mmu_address(CPUState * env, target_ulong * physical, int *prot, target_ulong address, int rw, int access_type) { int use_asid, n; tlb_t *matching = NULL; use_asid = (env->mmucr & MMUCR_SV) == 0 || (env->sr & SR_MD) == 0; if (rw == 2) { n = find_itlb_entry(env, address, use_asid, 1); if (n >= 0) { matching = &env->itlb[n]; if ((env->sr & SR_MD) & !(matching->pr & 2)) n = MMU_ITLB_VIOLATION; else *prot = PAGE_READ; } } else { n = find_utlb_entry(env, address, use_asid); if (n >= 0) { matching = &env->utlb[n]; switch ((matching->pr << 1) | ((env->sr & SR_MD) ? 1 : 0)) { case 0: case 2: n = (rw == 1) ? MMU_DTLB_VIOLATION_WRITE : MMU_DTLB_VIOLATION_READ; break; case 1: case 4: case 5: if (rw == 1) n = MMU_DTLB_VIOLATION_WRITE; else *prot = PAGE_READ; break; case 3: case 6: case 7: *prot = (rw == 1)? PAGE_WRITE : PAGE_READ; break; } } else if (n == MMU_DTLB_MISS) { n = (rw == 1) ? MMU_DTLB_MISS_WRITE : MMU_DTLB_MISS_READ; } } if (n >= 0) { *physical = ((matching->ppn << 10) & ~(matching->size - 1)) | (address & (matching->size - 1)); if ((rw == 1) & !matching->d) n = MMU_DTLB_INITIAL_WRITE; else n = MMU_OK; } return n; }
1threat
static void cpu_print_cc(FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...), uint32_t cc) { cpu_fprintf(f, "%c%c%c%c", cc & PSR_NEG? 'N' : '-', cc & PSR_ZERO? 'Z' : '-', cc & PSR_OVF? 'V' : '-', cc & PSR_CARRY? 'C' : '-'); }
1threat
How to handle kafka publishing failure in robust way : <p>I'm using Kafka and we have a use case to build a fault tolerant system where not even a single message should be missed. So here's the problem: If publishing to Kafka fails due to any reason (ZooKeeper down, Kafka broker down etc) how can we robustly handle those messages and replay them once things are back up again. Again as I say we cannot afford even a single message failure. Another use case is we also need to know at any given point in time how many messages were failed to publish to Kafka due to any reason i.e. something like counter functionality and now those messages needs to be re-published again.</p> <p>One of the solution is to push those messages to some database (like Cassandra where writes are very fast but we also need counter functionality and I guess Cassandra counter functionality is not that great and we don't want to use that.) which can handle that kind of load and also provide us with the counter facility which is very accurate.</p> <p>This question is more from architecture perspective and then which technology to use to make that happen.</p> <p>PS: We handle some where like 3000TPS. So when system start failing those failed messages can grow very fast in very short time. We're using java based frameworks.</p> <p>Thanks for your help!</p>
0debug
static int decompress_i(AVCodecContext *avctx, uint32_t *dst, int linesize) { SCPRContext *s = avctx->priv_data; GetByteContext *gb = &s->gb; int cx = 0, cx1 = 0, k = 0, clr = 0; int run, r, g, b, off, y = 0, x = 0, z, ret; unsigned backstep = linesize - avctx->width; const int cxshift = s->cxshift; unsigned lx, ly, ptype; reinit_tables(s); bytestream2_skip(gb, 2); init_rangecoder(&s->rc, gb); while (k < avctx->width + 1) { ret = decode_unit(s, &s->pixel_model[0][cx + cx1], 400, &r); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = r >> cxshift; ret = decode_unit(s, &s->pixel_model[1][cx + cx1], 400, &g); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = g >> cxshift; ret = decode_unit(s, &s->pixel_model[2][cx + cx1], 400, &b); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = b >> cxshift; ret = decode_value(s, s->run_model[0], 256, 400, &run); if (ret < 0) return ret; clr = (b << 16) + (g << 8) + r; k += run; while (run-- > 0) { if (y >= avctx->height) return AVERROR_INVALIDDATA; dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } } off = -linesize - 1; ptype = 0; while (x < avctx->width && y < avctx->height) { ret = decode_value(s, s->op_model[ptype], 6, 1000, &ptype); if (ret < 0) return ret; if (ptype == 0) { ret = decode_unit(s, &s->pixel_model[0][cx + cx1], 400, &r); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = r >> cxshift; ret = decode_unit(s, &s->pixel_model[1][cx + cx1], 400, &g); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = g >> cxshift; ret = decode_unit(s, &s->pixel_model[2][cx + cx1], 400, &b); if (ret < 0) return ret; clr = (b << 16) + (g << 8) + r; } if (ptype > 5) return AVERROR_INVALIDDATA; ret = decode_value(s, s->run_model[ptype], 256, 400, &run); if (ret < 0) return ret; switch (ptype) { case 0: while (run-- > 0) { if (y >= avctx->height) return AVERROR_INVALIDDATA; dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } break; case 1: while (run-- > 0) { if (y >= avctx->height) return AVERROR_INVALIDDATA; dst[y * linesize + x] = dst[ly * linesize + lx]; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } clr = dst[ly * linesize + lx]; break; case 2: while (run-- > 0) { if (y < 1 || y >= avctx->height) return AVERROR_INVALIDDATA; clr = dst[y * linesize + x + off + 1]; dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } break; case 4: while (run-- > 0) { uint8_t *odst = (uint8_t *)dst; if (y < 1 || y >= avctx->height || (y == 1 && x == 0)) return AVERROR_INVALIDDATA; if (x == 0) { z = backstep; } else { z = 0; } r = odst[(ly * linesize + lx) * 4] + odst[((y * linesize + x) + off - z) * 4 + 4] - odst[((y * linesize + x) + off - z) * 4]; g = odst[(ly * linesize + lx) * 4 + 1] + odst[((y * linesize + x) + off - z) * 4 + 5] - odst[((y * linesize + x) + off - z) * 4 + 1]; b = odst[(ly * linesize + lx) * 4 + 2] + odst[((y * linesize + x) + off - z) * 4 + 6] - odst[((y * linesize + x) + off - z) * 4 + 2]; clr = ((b & 0xFF) << 16) + ((g & 0xFF) << 8) + (r & 0xFF); dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } break; case 5: while (run-- > 0) { if (y < 1 || y >= avctx->height || (y == 1 && x == 0)) return AVERROR_INVALIDDATA; if (x == 0) { z = backstep; } else { z = 0; } clr = dst[y * linesize + x + off - z]; dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } break; } if (avctx->bits_per_coded_sample == 16) { cx1 = (clr & 0x3F00) >> 2; cx = (clr & 0xFFFFFF) >> 16; } else { cx1 = (clr & 0xFC00) >> 4; cx = (clr & 0xFFFFFF) >> 18; } } return 0; }
1threat
need help in jqurry : I had made a small form with no.of checkboxes..When I click on Check all checkbox then all the checkbox gets checked automatically....Following is my code.... But I have taken the following code from internet only.Although its working but as I am new to jqurry I am not able to understand the script...Please help.. <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script> $(document).ready(function(){ $("#checkAll").change(function () { $("input:checkbox").prop('checked', $(this).prop("checked")); alert("Yoy have checked all"); }); }); </script> </head> <body> <form> <p><label><input type="checkbox" id="checkAll"/> Check all</label></p> <fieldset> <legend>All Checkboxes</legend> <p><label><input type="checkbox" /> Option 1</label></p> <p><label><input type="checkbox" /> Option 2</label></p> <p><label><input type="checkbox" /> Option 3</label></p> <p><label><input type="checkbox" /> Option 4</label></p> </fieldset> </form> </body> </html>
0debug
Applying Format to Entire Row Openpyxl : <p>I have an Excel File that I want to format. The first row (excluding Headers so row2) should be red and <em>italicized</em>.</p> <p>the <a href="http://openpyxl.readthedocs.io/en/2.3.3/styles.html" rel="noreferrer">Openpyxl Documentation states</a>: </p> <blockquote> <p>If you want to apply styles to entire rows and columns then you must apply the style to each cell yourself</p> </blockquote> <p>I personally thinks this stinks... Here is my workaround:</p> <pre><code>import openpyxl from openpyxl.styles import NamedStyle from openpyxl import load_workbook from openpyxl.styles.colors import RED from openpyxl.styles import Font # I normally import a lot of stuff... I'll also take suggestions here. file = 'MY_PATH' wb = load_workbook(filename=file) sheet = wb.get_sheet_by_name('Output') for row in sheet.iter_rows(): for cell in row: if '2' in cell.coordinate: # using str() on cell.coordinate to use it in sheet['Cell_here'] sheet[str(cell.coordinate)].font = Font(color='00FF0000', italic=True) wb.save(filename=file) </code></pre> <p>The first downside is that if there are more cells such as <code>A24</code> my loop will apply the formatting to it. I can fix this with a regular expression. Would that be the correct approach?</p> <p><strong>Ultimately- is there a better way to apply a format to the entire row?</strong> Also. Can anyone point me in the right direction to some <em>good</em> Openpyxl documentation? I only found out about <code>sheet.iter_rows()</code> and <code>cell.coordinates</code> on Stack.</p>
0debug
I want to be able to shorten code in python, how can I do that? : <p>I am making a discord bot in python with discord.py. I want to know how i can shorten this function to fewer lines. This function takes a command (-cf red, for example) and flips a coin with both a red side and a blue side. When the results are in the code sends a DM to the person doing the coinflip while at the same time sending the results in the chat.</p> <pre><code>@bot.command(aliases=['coinflip']) async def cf(ctx, *, cfchoice): cfResults = random.choice(['red','blue']) userId = ctx.message.author.id user = bot.get_user(userId) time.sleep(1) # If the user wins the coinflip if cfchoice == cfResults: # Send result in the channel await ctx.send(f'It is {cfResults}!') # Send a DM to the person await user.send('You won on coinflip! Well done.') # If the user loses the coinflip elif cfchoice != cfResults: # Send result in the channel await ctx.send(f'It is {cfResults}!') # Send a DM to the person await user.send('You lost on coinflip! Good luck next time.') </code></pre>
0debug
Start range in v-for="n in 10" from zero : <p>I want to start the range from 0 instead of 1 in <code>v-for="n in 10"</code> which results in <code>1 2 3 .... 10</code> Is there a way to do it in Vuejs?</p>
0debug
How to make a .py file not human readable? : <p>I have a script in .py format and random forest in pickle format and i should deliver it to a customer . He should not be able to read both. </p>
0debug
How to use browser Incognito Mode in visual studio when Run a web project : <p><a href="https://i.stack.imgur.com/UuESD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/UuESD.png" alt="enter image description here"></a></p> <p>If i Run the project, it will launch using <strong>Google Chrome normal mode</strong>. But how can i launch it using <strong>Google Chrome Incognito Mode ?</strong></p>
0debug
Google App Script - GetColor() : Could you please help me to understand , How to use the Getcolor() Google App script . https://developers.google.com/apps-script/reference/calendar/
0debug
Angular 2 prevent enter from submitting in template-driven form : <p>I have forms that uses the template-driven blueprint, so something like this:</p> <pre><code>&lt;form #myForm="ngForm" ngSubmit="save(myForm.value, myForm.isValid)"&gt; &lt;input #name="ngModel" [(ngModel)]="name"&gt; &lt;button type="submit"&gt;Submit form&lt;/button&gt; &lt;/form&gt; </code></pre> <p>Now, how can I prevent ENTER from submitting the form? It interferes with custom ENTER behaviour inside of the form and also if you accidentally press enter in an input, which is unwanted.</p> <p>I've looked around and found some old Angular 1 answers and also some standard JavaScript ones but I feel that Angular 2 must have something like this already built in but I haven't been able to find it.</p> <p>If they don't, what would be the best way to achieve this?</p>
0debug
pandas Series getting 'Data must be 1-dimensional' error : <p>I'm new to pandas &amp; numpy. I'm running a simple program</p> <pre><code>labels = ['a','b','c','d','e'] s = Series(randn(5),index=labels) print(s) </code></pre> <p>getting the following error</p> <pre><code> s = Series(randn(5),index=labels) File "C:\Python27\lib\site-packages\pandas\core\series.py", line 243, in __init__ raise_cast_failure=True) File "C:\Python27\lib\site-packages\pandas\core\series.py", line 2950, in _sanitize_array raise Exception('Data must be 1-dimensional') Exception: Data must be 1-dimensional </code></pre> <p>Any idea what can be the issue? I'm trying this using eclipse, not using ipython notebook. </p>
0debug
comparison in forloop : i am fairly new to java and came across a problem while working on a project where i need to extract some data by comparing each result that i get out of a forloop with the other. The forloop is to get results out of an sql query & the code for the forloop is as following: for (Map<String, Object> row : results) { String data= row.get("getdata").toString(); } The data recieved out of this when the loop runs 2 times is somewhat like: a12:1:123;b23:2:234;c24:3:344 a12:1:123;b23:2:234;c24:4:345 when, in the above data for the same first vale, the second value after ":" is different, i want to get the third value, for example between c24:3:344 & c24:4:345 the second value is different i.e. 3 and 4 so i need to get 344 and 345. similarly i need to find any such data in the results received by the for loop. All you help is greatly appreciated and thanks in advance.
0debug
Can't remove space on top of nav_host_fragment : <p>I just implemented a bottom navigation (AS's default - File -> New -> Activity -> Bottom Navigation Activity) Everything is fine except for a space on the top of the <code>nav_host_fragment</code>. </p> <p><img src="https://i.ibb.co/vwYBJPG/space.png" alt="wrong space"></p> <p>Since it was generated in a ConstraintLayout, I tried to clean the constraints and set the top constraint with <code>parent</code>, setting <code>margin</code> to '0dp' and set <code>height</code> to <code>match_constraint</code>.</p> <p>I unsuccessfully deleted the constraints and tried over and over again.</p> <p>I used <code>Clean Project</code>.</p> <p>I changed to RelativeLayout and set arguments like this:</p> <pre><code> &lt;fragment android:id="@+id/nav_host_fragment" android:name="androidx.navigation.fragment.NavHostFragment" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentTop="true" android:layout_above="@+id/nav_view" app:defaultNavHost="true" app:navGraph="@navigation/mobile_navigation" /&gt; </code></pre> <p>But the space between <code>nav_host_fragment</code> and the top is still there.</p> <p>Here's the lyout file:</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingTop="?attr/actionBarSize"&gt; &lt;com.google.android.material.bottomnavigation.BottomNavigationView android:id="@+id/nav_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:background="?android:attr/windowBackground" app:menu="@menu/bottom_nav_menu" /&gt; &lt;fragment android:id="@+id/nav_host_fragment" android:name="androidx.navigation.fragment.NavHostFragment" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentTop="true" android:layout_above="@+id/nav_view" app:defaultNavHost="true" app:navGraph="@navigation/mobile_navigation" /&gt; &lt;/RelativeLayout&gt; </code></pre>
0debug
TypeScript TS7015: Element implicitly has an 'any' type because index expression is not of type 'number' : <p>Im getting this compilation error in my Angular 2 app:</p> <pre><code>TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'. </code></pre> <p>The piece of code causing it is:</p> <pre><code>getApplicationCount(state:string) { return this.applicationsByState[state] ? this.applicationsByState[state].length : 0; } </code></pre> <p>This however doesn't cause this error:</p> <pre><code>getApplicationCount(state:string) { return this.applicationsByState[&lt;any&gt;state] ? this.applicationsByState[&lt;any&gt;state].length : 0; } </code></pre> <p>This doesn't make any sense to me. I would like to solve it when defining the attributes the first time. At the moment I'm writing:</p> <pre><code>private applicationsByState: Array&lt;any&gt; = []; </code></pre> <p>But someone mentioned that the problem is trying to use a string type as index in an array and that I should use a map. But I'm not sure how to do that.</p> <p>Thans for your help!</p>
0debug
Having trouble writing a main method for my class : <p>So im writing a method for my computer science class in which im trying to make a kinda like walking path thing. What i want to do is test the methods where the isLevelSegment part will return true if the difference between the maximum and minimum elevation in the walking path segment is less than or equal to ten meters and the isDifficult method is trying to see if there are 3 or more elevation changes in a path ( elevation changes are at least 30 meters up or down ). All my code is written [ idk if its correct or not, i think it is ] and basically and idk why im having a really hard time writing the main method to test it. Help?</p> <p>public class Lab11 {</p> <pre><code>public class WalkingPath { private int[] markers; public boolean isLevelSegment (int start, int end ) { int min = 1; int max = 0; for (int i = start; i&lt;= end ; i ++) { if (markers[i] &gt; max) max = markers[i]; if (markers[i] &lt; min || min == -1) min = markers [i]; } if ((max - min) &lt;= 10) return true; else return false; } public boolean isDifficult () { int changes = 0; for ( int i = 1 ; i&lt; markers.length ; i ++) { if ((markers[i] - markers [i - 1]) &gt;= 30) changes ++; } if (changes &gt;= 3) return true; else return false; } } } </code></pre>
0debug
Find Highest Value in a dictionary : <p>I have a dictionary like so:</p> <pre><code>class1 = { max: 10, 3, 5 Michael: 4. 4, 8 jack: 0, 0, 3 } </code></pre> <p>This is the relevant code</p> <pre><code>class1 = {} with open("1.txt", "r+") as f: for line in f: columns = line.split(":") if len(columns) == 2: names = columns[0] scores = columns[1].strip() else: pass if class1.get(names): class1[names].append(scores) else: class1[names] = list(scores) </code></pre> <p>The numbers represent the scores and I would like for the highest score for each name to be printed out, this is my desired output:</p> <pre><code>max: 10 Micheal: 8 jack: 3 </code></pre> <p>I have already tried this:</p> <pre><code>max_value = max(class1.values()) print(sorted(max_value)) </code></pre> <p>But it makes no difference to my output.</p> <p>Thank you in advanced</p>
0debug
Exporting high resolution plots : <p>I need help in exporting high-quality plots from R console which can be used for academic publishing </p> <p>Tried export pdf options but it is difficult to attach pdf in a word file Please help</p>
0debug
av_cold void INIT_FUNC(VP9DSPContext *dsp, int bitexact) { #if HAVE_YASM int cpu_flags = av_get_cpu_flags(); #define init_lpf_8_func(idx1, idx2, dir, wd, bpp, opt) \ dsp->loop_filter_8[idx1][idx2] = ff_vp9_loop_filter_##dir##_##wd##_##bpp##_##opt #define init_lpf_16_func(idx, dir, bpp, opt) \ dsp->loop_filter_16[idx] = loop_filter_##dir##_16_##bpp##_##opt #define init_lpf_mix2_func(idx1, idx2, idx3, dir, wd1, wd2, bpp, opt) \ dsp->loop_filter_mix2[idx1][idx2][idx3] = loop_filter_##dir##_##wd1##wd2##_##bpp##_##opt #define init_lpf_funcs(bpp, opt) \ init_lpf_8_func(0, 0, h, 4, bpp, opt); \ init_lpf_8_func(0, 1, v, 4, bpp, opt); \ init_lpf_8_func(1, 0, h, 8, bpp, opt); \ init_lpf_8_func(1, 1, v, 8, bpp, opt); \ init_lpf_8_func(2, 0, h, 16, bpp, opt); \ init_lpf_8_func(2, 1, v, 16, bpp, opt); \ init_lpf_16_func(0, h, bpp, opt); \ init_lpf_16_func(1, v, bpp, opt); \ init_lpf_mix2_func(0, 0, 0, h, 4, 4, bpp, opt); \ init_lpf_mix2_func(0, 1, 0, h, 4, 8, bpp, opt); \ init_lpf_mix2_func(1, 0, 0, h, 8, 4, bpp, opt); \ init_lpf_mix2_func(1, 1, 0, h, 8, 8, bpp, opt); \ init_lpf_mix2_func(0, 0, 1, v, 4, 4, bpp, opt); \ init_lpf_mix2_func(0, 1, 1, v, 4, 8, bpp, opt); \ init_lpf_mix2_func(1, 0, 1, v, 8, 4, bpp, opt); \ init_lpf_mix2_func(1, 1, 1, v, 8, 8, bpp, opt) #define init_itx_func(idxa, idxb, typea, typeb, size, bpp, opt) \ dsp->itxfm_add[idxa][idxb] = \ ff_vp9_##typea##_##typeb##_##size##x##size##_add_##bpp##_##opt; #define init_itx_func_one(idx, typea, typeb, size, bpp, opt) \ init_itx_func(idx, DCT_DCT, typea, typeb, size, bpp, opt); \ init_itx_func(idx, ADST_DCT, typea, typeb, size, bpp, opt); \ init_itx_func(idx, DCT_ADST, typea, typeb, size, bpp, opt); \ init_itx_func(idx, ADST_ADST, typea, typeb, size, bpp, opt) #define init_itx_funcs(idx, size, bpp, opt) \ init_itx_func(idx, DCT_DCT, idct, idct, size, bpp, opt); \ init_itx_func(idx, ADST_DCT, idct, iadst, size, bpp, opt); \ init_itx_func(idx, DCT_ADST, iadst, idct, size, bpp, opt); \ init_itx_func(idx, ADST_ADST, iadst, iadst, size, bpp, opt); \ if (EXTERNAL_MMXEXT(cpu_flags)) { init_ipred_func(tm, TM_VP8, 4, BPC, mmxext); if (!bitexact) { init_itx_func_one(4 , iwht, iwht, 4, BPC, mmxext); #if BPC == 10 init_itx_func(TX_4X4, DCT_DCT, idct, idct, 4, 10, mmxext); #endif } } if (EXTERNAL_SSE2(cpu_flags)) { init_subpel3(0, put, BPC, sse2); init_subpel3(1, avg, BPC, sse2); init_lpf_funcs(BPC, sse2); init_8_16_32_ipred_funcs(tm, TM_VP8, BPC, sse2); #if BPC == 10 if (!bitexact) { init_itx_func(TX_4X4, ADST_DCT, idct, iadst, 4, 10, sse2); init_itx_func(TX_4X4, DCT_ADST, iadst, idct, 4, 10, sse2); init_itx_func(TX_4X4, ADST_ADST, iadst, iadst, 4, 10, sse2); } #endif } if (EXTERNAL_SSSE3(cpu_flags)) { init_lpf_funcs(BPC, ssse3); #if BPC == 10 if (!bitexact) { init_itx_funcs(TX_4X4, 4, BPC, ssse3); } #endif } if (EXTERNAL_AVX(cpu_flags)) { init_lpf_funcs(BPC, avx); } if (EXTERNAL_AVX2(cpu_flags)) { #if HAVE_AVX2_EXTERNAL init_subpel3_32_64(0, put, BPC, avx2); init_subpel3_32_64(1, avg, BPC, avx2); init_subpel2(2, 0, 16, put, BPC, avx2); init_subpel2(2, 1, 16, avg, BPC, avx2); #endif } #endif ff_vp9dsp_init_16bpp_x86(dsp); }
1threat
Please help me in the significance of get() in the following C++ code : Here is my code.This is a problem relating to file handling where we input data to a file and then display its contents. I am unable to understand how the line cin.get(ch); helps in the output. If find that if i remove this line from the code,the program is unable to take the input for the variable marks in the second iteration. Why is it so ? I am a bit confused in the working of get() here . Thanks in advance #include<iostream> #include<conio> #include<fstream> int main() { ofstream fout; fout.open("student",ios::out); char name[30],ch; float marks=0.0; for(int i=0;i<5;i++) { cout<<"Student "<<(i+1)<<":\t Name:"; cin.get(name,30); cout<<"\t\t Marks: "; cin>>marks; cin.get(ch); **// the confusion is in this line** fout<<name<<"\n"<<marks<<"\n"; } fout.close(); ifstream fin; fin.open("student",ios::in); fin.seekg(0); cout<<"\n"; for(i=0;i<5;i++) { fin.get(name,30); fin.get(ch); fin>>marks; fin.get(ch); cout<<"Student Name: "<<name; cout<<"\t Marks: "<<marks<<"\n"; } fin.close(); return 0; }
0debug
jsonbject getString() method returns null : <p>I have a json data that looks like the following:</p> <pre><code>{"bills":[{"BillID":"379","BillName":"Credit Card","Amount":"$700.00","PayType":"Auto","Status":"Not Due","DateDue":"2017-03-15","Title":"DUE!","BillSchedule":"90","BillNote":"Test","BillCategory":"Home Expense\/Utilities\/Gas"}]} </code></pre> <p>When I do the code below in Android Studio</p> <pre><code> JSONObject jsonObject = new JSONObject(result); jsonArray = jsonObject.getJSONArray("bills"); for (int i = 0; i &lt; jsonArray.length(); i++) { JSONObject jsonOBject = jsonArray.getJSONObject(i); String billID = jsonOBject.getString("BillID"); String billName = jsonOBject.getString("BillName"); String billAmount = jsonOBject.getString("Amount"); String payType = jsonOBject.getString("PayType"); String billStatus = jsonOBject.getString("Status"); String billDueDate = jsonOBject.getString("DateDue"); String title = jsonOBject.getString("Title"); String billSchedule = jsonObject.getString("BillSchedule"); String billNote = jsonOBject.optString("BillNote"); String billCategory = jsonObject.optString("BillCategory"); BillObject data = new BillObject(billID,billName,billAmount, payType, billStatus,billDueDate, title, billSchedule, billNote, billCategory); data_list.add(data); } </code></pre> <p>It raises an Json exception stating there is "no value for BillSchedule". As you can see by the Json data the BillSchedule field is being populated. Can someone help me figure this out, I don't know what I am missing.</p>
0debug
Upload failed: You need to use a different package name because "com.example" is restricted : <p>When i try to upload my apk it gives the following error</p> <p>You need to use a different package name because "com.example" is restricted.</p> <p>guys help me</p>
0debug
void qmp_blockdev_snapshot_internal_sync(const char *device, const char *name, Error **errp) { BlockdevSnapshotInternal snapshot = { .device = (char *) device, .name = (char *) name }; TransactionAction action = { .type = TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_INTERNAL_SYNC, .u.blockdev_snapshot_internal_sync = &snapshot, }; blockdev_do_action(&action, errp); }
1threat
from heapq import merge def combine_lists(num1,num2): combine_lists=list(merge(num1, num2)) return combine_lists
0debug
void memory_region_register_iommu_notifier(MemoryRegion *mr, Notifier *n) { if (mr->iommu_ops->notify_started && QLIST_EMPTY(&mr->iommu_notify.notifiers)) { mr->iommu_ops->notify_started(mr); } notifier_list_add(&mr->iommu_notify, n); }
1threat
static void icp_realize(DeviceState *dev, Error **errp) { ICPState *icp = ICP(dev); ICPStateClass *icpc = ICP_GET_CLASS(dev); PowerPCCPU *cpu; CPUPPCState *env; Object *obj; Error *err = NULL; obj = object_property_get_link(OBJECT(dev), ICP_PROP_XICS, &err); if (!obj) { error_setg(errp, "%s: required link '" ICP_PROP_XICS "' not found: %s", __func__, error_get_pretty(err)); return; } icp->xics = XICS_FABRIC(obj); obj = object_property_get_link(OBJECT(dev), ICP_PROP_CPU, &err); if (!obj) { error_setg(errp, "%s: required link '" ICP_PROP_CPU "' not found: %s", __func__, error_get_pretty(err)); return; } cpu = POWERPC_CPU(obj); cpu->intc = OBJECT(icp); icp->cs = CPU(obj); env = &cpu->env; switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_POWER7: icp->output = env->irq_inputs[POWER7_INPUT_INT]; break; case PPC_FLAGS_INPUT_970: icp->output = env->irq_inputs[PPC970_INPUT_INT]; break; default: error_setg(errp, "XICS interrupt controller does not support this CPU bus model"); return; } if (icpc->realize) { icpc->realize(icp, errp); } qemu_register_reset(icp_reset, dev); vmstate_register(NULL, icp->cs->cpu_index, &vmstate_icp_server, icp); }
1threat
Samsung Galaxy S8 full screen mode : <p>Latest Samsung's smartphone has interesting feature called <em>full screen</em> (or in marketing terms <em>infinity display</em>). In this mode app covers also part of display where home/back buttons are. Usual apps don't cover this area, leaving it black. But Samsung's native ones cover this area. </p> <p>Question: how to achieve this effect? I mean what kind of manifest declaration or programmatic call (possibly Samsung's legacy API) should I use?</p>
0debug
static int vhdx_log_flush(BlockDriverState *bs, BDRVVHDXState *s, VHDXLogSequence *logs) { int ret = 0; int i; uint32_t cnt, sectors_read; uint64_t new_file_size; void *data = NULL; VHDXLogDescEntries *desc_entries = NULL; VHDXLogEntryHeader hdr_tmp = { 0 }; cnt = logs->count; data = qemu_blockalign(bs, VHDX_LOG_SECTOR_SIZE); ret = vhdx_user_visible_write(bs, s); if (ret < 0) { goto exit; } while (cnt--) { ret = vhdx_log_peek_hdr(bs, &logs->log, &hdr_tmp); if (ret < 0) { goto exit; } if (hdr_tmp.flushed_file_offset > bdrv_getlength(bs->file->bs)) { ret = -EINVAL; goto exit; } ret = vhdx_log_read_desc(bs, s, &logs->log, &desc_entries, true); if (ret < 0) { goto exit; } for (i = 0; i < desc_entries->hdr.descriptor_count; i++) { if (desc_entries->desc[i].signature == VHDX_LOG_DESC_SIGNATURE) { ret = vhdx_log_read_sectors(bs, &logs->log, &sectors_read, data, 1, false); if (ret < 0) { goto exit; } if (sectors_read != 1) { ret = -EINVAL; goto exit; } vhdx_log_data_le_import(data); } ret = vhdx_log_flush_desc(bs, &desc_entries->desc[i], data); if (ret < 0) { goto exit; } } if (bdrv_getlength(bs->file->bs) < desc_entries->hdr.last_file_offset) { new_file_size = desc_entries->hdr.last_file_offset; if (new_file_size % (1024*1024)) { new_file_size = ((new_file_size >> 20) + 1) << 20; bdrv_truncate(bs->file, new_file_size, PREALLOC_MODE_OFF, NULL); } } qemu_vfree(desc_entries); desc_entries = NULL; } bdrv_flush(bs); vhdx_log_reset(bs, s); exit: qemu_vfree(data); qemu_vfree(desc_entries); return ret; }
1threat
jQuery $(this).data() is returning old values : <p>I have the following code:</p> <pre><code>updateColors = function() { $(".color-preview").each(function() { return $(this).css('background-color', $(this).data('color')); }); return null; }; </code></pre> <p>I put a breakpoint on the 3rd line, and type the following into the console:</p> <pre><code>&gt; this &lt;div class=​"color-preview" data-observer=​"{"attr":​"data-color", "observe":​"btn_col"}​" data-color=​"#ffff00" style=​"background-color:​ rgb(153, 0, 255)​;​"&gt;​&lt;/div&gt;​ &gt; $(this).data('color') "#9900ff" </code></pre> <p>As you can see, the actual element's <code>data-color</code> is <code>#ffff00</code>. However, jQuery's <code>.data()</code> method is returning <code>#9900ff</code>, which <em>was</em> the value of the element's <code>data-color</code>, but has been changed (and using the breakpoint, I can see that yes it has already changed).</p>
0debug
def max_occurrences(list1): max_val = 0 result = list1[0] for i in list1: occu = list1.count(i) if occu > max_val: max_val = occu result = i return result
0debug
R dplyr - count and select first row by group : df <- data.frame(id = c(1, 1, 2, 2, 2), desc = c("a1", "a2", "b1", "b2", "b3")) I would like to count by id and select the first row of desc within each id group. That is, return a data frame like the following. ``` id count desc 1 2 a1 2 3 b1 ``` Is there an easy way to do it using dplyr package? Can pipes + group_by() + summarise() do the work without using filter() and join()? Stata can do it as `collapse (count) count=id (first) desc, by(id)` Thanks. Jay
0debug
static int virtconsole_initfn(VirtIOSerialPort *port) { VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port); VirtIOSerialPortInfo *info = DO_UPCAST(VirtIOSerialPortInfo, qdev, vcon->port.dev.info); if (port->id == 0 && !info->is_console) { error_report("Port number 0 on virtio-serial devices reserved for virtconsole devices for backward compatibility."); return -1; } if (vcon->chr) { qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event, vcon); info->have_data = flush_buf; info->guest_open = guest_open; info->guest_close = guest_close; } return 0; }
1threat
void cache_fini(PageCache *cache) { int64_t i; g_assert(cache); g_assert(cache->page_cache); for (i = 0; i < cache->max_num_items; i++) { g_free(cache->page_cache[i].it_data); } g_free(cache->page_cache); cache->page_cache = NULL; }
1threat
static int common_init(AVCodecContext *avctx){ HYuvContext *s = avctx->priv_data; int i; s->avctx= avctx; s->flags= avctx->flags; dsputil_init(&s->dsp, avctx); s->width= avctx->width; s->height= avctx->height; assert(s->width>0 && s->height>0); for(i=0; i<3; i++){ s->temp[i]= av_malloc(avctx->width + 16); } return 0; }
1threat
QError *qerror_from_info(const char *file, int linenr, const char *func, const char *fmt, va_list *va) { QError *qerr; qerr = qerror_new(); loc_save(&qerr->loc); qerr->linenr = linenr; qerr->file = file; qerr->func = func; if (!fmt) { qerror_abort(qerr, "QDict not specified"); } qerror_set_data(qerr, fmt, va); qerror_set_desc(qerr, fmt); return qerr; }
1threat
Best practice for nodejs deployment - Directly moving node_modules to server or run npm install command : <p>What is the best practice for deploying a nodejs application?</p> <p>1) Directly moving the node_modules folders from the development server to production server, so that our same local environment can be created in the production also. Whatever changes made to any of the node modules remotely will not affect our code.</p> <p>2) Run <code>npm install</code> command in the production server with the help of package.json. Here the problem is, any changes in the node modules will affect our code. I have faced some issues with the loopback module (<a href="https://stackoverflow.com/questions/50683224/loopback-getting-error-major-change-in-user-validatepassword-function-in-the-s">issue link</a>). </p> <p>Can anyone help me?</p>
0debug
static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) { int i, n, total_non_cc_elements; struct elem_to_channel e2c_vec[MAX_ELEM_ID] = {{ 0 }}; int num_front_channels, num_side_channels, num_back_channels; uint64_t layout; i = 0; num_front_channels = count_paired_channels(layout_map, tags, AAC_CHANNEL_FRONT, &i); if (num_front_channels < 0) return 0; num_side_channels = count_paired_channels(layout_map, tags, AAC_CHANNEL_SIDE, &i); if (num_side_channels < 0) return 0; num_back_channels = count_paired_channels(layout_map, tags, AAC_CHANNEL_BACK, &i); if (num_back_channels < 0) return 0; i = 0; if (num_front_channels & 1) { e2c_vec[i] = (struct elem_to_channel) { .av_position = AV_CH_FRONT_CENTER, .syn_ele = TYPE_SCE, .elem_id = layout_map[i][1], .aac_position = AAC_CHANNEL_FRONT }; i++; num_front_channels--; } if (num_front_channels >= 4) { i += assign_pair(e2c_vec, layout_map, i, tags, AV_CH_FRONT_LEFT_OF_CENTER, AV_CH_FRONT_RIGHT_OF_CENTER, AAC_CHANNEL_FRONT); num_front_channels -= 2; } if (num_front_channels >= 2) { i += assign_pair(e2c_vec, layout_map, i, tags, AV_CH_FRONT_LEFT, AV_CH_FRONT_RIGHT, AAC_CHANNEL_FRONT); num_front_channels -= 2; } while (num_front_channels >= 2) { i += assign_pair(e2c_vec, layout_map, i, tags, UINT64_MAX, UINT64_MAX, AAC_CHANNEL_FRONT); num_front_channels -= 2; } if (num_side_channels >= 2) { i += assign_pair(e2c_vec, layout_map, i, tags, AV_CH_SIDE_LEFT, AV_CH_SIDE_RIGHT, AAC_CHANNEL_FRONT); num_side_channels -= 2; } while (num_side_channels >= 2) { i += assign_pair(e2c_vec, layout_map, i, tags, UINT64_MAX, UINT64_MAX, AAC_CHANNEL_SIDE); num_side_channels -= 2; } while (num_back_channels >= 4) { i += assign_pair(e2c_vec, layout_map, i, tags, UINT64_MAX, UINT64_MAX, AAC_CHANNEL_BACK); num_back_channels -= 2; } if (num_back_channels >= 2) { i += assign_pair(e2c_vec, layout_map, i, tags, AV_CH_BACK_LEFT, AV_CH_BACK_RIGHT, AAC_CHANNEL_BACK); num_back_channels -= 2; } if (num_back_channels) { e2c_vec[i] = (struct elem_to_channel) { .av_position = AV_CH_BACK_CENTER, .syn_ele = TYPE_SCE, .elem_id = layout_map[i][1], .aac_position = AAC_CHANNEL_BACK }; i++; num_back_channels--; } if (i < tags && layout_map[i][2] == AAC_CHANNEL_LFE) { e2c_vec[i] = (struct elem_to_channel) { .av_position = AV_CH_LOW_FREQUENCY, .syn_ele = TYPE_LFE, .elem_id = layout_map[i][1], .aac_position = AAC_CHANNEL_LFE }; i++; } while (i < tags && layout_map[i][2] == AAC_CHANNEL_LFE) { e2c_vec[i] = (struct elem_to_channel) { .av_position = UINT64_MAX, .syn_ele = TYPE_LFE, .elem_id = layout_map[i][1], .aac_position = AAC_CHANNEL_LFE }; i++; } total_non_cc_elements = n = i; do { int next_n = 0; for (i = 1; i < n; i++) { if (e2c_vec[i-1].av_position > e2c_vec[i].av_position) { FFSWAP(struct elem_to_channel, e2c_vec[i-1], e2c_vec[i]); next_n = i; } } n = next_n; } while (n > 0); layout = 0; for (i = 0; i < total_non_cc_elements; i++) { layout_map[i][0] = e2c_vec[i].syn_ele; layout_map[i][1] = e2c_vec[i].elem_id; layout_map[i][2] = e2c_vec[i].aac_position; if (e2c_vec[i].av_position != UINT64_MAX) { layout |= e2c_vec[i].av_position; } } return layout; }
1threat
Sort Dictionary by Values : <p>I have a dictionary of ints.</p> <pre><code>d = {'jjd':2,'ddf':1,'kik':3} </code></pre> <p>Its much longer then this though. I want to sort by values highest to lowest. But I really want the results returned in an array so I can iterate through it like so:</p> <pre><code>for x in results: print d[x] </code></pre> <p>this should print out: ['kik','jjd','ddf']</p>
0debug
how to do code listing in Latex without line numbers (when using lstlisting environment) : <p>I have been writing a project report and have added some pseudo codes using the following command : lstlisting in Latex as shown bellow.</p> <pre><code> \begin{lstlisting}[language=c++] # On leave focus of email field IF email is blank Error message: "Please enter an email address" ELSE IF email field value is not a valid email address Error message: "Wrong email please try again"} # On leave focus of password IF password is not sufficiently strong Error message: "Password strength is not good" \end{lstlisting} </code></pre> <p>The above works just fine but in the code block thy are some line numbers appearing and I would like to get ride of those. Any hints on how to remove them? I also know the following:</p> <pre><code> \section*{New section} </code></pre> <p>Would give a section title without number. But in the case of code listing it doesn't work and produce an error instead.</p>
0debug
Array Object processing need a array with all Id exist in array object using JavaScript : <p>I have an array like this.</p> <pre><code>[ { "id": 13, "name": "VA" }, { "id": 14, "name": "NA" }, { "id": 15, "name": "PA" } ] </code></pre> <p>I need a new array with all id values like this [13,14,15]. Using javascript.</p>
0debug
static void avc_luma_hv_qrt_and_aver_dst_8x8_msa(const uint8_t *src_x, const uint8_t *src_y, int32_t src_stride, uint8_t *dst, int32_t dst_stride) { uint32_t loop_cnt; v16i8 src_hz0, src_hz1, src_hz2, src_hz3; v16u8 dst0, dst1, dst2, dst3; v16i8 src_vt0, src_vt1, src_vt2, src_vt3; v16i8 src_vt4, src_vt5, src_vt6, src_vt7, src_vt8; v16i8 mask0, mask1, mask2; v8i16 hz_out0, hz_out1, hz_out2, hz_out3; v8i16 vert_out0, vert_out1, vert_out2, vert_out3; v8i16 out0, out1, out2, out3; LD_SB3(&luma_mask_arr[0], 16, mask0, mask1, mask2); LD_SB5(src_y, src_stride, src_vt0, src_vt1, src_vt2, src_vt3, src_vt4); src_y += (5 * src_stride); src_vt0 = (v16i8) __msa_insve_d((v2i64) src_vt0, 1, (v2i64) src_vt1); src_vt1 = (v16i8) __msa_insve_d((v2i64) src_vt1, 1, (v2i64) src_vt2); src_vt2 = (v16i8) __msa_insve_d((v2i64) src_vt2, 1, (v2i64) src_vt3); src_vt3 = (v16i8) __msa_insve_d((v2i64) src_vt3, 1, (v2i64) src_vt4); XORI_B4_128_SB(src_vt0, src_vt1, src_vt2, src_vt3); for (loop_cnt = 2; loop_cnt--;) { LD_SB4(src_x, src_stride, src_hz0, src_hz1, src_hz2, src_hz3); XORI_B4_128_SB(src_hz0, src_hz1, src_hz2, src_hz3); src_x += (4 * src_stride); LD_UB4(dst, dst_stride, dst0, dst1, dst2, dst3); hz_out0 = AVC_HORZ_FILTER_SH(src_hz0, mask0, mask1, mask2); hz_out1 = AVC_HORZ_FILTER_SH(src_hz1, mask0, mask1, mask2); hz_out2 = AVC_HORZ_FILTER_SH(src_hz2, mask0, mask1, mask2); hz_out3 = AVC_HORZ_FILTER_SH(src_hz3, mask0, mask1, mask2); SRARI_H4_SH(hz_out0, hz_out1, hz_out2, hz_out3, 5); SAT_SH4_SH(hz_out0, hz_out1, hz_out2, hz_out3, 7); LD_SB4(src_y, src_stride, src_vt5, src_vt6, src_vt7, src_vt8); src_y += (4 * src_stride); src_vt4 = (v16i8) __msa_insve_d((v2i64) src_vt4, 1, (v2i64) src_vt5); src_vt5 = (v16i8) __msa_insve_d((v2i64) src_vt5, 1, (v2i64) src_vt6); src_vt6 = (v16i8) __msa_insve_d((v2i64) src_vt6, 1, (v2i64) src_vt7); src_vt7 = (v16i8) __msa_insve_d((v2i64) src_vt7, 1, (v2i64) src_vt8); XORI_B4_128_SB(src_vt4, src_vt5, src_vt6, src_vt7); AVC_CALC_DPADD_B_6PIX_2COEFF_SH(src_vt0, src_vt1, src_vt2, src_vt3, src_vt4, src_vt5, vert_out0, vert_out1); AVC_CALC_DPADD_B_6PIX_2COEFF_SH(src_vt2, src_vt3, src_vt4, src_vt5, src_vt6, src_vt7, vert_out2, vert_out3); SRARI_H4_SH(vert_out0, vert_out1, vert_out2, vert_out3, 5); SAT_SH4_SH(vert_out0, vert_out1, vert_out2, vert_out3, 7); out0 = __msa_srari_h((hz_out0 + vert_out0), 1); out1 = __msa_srari_h((hz_out1 + vert_out1), 1); out2 = __msa_srari_h((hz_out2 + vert_out2), 1); out3 = __msa_srari_h((hz_out3 + vert_out3), 1); SAT_SH4_SH(out0, out1, out2, out3, 7); ILVR_D2_UB(dst1, dst0, dst3, dst2, dst0, dst1); CONVERT_UB_AVG_ST8x4_UB(out0, out1, out2, out3, dst0, dst1, dst, dst_stride); dst += (4 * dst_stride); src_vt0 = src_vt4; src_vt1 = src_vt5; src_vt2 = src_vt6; src_vt3 = src_vt7; src_vt4 = src_vt8; } }
1threat
How to convert array into comma separated string in javascript : <p>I have an array </p> <p><code>a.value = [a,b,c,d,e,f]</code></p> <p>How can I convert to comma seperated string like </p> <p><code>a.value = "a,b,c,d,e,f"</code></p> <p>Thanks for all help. </p>
0debug
https on S3 WITHOUT cloudfront possible? : <p>We currently want to start hosting all our assets through AWS S3 and we also want to server everything over https. I understand I can use the Amazon Certificate Manager (ACM) with Cloudfront to server assets over https. The problem is that we are in the medical industry and we are legally prohibited to host anything outside the EU. With S3 I can choose a location (Frankfurt for us), but with Cloudfront I just get this option:</p> <p><a href="https://i.stack.imgur.com/PYiFr.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PYiFr.png" alt="enter image description here"></a></p> <p>So I thought that I could maybe use Letsencrypt to generate my own certs. But I think I then still need to use ACM which only works with Cloudfront, which means I still can't use it.</p> <p>Does anybody know if I can somehow setup S3 with https but <em>without</em> cloudfront?</p>
0debug
I have a query in java : What does parseInt do exactly? Because my second argument was roll no. Which was not parsed but third argument was marks , which was parsed . Why so?
0debug
Covert Json to NSDictionary : I am trying to convert serialized `Json` string to `NSDictionary` but not find any solution to convert serialized `Json` to `NSDictionary`. This is my response string {"id":2,"parent_id":1,"lft":2,"rght":3,"name":"Audio Engineering","images":[{"id":22,"user_id":2,"name":"iStock_000027023404_Small","url":"https:\/\/pbs.twimg.com\/profile_images\/97601593\/Picture_3_400x400.png","alt":"iStock_000027023404_Small","description":"","thumbnail":"a:3:{i:0;a:4:{s:4:\"name\";s:25:\"iStock_000027023404_Small\";s:5:\"width\";i:30;s:6:\"height\";i:30;s:3:\"url\";s:58:\"\/uploads\/2016\/09\/thumb\/small\/iStock_000027023404_Small.jpg\";}i:1;a:4:{s:4:\"name\";s:25:\"iStock_000027023404_Small\";s:5:\"width\";i:90;s:6:\"height\";i:90;s:3:\"url\";s:59:\"\/uploads\/2016\/09\/thumb\/medium\/iStock_000027023404_Small.jpg\";}i:2;a:4:{s:4:\"name\";s:25:\"iStock_000027023404_Small\";s:5:\"width\";i:230;s:6:\"height\";i:230;s:3:\"url\";s:67:\"\/uploads\/2016\/09\/thumb\/medium_251x230\/iStock_000027023404_Small.jpg\";}}","created":"2016-09-07T06:24:09+00:00","modified":"2016-09-07T06:24:09+00:00","_joinData":{"id":12,"category_id":2,"image_id":22}}]} Which I am trying to convert to `NSDictionary`. In this value for key `Thumbnail` is serialized data which I am not able to parse. So if anybody knows the solution please help. Thanks in advance.
0debug
How to make insert and update from different table in one Mysql query with php : Ive tried the code below but it didnt work if (isset($_POST['ubah'])) { $queryUpdate = mysqli_multi_query("INSERT INTO perbaikan SET id_perbaikan = '',idrusakbaik = '" . $id . "',komenrusak = '" . $_POST['komenrusak'] . "',tglbaik = '" . $tgl_sekarang . "'; UPDATE kerusakan SET status = '" . $_POST['status'] . "'WHERE id_kerusakan = '" . $id . "'"); if ($queryUpdate) { echo "<script> alert('Data Berhasil Disimpan'); location.href='index.php?hal=master/perbaikan-mekanik/list' </script>"; exit; } }
0debug
void qemu_mutex_init(QemuMutex *mutex) { int err; pthread_mutexattr_t mutexattr; pthread_mutexattr_init(&mutexattr); pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_ERRORCHECK); err = pthread_mutex_init(&mutex->lock, &mutexattr); pthread_mutexattr_destroy(&mutexattr); if (err) error_exit(err, __func__); }
1threat
How much time does it take for firebase analytics first report? : <p>We wanted to try out the new analytics capabilities provided by firebase, and followed all the steps in the getting started guide. </p> <p>We 've run the app, logged a lot of events and its been a few hours; yet there is no data on the dashboard - We just see a banner saying "Your analytics data will appear here soon" </p> <p>How much time does it take to get our first reports, events, etc.? </p>
0debug
apply inline css to rails : <p>I wish to apply CSS in inline rails code.</p> <pre><code>&lt;%= form_for @wishlist, html: { class: 'ajax_form', id: 'change_wishlist_accessibility' } do |f| %&gt; &lt;%= f.radio_button :is_private, true %&gt;&amp;nbsp;&lt;%= Spree.t(:private) %&gt; &lt;%= f.radio_button :is_private, false %&gt;&amp;nbsp;&lt;%= Spree.t(:public) %&gt; </code></pre> <p>&lt;% end -%> I want to apply <code>margin-left: 600px;</code> tot the form.</p> <p>How can I do this?</p> <p>Thanks</p>
0debug
static inline void float_to_int (float * _f, int16_t * s16, int samples) { int32_t * f = (int32_t *) _f; int i; for (i = 0; i < samples; i++) { s16[i] = blah (f[i]); } }
1threat
Kotlin: why do I need to initialize a var with custom getter? : <p>Why do I need to initialize a <code>var</code> with a custom getter, that returns a constant?</p> <pre><code>var greeting: String // Property must be initialized get() = "hello" </code></pre> <p>I don't need initialization when I make <code>greeting</code> read-only (<code>val</code>)</p>
0debug
I want to rename all my objects in maya but somethings is locked that I can t do it : [enter image description here][1] It is stocked in head one and it only transform Ghoul and SHJnt. In addition,I try to compile it by function one by one. and editor told me that I can t rename which is locked. How to solve this problem! thank u so much! [1]: http://i.stack.imgur.com/EbCNu.jpg
0debug
static void qdm2_fft_decode_tones (QDM2Context *q, int duration, GetBitContext *gb, int b) { int channel, stereo, phase, exp; int local_int_4, local_int_8, stereo_phase, local_int_10; int local_int_14, stereo_exp, local_int_20, local_int_28; int n, offset; local_int_4 = 0; local_int_28 = 0; local_int_20 = 2; local_int_8 = (4 - duration); local_int_10 = 1 << (q->group_order - duration - 1); offset = 1; while (1) { if (q->superblocktype_2_3) { while ((n = qdm2_get_vlc(gb, &vlc_tab_fft_tone_offset[local_int_8], 1, 2)) < 2) { offset = 1; if (n == 0) { local_int_4 += local_int_10; local_int_28 += (1 << local_int_8); } else { local_int_4 += 8*local_int_10; local_int_28 += (8 << local_int_8); } } offset += (n - 2); } else { offset += qdm2_get_vlc(gb, &vlc_tab_fft_tone_offset[local_int_8], 1, 2); while (offset >= (local_int_10 - 1)) { offset += (1 - (local_int_10 - 1)); local_int_4 += local_int_10; local_int_28 += (1 << local_int_8); } } if (local_int_4 >= q->group_size) return; local_int_14 = (offset >> local_int_8); if (local_int_14 >= FF_ARRAY_ELEMS(fft_level_index_table)) return; if (q->nb_channels > 1) { channel = get_bits1(gb); stereo = get_bits1(gb); } else { channel = 0; stereo = 0; } exp = qdm2_get_vlc(gb, (b ? &fft_level_exp_vlc : &fft_level_exp_alt_vlc), 0, 2); exp += q->fft_level_exp[fft_level_index_table[local_int_14]]; exp = (exp < 0) ? 0 : exp; phase = get_bits(gb, 3); stereo_exp = 0; stereo_phase = 0; if (stereo) { stereo_exp = (exp - qdm2_get_vlc(gb, &fft_stereo_exp_vlc, 0, 1)); stereo_phase = (phase - qdm2_get_vlc(gb, &fft_stereo_phase_vlc, 0, 1)); if (stereo_phase < 0) stereo_phase += 8; } if (q->frequency_range > (local_int_14 + 1)) { int sub_packet = (local_int_20 + local_int_28); qdm2_fft_init_coefficient(q, sub_packet, offset, duration, channel, exp, phase); if (stereo) qdm2_fft_init_coefficient(q, sub_packet, offset, duration, (1 - channel), stereo_exp, stereo_phase); } offset++; } }
1threat
Vagrant Multi-Machine Parallel Start : <p>I'm trying to provision a master-master MySQL pair and they can only be configured correctly if both of them are up.</p> <pre><code>Vagrant.configure("2") do |config| web.vm.box = "centos/7" config.vm.define "primary" do |primary| ....... end config.vm.define "secondary" do |secondary| ....... end end </code></pre> <p>I've run thru this multiple times and Vagrant only starts the second vm after the first one is up.</p> <p>Is there any way to force Vagrant to start up two VM's at the same time? </p>
0debug
Emacs: Failed to verify signature archive-contents.sig : <p>Recently tried to update emacs packages and got this.</p> <pre><code>Failed to verify signature archive-contents.sig: No public key for 066DAFCB81E42C40 created at 2019-10-02T10:10:02+0100 using RSA Command output: gpg: Signature made Wed 02 Oct 2019 10:10:02 AM BST gpg: using RSA key C433554766D3DDC64221BFAA066DAFCB81E42C40 gpg: Can't check signature: No public key </code></pre> <p>Any ideas why?</p>
0debug
static void gen_ove_ov(DisasContext *dc, TCGv ov) { gen_helper_ove(cpu_env, ov); }
1threat
function openDialog() set width and set height Google Spreadsheete : i need set width in this dialog [enter image description here][1] [1]: http://i.stack.imgur.com/iXskO.png the code it's: // Use this code for Google Docs, Forms, or new Sheets. function onOpen() { SpreadsheetApp.getUi() // Or DocumentApp or FormApp. .createMenu('Cadastro') .addItem('Open', 'openDialog') .addToUi(); } function openDialog() { var html = HtmlService.createHtmlOutputFromFile('index'); SpreadsheetApp.getUi() // Or DocumentApp or FormApp. .showModalDialog(html, 'Dialog title'); }`enter code here`
0debug
Python - Replace only exact word in string : <p>I want to replace only specific word in one string. However, some other words have that word inside but I don't want them to be changed.</p> <p>For example, for the below string I only want to replace <code>x</code> with <code>y</code> in <code>z</code> string. how to do that?</p> <pre><code>x = "the" y = "a" z = "This is the thermometer" </code></pre>
0debug
uint64_t blk_mig_bytes_total(void) { BlkMigDevState *bmds; uint64_t sum = 0; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { sum += bmds->total_sectors; } return sum << BDRV_SECTOR_BITS; }
1threat
static void v9fs_create_post_mksock(V9fsState *s, V9fsCreateState *vs, int err) { if (err) { err = -errno; goto out; } err = v9fs_do_chmod(s, &vs->fullname, vs->perm & 0777); v9fs_create_post_perms(s, vs, err); return; out: v9fs_post_create(s, vs, err); }
1threat
Array of "Object" class : <p>Despite the fact that you lose the typing security, is it bad to use primitive Object class arrays to be able to have a multi-typed array?</p> <p>Code to understand:</p> <pre><code>public class testobject { public static void main (String[] args){ Object[] obj = new Object[5]; obj[0] = "Cat"; obj[1] = 7; obj[2] = new Object(); for(int i = 0; i &lt; obj.length; i++){ System.out.println(obj[i]); } } } </code></pre>
0debug
static int get_qcc(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q, uint8_t *properties) { int compno; if (bytestream2_get_bytes_left(&s->g) < 1) return AVERROR_INVALIDDATA; compno = bytestream2_get_byteu(&s->g); properties[compno] |= HAD_QCC; return get_qcx(s, n - 1, q + compno); }
1threat
static int net_socket_connect_init(VLANState *vlan, const char *model, const char *name, const char *host_str) { NetSocketState *s; int fd, connected, ret, err; struct sockaddr_in saddr; if (parse_host_port(&saddr, host_str) < 0) return -1; fd = socket(PF_INET, SOCK_STREAM, 0); if (fd < 0) { perror("socket"); return -1; } socket_set_nonblock(fd); connected = 0; for(;;) { ret = connect(fd, (struct sockaddr *)&saddr, sizeof(saddr)); if (ret < 0) { err = socket_error(); if (err == EINTR || err == EWOULDBLOCK) { } else if (err == EINPROGRESS) { break; #ifdef _WIN32 } else if (err == WSAEALREADY) { break; #endif } else { perror("connect"); closesocket(fd); return -1; } } else { connected = 1; break; } } s = net_socket_fd_init(vlan, model, name, fd, connected); if (!s) return -1; snprintf(s->nc.info_str, sizeof(s->nc.info_str), "socket: connect to %s:%d", inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port)); return 0; }
1threat
In moment.js which directive works as ng-value in Angular.js for Input fields? : Basically I want to know a directive in Moment,js which works same as ng-value in Angular.js for input fields
0debug
Ant-Design Table > How can I disable pagination and show all records : <p>My questions is: Ant-Design Table > How can I disable pagination and show all records... Currently I can configure pagination component but I don't know how to disable it. Thanks</p>
0debug
Can I write javascript web apps in visual studio 2015? : <p>I don't know anything about javascript web programming... but want to learn.</p> <p>My question is : Can I use visual studio 2015 to write, debug and publish(?) javascript web applications.</p> <p>Again... I don't know if 'publishing' is the right terminology for writing web applications in Javascript... of if you can even 'write' web applications in Javascript...</p> <p>Any information on the topic would be good to know.</p> <p>thanks</p>
0debug
def sub_list(nums1,nums2): result = map(lambda x, y: x - y, nums1, nums2) return list(result)
0debug
void qmp_input_visitor_cleanup(QmpInputVisitor *v) { qobject_decref(v->stack[0].obj); g_free(v); }
1threat
Read a file line by line with condition in shell script : <p>i have a file errorgot.log</p> <pre><code>1 23 23 2 22 42 3 12 2 4 5 26 5 14 45 </code></pre> <p>i want to sum all the third number in a line with a shell script. for the example, 23 + 42 + 2 + 26 + 45 = 138</p> <p>thanks bfore</p>
0debug
Why does Python return this? : <p>If <code>my_string = "This is MY string!"</code>, why does <code>print(my_string[0:7:5])</code> return "Ti" and not "T i" because there is a space between 'This' and 'is'?</p>
0debug
I got a error in visual studio : Description The specified task executable "csc.exe" could not be run. Could not load file or assembly 'Microsoft.CodeAnalysis.CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
0debug
Why does my C program not run? : <pre><code>#include &lt;stdio.h&gt; #include &lt;math.h&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt; #define N 7 void getArray1(int ar1[]) { int i; printf("Enter %d integers:", N); for (i = 0; i &lt; N; i++) { scanf("%d", &amp;ar1[i]); } } void getMax(int *p) { printf("Enter a max value greater than zero:"); scanf("%d", *p); while (*p = 0 || *p &lt; 0) { printf("Incorrect input, try again:"); scanf("%d", *p); } } void fillRandom (int ar2[], int max) { int i; for (i = 0; i &lt; N; i++) { ar2[i] = rand() % (max+1); } } void checkMatching(int ar1[], int ar2[], int ar3[]) { int i, j=0, flag = 1; for (i = 0; j &lt; N; j++) { while (flag!=0) { if (ar1[i] == ar2[j]) flag = 0; j++; if (flag == 0) j = 0; } if (flag == 1) ar3[i] = ar1[i]; flag = 1; } } void printMatching(int ar3[]) { int i, flag = 0; for (i = 0; i &lt; N; i++) { if (ar3[i] != 0) { printf("%d", ar3[i]); flag = 1; } } if (flag == 0) printf("All numbers from ar1 appear in ar2!"); } void main() { int maxValue; int ar1[N]; int ar2[N]; int ar3[N] = { 0 }; srand(time(NULL)); getArray1(ar1[N]); getMax(&amp;maxValue); fillRandom(ar2[N], maxValue); checkMatching(ar1[N], ar2[N], ar3[N]); printMatching(ar3[N]); } </code></pre> <p>I'm very new to programming and this is an assignment I have. Basically, the program is supposed to get one array from the user, fill a second array with random numbers from 0 to a value selected by the user, and then print the elements in the first array that do not appear in the second. </p> <p>I'm using Visual Studio, the program compiles ok, no errors are shown, but after typing 7 numbers it crashes (ConsoleApplication has stopped working) and I just can't figure out why.</p>
0debug
How to locate a webtable cell with specific text in selnium c# : I have trouble in locating a webtable with a specific text in cell in selenium using c# As the following Html <td class="status" > <Span class="label label-status"> new <span> <td> I need to locate with the text "new" so if this condition pass click on this cell
0debug
void ff_avg_h264_qpel4_mc11_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hv_qrt_and_aver_dst_4x4_msa(src - 2, src - (stride * 2), stride, dst, stride); }
1threat
select query with inner join with some pblm : SELECT distinct response_user,patient_name,ipno,department FROM response inner join patient_details on response.response_user=patient_details.id inner join key_points on response.response_key=key_points.kp_id where department='CVTS' and MONTH(response_on) between '12' and '12' and response_key between 146 and 149 and response_val='5' or response_val='4' and kp_belongs_to='1' order by patient_name asc i want the name of the patients in specific department
0debug
alert('Hello ' + user_input);
1threat
static int dca_find_frame_end(DCAParseContext *pc1, const uint8_t *buf, int buf_size) { int start_found, i; uint32_t state; ParseContext *pc = &pc1->pc; start_found = pc->frame_start_found; state = pc->state; i = 0; if (!start_found) { for (i = 0; i < buf_size; i++) { state = (state << 8) | buf[i]; if (IS_MARKER(state, i, buf, buf_size)) { if (!pc1->lastmarker || state == pc1->lastmarker || pc1->lastmarker == DCA_SYNCWORD_SUBSTREAM) { start_found = 1; pc1->lastmarker = state; i++; break; } } } } if (start_found) { for (; i < buf_size; i++) { pc1->size++; state = (state << 8) | buf[i]; if (state == DCA_SYNCWORD_SUBSTREAM && !pc1->hd_pos) pc1->hd_pos = pc1->size; if (IS_MARKER(state, i, buf, buf_size) && (state == pc1->lastmarker || pc1->lastmarker == DCA_SYNCWORD_SUBSTREAM)) { if (pc1->framesize > pc1->size) continue; pc->frame_start_found = 0; pc->state = -1; pc1->size = 0; return i - 3; } } } pc->frame_start_found = start_found; pc->state = state; return END_NOT_FOUND; }
1threat
how can i set a error to the user as the spinner is mandatory and an item to be selected? : i want to get a error message in spinner, while clicking a button stating the user to "select a city".Can anyone please help me with the mainactivity.java code <Spinner android:id="@+id/spinner1" android:layout_width="319dp" android:layout_height="52dp" android:layout_marginTop="11dp" android:entries="@array/state_arrays"/>
0debug
QUARRY TO LIST ORACLE TABLESPACE : How i can list oracle **all tablespaces +temp Tablespace** by displaying **allocate space(MB), used space(MB), status(online\offline)** and **type** with one SQL quarry
0debug
Expected onClick listener to be a function, instead got type object - react redux : <p>As explained in the title, I am getting the error Expected onClick listener to be a function, instead got type object </p> <p>But I am unable to understand why this isnt working. as far as I know, the onClick listener IS a function.</p> <p>Here's, the CharacterList Component where the error comes from</p> <pre><code>import React,{Component} from 'react'; import {connect} from 'react-redux'; import {addCharacterById} from '../actions'; import {bindActionCreators} from 'redux'; class CharacterList extends Component{ render(){ //console.log('name : ',this.props.characters[2].name); return( &lt;div&gt; &lt;h3&gt;Characters&lt;/h3&gt; &lt;ul&gt; {this.props.characters.map((character)=&gt;{ return(&lt;li key={character.id}&gt;{character.name} &lt;div onClick={this.props.addCharacterById(character.id)} &gt;+&lt;/div&gt; &lt;/li&gt;); })} &lt;/ul&gt; &lt;/div&gt; ) } } function mapStateToProps(state){ return { characters:state } } export default connect(mapStateToProps,{addCharacterById})(CharacterList); </code></pre> <p>And here's the action creator</p> <pre><code>export const ADD_CHARACTER='ADD_CHARACTER'; export function addCharacterById(id){ var action ={ type:ADD_CHARACTER, id } return action; } </code></pre> <p>So, what do you guys think? what is the problem here?</p>
0debug
500 Internal Server Error in wordpress. Tried everithing : I've got a pretty old and large wordpress website to fix and develop it. After I fixed some error, **I got an "Internal Server Error 500" globally to that subdomain** (also for wp-admin,wp-login,index.php,etc...). -Firstly I **checked for the .htaccess file**, deleted it, manually recreated it with the wordpress defaults, but it didn't help. Secondly I incrased the php limit with added a php.ini file, and also defined the limit in wp-config.php, but nothing changed. -Then I **deactivated all plugins** (renamed the plugin directory), but still nothing. -I **updated the "wp-admin", "wp-includes" directories, and some other core files** from a newly installed worpress. -I realized that the directories and files premissions are wrong. I **set the 644 (for files) and 755 (for directories) premissions.** Still got the error. -I **modified the "home" and "site url" options** in phpmyadmin to the subdomain. -After that I decided to reinstall the whole wordpress to fix the problem, and I started to downloading the wp-content to my computer (25 GB) when I found some .php files in the uploads and in the gallery. They were mostly some kind of backdoors...fortunately apache weren't running on my machine. Finished with the download after 15 hours. I was very happy. -After all, I created an additional backup directory on the FTP server and moved the old wp site into that. I **uploaded the newest wordpress to the original site location on the server, and set the wp-config.php file. But I sill got the "500 Internal Server Error"...** **In conclusion, I guess the problem is in the mysql database, but I hope I'm wrong. It's pretty large and no idea what could be the issue in that. Perhabs something in the wp_options table. I don't know.** I use WinSCP for FTP connect, Notepad++ and Eclipse for editing. If you had patience to read that, **please help me with some useful idea**. Thanks!
0debug
How to set the zIndex layer order for geoJson layers? : <p>I would like to have certain layers to be always on top of others, no matter in which order they are added to the map. I am aware of <code>bringToFront()</code>, but it does not meet my requirements. I would like to set the zIndex dynamically based on properties.</p> <p>Leaflet has the method <code>setZIndex()</code>, but this apparently does not work for geoJson layers: <a href="https://jsfiddle.net/jw2srhwn/" rel="noreferrer">https://jsfiddle.net/jw2srhwn/</a></p> <p>Any ideas?</p>
0debug
Why are numpy functions so slow on pandas series / dataframes? : <p>Consider a small MWE, taken from <a href="https://stackoverflow.com/q/47881048/4909087">another question</a>:</p> <pre><code>DateTime Data 2017-11-21 18:54:31 1 2017-11-22 02:26:48 2 2017-11-22 10:19:44 3 2017-11-22 15:11:28 6 2017-11-22 23:21:58 7 2017-11-28 14:28:28 28 2017-11-28 14:36:40 0 2017-11-28 14:59:48 1 </code></pre> <p>The goal is to clip all values with an upper bound of 1. My answer uses <code>np.clip</code>, which works fine.</p> <pre><code>np.clip(df.Data, a_min=None, a_max=1) array([1, 1, 1, 1, 1, 1, 0, 1]) </code></pre> <p>Or, </p> <pre><code>np.clip(df.Data.values, a_min=None, a_max=1) array([1, 1, 1, 1, 1, 1, 0, 1]) </code></pre> <p>Both of which return the same answer. My question is about the relative performance of these two methods. Consider - </p> <pre><code>df = pd.concat([df]*1000).reset_index(drop=True) %timeit np.clip(df.Data, a_min=None, a_max=1) 1000 loops, best of 3: 270 µs per loop %timeit np.clip(df.Data.values, a_min=None, a_max=1) 10000 loops, best of 3: 23.4 µs per loop </code></pre> <p>Why is there such a massive difference between the two, just by calling <code>values</code> on the latter? In other words...</p> <p><strong>Why are numpy functions so slow on pandas objects?</strong></p>
0debug
Is Google Cloud Storage an automagical global CDN? : <p>I’m attempting to setup a Google Cloud Storage bucket to store and serve all the static objects for my site. I’m also attempting to push all the objects in that bucket out to all the global edge locations offered by Google Cloud CDN.</p> <p>I’ve created a bucket on Google Cloud Storage: <code>cdn.mysite.com</code>. I chose “US” multi-region for the bucket <code>location</code> setting.</p> <p>My assumption is that any object stored in this bucket will be replicated to all the <code>us-*</code> regions for high-durability purposes, but <strong>not</strong> pushed out to all the Google Cloud CDN global edge locations for CDN purposes.</p> <p>Or are all my objects in my “US” multi-region bucket already automagically pushed out to all of Google Cloud CDN edge locations?</p> <p>I’m gobsmacked that I can’t figure out whether or not my bucket is <em>already</em> a CDN or not. Even after two days of searching (Google, ironically).</p> <p>Thanks in advance for any help.</p>
0debug
static sd_rsp_type_t sd_app_command(SDState *sd, SDRequest req) { DPRINTF("ACMD%d 0x%08x\n", req.cmd, req.arg); switch (req.cmd) { case 6: switch (sd->state) { case sd_transfer_state: sd->sd_status[0] &= 0x3f; sd->sd_status[0] |= (req.arg & 0x03) << 6; return sd_r1; default: break; } break; case 13: switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; case 22: switch (sd->state) { case sd_transfer_state: *(uint32_t *) sd->data = sd->blk_written; sd->state = sd_sendingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; case 23: switch (sd->state) { case sd_transfer_state: return sd_r1; default: break; } break; case 41: if (sd->spi) { sd->state = sd_transfer_state; return sd_r1; } switch (sd->state) { case sd_idle_state: if (req.arg) sd->state = sd_ready_state; return sd_r3; default: break; } break; case 42: switch (sd->state) { case sd_transfer_state: return sd_r1; default: break; } break; case 51: switch (sd->state) { case sd_transfer_state: sd->state = sd_sendingdata_state; sd->data_start = 0; sd->data_offset = 0; return sd_r1; default: break; } break; default: sd->card_status &= ~APP_CMD; return sd_normal_command(sd, req); } fprintf(stderr, "SD: ACMD%i in a wrong state\n", req.cmd); return sd_illegal; }
1threat
Is it good practice to use multiple namespace in same C++ source file? : <p>I want to include more than one namespace in the same .cpp file.</p> <p>While <code>std</code> is widely used, the namespace <code>z3</code> will be used in about 10% of a 25 KLOC file.</p> <p>Will it be a good practice to use both as </p> <pre><code> using namespace std; using namespace z3; </code></pre> <p>I am thinking of using only <code>std</code> and then use the <code>Z3</code> methods by mentioning the namespase whenever required. Like,</p> <pre><code> using namespace std; z3::context c; z3::solver s; </code></pre> <p>Which of these is better practice?</p> <p>I do not want to rename them into one namespace.</p> <p>Thanks and regards, Sukanya</p>
0debug
npm build gives "Ineffective mark-compacts near heap limit Allocation failed" : <p>I have a reactjs/typescript project, running on windows 10. Im trying to build by ts-scripts with</p> <blockquote> <p>"rimraf ../wwwroot/* &amp;&amp; react-scripts-ts build &amp;&amp; copyfiles ./build/**/* ../wwwroot/ -u 1</p> </blockquote> <p>This has worked ok before, but when I removed the node_modules-folder, re-run the npm install-command and then the command above I get the error message</p> <blockquote> <p>FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory</p> </blockquote> <p>I have no idea why. After googling Ive seen</p> <blockquote> <p>NODE_OPTIONS="–max-old-space-size=2048" but I dont know where to put this</p> </blockquote> <p><strong>Full error message</strong></p> <p>Last few GCs </p> <pre><code>[11376:0000024682F49880] 60039 ms: Mark-sweep 2034.1 (2085.2) -&gt; 2033.7 (2085.2) MB, 1029.4 / 0.0 ms (average mu = 0.073, current mu = 0.006) allocation failure scavenge might not succeed [11376:0000024682F49880] 61094 ms: Mark-sweep 2034.4 (2085.2) -&gt; 2034.1 (2085.7) MB, 1047.7 / 0.0 ms (average mu = 0.039, current mu = 0.007) allocation failure scavenge might not succeed JS stacktrace ==== JS stack trace ========================================= 0: ExitFrame [pc: 000001CDF84DC5C1] Security context: 0x007044b9e6e1 &lt;JSObject&gt; 1: bindChildrenWorker(aka bindChildrenWorker) [000001AD1C0ACD59] [C:\Users\robcar\source\repos\Boost\Boost.Web\ClientApp\node_modules\typescript\lib\typescript.js:~27657] [pc=000001CDF8FA47CA](this=0x03da79d826f1 &lt;undefined&gt;,node=0x034b8724ab71 &lt;NodeObject map = 000000660468F931&gt;) 2: bind(aka bind) [000001AD1C0AE2D9] [C:\Users\robcar\source\repos\B... FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 00007FF6B5EA121A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4810 2: 00007FF6B5E7A5B6 node::MakeCallback+4518 3: 00007FF6B5E7AFA0 node_module_register+2160 4: 00007FF6B610B3EE v8::internal::FatalProcessOutOfMemory+846 5: 00007FF6B610B31F v8::internal::FatalProcessOutOfMemory+639 6: 00007FF6B6649304 v8::internal::Heap::MaxHeapGrowingFactor+11476 7: 00007FF6B663FA67 v8::internal::ScavengeJob::operator=+25543 8: 00007FF6B663DFDC v8::internal::ScavengeJob::operator=+18748 9: 00007FF6B6646F57 v8::internal::Heap::MaxHeapGrowingFactor+2343 10: 00007FF6B6646FD6 v8::internal::Heap::MaxHeapGrowingFactor+2470 11: 00007FF6B61E9DD7 v8::internal::Factory::NewFillerObject+55 12: 00007FF6B6281ABA v8::internal::WasmJs::Install+29530 13: 000001CDF84DC5C1 </code></pre>
0debug
integrate ng2Material by NPM : I have a problem trying to integrate Angular2 with ng2Material. I get show small buttons with the Material style but i dont know why when i click over the buttons, i can see the effect over buttons click. If somebody can help me please, this is really urgent. I prepare a github url You must just make: 1) npm install 2) bower install 3) npm run go [Github project][1] [1]: https://github.com/webdeveloperfront/ng2Material_Angular2
0debug
Making a text field required only if another text field has been filled out in C# : <p>I'm making a web form to enter customer information into a database. I have 4 textboxes for billingAddress, billingCity, billingState, and billingZip. BillingAddress is an optional field.</p> <p>My question is: how can I set up requiredfieldvalidators on billingCity, billingState, and billingZip so that these fields are only required if billingAddress has been filled out?</p> <p>*Side Note: Database requirements have separate columnms for address, city, state, and zip code, so I can't just combine them into one field.</p>
0debug
Java- How do I store my numbers in my int? : I'm a beginner still trying to learn java , I have no clue what have I did wrong on my code because they seem logically correct, really appreciate if someone can give me a hand ! Thanks very much ! What I'm trying to do is create an int and when everytime I clicked yes in my confirmation dialog the int will increase by 1 and the whole program should stop executing when the number that store into that int reached to 5. //This is the main game public class Game { private JPanel Game; private JButton Water; private JButton Nature; private JButton Fire; private JLabel countDownLabel; private JLabel computerScore; private int myChoice; private int computerChoice; int gamePlayed = 0; //store the times of game played public Game() { JFrame frame = new JFrame("The Elements"); frame.setContentPane(this.Game); frame.setMinimumSize(new Dimension(500, 500)); frame.pack(); frame.setVisible(true); //if the times of game played is less than 5 times , execute the following code if (gamePlayed <= 5) { Water.addActionListener( new ActionListener() { @Override //Water counter Fire , Nature counter water public void actionPerformed( ActionEvent e ) { int select; select = JOptionPane.showConfirmDialog( null, "You're using the power of water", "Water", JOptionPane.YES_NO_OPTION ); if ( select == JOptionPane.YES_OPTION ) { myChoice = 0; computerChoice = computerPlays(); conditionsDisplayResults( myChoice, computerChoice ); gamePlayed = gamePlayed + 1;//add 1 time of played game when the yes option clicked } } } ); Fire.addActionListener( new ActionListener() { @Override public void actionPerformed( ActionEvent e ) { int select = JOptionPane.showConfirmDialog( null, "You're using the power of fire", "Fire", JOptionPane.YES_NO_OPTION ); if ( select == JOptionPane.YES_OPTION ) { myChoice = 1; computerChoice = computerPlays(); conditionsDisplayResults( myChoice, computerChoice ); gamePlayed += 1;//add 1 time of played game when the yes option clicked } } } ); Nature.addActionListener( new ActionListener() { @Override public void actionPerformed( ActionEvent e ) { int select = JOptionPane.showConfirmDialog( null, "You're using the power of nature", "Nature", JOptionPane.YES_NO_OPTION ); if ( select == JOptionPane.YES_OPTION ) { myChoice = 2; computerChoice = computerPlays(); conditionsDisplayResults( myChoice, computerChoice ); gamePlayed += 1;//add 1 time of played game when the yes option clicked } } } ); } else{ //else which when the times of game played is more than 5 times , execute the following code GameResult(); MainMenu mainMenu = new MainMenu(); } }
0debug