problem
stringlengths
26
131k
labels
class label
2 classes
static int hpet_start_timer(struct qemu_alarm_timer *t) { struct hpet_info info; int r, fd; fd = open("/dev/hpet", O_RDONLY); if (fd < 0) return -1; r = ioctl(fd, HPET_IRQFREQ, RTC_FREQ); if (r < 0) { fprintf(stderr, "Could not configure '/dev/hpet' to have a 1024Hz timer. This is not a fatal\n" "error, but for better emulation accuracy type:\n" "'echo 1024 > /proc/sys/dev/hpet/max-user-freq' as root.\n"); goto fail; } r = ioctl(fd, HPET_INFO, &info); if (r < 0) goto fail; r = ioctl(fd, HPET_EPI, 0); if (info.hi_flags && (r < 0)) goto fail; r = ioctl(fd, HPET_IE_ON, 0); if (r < 0) goto fail; enable_sigio_timer(fd); t->priv = (void *)(long)fd; return 0; fail: close(fd); return -1; }
1threat
What does "naive" bays mean on Machine learning? : What does "naive" bays mean on Machine learning? I need a brief explanation.
0debug
static void dump_sprs (CPUPPCState *env) { ppc_spr_t *spr; uint32_t pvr = env->spr[SPR_PVR]; uint32_t sr, sw, ur, uw; int i, j, n; printf("* SPRs for PVR=%08x\n", pvr); for (i = 0; i < 32; i++) { for (j = 0; j < 32; j++) { n = (i << 5) | j; spr = &env->spr_cb[n]; #if !defined(CONFIG_USER_ONLY) sw = spr->oea_write != NULL && spr->oea_write != SPR_NOACCESS; sr = spr->oea_read != NULL && spr->oea_read != SPR_NOACCESS; #else sw = 0; sr = 0; #endif uw = spr->uea_write != NULL && spr->uea_write != SPR_NOACCESS; ur = spr->uea_read != NULL && spr->uea_read != SPR_NOACCESS; if (sw || sr || uw || ur) { printf("%4d (%03x) %8s s%c%c u%c%c\n", (i << 5) | j, (i << 5) | j, spr->name, sw ? 'w' : '-', sr ? 'r' : '-', uw ? 'w' : '-', ur ? 'r' : '-'); } } } fflush(stdout); fflush(stderr); }
1threat
Requests and redirections, waste of time? : <p>Let's say that I perform a GET request on a URL (this one for example: <a href="http://pubs.acs.org/doi/abs/10.1021/acs.accounts.5b00398" rel="nofollow">http://pubs.acs.org/doi/abs/10.1021/acs.accounts.5b00398</a>), and that I trace the request:</p> <pre><code>response = requests.get(url, timeout=10) if response.history: print("Request was redirected") for resp in response.history: print("Status code, URL: {}, {}".format(resp.status_code, resp.url)) print("Final destination:") print("Status code, URL: {}, {}".format(resp.status_code, response.url)) else: print("Request was not redirected") </code></pre> <p>The output is:</p> <pre><code>Request was redirected Status code, URL: 302, http://pubs.acs.org/doi/abs/10.1021/acs.accounts.5b00398 Status code, URL: 302, http://pubs.acs.org/doi/abs/10.1021/acs.accounts.5b00398?cookieSet=1 Final destination: Status code, URL: 302, http://pubs.acs.org/doi/abs/10.1021/acs.accounts.5b00398 </code></pre> <p>I would like to know a few things:</p> <ul> <li>why does the server redirects me to the url + cookieSet=1 ? To give me a cookie ?</li> <li>Does this redirection take time ?</li> <li>If so, could I request the cookie page in the first place ?</li> <li>If I have to perform several requests on the same server, should I use a session, if the server gives me a cookie ?</li> </ul>
0debug
Flutter: How to capitalize a single word : <p>In Flutter, how would you capitalize a single word? I know of <strong>Text().toUpperCase()</strong>, but I'd like to capitalize only the first letter, not the whole word. Will I need to use Regex, or does Flutter have a built-in function for that?</p>
0debug
Will This Code Work on Other Windows Versions? : <p>The following batch file works on my version of windows (10) but will it work on windows 7 or 8?</p> <pre><code>@echo off title color a mode con cols=20 lines=10 &gt;null mshta.exe vbscript:Execute("msgbox ""Error while opening."",5+64,""Error"":close") mshta.exe vbscript:Execute("msgbox ""A virus has been detected. Would you like to run a scan?"",0+48,""Virus"":close") mshta.exe vbscript:Execute("msgbox ""Access denied. Launching virus."",2+16,""You Have Been Infected"":close") start call "juices" start call "juices" mshta.exe vbscript:Execute("msgbox ""Deleting core files..."",2+16,""Removing"":close") start call "juices2" start call "jxt295" start call "jxt295" start call "jxt295" start call "jxt295" call "shdwn" </code></pre>
0debug
How do I check that a switch block is exhaustive in TypeScript? : <p>I have some code:</p> <pre><code>enum Color { Red, Green, Blue } function getColorName(c: Color): string { switch(c) { case Color.Red: return 'red'; case Color.Green: return 'green'; // Forgot about Blue } throw new Error('Did not expect to be here'); } </code></pre> <p>I forgot to handle the <code>Color.Blue</code> case and I'd prefer to have gotten a compile error. How can I structure my code such that TypeScript flags this as an error?</p>
0debug
How to add Header values to HttpWebRequest in .Net Core : <p>I am developing simple Http client to consume an Asp.Net Core Web API. I want to pass few http header values to the Web API via HttpHeaderCollection. In previous versions of .Net framework allowed to add header values to the HttpHeaderCollection as following</p> <pre><code>WebHeaderCollection aPIHeaderValues = new WebHeaderCollection(); aPIHeaderValues .Add("UserName","somevalue"); aPIHeaderValues .Add("TokenValue", "somevalue"); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Headers.add(aPIHeaderValues); HttpWebResponse response = (HttpWebResponse)_request.GetResponse(); </code></pre> <p>But in .Net Core there is no way to add headers to <strong>request.Headers</strong> collection. As well as we cannot add headers by defining new WebHeaderCollection </p> <pre><code>WebHeaderCollection aPIHeaderValues = new WebHeaderCollection(); </code></pre> <p>Is there any alternative way to do this in .Net Core</p>
0debug
Programming error that doesn't make sense to me : <p>I am writing a Java program where the user enters in a sales amount and then they enter a code(1, 2, or a 3) and then the program calculates the commission based on the sales type(the code the user entered). It works for 1 and 3 but for some odd reason when I enter in a 2 for the code it does nothing, just closes even though the code is pretty much the same as 1 and 3. Any help would be appreciated.</p> <pre><code>public class TravelCommission extends Frame </code></pre> <p>{</p> <pre><code>static double dollars; static double answer; static int empCode; static DecimalFormat df = new DecimalFormat("#.#"); public static void main(String[] args) { //Calling all methods dollars = getSales(0); empCode = getCode(0); answer = getCommission(dollars, empCode); output(dollars, answer); finish(); } private static double getSales(double sales) { //Getting sales along with error checking and exception handeling try { sales = Double.parseDouble(JOptionPane.showInputDialog(null, "Please enter in sales:", "Sales", JOptionPane.DEFAULT_OPTION)); if(sales &lt;= 0) { JOptionPane.showMessageDialog(null, "Please enter a value greater than 0.", "Error", JOptionPane.INFORMATION_MESSAGE); } else if(sales == JOptionPane.CANCEL_OPTION) { System.exit(0); } else { } } catch (IllegalArgumentException e) { JOptionPane.showMessageDialog(null, "Enter in a double value.", "Error!", JOptionPane.ERROR_MESSAGE); } return sales; } private static int getCode(int code) { try { code = Integer.parseInt(JOptionPane.showInputDialog(null, "Please enter the code for the type of sale\n1 = Telephone\n2 = In-store\n3 = Outdoor:", "Sales", JOptionPane.DEFAULT_OPTION)); if(code &lt;= 0 || code &gt; 3) { JOptionPane.showMessageDialog(null, "Please enter a 1, 2, or 3.", "Error", JOptionPane.INFORMATION_MESSAGE); } else if(code == JOptionPane.CANCEL_OPTION) { System.exit(0); } else { } } catch (IllegalArgumentException e) { JOptionPane.showMessageDialog(null, "Please enter in a 1, 2, or 3.", "Error!", JOptionPane.ERROR_MESSAGE); } return code; } private static double getCommission(double dollars, int empCode) { //Determing the amount of commission made based off of the type of sale if(empCode == 1) { answer = dollars * 0.10; } else if(empCode == 2) { answer = dollars * 0.14; } else if(empCode == 3) { answer = dollars * 0.18; } return answer; } //Outputing the commission public static int output(double dollars, double answer) { JOptionPane.showMessageDialog(null, "Your total commission on sales of $" + dollars + " is $" + df.format(answer)); return 0; } //Closes the program public static void finish() { System.exit(0); return; } </code></pre> <p>}</p>
0debug
static int mxf_read_content_storage(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) { MXFContext *mxf = arg; switch (tag) { case 0x1901: mxf->packages_count = avio_rb32(pb); mxf->packages_refs = av_calloc(mxf->packages_count, sizeof(UID)); if (!mxf->packages_refs) return AVERROR(ENOMEM); avio_skip(pb, 4); avio_read(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID)); break; } return 0; }
1threat
How does Ruby detect a carriage return in a string? : <p>I'm iterating through a large string that has several carriage returns. I'd like my logic to do something every time a carriage return is discovered (create a new ActiveRecord instance with all the string content before the carriage return). </p>
0debug
static void cirrus_mem_writeb_mode4and5_16bpp(CirrusVGAState * s, unsigned mode, unsigned offset, uint32_t mem_value) { int x; unsigned val = mem_value; uint8_t *dst; dst = s->vram_ptr + offset; for (x = 0; x < 8; x++) { if (val & 0x80) { *dst = s->cirrus_shadow_gr1; *(dst + 1) = s->gr[0x11]; } else if (mode == 5) { *dst = s->cirrus_shadow_gr0; *(dst + 1) = s->gr[0x10]; } val <<= 1; dst += 2; } cpu_physical_memory_set_dirty(s->vram_offset + offset); cpu_physical_memory_set_dirty(s->vram_offset + offset + 15); }
1threat
static void draw_char(AVCodecContext *avctx, int c) { AnsiContext *s = avctx->priv_data; int fg = s->fg; int bg = s->bg; if ((s->attributes & ATTR_BOLD)) fg += 8; if ((s->attributes & ATTR_BLINK)) bg += 8; if ((s->attributes & ATTR_REVERSE)) FFSWAP(int, fg, bg); if ((s->attributes & ATTR_CONCEALED)) fg = bg; ff_draw_pc_font(s->frame->data[0] + s->y * s->frame->linesize[0] + s->x, s->frame->linesize[0], s->font, s->font_height, c, fg, bg); s->x += FONT_WIDTH; if (s->x >= avctx->width) { s->x = 0; hscroll(avctx); } }
1threat
Crash on Canvas SwiftUI : <p>i'm implementing a little app with new iOS framework SwiftUI. I'm using <code>@EnvironmentObject</code> to bind my data to view. All works, but the Canvas crash and not show nothing. Why?</p> <pre><code>struct CompetitionsListSwiftUIView : View { @EnvironmentObject var competitionsViewModel: CompetitionsViewModel var body: some View { List(self.competitionsViewModel.competitions.identified(by: \.id)) { competition in CompetitionCellSwiftUIView(competition: competition) } } } #if DEBUG struct CompetitionsListSwiftUIView_Previews : PreviewProvider { static var previews: some View { CompetitionsListSwiftUIView() } } #endif </code></pre> <p>The error message of the Canvas is this:</p> <pre><code>Error Domain=render service Code=12 "Rendering service was interrupted" UserInfo={NSLocalizedDescription=Rendering service was interrupted} </code></pre>
0debug
How to solve The condition has length > 1 and only the first element will be used in R : <p>When I type these code ,</p> <pre><code>z&lt;-NULL for(i in unique(A$KCL_ID)){ RESULT&lt;-A[A$KCL_ID==i,] if(RESULT$DAYS==min(RESULT$DAYS)){ RESULT$DATE&lt;-"closest" }else{RESULT$DATE&lt;-RESULT$BMIextraction} z&lt;-rbind(z,RESULT) } </code></pre> <p>I get some error message like this:</p> <pre><code>Error in charToDate(x) : character string is not in a standard unambiguous format In addition: Warning messages: 1: In if (RESULT$DAYS == min(RESULT$DAYS)) { : the condition has length &gt; 1 and only the first element will be used 2: In if (RESULT$DAYS == min(RESULT$DAYS)) { : the condition has length &gt; 1 and only the first element will be used 3: In if (RESULT$DAYS == min(RESULT$DAYS)) { : the condition has length &gt; 1 and only the first element will be used 4: In if (RESULT$DAYS == min(RESULT$DAYS)) { : the condition has length &gt; 1 and only the first element will be used </code></pre> <p>How can I resolve this question?</p>
0debug
bool write_list_to_kvmstate(ARMCPU *cpu) { CPUState *cs = CPU(cpu); int i; bool ok = true; for (i = 0; i < cpu->cpreg_array_len; i++) { struct kvm_one_reg r; uint64_t regidx = cpu->cpreg_indexes[i]; uint32_t v32; int ret; r.id = regidx; switch (regidx & KVM_REG_SIZE_MASK) { case KVM_REG_SIZE_U32: v32 = cpu->cpreg_values[i]; r.addr = (uintptr_t)&v32; break; case KVM_REG_SIZE_U64: r.addr = (uintptr_t)(cpu->cpreg_values + i); break; default: abort(); } ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, &r); if (ret) { ok = false; } } return ok; }
1threat
iOS Change every cell colour (section + row) : <p>I would like to change cell color in every cell (4 colours % 4) :</p> <p><strong>1. Section 1</strong></p> <p>Cell 1 : RED</p> <p>Cell 2 : BLUE</p> <p><strong>2. Section 2</strong></p> <p>Cell 3 : BLACK</p> <p><strong>3. Section 3</strong></p> <p>Cell 4 : WHITE</p> <p><strong>4. Section 4</strong></p> <p>Cell 5 : RED</p> <p>Cell 6 : BLUE</p> <p>Cell 7 : BLACK ...</p> <p>How can I achieve this ?</p> <p>I know how to change color in <code>cellForRow</code> : <code>cell.contentView.backgroundColor = [UIColor colorWithRed:119.0/255.0 green:221.0/255 blue:167.0/255 alpha:1.0f];</code></p>
0debug
static void pl110_write(void *opaque, hwaddr offset, uint64_t val, unsigned size) { pl110_state *s = (pl110_state *)opaque; int n; s->invalidate = 1; if (offset >= 0x200 && offset < 0x400) { n = (offset - 0x200) >> 2; s->raw_palette[(offset - 0x200) >> 2] = val; pl110_update_palette(s, n); return; } switch (offset >> 2) { case 0: s->timing[0] = val; n = ((val & 0xfc) + 4) * 4; pl110_resize(s, n, s->rows); break; case 1: s->timing[1] = val; n = (val & 0x3ff) + 1; pl110_resize(s, s->cols, n); break; case 2: s->timing[2] = val; break; case 3: s->timing[3] = val; break; case 4: s->upbase = val; break; case 5: s->lpbase = val; break; case 6: if (s->version != PL110) { goto control; } imsc: s->int_mask = val; pl110_update(s); break; case 7: if (s->version != PL110) { goto imsc; } control: s->cr = val; s->bpp = (val >> 1) & 7; if (pl110_enabled(s)) { qemu_console_resize(s->ds, s->cols, s->rows); } break; case 10: s->int_status &= ~val; pl110_update(s); break; default: hw_error("pl110_write: Bad offset %x\n", (int)offset); } }
1threat
What is wrong with the formatting in my Java code? : <p>I've been told that there are problems with my formatting, at the end. However, I can't figure out what that would be...The error messages are at the end of the code. PLEASE DON'T BE AMBIGUOUS WITH YOUR ANSWERS AND TELL ME WHAT TO FOCUS ON OR REVIEW (LIKE FORMATTING).I NEED CONCRETE THINGS TO CHANGE. Thank you!! Here's the code: </p> <pre><code>public static void main(String[] args) { double pennies = 0.01; //number of pennies double totalPennies = 0.01; //the variable that is added to int maxDays; //number of days the loop will double the pennies to int day = 0; //the variable used to count each day in the loop //Create a String variable for user input with a console window. String input; //Create a scanner object for keyboard input into the console. Scanner keyboard = new Scanner(System.in); //Ask user for the number of days to count. input = JOptionPane.showInputDialog("Enter the maximum number of days worked in your pay period" + " and I will tell you how much money you made. Please enter at least 1."); maxDays = Integer.parseInt(input); //this makes the user's string input into //an integer data type //Input Validation while(maxDays &lt; 1) { System.out.println("You have entered a number that " + "is less than 1. \nPlease enter a number that is at" + " least 1 or more:"); maxDays = keyboard.nextInt(); } //next we have the first loop that will only execute if the user enters at least 1 while(maxDays &gt;= 1) { //here's the chart System.out.println("Day Day's Income Total "); //titles for the chart System.out.println("----------------------------------"); //34 dashes/spaces System.out.println("1 $0.01 $0.01 "); //the first day //this next nested loop will do the actual counting and add to the chart with //each iteration for(day = 2; day &lt;= maxDays; day++) { pennies = pennies * 2; //double pennies totalPennies += pennies; //add the new value of pennies to the running total //add information from each iteration to the chart System.out.printf("%10.0d" + "$%18.0f" + "$%6.0f", day, pennies, totalPennies ); } } } </code></pre> <p>Here are the error messages:</p> <pre><code>Exception in thread "main" java.util.IllegalFormatPrecisionException: 0 at java.util.Formatter$FormatSpecifier.checkInteger(Formatter.java:2984) at java.util.Formatter$FormatSpecifier.&lt;init&gt;(Formatter.java:2729) at java.util.Formatter.parse(Formatter.java:2560) at java.util.Formatter.format(Formatter.java:2501) at java.io.PrintStream.format(PrintStream.java:970) at java.io.PrintStream.printf(PrintStream.java:871) at assignment4PenniesForPay.assignment4PenniesForPay.main(assignment4PenniesForPay.java:65) </code></pre> <p>Line 65 is the formatting line. </p>
0debug
android setText STOPPİNG ERROR : Ben dairenin alanını hesaplamak istiyorum ve sonucu textView yazdır.Ama hata veriyor.I'm sorry for my bad english public void hesapla1(View v){ double pi = 3.14; double yari = R.id.e1; double alan = pi * Math.pow(yari,2); Log.e("a","Buraya kadar geldi"); sonuc1.setText((int) alan); //Mantık Kuramıyorum }
0debug
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
1threat
coding for TI CC2650 : JavaScript question I appreciate any help anyone could give me with this. I have the Ti cc2650 SENSOR. What I wanted to accomplish is in JavaScript. SCENARIO 1 • So l setup a height value. • The sensor is on the floor. Every time I pick the sensor and lift it to that height, the phone will do something(vibrate, play a small song, etc) SCENARIO 2 • The phone is on the top of the table; • The sensor is on the floor; • I pick up the sensor and the phone will tell me how far the sensor is the closer it gets; 1) Which sensor(s) do I use to accomplish that? Can anyone help?? Thank you for the eternity!!!
0debug
Why is my callback returning an undefined value? : <p>I'm trying to get a value from a callback, but it returns an undefined value. Below is the code I'm using:</p> <pre><code>function getJSON(url, callback) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 &amp;&amp; this.status == 200) { if (callback) return callback(this.responseText); } }; xhttp.open("GET", url, true); xhttp.send(); } function getUserName() { getJSON("this is my url", function(resultJSON) { return JSON.parse(resultJSON).user[0].displayName; }); } var userN = getUserName(); document.getElementById("username").innerHTML = "Hi " + userN; </code></pre> <p>I know this has been asked a billion times but I can't get it working the way I need with previous answers. The html element is still giving a "Hi undefined". Any thought or suggestion?</p>
0debug
Excel delete all row where is first cell empty : How delete all row, where is first cell empty? [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/sMBOk.png
0debug
Axios (in React-native) not calling server in localhost : <p>I'm building a really easy api and react-native application. The server works well (tested with PostMan) but the application doesn't call the server. It blocks when axios has to send the post request (see below).</p> <p>I'm desperate :-( Loosing too mush time in it. Please, if you can help me...</p> <p>Here is my code LogIn page. It dispatch the action creator (working with redux) giving email and password:</p> <pre><code>... const LogIn = React.createClass({ submitLogin() { // log in the server if (this.props.email !== '' &amp;&amp; this.props.psw !== '') { if (this.props.valid === true) { this.props.dispatch(logIn(this.props.email, this.props.psw)); } else { this.props.dispatch(errorTyping()); } } }, ... </code></pre> <p>email and password are weel retrieved and sent to the action creator:</p> <pre><code>import axios from 'axios'; import { SIGNIN_URL, SIGNUP_URL } from '../api'; // import { addAlert } from './alerts'; exports.logIn = (email, password) =&gt; { return function (dispatch) { console.log(email); console.log(password); console.log(SIGNIN_URL); return axios.post(SIGNIN_URL, { email, password }) .then( (response) =&gt; { console.log(response); const { token, userId } = response.data; dispatch(authUser(userId)); } ) .catch( (error) =&gt; { console.log('Could not log in'); } ); }; }; const authUser = (userId) =&gt; { return { type: 'AUTH_USER', userId }; }; ... </code></pre> <p>The three console.log() before axios show the data in the correct way. SIGNIN_URL is exactly the same I use in postman. ...but axios doesn't call.</p> <p>Just to give all the cards, this is my store:</p> <pre><code>import thunk from 'redux-thunk'; import { createStore, compose, applyMiddleware } from 'redux'; import { AsyncStorage } from 'react-native'; import { persistStore, autoRehydrate } from 'redux-persist'; import reducer from '../reducer'; const defaultState = {}; exports.configureStore = (initialState = defaultState) =&gt; { const store = createStore(reducer, initialState, compose( applyMiddleware(thunk), autoRehydrate() )); persistStore(store, { storage: AsyncStorage }); return store; }; </code></pre> <p>There's no error message in the debugger (but the one given by the axios call ('Could not log in')</p> <p>I'm on windows 10, with:</p> <pre><code>"axios": "^0.15.3", "react": "15.4.2", "react-native": "0.38.0", "redux": "^3.6.0" </code></pre> <p>The call fails even when I prepare a simple GET call and the server is supposed to give back a simple message (tested with postman and browser):</p> <pre><code>exports.test = () =&gt; { return function () { return axios.get('https://localhost:3000/v1/test') .then( (response) =&gt; { console.log(response); } ) .catch( (error) =&gt; { console.log('error'); } ); }; }; </code></pre> <p>Last, I tryed also to modify the call adding a header as the following, because the api is coded to accept json:</p> <pre><code>const head = { headers: { 'Content-Type': 'application/json' } }; exports.test = () =&gt; { return function () { return axios.get('https://api.github.com/users/massimopibiri', head) .then( (response) =&gt; { console.log(response); } ) .catch( (error) =&gt; { console.log('error'); } ); }; }; </code></pre> <p>but even this didn't work. hope somebody can help me. Other similar issues didn't.</p>
0debug
why is my CountRecur method not working, ive tried to comb through it but no dice. : why is my CountRecur method not working, ive tried to comb through it but no dice. I know its not all that well optimized, but ive tried everything and i thought i might give this a shot. //* assume that StrArr1 is already in alphabetical order, and that all the strings in it are words that may occur more than once, they're also all in low caps. the remove recur works fine, i tested it//* public void CountRecur() { ArrayList <String> StrArr2 = new ArrayList <String> (); StrArr2 = StrArr1; this.RemoveRecur(StrArr2); int count = 0; int j = 0; for (int i = 0; i <= StrArr2.size(); i++) { if (count != 0) { IntArr.add(count); } count = 0; if (i < StrArr2.size()) { while (j < StrArr1.size() && StrArr2.get(i).equals(StrArr1.get(j))) { count++; j++; } } } } public void RemoveRecur(ArrayList <String> StrArr3) { int i = 1; while (i < StrArr3.size()) { if (StrArr3.get(i).equals(StrArr3.get(i - 1))) { StrArr3.remove(i - 1); i = 0; } i++; } }
0debug
static int v9fs_synth_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf) { stbuf->f_type = 0xABCD; stbuf->f_bsize = 512; stbuf->f_blocks = 0; stbuf->f_files = v9fs_synth_node_count; stbuf->f_namelen = NAME_MAX; return 0; }
1threat
static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt, const uint8_t *buf, int len) { unsigned int ssrc, h; int payload_type, seq, ret, flags = 0; int ext; AVStream *st; uint32_t timestamp; int rv= 0; ext = buf[0] & 0x10; payload_type = buf[1] & 0x7f; if (buf[1] & 0x80) flags |= RTP_FLAG_MARKER; seq = AV_RB16(buf + 2); timestamp = AV_RB32(buf + 4); ssrc = AV_RB32(buf + 8); s->ssrc = ssrc; if (s->payload_type != payload_type) return -1; st = s->st; if(!rtp_valid_packet_in_sequence(&s->statistics, seq)) { av_log(st?st->codec:NULL, AV_LOG_ERROR, "RTP: PT=%02x: bad cseq %04x expected=%04x\n", payload_type, seq, ((s->seq + 1) & 0xffff)); return -1; } if (buf[0] & 0x20) { int padding = buf[len - 1]; if (len >= 12 + padding) len -= padding; } s->seq = seq; len -= 12; buf += 12; if (ext) { if (len < 4) return -1; ext = (AV_RB16(buf + 2) + 1) << 2; if (len < ext) return -1; len -= ext; buf += ext; } if (!st) { ret = ff_mpegts_parse_packet(s->ts, pkt, buf, len); if (ret < 0) return AVERROR(EAGAIN); if (ret < len) { s->read_buf_size = len - ret; memcpy(s->buf, buf + ret, s->read_buf_size); s->read_buf_index = 0; return 1; } return 0; } else if (s->parse_packet) { rv = s->parse_packet(s->ic, s->dynamic_protocol_context, s->st, pkt, &timestamp, buf, len, flags); } else { switch(st->codec->codec_id) { case AV_CODEC_ID_MP2: case AV_CODEC_ID_MP3: if (len <= 4) return -1; h = AV_RB32(buf); len -= 4; buf += 4; av_new_packet(pkt, len); memcpy(pkt->data, buf, len); break; case AV_CODEC_ID_MPEG1VIDEO: case AV_CODEC_ID_MPEG2VIDEO: if (len <= 4) return -1; h = AV_RB32(buf); buf += 4; len -= 4; if (h & (1 << 26)) { if (len <= 4) return -1; buf += 4; len -= 4; } av_new_packet(pkt, len); memcpy(pkt->data, buf, len); break; default: av_new_packet(pkt, len); memcpy(pkt->data, buf, len); break; } pkt->stream_index = st->index; } finalize_packet(s, pkt, timestamp); return rv; }
1threat
How to auto deploying git repositories with submodules on AWS? : <p>I have a submodule in my git repository and my directory structure is like,</p> <pre><code>app -- folder1 -- folder2 -- submodule @5855 </code></pre> <p>I have deployed my code on AWS by using autodeploy service. Now, on server I have code in the parent-directory but submodule directories are empty.</p> <p>Q1) How can I get data in submodules. My repository on server is not git repository. Do I need to convert it firstly into git repo and then run <code>submodule</code> commands to get it ?</p> <p>Q2) How can I automate the submodule deployment as well?</p> <p>Thanks</p>
0debug
I am really new to programming : Very new to the programming world. All I want to do is open my html file from Sublime into google chrome. When I've researched an answer it tells me to do this: { "ignored_packages": [ "Vintage" ] "selectedBrowser": [ "chrome" ] } When I do that I get this message: Error trying to parse settings: Unexpected character, expected a comma or closing bracket in Packages/User/Preferences.sublime-settings:6:2
0debug
uint32_t helper_efdctsiz (uint64_t val) { CPU_DoubleU u; u.ll = val; if (unlikely(float64_is_nan(u.d))) return 0; return float64_to_int32_round_to_zero(u.d, &env->vec_status); }
1threat
The relationship between JAVA and html : <p>Is JAVA compatible with html and js? Can we work together other than jsp??? </p> <p>To link the WEKA function.We implemented the java code using jar, and we need the html and js links for visualization. Is there any other method of linkage besides jsp?</p>
0debug
Math: Figure details from the summary : <p>If I have played 10 games with a 100% win rate in cruisers and a 50% win rate in battleships and my overall win rate is 60%. How many matches did i play in cruisers?</p>
0debug
static void uhci_queue_free(UHCIQueue *queue) { UHCIState *s = queue->uhci; UHCIAsync *async; while (!QTAILQ_EMPTY(&queue->asyncs)) { async = QTAILQ_FIRST(&queue->asyncs); uhci_async_cancel(async); } trace_usb_uhci_queue_del(queue->token); QTAILQ_REMOVE(&s->queues, queue, next); g_free(queue); }
1threat
chrome in --headless mode: Provide credentials/auth for proxy : <p>I am running chrome the following way:</p> <p><code>google-chrome --headless --disable-gpu --dump-dom --disable-web-security</code></p> <p>Due to a corporate proxy, it seems to be bumping into a authentication popup that is asking to input credentials. How do I inject these credentials on the command line?</p>
0debug
Invalid literal for int() with base 10: 'x' error in Python? : <p>I'm working on a program that prompts a user for a number within a range of integers they've entered. If the number they enter is out of range, they're prompted to give another, and if they enter a letter instead they're prompted to change their answer as well. Here is what I've got:</p> <pre><code>def code_one(d, f): s = input('Enter a number between' + str(d) + 'and' + str(f) + ': ') s = int(s) if int(d) &lt;= s &lt;= int(f): return s else: while s &lt; int(d) or s &gt; int(f): s = input(str(s) + 'is out of range. Please try again. ') s = int(s) if s &lt; int(d) or s &gt; int(f): continue else: return s while s.isdigit == False: s = input(str(s) + 'is not a number. Please try again.' ) if s.isdigit == False: continue else: return s </code></pre> <p>It works fine up until the line reading "while s.isdigit == False:" and then, if I input a letter instead of a number, I get the error "invalid literal for int() with base 10: 'x'", (the x being whatever letter I happen to enter). What can I do to fix this?</p>
0debug
Android FileProvider for CACHE DIR : Failed to find configured root that contains : <p>I found so many links which is related to FileProvider, but I didn't found solution for <strong>cache directory</strong> </p> <blockquote> <p>java.lang.IllegalArgumentException: Failed to find configured root that contains <code>/data/data/pkg name/cache/1487876607264.png</code></p> </blockquote> <p>I want to use it for <strong>CACHE DIRECTORY</strong>, How can I give path in <strong>provider</strong>.</p> <pre><code>&lt;paths&gt; &lt;external-path name="external_files" path="." /&gt; &lt;/paths&gt; </code></pre> <p>I used it as :</p> <pre><code>File file = new File(context.getCacheDir(), System.currentTimeMillis() + ".png"); Uri uri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".provider", file); </code></pre> <p>Its working fine if I give application folder path, but not working with <strong>Cache Directory.</strong></p> <p>Any Help?</p>
0debug
Why does the order of NgModule imports matter? : <p>I have been going through the Angular tutorial and when going through the HTTP section <a href="https://angular.io/docs/ts/latest/tutorial/toh-pt6.html" rel="noreferrer">https://angular.io/docs/ts/latest/tutorial/toh-pt6.html</a> and have noticed that the order in which imports are declared in the NgModule makes a difference in terms of whether or not the application works. I would like to know why that is.</p> <p>In particular this works:</p> <pre> @NgModule({ imports: [ BrowserModule, FormsModule, HttpModule, InMemoryWebApiModule.forRoot(InMemoryDataService), AppRoutingModule ], ... }) </pre> <p>but the following does not. The list of heroes does not get loaded. Note that the HttpModule is declared AFTER the InMemoryWebApiModule:</p> <pre> @NgModule({ imports: [ BrowserModule, FormsModule, InMemoryWebApiModule.forRoot(InMemoryDataService), HttpModule, AppRoutingModule ], ... }) </pre> <p>The tutorial is using Angular 2.4.4. I have noticed the problem in both Firefox and IE. I have not found anything in my google searches that would indicate the source of the problem.</p>
0debug
Whats about refs in consrtuctors when collection updates? : I have constructor of some service: public Ctor(List<Items> items) { _items=items; } public void Work() { if(_items.Count()>5) //do some work } `Work` method will be call time by time. So, if outside of object i change items count- what happens? is `_items.Count()` change? Because, at current version i use this: public void Work() { if(StaticClass.Items.Count()>5)//do some work } Where `StaticClass.Items` updates when outside items collection changes. So, if i make this: var service=new Consrtuctor(StaticClass.Items); And then i update `StaticClass.Items` elems - can i use actual _items.Count() value when `Work` method calls (by some timer)? Or, should i use `ref` keyword?
0debug
static int nbd_config(BDRVNBDState *s, QDict *options, char **export) { Error *local_err = NULL; if (qdict_haskey(options, "path") == qdict_haskey(options, "host")) { if (qdict_haskey(options, "path")) { qerror_report(ERROR_CLASS_GENERIC_ERROR, "path and host may not " "be used at the same time."); } else { qerror_report(ERROR_CLASS_GENERIC_ERROR, "one of path and host " "must be specified."); } return -EINVAL; } s->client.is_unix = qdict_haskey(options, "path"); s->socket_opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort); qemu_opts_absorb_qdict(s->socket_opts, options, &local_err); if (local_err) { qerror_report_err(local_err); error_free(local_err); return -EINVAL; } if (!qemu_opt_get(s->socket_opts, "port")) { qemu_opt_set_number(s->socket_opts, "port", NBD_DEFAULT_PORT); } *export = g_strdup(qdict_get_try_str(options, "export")); if (*export) { qdict_del(options, "export"); } return 0; }
1threat
void qemu_spice_vm_change_state_handler(void *opaque, int running, int reason) { SimpleSpiceDisplay *ssd = opaque; if (running) { ssd->worker->start(ssd->worker); } else { qemu_mutex_unlock_iothread(); ssd->worker->stop(ssd->worker); qemu_mutex_lock_iothread(); } ssd->running = running; }
1threat
static void rng_egd_chr_read(void *opaque, const uint8_t *buf, int size) { RngEgd *s = RNG_EGD(opaque); size_t buf_offset = 0; while (size > 0 && s->parent.requests) { RngRequest *req = s->parent.requests->data; int len = MIN(size, req->size - req->offset); memcpy(req->data + req->offset, buf + buf_offset, len); buf_offset += len; req->offset += len; size -= len; if (req->offset == req->size) { s->parent.requests = g_slist_remove_link(s->parent.requests, s->parent.requests); req->receive_entropy(req->opaque, req->data, req->size); rng_egd_free_request(req); } } }
1threat
No tests found for given includes: : <p>I'm trying to run a simple test that's in my Test class from IDE (Intellij IDEA) and error that pops out is: </p> <pre><code>No tests found for given includes: org.sample.Test.test </code></pre> <p>Same thing is happening when I try to run it from command-line. In Intellij, I've set up <code>Build, Execution, Deployment &gt; Build Tools &gt; Gradle &gt; Runner</code> to <code>Gradle Test Runner</code> and I have <code>@Test</code> on my method. Also, I can't run any test (from some other project), so I suppose that it's some configuration problem. </p> <p>Can someone point me to something, what can I be doing wrong ?</p>
0debug
static void H264_CHROMA_MC8_TMPL(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y, int rnd) { if(y==0 && x==0) { H264_CHROMA_MC8_MV0(dst, src, stride, h); return; } assert(x<8 && y<8 && x>=0 && y>=0); if(y==0 || x==0) { asm volatile( "movd %0, %%xmm7 \n\t" "movq %1, %%xmm6 \n\t" "pshuflw $0, %%xmm7, %%xmm7 \n\t" "movlhps %%xmm6, %%xmm6 \n\t" "movlhps %%xmm7, %%xmm7 \n\t" :: "r"(255*(x+y)+8), "m"(rnd?ff_pw_4:ff_pw_3)); if(x) { asm volatile( "1: \n\t" "movq (%1), %%xmm0 \n\t" "movq 1(%1), %%xmm1 \n\t" "movq (%1,%3), %%xmm2 \n\t" "movq 1(%1,%3), %%xmm3 \n\t" "punpcklbw %%xmm1, %%xmm0 \n\t" "punpcklbw %%xmm3, %%xmm2 \n\t" "pmaddubsw %%xmm7, %%xmm0 \n\t" "pmaddubsw %%xmm7, %%xmm2 \n\t" AVG_OP("movq (%0), %%xmm4 \n\t") AVG_OP("movhps (%0,%3), %%xmm4 \n\t") "paddw %%xmm6, %%xmm0 \n\t" "paddw %%xmm6, %%xmm2 \n\t" "psrlw $3, %%xmm0 \n\t" "psrlw $3, %%xmm2 \n\t" "packuswb %%xmm2, %%xmm0 \n\t" AVG_OP("pavgb %%xmm4, %%xmm0 \n\t") "movq %%xmm0, (%0) \n\t" "movhps %%xmm0, (%0,%3) \n\t" "sub $2, %2 \n\t" "lea (%1,%3,2), %1 \n\t" "lea (%0,%3,2), %0 \n\t" "jg 1b \n\t" :"+r"(dst), "+r"(src), "+r"(h) :"r"((long)stride) ); } else { asm volatile( "1: \n\t" "movq (%1), %%xmm0 \n\t" "movq (%1,%3), %%xmm1 \n\t" "movdqa %%xmm1, %%xmm2 \n\t" "movq (%1,%3,2), %%xmm3 \n\t" "punpcklbw %%xmm1, %%xmm0 \n\t" "punpcklbw %%xmm3, %%xmm2 \n\t" "pmaddubsw %%xmm7, %%xmm0 \n\t" "pmaddubsw %%xmm7, %%xmm2 \n\t" AVG_OP("movq (%0), %%xmm4 \n\t") AVG_OP("movhps (%0,%3), %%xmm4 \n\t") "paddw %%xmm6, %%xmm0 \n\t" "paddw %%xmm6, %%xmm2 \n\t" "psrlw $3, %%xmm0 \n\t" "psrlw $3, %%xmm2 \n\t" "packuswb %%xmm2, %%xmm0 \n\t" AVG_OP("pavgb %%xmm4, %%xmm0 \n\t") "movq %%xmm0, (%0) \n\t" "movhps %%xmm0, (%0,%3) \n\t" "sub $2, %2 \n\t" "lea (%1,%3,2), %1 \n\t" "lea (%0,%3,2), %0 \n\t" "jg 1b \n\t" :"+r"(dst), "+r"(src), "+r"(h) :"r"((long)stride) ); } return; } asm volatile( "movd %0, %%xmm7 \n\t" "movd %1, %%xmm6 \n\t" "movdqa %2, %%xmm5 \n\t" "pshuflw $0, %%xmm7, %%xmm7 \n\t" "pshuflw $0, %%xmm6, %%xmm6 \n\t" "movlhps %%xmm7, %%xmm7 \n\t" "movlhps %%xmm6, %%xmm6 \n\t" :: "r"((x*255+8)*(8-y)), "r"((x*255+8)*y), "m"(rnd?ff_pw_32:ff_pw_28) ); asm volatile( "movq (%1), %%xmm0 \n\t" "movq 1(%1), %%xmm1 \n\t" "punpcklbw %%xmm1, %%xmm0 \n\t" "add %3, %1 \n\t" "1: \n\t" "movq (%1), %%xmm1 \n\t" "movq 1(%1), %%xmm2 \n\t" "movq (%1,%3), %%xmm3 \n\t" "movq 1(%1,%3), %%xmm4 \n\t" "lea (%1,%3,2), %1 \n\t" "punpcklbw %%xmm2, %%xmm1 \n\t" "punpcklbw %%xmm4, %%xmm3 \n\t" "movdqa %%xmm1, %%xmm2 \n\t" "movdqa %%xmm3, %%xmm4 \n\t" "pmaddubsw %%xmm7, %%xmm0 \n\t" "pmaddubsw %%xmm6, %%xmm1 \n\t" "pmaddubsw %%xmm7, %%xmm2 \n\t" "pmaddubsw %%xmm6, %%xmm3 \n\t" "paddw %%xmm5, %%xmm0 \n\t" "paddw %%xmm5, %%xmm2 \n\t" "paddw %%xmm0, %%xmm1 \n\t" "paddw %%xmm2, %%xmm3 \n\t" "movdqa %%xmm4, %%xmm0 \n\t" "psrlw $6, %%xmm1 \n\t" "psrlw $6, %%xmm3 \n\t" AVG_OP("movq (%0), %%xmm2 \n\t") AVG_OP("movhps (%0,%3), %%xmm2 \n\t") "packuswb %%xmm3, %%xmm1 \n\t" AVG_OP("pavgb %%xmm2, %%xmm1 \n\t") "movq %%xmm1, (%0)\n\t" "movhps %%xmm1, (%0,%3)\n\t" "sub $2, %2 \n\t" "lea (%0,%3,2), %0 \n\t" "jg 1b \n\t" :"+r"(dst), "+r"(src), "+r"(h) :"r"((long)stride) ); }
1threat
Write a function which returns the calling string value converted to lowercase without using .toLowerCase : <p>This what I have so far, but I am getting a "Uncaught TypeError: Cannot read property '0' of undefined" error and I can't seem to figure it out. </p> <pre><code>function second_function(str) { var i; for (i = 0; i &lt; arguments.length; i++) { if(str.codeCharAt[i] &gt;= 65 || str.codeCharAt[i] &lt;= 90) { str.codeCharAt[i] += 32; } } return str; } </code></pre> <p>i = 0 should equal to the first letter. If anyone could help it would be greatly appreciated. Also I have very little to no skills in JavaScript so please bear with me. </p>
0debug
static int posix_aio_flush(void *opaque) { PosixAioState *s = opaque; return !!s->first_aio; }
1threat
Angular5 - simple CRUD example Angular5 with java : I am unable to integrate java code with Angular5 in eclipse.So please send me complete CRUD example in eclipse with the help of angular5, jsp ,servlet and mysql.
0debug
cant remove text decoration : yea i know this has been asked and answered but i cant get this working no matter what. i need to remove the text decoration on a link that i have applied to a div. the code looks like this. <!DOCTYPE html> <html> <header> <link rel="stylesheet" type="text/css" href="link_decor_none.css"> </header> <body> <div id="about-con"> <a href="http://ptunitedbrochure.bkm-tech.com/about.php"> <div class="inline-nav" id="about"> <div style="margin-top: 2px; text-align: center"> About Us </div> </div> </a> </div> </body> </html> and css is this #about-con a { text-decoration: none !important; } div #about-con a:link { text-decoration: none; } #about { position: relative; width: 100px; height: 1.5em; font-size: 1.125em; border-top-left-radius: 25px; border-bottom-left-radius: 25px; border: 1.5px; border-style: solid; border-color: black; } please and thanks. this has been to much of a headache
0debug
int scsi_convert_sense(uint8_t *in_buf, int in_len, uint8_t *buf, int len, bool fixed) { SCSISense sense; bool fixed_in; fixed_in = (in_buf[0] & 2) == 0; if (in_len && fixed == fixed_in) { memcpy(buf, in_buf, MIN(len, in_len)); return MIN(len, in_len); } if (in_len == 0) { sense = SENSE_CODE(NO_SENSE); } else { sense = scsi_parse_sense_buf(in_buf, in_len); } return scsi_build_sense_buf(buf, len, sense, fixed); }
1threat
npm: "Cannot find module internal/errors" : <p>On a MacBook with the latest version of NodeJS, I am trying to update npm:</p> <pre><code>npm install npm@latest </code></pre> <p>The error message is:</p> <pre><code>npm ERR: code MODULE_NOT_FOUND npm ERR: Cannot find module 'internal/errors' npm ERR: A complete log of this run can be found in: npm ERR: /Users/alexander/.npm/_logs/2017_09_15_12_35_47_079Z-debug.log </code></pre> <p>and the referenced log file reads</p> <pre><code>0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/bin/node', 1 verbose cli '/usr/local/bin/npm', 1 verbose cli 'install', 1 verbose cli 'npm@latest' ] 2 info using npm@5.3.0 3 info using node@v8.5.0 4 verbose npm-session 5db7f116200ca64c 5 verbose stack Error: Cannot find module 'internal/errors' 5 verbose stack at Function.Module._resolveFilename (module.js:527:15) 5 verbose stack at Function.Module._load (module.js:476:23) 5 verbose stack at Module.require (module.js:568:17) 5 verbose stack at require (internal/module.js:11:18) 5 verbose stack at evalmachine.&lt;anonymous&gt;:36:16 5 verbose stack at Object.&lt;anonymous&gt; (/usr/local/lib/node_modules/npm/node_modules/cmd-shim/node_modules/graceful-fs/fs.js:11:1) 5 verbose stack at Module._compile (module.js:624:30) 5 verbose stack at Object.Module._extensions..js (module.js:635:10) 5 verbose stack at Module.load (module.js:545:32) 5 verbose stack at tryModuleLoad (module.js:508:12) 5 verbose stack at Function.Module._load (module.js:500:3) 5 verbose stack at Module.require (module.js:568:17) 5 verbose stack at require (internal/module.js:11:18) 5 verbose stack at Object.&lt;anonymous&gt; (/usr/local/lib/node_modules/npm/node_modules/cmd-shim/node_modules/graceful-fs/graceful-fs.js:3:27) 5 verbose stack at Module._compile (module.js:624:30) 5 verbose stack at Object.Module._extensions..js (module.js:635:10) 6 verbose cwd /Users/alexander/Documents/Source/Repos 7 verbose Darwin 16.7.0 8 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "npm@latest" 9 verbose node v8.5.0 10 verbose npm v5.3.0 11 error code MODULE_NOT_FOUND 12 error Cannot find module 'internal/errors' 13 verbose exit [ 1, true ] </code></pre> <p>The same worked ok on the windows machine.</p> <p>What is the problem and how can I fix this?</p>
0debug
How can visualize tensorflow convolution filters? : <p><a href="https://i.stack.imgur.com/prfoT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/prfoT.png" alt="Example"></a></p> <p>In many documents, there are images about each filter like "Example". I want to visual my convolution filters like "Example" image, but I don't know how can visualize it.</p> <p>How can I visualize my convolution filters?</p>
0debug
int keysym2scancode(void *kbd_layout, int keysym) { kbd_layout_t *k = kbd_layout; if (keysym < MAX_NORMAL_KEYCODE) { if (k->keysym2keycode[keysym] == 0) { trace_keymap_unmapped(keysym); fprintf(stderr, "Warning: no scancode found for keysym %d\n", keysym); } return k->keysym2keycode[keysym]; } else { int i; #ifdef XK_ISO_Left_Tab if (keysym == XK_ISO_Left_Tab) { keysym = XK_Tab; } #endif for (i = 0; i < k->extra_count; i++) { if (k->keysym2keycode_extra[i].keysym == keysym) { return k->keysym2keycode_extra[i].keycode; } } } return 0; }
1threat
Generate a random number in interval [0,360) which is divisible by number 15 : <p>I am wondering how to generate a number in interval of [0,360) which would be also divisible by number 15. Examples: 0, 15, 30, 45, 50.. I can generate a number in the interval with:</p> <pre><code> (int)(Math.random()*360)); </code></pre> <p>But I don't know how to make sure that the generated number is divisible by number 15. </p>
0debug
How to show image from server to my ImageView in Android : <p>I have an image link from server, I want to show it in my android app, I tried this code but not worked for</p> <pre><code>imageview.setImageURI(Uri.parse("pathofimage")); </code></pre> <p>Image link is like <a href="http://http:/54.70.37.32/uploads/Provider__profile_pic.jpg" rel="nofollow noreferrer">http:/54.70.37.32/uploads/Provider_profile_pic.jpg</a></p>
0debug
static void e1000e_pci_realize(PCIDevice *pci_dev, Error **errp) { static const uint16_t e1000e_pmrb_offset = 0x0C8; static const uint16_t e1000e_pcie_offset = 0x0E0; static const uint16_t e1000e_aer_offset = 0x100; static const uint16_t e1000e_dsn_offset = 0x140; E1000EState *s = E1000E(pci_dev); uint8_t *macaddr; int ret; trace_e1000e_cb_pci_realize(); pci_dev->config_write = e1000e_write_config; pci_dev->config[PCI_CACHE_LINE_SIZE] = 0x10; pci_dev->config[PCI_INTERRUPT_PIN] = 1; pci_set_word(pci_dev->config + PCI_SUBSYSTEM_VENDOR_ID, s->subsys_ven); pci_set_word(pci_dev->config + PCI_SUBSYSTEM_ID, s->subsys); s->subsys_ven_used = s->subsys_ven; s->subsys_used = s->subsys; memory_region_init_io(&s->mmio, OBJECT(s), &mmio_ops, s, "e1000e-mmio", E1000E_MMIO_SIZE); pci_register_bar(pci_dev, E1000E_MMIO_IDX, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->mmio); memory_region_init(&s->flash, OBJECT(s), "e1000e-flash", E1000E_FLASH_SIZE); pci_register_bar(pci_dev, E1000E_FLASH_IDX, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->flash); memory_region_init_io(&s->io, OBJECT(s), &io_ops, s, "e1000e-io", E1000E_IO_SIZE); pci_register_bar(pci_dev, E1000E_IO_IDX, PCI_BASE_ADDRESS_SPACE_IO, &s->io); memory_region_init(&s->msix, OBJECT(s), "e1000e-msix", E1000E_MSIX_SIZE); pci_register_bar(pci_dev, E1000E_MSIX_IDX, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->msix); qemu_macaddr_default_if_unset(&s->conf.macaddr); macaddr = s->conf.macaddr.a; e1000e_init_msix(s); if (pcie_endpoint_cap_v1_init(pci_dev, e1000e_pcie_offset) < 0) { hw_error("Failed to initialize PCIe capability"); } ret = msi_init(PCI_DEVICE(s), 0xD0, 1, true, false, NULL); if (ret) { trace_e1000e_msi_init_fail(ret); } if (e1000e_add_pm_capability(pci_dev, e1000e_pmrb_offset, PCI_PM_CAP_DSI) < 0) { hw_error("Failed to initialize PM capability"); } if (pcie_aer_init(pci_dev, e1000e_aer_offset, PCI_ERR_SIZEOF) < 0) { hw_error("Failed to initialize AER capability"); } pcie_dev_ser_num_init(pci_dev, e1000e_dsn_offset, e1000e_gen_dsn(macaddr)); e1000e_init_net_peer(s, pci_dev, macaddr); e1000e_core_realize(s); e1000e_core_pci_realize(&s->core, e1000e_eeprom_template, sizeof(e1000e_eeprom_template), macaddr); }
1threat
How can i make this code more succinct : without using the replace method i don't really understand regex expressions yet Write a function royalWe(sentence) that returns an string where every word 'I' is replaced with 'we', every word 'mine' is replaced with 'ours', every word 'my' is replaced with 'our', and every word 'me' is replaced with "us" Examples: royalWe("I want to go to the store") => "we want to go to the store" royalWe("This is my house and you will respect me") => "This is our house and you will respect us" royalWe("This is mine") => "This is ours" royalWe("Jump for my love") => "Jump for our love" function royalWe(sentence){ var sent = sentence.split(" "); var newSent = []; var replaceWords = ["I","mine","my","me"]; var words = ["we","ours","our","us"] for(var i = 0; i < sent.length; i++) { var idxofchar = replaceWords.indexOf(sent[i]); if(idxofchar !== -1) { var word = sent[i].split(sent[i]).join(words[idxofchar]) newSent.push(word); } else { newSent.push(sent[i]); } } return newSent.join(" "); }
0debug
C# do something based on image detection : <p>I am making a program in C#. I want it to do something if image is detected on screen. For example let's say I am making a game bot. And my health is image on my screen filled with green color like so:</p> <p><a href="http://i.stack.imgur.com/3BuJT.jpg" rel="nofollow">FULL HP BAR</a></p> <p>And something took my hp to this level:</p> <p><a href="http://i.stack.imgur.com/9i4Jf.jpg" rel="nofollow">TAKEN HP BAR</a></p> <p>If the C# detects the image with hp taken, do something ... Is this possible and how can i do it ? Thanks.</p>
0debug
void bdrv_op_block(BlockDriverState *bs, BlockOpType op, Error *reason) { BdrvOpBlocker *blocker; assert((int) op >= 0 && op < BLOCK_OP_TYPE_MAX); blocker = g_malloc0(sizeof(BdrvOpBlocker)); blocker->reason = reason; QLIST_INSERT_HEAD(&bs->op_blockers[op], blocker, list); }
1threat
How to represent an empty InputStream : <p>I'm reducing a stream of <code>InputStreams</code> like so:</p> <pre><code>InputStream total = input.collect( Collectors.reducing( empty, Item::getInputStream, (is1, is2) -&gt; new SequenceInputStream(is1, is2))); </code></pre> <p>For the identity <code>InputStream</code>, I'm using:</p> <pre><code>InputStream empty = new ByteArrayInputStream(new byte[0]); </code></pre> <p>This works, but is there a better way to represent an empty <code>InputStream</code>?</p>
0debug
Removing unnecessary parameters from VSTS task group : <p>I have a task group which contains besides other tasks the Azure Key Vault task and the Azure Resource Group Deployment task. In the latter I want to override some parameters in the ARM template with values which come from the key vault.</p> <p>The <strong>Secrets filter</strong> field in the <strong>Azure Key Vault</strong> task looks like <code>secret1,secret2,secret3</code>. These secrets are available as variables in other tasks with the same name like the secret names. So the <strong>Override template parameters</strong> field within the <strong>Azure Resource Group Deployment</strong> task has the value <code>-p1 $(secret1) -p2 $(secret2) -p3 $(secret3)</code>.</p> <p>The problem is that VSTS automatically picks the three variables as parameters for the task group. I don't want this to happen. These variables will be set and read out within the task group itself. They are like private fields within a class.</p> <p>One way would be to remove the Azure Key Vault task and use <strong>Build and Release > Library > Variable groups</strong> instead. But there is no way to link variable groups to task groups.</p>
0debug
what is worng in this why new font is not working? : Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click TextBox1.Font = new Font(TextBox1.Font, FontStyle.Bold) End Sub
0debug
static int unpack(const uint8_t *src, const uint8_t *src_end, unsigned char *dst, int width, int height) { unsigned char *dst_end = dst + width*height; int size,size1,size2,offset,run; unsigned char *dst_start = dst; if (src[0] & 0x01) src += 5; else src += 2; if (src+3>src_end) return -1; size = AV_RB24(src); src += 3; while(size>0 && src<src_end) { size1 = (src[0] & 3); if ( src[0] & 0x80 ) { if (src[0] & 0x40 ) { 1 if ( src[0] & 0x20 ) { 11 if ( src[0] < 0xFC ) size1 = (((src[0] & 31) + 1) << 2); src++; size2 = 0; } else { 10 offset = ((src[0] & 0x10) << 12) + AV_RB16(&src[1]) + 1; size2 = ((src[0] & 0xC) << 6) + src[3] + 5; src += 4; } } else { 0 size1 = ( ( src[1] & 0xC0) >> 6 ); offset = (AV_RB16(&src[1]) & 0x3FFF) + 1; size2 = (src[0] & 0x3F) + 4; src += 3; } } else { offset = ((src[0] & 0x60) << 3) + src[1] + 1; size2 = ((src[0] & 0x1C) >> 2) + 3; src += 2; } if (size1>src_end-src) break; if (size1>0) { size -= size1; run = FFMIN(size1, dst_end-dst); memcpy(dst, src, run); dst += run; src += run; } if (size2>0) { if (dst-dst_start<offset) return 0; size -= size2; run = FFMIN(size2, dst_end-dst); av_memcpy_backptr(dst, offset, run); dst += run; } } return 0; }
1threat
Could not find method leftShift() for arguments after updating studio 3.4 : <p>After updating studio <code>3.4</code> and Gradle version to <code>5.1.1</code> I got the error on my task as <strong>Could not find method leftShift()</strong></p> <p><strong>My task:</strong></p> <pre><code>task incrementBetaVersion &lt;&lt; { println("Incrementing Beta Version Number...") incrementVersionNumber('BetaVersionNumber') println("Incrementing Beta Version Number...") incrementVersionName('BetaVersionName') } </code></pre> <p>I got the error for the left shift operator <code>&lt;&lt;</code> in the line.</p> <p>How to resolve this error?</p>
0debug
What is correct lifecycle method in React 16.3 to update canvas from props? : <p>I have a Canvas component, which looks approximately like this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>class Canvas extends React.Component{ saveRef = node =&gt; { this._canvas = node; } shouldComponentUpdate(){ /*I will never re-render this component*/ return false; } componentWillReceiveProps( nextProps ){ /*Here I do manipulations with this._ctx, when new props come*/ } render(){ return ( &lt;canvas ref={this.saveRef} /&gt; ); } componentDidMount(){ this._ctx = this._canvas.getContext( "2d" ); } }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"&gt;&lt;/script&gt; &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"&gt;&lt;/script&gt;</code></pre> </div> </div> </p> <p>React community began to deprecate <code>componentWillReceiveProps</code> in order to replace it with <code>getDerivedStateFromProps</code>. I can use <code>componentDidUpdate</code> to perform my drawings, but then I need to remove <code>shouldComponentUpdate</code> and I will have a lot of useless render calls. What is the correct performant way to update my component in react 16.3, when new props come?</p>
0debug
static uint32_t nvram_readb (void *opaque, target_phys_addr_t addr) { ds1225y_t *NVRAM = opaque; int64_t pos; pos = addr - NVRAM->mem_base; if (addr >= NVRAM->capacity) addr -= NVRAM->capacity; if (!ds1225y_set_to_mode(NVRAM, readmode, "rb")) return 0; qemu_fseek(NVRAM->file, pos, SEEK_SET); return (uint32_t)qemu_get_byte(NVRAM->file); }
1threat
static void bdrv_replace_child(BdrvChild *child, BlockDriverState *new_bs, bool check_new_perm) { BlockDriverState *old_bs = child->bs; uint64_t perm, shared_perm; if (old_bs) { bdrv_get_cumulative_perm(old_bs, &perm, &shared_perm); bdrv_check_perm(old_bs, perm, shared_perm, NULL, &error_abort); bdrv_set_perm(old_bs, perm, shared_perm); } bdrv_replace_child_noperm(child, new_bs); if (new_bs) { bdrv_get_cumulative_perm(new_bs, &perm, &shared_perm); if (check_new_perm) { bdrv_check_perm(new_bs, perm, shared_perm, NULL, &error_abort); } bdrv_set_perm(new_bs, perm, shared_perm); } }
1threat
static void disas_arm_insn(CPUState * env, DisasContext *s) { unsigned int cond, insn, val, op1, i, shift, rm, rs, rn, rd, sh; insn = ldl_code(s->pc); s->pc += 4; cond = insn >> 28; if (cond == 0xf){ if ((insn & 0x0d70f000) == 0x0550f000) return; else if ((insn & 0x0e000000) == 0x0a000000) { int32_t offset; val = (uint32_t)s->pc; gen_op_movl_T0_im(val); gen_movl_reg_T0(s, 14); offset = (((int32_t)insn) << 8) >> 8; val += (offset << 2) | ((insn >> 23) & 2) | 1; val += 4; gen_op_movl_T0_im(val); gen_bx(s); return; } else if ((insn & 0x0fe00000) == 0x0c400000) { } else if ((insn & 0x0f000010) == 0x0e000010) { } else if ((insn & 0x0ff10010) == 0x01000000) { } else if ((insn & 0x0ffffdff) == 0x01010000) { if (insn & (1 << 9)) { goto illegal_op; } return; } goto illegal_op; } if (cond != 0xe) { s->condlabel = gen_new_label(); gen_test_cc[cond ^ 1](s->condlabel); s->condjmp = 1; } if ((insn & 0x0f900000) == 0x03000000) { if ((insn & 0x0fb0f000) != 0x0320f000) goto illegal_op; val = insn & 0xff; shift = ((insn >> 8) & 0xf) * 2; if (shift) val = (val >> shift) | (val << (32 - shift)); gen_op_movl_T0_im(val); i = ((insn & (1 << 22)) != 0); if (gen_set_psr_T0(s, msr_mask(s, (insn >> 16) & 0xf, i), i)) goto illegal_op; } else if ((insn & 0x0f900000) == 0x01000000 && (insn & 0x00000090) != 0x00000090) { op1 = (insn >> 21) & 3; sh = (insn >> 4) & 0xf; rm = insn & 0xf; switch (sh) { case 0x0: if (op1 & 1) { gen_movl_T0_reg(s, rm); i = ((op1 & 2) != 0); if (gen_set_psr_T0(s, msr_mask(s, (insn >> 16) & 0xf, i), i)) goto illegal_op; } else { rd = (insn >> 12) & 0xf; if (op1 & 2) { if (IS_USER(s)) goto illegal_op; gen_op_movl_T0_spsr(); } else { gen_op_movl_T0_cpsr(); } gen_movl_reg_T0(s, rd); } break; case 0x1: if (op1 == 1) { gen_movl_T0_reg(s, rm); gen_bx(s); } else if (op1 == 3) { rd = (insn >> 12) & 0xf; gen_movl_T0_reg(s, rm); gen_op_clz_T0(); gen_movl_reg_T0(s, rd); } else { goto illegal_op; } break; case 0x2: if (op1 == 1) { ARCH(5J); gen_movl_T0_reg(s, rm); gen_bx(s); } else { goto illegal_op; } break; case 0x3: if (op1 != 1) goto illegal_op; val = (uint32_t)s->pc; gen_op_movl_T0_im(val); gen_movl_reg_T0(s, 14); gen_movl_T0_reg(s, rm); gen_bx(s); break; case 0x5: rd = (insn >> 12) & 0xf; rn = (insn >> 16) & 0xf; gen_movl_T0_reg(s, rm); gen_movl_T1_reg(s, rn); if (op1 & 2) gen_op_double_T1_saturate(); if (op1 & 1) gen_op_subl_T0_T1_saturate(); else gen_op_addl_T0_T1_saturate(); gen_movl_reg_T0(s, rd); break; case 7: gen_op_movl_T0_im((long)s->pc - 4); gen_op_movl_reg_TN[0][15](); gen_op_bkpt(); s->is_jmp = DISAS_JUMP; break; case 0x8: case 0xa: case 0xc: case 0xe: rs = (insn >> 8) & 0xf; rn = (insn >> 12) & 0xf; rd = (insn >> 16) & 0xf; if (op1 == 1) { gen_movl_T0_reg(s, rm); gen_movl_T1_reg(s, rs); if (sh & 4) gen_op_sarl_T1_im(16); else gen_op_sxth_T1(); gen_op_imulw_T0_T1(); if ((sh & 2) == 0) { gen_movl_T1_reg(s, rn); gen_op_addl_T0_T1_setq(); } gen_movl_reg_T0(s, rd); } else { gen_movl_T0_reg(s, rm); gen_movl_T1_reg(s, rs); gen_mulxy(sh & 2, sh & 4); if (op1 == 2) { gen_op_signbit_T1_T0(); gen_op_addq_T0_T1(rn, rd); gen_movl_reg_T0(s, rn); gen_movl_reg_T1(s, rd); } else { if (op1 == 0) { gen_movl_T1_reg(s, rn); gen_op_addl_T0_T1_setq(); } gen_movl_reg_T0(s, rd); } } break; default: goto illegal_op; } } else if (((insn & 0x0e000000) == 0 && (insn & 0x00000090) != 0x90) || ((insn & 0x0e000000) == (1 << 25))) { int set_cc, logic_cc, shiftop; op1 = (insn >> 21) & 0xf; set_cc = (insn >> 20) & 1; logic_cc = table_logic_cc[op1] & set_cc; if (insn & (1 << 25)) { val = insn & 0xff; shift = ((insn >> 8) & 0xf) * 2; if (shift) val = (val >> shift) | (val << (32 - shift)); gen_op_movl_T1_im(val); if (logic_cc && shift) gen_op_mov_CF_T1(); } else { rm = (insn) & 0xf; gen_movl_T1_reg(s, rm); shiftop = (insn >> 5) & 3; if (!(insn & (1 << 4))) { shift = (insn >> 7) & 0x1f; if (shift != 0) { if (logic_cc) { gen_shift_T1_im_cc[shiftop](shift); } else { gen_shift_T1_im[shiftop](shift); } } else if (shiftop != 0) { if (logic_cc) { gen_shift_T1_0_cc[shiftop](); } else { gen_shift_T1_0[shiftop](); } } } else { rs = (insn >> 8) & 0xf; gen_movl_T0_reg(s, rs); if (logic_cc) { gen_shift_T1_T0_cc[shiftop](); } else { gen_shift_T1_T0[shiftop](); } } } if (op1 != 0x0f && op1 != 0x0d) { rn = (insn >> 16) & 0xf; gen_movl_T0_reg(s, rn); } rd = (insn >> 12) & 0xf; switch(op1) { case 0x00: gen_op_andl_T0_T1(); gen_movl_reg_T0(s, rd); if (logic_cc) gen_op_logic_T0_cc(); break; case 0x01: gen_op_xorl_T0_T1(); gen_movl_reg_T0(s, rd); if (logic_cc) gen_op_logic_T0_cc(); break; case 0x02: if (set_cc && rd == 15) { if (IS_USER(s)) goto illegal_op; gen_op_subl_T0_T1_cc(); gen_exception_return(s); } else { if (set_cc) gen_op_subl_T0_T1_cc(); else gen_op_subl_T0_T1(); gen_movl_reg_T0(s, rd); } break; case 0x03: if (set_cc) gen_op_rsbl_T0_T1_cc(); else gen_op_rsbl_T0_T1(); gen_movl_reg_T0(s, rd); break; case 0x04: if (set_cc) gen_op_addl_T0_T1_cc(); else gen_op_addl_T0_T1(); gen_movl_reg_T0(s, rd); break; case 0x05: if (set_cc) gen_op_adcl_T0_T1_cc(); else gen_op_adcl_T0_T1(); gen_movl_reg_T0(s, rd); break; case 0x06: if (set_cc) gen_op_sbcl_T0_T1_cc(); else gen_op_sbcl_T0_T1(); gen_movl_reg_T0(s, rd); break; case 0x07: if (set_cc) gen_op_rscl_T0_T1_cc(); else gen_op_rscl_T0_T1(); gen_movl_reg_T0(s, rd); break; case 0x08: if (set_cc) { gen_op_andl_T0_T1(); gen_op_logic_T0_cc(); } break; case 0x09: if (set_cc) { gen_op_xorl_T0_T1(); gen_op_logic_T0_cc(); } break; case 0x0a: if (set_cc) { gen_op_subl_T0_T1_cc(); } break; case 0x0b: if (set_cc) { gen_op_addl_T0_T1_cc(); } break; case 0x0c: gen_op_orl_T0_T1(); gen_movl_reg_T0(s, rd); if (logic_cc) gen_op_logic_T0_cc(); break; case 0x0d: if (logic_cc && rd == 15) { if (IS_USER(s)) goto illegal_op; gen_op_movl_T0_T1(); gen_exception_return(s); } else { gen_movl_reg_T1(s, rd); if (logic_cc) gen_op_logic_T1_cc(); } break; case 0x0e: gen_op_bicl_T0_T1(); gen_movl_reg_T0(s, rd); if (logic_cc) gen_op_logic_T0_cc(); break; default: case 0x0f: gen_op_notl_T1(); gen_movl_reg_T1(s, rd); if (logic_cc) gen_op_logic_T1_cc(); break; } } else { op1 = (insn >> 24) & 0xf; switch(op1) { case 0x0: case 0x1: sh = (insn >> 5) & 3; if (sh == 0) { if (op1 == 0x0) { rd = (insn >> 16) & 0xf; rn = (insn >> 12) & 0xf; rs = (insn >> 8) & 0xf; rm = (insn) & 0xf; if (((insn >> 22) & 3) == 0) { gen_movl_T0_reg(s, rs); gen_movl_T1_reg(s, rm); gen_op_mul_T0_T1(); if (insn & (1 << 21)) { gen_movl_T1_reg(s, rn); gen_op_addl_T0_T1(); } if (insn & (1 << 20)) gen_op_logic_T0_cc(); gen_movl_reg_T0(s, rd); } else { gen_movl_T0_reg(s, rs); gen_movl_T1_reg(s, rm); if (insn & (1 << 22)) gen_op_imull_T0_T1(); else gen_op_mull_T0_T1(); if (insn & (1 << 21)) gen_op_addq_T0_T1(rn, rd); if (!(insn & (1 << 23))) { ARCH(6); gen_op_addq_lo_T0_T1(rn); gen_op_addq_lo_T0_T1(rd); } if (insn & (1 << 20)) gen_op_logicq_cc(); gen_movl_reg_T0(s, rn); gen_movl_reg_T1(s, rd); } } else { rn = (insn >> 16) & 0xf; rd = (insn >> 12) & 0xf; if (insn & (1 << 23)) { goto illegal_op; } else { rm = (insn) & 0xf; gen_movl_T0_reg(s, rm); gen_movl_T1_reg(s, rn); if (insn & (1 << 22)) { gen_ldst(swpb, s); } else { gen_ldst(swpl, s); } gen_movl_reg_T0(s, rd); } } } else { int address_offset; rn = (insn >> 16) & 0xf; rd = (insn >> 12) & 0xf; gen_movl_T1_reg(s, rn); if (insn & (1 << 24)) gen_add_datah_offset(s, insn, 0); address_offset = 0; if (insn & (1 << 20)) { switch(sh) { case 1: gen_ldst(lduw, s); break; case 2: gen_ldst(ldsb, s); break; default: case 3: gen_ldst(ldsw, s); break; } gen_movl_reg_T0(s, rd); } else if (sh & 2) { if (sh & 1) { gen_movl_T0_reg(s, rd); gen_ldst(stl, s); gen_op_addl_T1_im(4); gen_movl_T0_reg(s, rd + 1); gen_ldst(stl, s); } else { gen_ldst(ldl, s); gen_movl_reg_T0(s, rd); gen_op_addl_T1_im(4); gen_ldst(ldl, s); gen_movl_reg_T0(s, rd + 1); } address_offset = -4; } else { gen_movl_T0_reg(s, rd); gen_ldst(stw, s); } if (!(insn & (1 << 24))) { gen_add_datah_offset(s, insn, address_offset); gen_movl_reg_T1(s, rn); } else if (insn & (1 << 21)) { if (address_offset) gen_op_addl_T1_im(address_offset); gen_movl_reg_T1(s, rn); } } break; case 0x4: case 0x5: case 0x6: case 0x7: sh = (0xf << 20) | (0xf << 4); if (op1 == 0x7 && ((insn & sh) == sh)) { goto illegal_op; } rn = (insn >> 16) & 0xf; rd = (insn >> 12) & 0xf; gen_movl_T1_reg(s, rn); i = (IS_USER(s) || (insn & 0x01200000) == 0x00200000); if (insn & (1 << 24)) gen_add_data_offset(s, insn); if (insn & (1 << 20)) { #if defined(CONFIG_USER_ONLY) if (insn & (1 << 22)) gen_op_ldub_raw(); else gen_op_ldl_raw(); #else if (insn & (1 << 22)) { if (i) gen_op_ldub_user(); else gen_op_ldub_kernel(); } else { if (i) gen_op_ldl_user(); else gen_op_ldl_kernel(); } #endif if (rd == 15) gen_bx(s); else gen_movl_reg_T0(s, rd); } else { gen_movl_T0_reg(s, rd); #if defined(CONFIG_USER_ONLY) if (insn & (1 << 22)) gen_op_stb_raw(); else gen_op_stl_raw(); #else if (insn & (1 << 22)) { if (i) gen_op_stb_user(); else gen_op_stb_kernel(); } else { if (i) gen_op_stl_user(); else gen_op_stl_kernel(); } #endif } if (!(insn & (1 << 24))) { gen_add_data_offset(s, insn); gen_movl_reg_T1(s, rn); } else if (insn & (1 << 21)) gen_movl_reg_T1(s, rn); { } break; case 0x08: case 0x09: { int j, n, user, loaded_base; user = 0; if (insn & (1 << 22)) { if (IS_USER(s)) goto illegal_op; if ((insn & (1 << 15)) == 0) user = 1; } rn = (insn >> 16) & 0xf; gen_movl_T1_reg(s, rn); loaded_base = 0; n = 0; for(i=0;i<16;i++) { if (insn & (1 << i)) n++; } if (insn & (1 << 23)) { if (insn & (1 << 24)) { gen_op_addl_T1_im(4); } else { } } else { if (insn & (1 << 24)) { gen_op_addl_T1_im(-(n * 4)); } else { if (n != 1) gen_op_addl_T1_im(-((n - 1) * 4)); } } j = 0; for(i=0;i<16;i++) { if (insn & (1 << i)) { if (insn & (1 << 20)) { gen_ldst(ldl, s); if (i == 15) { gen_bx(s); } else if (user) { gen_op_movl_user_T0(i); } else if (i == rn) { gen_op_movl_T2_T0(); loaded_base = 1; } else { gen_movl_reg_T0(s, i); } } else { if (i == 15) { val = (long)s->pc + 8; gen_op_movl_TN_im[0](val); } else if (user) { gen_op_movl_T0_user(i); } else { gen_movl_T0_reg(s, i); } gen_ldst(stl, s); } j++; if (j != n) gen_op_addl_T1_im(4); } } if (insn & (1 << 21)) { if (insn & (1 << 23)) { if (insn & (1 << 24)) { } else { gen_op_addl_T1_im(4); } } else { if (insn & (1 << 24)) { if (n != 1) gen_op_addl_T1_im(-((n - 1) * 4)); } else { gen_op_addl_T1_im(-(n * 4)); } } gen_movl_reg_T1(s, rn); } if (loaded_base) { gen_op_movl_T0_T2(); gen_movl_reg_T0(s, rn); } if ((insn & (1 << 22)) && !user) { gen_op_movl_T0_spsr(); gen_op_movl_cpsr_T0(0xffffffff); s->is_jmp = DISAS_UPDATE; } } break; case 0xa: case 0xb: { int32_t offset; val = (int32_t)s->pc; if (insn & (1 << 24)) { gen_op_movl_T0_im(val); gen_op_movl_reg_TN[0][14](); } offset = (((int32_t)insn << 8) >> 8); val += (offset << 2) + 4; gen_jmp(s, val); } break; case 0xc: case 0xd: case 0xe: op1 = (insn >> 8) & 0xf; switch (op1) { case 10: case 11: if (disas_vfp_insn (env, s, insn)) goto illegal_op; break; case 15: if (disas_cp15_insn (s, insn)) goto illegal_op; break; default: goto illegal_op; } break; case 0xf: gen_op_movl_T0_im((long)s->pc); gen_op_movl_reg_TN[0][15](); gen_op_swi(); s->is_jmp = DISAS_JUMP; break; default: illegal_op: gen_op_movl_T0_im((long)s->pc - 4); gen_op_movl_reg_TN[0][15](); gen_op_undef_insn(); s->is_jmp = DISAS_JUMP; break; } } }
1threat
difficulty in understanding how pointers work in c : <p>I am learning c language for over a year now. But I still don't understand how pointers work. Can anyone suggest a good online resource to make concepts clear.</p>
0debug
Why is COPY in docker build not detecting updates : <p>I run a build on a node application and then use the artifacts to build a docker image. The COPY command that moves my source in place isn't detecting changes to the source files after a build; its just using the cache.</p> <p><code>Step 9/12 : COPY server /home/nodejs/app/server ---&gt; Using cache ---&gt; bee2f9334952</code></p> <p>Am I doing something wrong with COPY or is there a way to not cache a particular step?</p>
0debug
Am I using a Production or Development environment in PHP? : How do I configure PHP to either use a production environment or a development environment in PHP 5.5.x? In order for the errors to display that I want to see, I've uncommented 'Production Value: On' underneath the display_errors section, and 'Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT' underneath the error_reporting section. However, what determines production vs. development? Is it a setting in php.ini, or somewhere else?
0debug
Springs RestTemplate default connection pool : <p>Just wondering if RestTemplate out of the box uses connection pooling or does it simply establish a new connection each time ?</p>
0debug
int tcp_fconnect(struct socket *so) { Slirp *slirp = so->slirp; int ret=0; DEBUG_CALL("tcp_fconnect"); DEBUG_ARG("so = %p", so); if( (ret = so->s = qemu_socket(AF_INET,SOCK_STREAM,0)) >= 0) { int opt, s=so->s; struct sockaddr_in addr; qemu_set_nonblock(s); socket_set_fast_reuse(s); opt = 1; qemu_setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(opt)); addr.sin_family = AF_INET; if ((so->so_faddr.s_addr & slirp->vnetwork_mask.s_addr) == slirp->vnetwork_addr.s_addr) { if (so->so_faddr.s_addr == slirp->vnameserver_addr.s_addr) { if (get_dns_addr(&addr.sin_addr) < 0) addr.sin_addr = loopback_addr; } else { addr.sin_addr = loopback_addr; } } else addr.sin_addr = so->so_faddr; addr.sin_port = so->so_fport; DEBUG_MISC((dfd, " connect()ing, addr.sin_port=%d, " "addr.sin_addr.s_addr=%.16s\n", ntohs(addr.sin_port), inet_ntoa(addr.sin_addr))); ret = connect(s,(struct sockaddr *)&addr,sizeof (addr)); soisfconnecting(so); } return(ret); }
1threat
php gcm save registration token : <p>hello I'm working with gcm , service worker I'm getting registration id of each user and everything , now what I want is how to save the registration token and store it to my database using mysql and php. any help would be appreciated</p>
0debug
Create a BAT that can open a selection of executables? : <p>I want to make a batch file that gives me a selection to open various executables. For example,</p> <pre><code>What do you want to open? 1. Application1.exe 2. Application2.exe 3. Application3.exe </code></pre> <p>Inputting a number will open the desired executable that isn't in the same directory as the batch file itself. So it's basically a launcher.</p>
0debug
jQuery set all select inputs to certain value : <p>I'd like to loop through all of the select inputs on a page and if the selected value is not a certain option then set that value to selected</p> <p>I have some selects (notice in select1, option 2 is selected)</p> <pre><code>&lt;select name="select1"&gt; &lt;option value="1"&gt;One&lt;/option&gt; &lt;option value="2" selected&gt;Two&lt;/option&gt; &lt;option value="3"&gt;Three&lt;/option&gt; &lt;option value="4"&gt;Four&lt;/option&gt; &lt;option value="5"&gt;Five&lt;/option&gt; &lt;/select&gt; &lt;select name="select2"&gt; &lt;option value="1"&gt;One&lt;/option&gt; &lt;option value="2"&gt;Two&lt;/option&gt; &lt;option value="3"&gt;Three&lt;/option&gt; &lt;option value="4"&gt;Four&lt;/option&gt; &lt;option value="5"&gt;Five&lt;/option&gt; &lt;/select&gt; &lt;select name="select3"&gt; &lt;option value="1"&gt;One&lt;/option&gt; &lt;option value="2"&gt;Two&lt;/option&gt; &lt;option value="3"&gt;Three&lt;/option&gt; &lt;option value="4"&gt;Four&lt;/option&gt; &lt;option value="5"&gt;Five&lt;/option&gt; &lt;/select&gt; </code></pre> <p>The idea here would be to have a checkbox that when it's checked set select2 and select3 to have option 2 selected as they don't have that option already selected and append a string to the value so I know they've been updated e.g '-updated' </p> <p>I'm looping through them like so, but I can't figure out how to set the selected property to option '2' if it isn't already selected and then append '-updated' to the value</p> <pre><code>$('select').each(function() { var selected = $(this).find(":selected"); if (selected.val() != 2) { // set option 2 as selected // append '-updated' to value } } </code></pre> <p>Fiddle <a href="https://jsfiddle.net/69zzr6xa/6/" rel="nofollow">https://jsfiddle.net/69zzr6xa/6/</a></p>
0debug
static void timer_save(QEMUFile *f, void *opaque) { if (cpu_ticks_enabled) { hw_error("cannot save state if virtual timers are running"); } qemu_put_be64(f, cpu_ticks_offset); qemu_put_be64(f, ticks_per_sec); qemu_put_be64(f, cpu_clock_offset); }
1threat
How to translate a python file to linux executable file : <p>I use python 2.7 and I am wondering how can I change my python code into a linux executable file very similar to using gcc -o hello hello.c but with python</p>
0debug
Postgres UPDATE with ORDER BY, how to do it? : <p>I need to do a Postgres update on a collection of records &amp; I'm trying to prevent a deadlock which appeared in the stress tests. </p> <p>The typical resolution to this is to update records in a certain order, by ID for example - but it seems that Postgres doesn't allow ORDER BY for UPDATE.</p> <p>Assuming I need to do an update, for example:</p> <pre><code>UPDATE BALANCES WHERE ID IN (SELECT ID FROM some_function() ORDER BY ID); </code></pre> <p>results in deadlocks when you run 200 queries concurrently. What to do?</p> <p>I'm looking for a general solution, not case-specific workarounds like in <a href="https://stackoverflow.com/questions/16735950/update-with-order-by">UPDATE with ORDER BY</a></p> <p>It <em>feels</em> that there must be a better solution than writing a cursor function. Also, if there's no better way, how would that cursor function optimally look like? Update record-by-record</p>
0debug
static void cook_imlt(COOKContext *q, float* inbuffer, float* outbuffer) { int i; q->mdct_ctx.fft.imdct_calc(&q->mdct_ctx, outbuffer, inbuffer, q->mdct_tmp); for(i = 0; i < q->samples_per_channel; i++){ float tmp = outbuffer[i]; outbuffer[i] = q->mlt_window[i] * outbuffer[q->samples_per_channel + i]; outbuffer[q->samples_per_channel + i] = q->mlt_window[q->samples_per_channel - 1 - i] * -tmp; } }
1threat
document.getElementById('input').innerHTML = user_input;
1threat
Laravel/PHPUnit: Assert json element exists without defining the value : <p>I'm sending a post request in a test case, and I want to assert that a specific element, let's say with key 'x' exists in the response. In this case, I can't say <code>seeJson(['x' =&gt; whatever]);</code> because the value is unknown to me. and for sure, I can't do it with <code>seeJson(['x']);</code>. </p> <p>Is there a way to solve this?</p> <p>If it matters: Laravel: v5.2.31 PHPUnit: 5.3.4</p>
0debug
int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *got_picture_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; RV34DecContext *r = avctx->priv_data; MpegEncContext *s = &r->s; AVFrame *pict = data; SliceInfo si; int i; int slice_count; const uint8_t *slices_hdr = NULL; int last = 0; if (buf_size == 0) { if (s->low_delay==0 && s->next_picture_ptr) { *pict = s->next_picture_ptr->f; s->next_picture_ptr = NULL; *got_picture_ptr = 1; } return 0; } if(!avctx->slice_count){ slice_count = (*buf++) + 1; slices_hdr = buf + 4; buf += 8 * slice_count; buf_size -= 1 + 8 * slice_count; }else slice_count = avctx->slice_count; if(get_slice_offset(avctx, slices_hdr, 0) < 0 || get_slice_offset(avctx, slices_hdr, 0) > buf_size){ av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n"); } init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, 0), (buf_size-get_slice_offset(avctx, slices_hdr, 0))*8); if(r->parse_slice_header(r, &r->s.gb, &si) < 0 || si.start){ av_log(avctx, AV_LOG_ERROR, "First slice header is incorrect\n"); } if ((!s->last_picture_ptr || !s->last_picture_ptr->f.data[0]) && si.type == AV_PICTURE_TYPE_B) { av_log(avctx, AV_LOG_ERROR, "Invalid decoder state: B-frame without " "reference data.\n"); } if( (avctx->skip_frame >= AVDISCARD_NONREF && si.type==AV_PICTURE_TYPE_B) || (avctx->skip_frame >= AVDISCARD_NONKEY && si.type!=AV_PICTURE_TYPE_I) || avctx->skip_frame >= AVDISCARD_ALL) return avpkt->size; if (si.start == 0) { if (s->mb_num_left > 0) { av_log(avctx, AV_LOG_ERROR, "New frame but still %d MB left.\n", s->mb_num_left); ff_er_frame_end(s); ff_MPV_frame_end(s); } if (s->width != si.width || s->height != si.height) { int err; av_log(s->avctx, AV_LOG_WARNING, "Changing dimensions to %dx%d\n", si.width, si.height); s->width = si.width; s->height = si.height; avcodec_set_dimensions(s->avctx, s->width, s->height); if ((err = ff_MPV_common_frame_size_change(s)) < 0) return err; if ((err = rv34_decoder_realloc(r)) < 0) return err; } s->pict_type = si.type ? si.type : AV_PICTURE_TYPE_I; if (ff_MPV_frame_start(s, s->avctx) < 0) return -1; ff_er_frame_start(s); if (!r->tmp_b_block_base) { int i; r->tmp_b_block_base = av_malloc(s->linesize * 48); for (i = 0; i < 2; i++) r->tmp_b_block_y[i] = r->tmp_b_block_base + i * 16 * s->linesize; for (i = 0; i < 4; i++) r->tmp_b_block_uv[i] = r->tmp_b_block_base + 32 * s->linesize + (i >> 1) * 8 * s->uvlinesize + (i & 1) * 16; } r->cur_pts = si.pts; if (s->pict_type != AV_PICTURE_TYPE_B) { r->last_pts = r->next_pts; r->next_pts = r->cur_pts; } else { int refdist = GET_PTS_DIFF(r->next_pts, r->last_pts); int dist0 = GET_PTS_DIFF(r->cur_pts, r->last_pts); int dist1 = GET_PTS_DIFF(r->next_pts, r->cur_pts); if(!refdist){ r->mv_weight1 = r->mv_weight2 = r->weight1 = r->weight2 = 8192; r->scaled_weight = 0; }else{ r->mv_weight1 = (dist0 << 14) / refdist; r->mv_weight2 = (dist1 << 14) / refdist; if((r->mv_weight1|r->mv_weight2) & 511){ r->weight1 = r->mv_weight1; r->weight2 = r->mv_weight2; r->scaled_weight = 0; }else{ r->weight1 = r->mv_weight1 >> 9; r->weight2 = r->mv_weight2 >> 9; r->scaled_weight = 1; } } } s->mb_x = s->mb_y = 0; ff_thread_finish_setup(s->avctx); } else if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) { av_log(s->avctx, AV_LOG_ERROR, "Decoder needs full frames in frame " "multithreading mode (start MB is %d).\n", si.start); } for(i = 0; i < slice_count; i++){ int offset = get_slice_offset(avctx, slices_hdr, i); int size; if(i+1 == slice_count) size = buf_size - offset; else size = get_slice_offset(avctx, slices_hdr, i+1) - offset; if(offset < 0 || offset > buf_size){ av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n"); break; } r->si.end = s->mb_width * s->mb_height; s->mb_num_left = r->s.mb_x + r->s.mb_y*r->s.mb_width - r->si.start; if(i+1 < slice_count){ if (get_slice_offset(avctx, slices_hdr, i+1) < 0 || get_slice_offset(avctx, slices_hdr, i+1) > buf_size) { av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n"); break; } init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, i+1), (buf_size-get_slice_offset(avctx, slices_hdr, i+1))*8); if(r->parse_slice_header(r, &r->s.gb, &si) < 0){ if(i+2 < slice_count) size = get_slice_offset(avctx, slices_hdr, i+2) - offset; else size = buf_size - offset; }else r->si.end = si.start; } if (size < 0 || size > buf_size - offset) { av_log(avctx, AV_LOG_ERROR, "Slice size is invalid\n"); break; } last = rv34_decode_slice(r, r->si.end, buf + offset, size); if(last) break; } if (s->current_picture_ptr) { if (last) { if(r->loop_filter) r->loop_filter(r, s->mb_height - 1); *got_picture_ptr = finish_frame(avctx, pict); } else if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) { av_log(avctx, AV_LOG_INFO, "marking unfished frame as finished\n"); ff_er_frame_end(s); ff_MPV_frame_end(s); s->mb_num_left = 0; ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0); } } return avpkt->size; }
1threat
Get a yarn configuration from commandline : <p>In EMR, is there a way to get a specific value of the configuration given the configuration key using the <code>yarn</code> command?</p> <p>For example I would like to do something like this</p> <pre><code>yarn get-config yarn.scheduler.maximum-allocation-mb </code></pre>
0debug
C#, microsoft bot : <p>I've created a simple chat bot using Microsoft QnA Maker cognitive service. Is there any parallel product available from any other vendor like facebook, google, IBM etc like QnA Maker service?</p>
0debug
Can i generate a .exe with a WPF application? : <p>Is possible to generate a .exe from another .exe? using visual studio and net framework ? for example the application grab a .dll and convert into a standalone .exe app</p>
0debug
How to use images in css with Webpack : <p>I am making a React w/ Webpack setup and am struggling to do what seems like should be a simple task. I want webpack to include images, and minimize them like I with gulp but I can't figure it out. I just want to be able to link an image in my css like so:</p> <pre><code>/* ./src/img/background.jpg */ body { background: url('./img/background.jpg'); } </code></pre> <p>I have all of my css/js/img folders inside a src folder. Webpack outputs to a dist folder, but I can't figure out how to get images there.</p> <p>Here is my webpack setup:</p> <pre><code> var path = require('path'); var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { devtool: 'cheap-eval-source-map', entry: [ 'webpack-dev-server/client?http://localhost:8080', 'webpack/hot/dev-server', './src/index.js' ], output: { path: path.join(__dirname, 'dist'), // publicPath: './dist', filename: 'bundle.js' }, plugins: [ new webpack.HotModuleReplacementPlugin(), new HtmlWebpackPlugin({ template: './src/index.html' }) ], module: { loaders: [{ exclude: /node_modules/, test: /\.js?$/, loader: 'babel' }, { test: /\.scss$/, loader: 'style!css!sass' }, { test: /\.(png|jpg)$/, loader: 'file-loader' }] }, devServer: { historyApiFallback: true, contentBase: './dist', hot: true } }; </code></pre>
0debug
What is the difference between classes and test-classes : <p>I had a springmvc maven project By IntelliJ Idea,I put the logbak.xml in the <code>src/main/resources</code> folder and another logbak.xml with different configurations in the <code>src/test/resources</code> folder.</p> <p>When running my Junit Test,the logbak.xml in the test folder worked. When running my web in tomcat server,the logbak.xml in the main folder worked.</p> <p>If I had no logbak.xml in test folder,the logbak.xml in the main folder worked.</p> <p>Why the logbak.xml can't be loaded twice? How to decide which file can be loaded first when different running above?</p>
0debug
Anonymous Classes - when are they created? : <p>Does an anonymous class get created (not instantiated, but the class actually being defined/loaded) each time its enclosing method is called or are they reused? For instance:</p> <pre><code>public MyInterface getAnonymousMyInterface() { return new MyInterface(){ public void doStuff(){ System.out.println("did stuff"); } } } </code></pre> <p>Will calling <code>getAnonymousMyInterface()</code> create two different classes?</p>
0debug
space and time complexity of lisp functions : Good morning guys there are two lisp's functions (defun fact (x &optional (acc 1) (if (zerop x) acc (fatt (- 1 x) (* x acc)))) (defun fatt (x) (if (zerop x) 1 (* x (fatt (- x 1)))) How can i find space and time complexity of this functions? Thanks
0debug
void *colo_process_incoming_thread(void *opaque) { MigrationIncomingState *mis = opaque; migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, MIGRATION_STATUS_COLO); mis->to_src_file = qemu_file_get_return_path(mis->from_src_file); if (!mis->to_src_file) { error_report("COLO incoming thread: Open QEMUFile to_src_file failed"); goto out; } qemu_file_set_blocking(mis->from_src_file, true); out: if (mis->to_src_file) { qemu_fclose(mis->to_src_file); } migration_incoming_exit_colo(); return NULL; }
1threat
I am getting Null Pointer Exception in my Selenium Script? : <pre><code> enter code here import java.util.ArrayList; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class ArrayLiist { public static void main(String[] args) { launchBrowser("CH"); WebDriver driver=null; driver.findElement(By.id("user_login")).sendKeys("admin"); driver.findElement(By.id("user_pss")).sendKeys("demo123"); driver.findElement(By.id("wp-submit")).click(); } public static void launchBrowser(String bn) { if(bn=="CH") { System.setProperty("webdriver.chrome.driver","E:\\Selenium Downloaded\\chrome\\chromedriver.exe"); ChromeDriver driver = new ChromeDriver(); driver.get("http://demosite.center/wordpress/wp-admin/plugins.php"); } } } </code></pre> <p>i think driver is not being identified ? i have institiated webdriver =null , still it is showing null pointer exception</p> <p>Exception in thread "main" java.lang.NullPointerException at ArrayLiist.main(ArrayLiist.java:13)</p>
0debug
document.getElementById('input').innerHTML = user_input;
1threat
Get a word with his value : There is exists a way to extract a word with the value in a file. For example File contents: "foo":1234,"bar":123 Or foo:1234,bar:123 I only need foo:1234 Can someone help me?
0debug
Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener on a null object reference at SignUpActivity.onCreate : <p>I tried to click the signup button in the loginactivity but when click the button in the app, it will jump out and give an error like this, it's true that there are questions similar to the one I'm asking, but I really tried all the solutions you proposed but it does not work for me.</p> <p>The error:</p> <pre><code>&gt; E/AndroidRuntime: FATAL EXCEPTION: main &gt; Process: com.fivenine.shareit, PID: 17033 &gt; java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fivenine.shareit/com.fivenine.shareit.AccountActivity.SignUpActivity}: &gt; java.lang.NullPointerException: Attempt to invoke virtual method 'void &gt; android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' &gt; on a null object reference &gt; at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2747) &gt; at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2808) &gt; at android.app.ActivityThread.-wrap12(ActivityThread.java) &gt; at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541) &gt; at android.os.Handler.dispatchMessage(Handler.java:102) &gt; at android.os.Looper.loop(Looper.java:165) &gt; at android.app.ActivityThread.main(ActivityThread.java:6375) &gt; at java.lang.reflect.Method.invoke(Native Method) &gt; at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912) &gt; at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802) &gt; Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void &gt; android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' &gt; on a null object reference &gt; at com.fivenine.shareit.AccountActivity.SignUpActivity.onCreate(SignUpActivity.java:44) &gt; at android.app.Activity.performCreate(Activity.java:6845) &gt; at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) &gt; at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2700) &gt; at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2808)  &gt; at android.app.ActivityThread.-wrap12(ActivityThread.java)  &gt; at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541)  &gt; at android.os.Handler.dispatchMessage(Handler.java:102)  &gt; at android.os.Looper.loop(Looper.java:165)  &gt; at android.app.ActivityThread.main(ActivityThread.java:6375)  &gt; at java.lang.reflect.Method.invoke(Native Method)  &gt; at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)  &gt; at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802) </code></pre> <p>here is the SignUpActivity.java:</p> <pre><code>import android.content.Intent; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.Toast; import com.fivenine.shareit.MainActivity; import com.fivenine.shareit.R; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; public class SignUpActivity extends AppCompatActivity { private EditText inputEmail, inputPassword; private Button btnSignIn, btnSignUp, btnResetPassword; private ProgressBar progressBar; private FirebaseAuth auth; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sign_up); //Get Firebase auth instance auth = FirebaseAuth.getInstance(); btnSignIn = (Button) findViewById(R.id.sign_in_button); btnSignUp = (Button) findViewById(R.id.sign_up_button); inputEmail = (EditText) findViewById(R.id.email); inputPassword = (EditText) findViewById(R.id.password); progressBar = (ProgressBar) findViewById(R.id.progressBar); btnResetPassword = (Button) findViewById(R.id.btn_reset_password); btnResetPassword.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View view) { startActivity(new Intent(SignUpActivity.this, ResetPasswordActivity.class)); } }); btnSignIn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); btnSignUp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String email = inputEmail.getText().toString().trim(); String password = inputPassword.getText().toString().trim(); if (TextUtils.isEmpty(email)){ Toast.makeText(getApplicationContext(), "Enter email address!", Toast.LENGTH_SHORT).show(); return; } if (TextUtils.isEmpty(password)){ Toast.makeText(getApplicationContext(), "Enter password!", Toast.LENGTH_SHORT).show(); return; } if (password.length() &lt; 6){ Toast.makeText(getApplicationContext(), "Password too short,enter minimum 6 characters!", Toast.LENGTH_SHORT).show(); return; } progressBar.setVisibility(View.VISIBLE); //create user auth.createUserWithEmailAndPassword(email, password) .addOnCompleteListener(SignUpActivity.this, new OnCompleteListener&lt;AuthResult&gt;() { @Override public void onComplete(@NonNull Task&lt;AuthResult&gt; task) { Toast.makeText(SignUpActivity.this,"createUserWithEmail:onComplete:" + task.isSuccessful(), Toast.LENGTH_SHORT).show(); progressBar.setVisibility(View.GONE); if(!task.isSuccessful()){ Toast.makeText(SignUpActivity.this, "Authenticaton faled." + task.getException(), Toast.LENGTH_SHORT).show(); }else{ startActivity(new Intent(SignUpActivity.this, MainActivity.class)); finish(); } } }); } }); } @Override protected void onResume(){ super.onResume(); progressBar.setVisibility(View.GONE); } } </code></pre> <p>The activity_sign_up.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.fivenine.shareit.AccountActivity.SignUpActivity"&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/gradient_6" android:gravity="center" android:orientation="vertical" android:padding="@dimen/activity_horizontal_margin"&gt; &lt;ImageView android:layout_width="75dp" android:layout_height="80dp" android:layout_gravity="center_horizontal" android:layout_marginBottom="30dp" android:contentDescription="" android:src="@drawable/profile" tools:ignore="ContentDescription" /&gt; &lt;EditText android:id="@+id/email" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/email" android:inputType="textEmailAddress" android:maxLines="1" android:textColor="@android:color/black"/&gt; &lt;EditText android:id="@+id/password" android:layout_width="match_parent" android:layout_height="wrap_content" android:focusableInTouchMode="true" android:hint="@string/hint_password" android:imeActionId="@integer/login" android:imeOptions="actionUnspecified" android:inputType="textPassword" android:maxLines="1" android:textColor="@android:color/black"/&gt; &lt;Button android:id="@+id/sign_up_button" style="?android:textAppearanceSmall" android:layout_width="200dp" android:layout_height="wrap_content" android:layout_marginTop="20dip" android:background="@drawable/btn_corner_pink_gradient" android:text="@string/action_sign_in_short" android:textColor="@android:color/white" android:textStyle="bold"/&gt; &lt;!-- &lt;Button android:id="@+id/btn_reset_password" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="20dip" android:background="@null" android:text="@string/btn_forgot_password" android:textAllCaps="false" android:textColor="@color/colorAccent"/&gt; --&gt; &lt;!-- Link to login screen --&gt; &lt;Button android:id="@+id/sign_in_button" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="20dip" android:background="@null" android:text="@string/btn_link_to_login" android:textAllCaps="false" android:textColor="@color/colorWhite" android:textSize="15sp"/&gt; &lt;/LinearLayout&gt; &lt;ProgressBar android:id="@+id/progressBar" android:layout_width="30dp" android:layout_height="30dp" android:layout_gravity="center|bottom" android:layout_marginBottom="20dp" android:visibility="gone"/&gt; &lt;/android.support.constraint.ConstraintLayout&gt; </code></pre>
0debug
kubectl unable to connect to server: x509: certificate signed by unknown authority : <p>i'm getting an error when running kubectl one one machine (windows)</p> <p>the k8s cluster is running on CentOs 7 kubernetes cluster 1.7 master, worker</p> <p>Here's my .kube\config</p> <pre> <code> apiVersion: v1 clusters: - cluster: certificate-authority-data: REDACTED server: https://10.10.12.7:6443 name: kubernetes contexts: - context: cluster: kubernetes user: system:node:localhost.localdomain name: system:node:localhost.localdomain@kubernetes current-context: system:node:localhost.localdomain@kubernetes kind: Config preferences: {} users: - name: system:node:localhost.localdomain user: client-certificate-data: REDACTED client-key-data: REDACTED </code> </pre> <p>the cluster is built using kubeadm with the default certificates on the pki directory</p> <p>kubectl unable to connect to server: x509: certificate signed by unknown authority</p>
0debug
PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic, MemoryRegion *address_space_mem, MemoryRegion *address_space_io) { DeviceState *dev; SysBusDevice *s; PCIHostState *phb; GrackleState *d; dev = qdev_create(NULL, TYPE_GRACKLE_PCI_HOST_BRIDGE); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); phb = PCI_HOST_BRIDGE(dev); d = GRACKLE_PCI_HOST_BRIDGE(dev); memory_region_init(&d->pci_mmio, OBJECT(s), "pci-mmio", 0x100000000ULL); memory_region_init_alias(&d->pci_hole, OBJECT(s), "pci-hole", &d->pci_mmio, 0x80000000ULL, 0x7e000000ULL); memory_region_add_subregion(address_space_mem, 0x80000000ULL, &d->pci_hole); phb->bus = pci_register_bus(dev, "pci", pci_grackle_set_irq, pci_grackle_map_irq, pic, &d->pci_mmio, address_space_io, 0, 4, TYPE_PCI_BUS); pci_create_simple(phb->bus, 0, "grackle"); sysbus_mmio_map(s, 0, base); sysbus_mmio_map(s, 1, base + 0x00200000); return phb->bus; }
1threat
How do I operate on a DataFrame with a Series for every column : <h2>Objective and Motivation</h2> <p>I've seen this kind of question several times over and have seen many other questions that involve some element of this. Most recently, I had to spend a bit of time explaining this concept in comments while looking for an appropriate canonical Q&amp;A. I did not find one and so I thought I'd write one.</p> <p>This question usually arises with respect to a specific operation but equally applies to most arithmetic operations.</p> <ul> <li>How do I subtract a <code>Series</code> from every column in a <code>DataFrame</code>?</li> <li>How do I add a <code>Series</code> from every column in a <code>DataFrame</code>?</li> <li>How do I multiply a <code>Series</code> from every column in a <code>DataFrame</code>?</li> <li>How do I divide a <code>Series</code> from every column in a <code>DataFrame</code>?</li> </ul> <h2>The Question</h2> <p>Given a <code>Series</code> <code>s</code> and <code>DataFrame</code> <code>df</code>. How do I operate on each column of <code>df</code> with <code>s</code>?</p> <pre><code>df = pd.DataFrame( [[1, 2, 3], [4, 5, 6]], index=[0, 1], columns=['a', 'b', 'c'] ) s = pd.Series([3, 14], index=[0, 1]) </code></pre> <p>When I attempt to add them, I get all <code>np.nan</code></p> <pre><code>df + s a b c 0 1 0 NaN NaN NaN NaN NaN 1 NaN NaN NaN NaN NaN </code></pre> <p>What I thought I should get is</p> <pre><code> a b c 0 4 5 6 1 18 19 20 </code></pre>
0debug
Need to copy all fields value of specific item on table to another item in sql server : [sql database snapshot][1] [1]: https://i.stack.imgur.com/TRDpj.png I need to copy this selected article data to another article. Need a query in sql to solve this issue.
0debug
How to float text around image in react native : <p>I am trying to achieve a very common effect in react native of having text wrap around an image. On the web you would assign a <code>float</code> property to the image and follow it with a <code>p</code> tag. <a href="https://i.stack.imgur.com/MWgnc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/MWgnc.png" alt="Here is how I want my elements to flow"></a>. </p> <p>Here is a <a href="https://rnplay.org/apps/_s6X_Q" rel="noreferrer">RNPlay example</a> I've been working on. I think the method I currently have is a bit hackish, and doesn't properly work since the text does not align with the top of the image and flow down. Is there a proper and clean way to accomplish this?</p>
0debug
How to send an email to multiple recipients ? : <p>I have a stored procedure which sent emails to few recipients. In this I want to send to two differet recipients using <strong><em>@copy_recipients</em></strong>. But I get a syntax error. How to make this work? </p> <p><strong>stored procedure code</strong> </p> <pre><code>EXEC msdb.dbo.sp_send_dbmail @profile_name = 'mail', @recipients = @Mail1, @copy_recipients = @Mail2;@Mail3, @body =@body , @subject =@subject </code></pre>
0debug