problem
stringlengths
26
131k
labels
class label
2 classes
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height) { if (!dst || !src) return; for (;height > 0; height--) { memcpy(dst, src, bytewidth); dst += dst_linesize; src += src_linesize; } }
1threat
Open site in new tab of existing Chrome instance when debugging : <p>When debugging a web application in Visual Studio is it possible to get it to launch in an existing tab of an existing instance of Chrome rather than in a new window when clicking the Launch in Chrome button <a href="https://i.stack.imgur.com/HyysO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/HyysO.png" alt="launch in Chrome"></a>?</p>
0debug
Firebase: How to run 'HTTPS callable functions' locally using Cloud Functions shell? : <p>I couldn't find a solution for this use case in <a href="https://firebase.google.com/docs/functions/local-emulator" rel="noreferrer">Firebase official guides</a>.</p> <ul> <li>They are HTTPS callable functions </li> <li>Want to run Functions locally using Cloud Functions shell to test</li> <li>Functions save received data to Firestore</li> <li>The 'auth' context information is also needed</li> </ul> <p>My code as below. Thanks in advance.</p> <hr> <p><em>Function :</em></p> <pre><code>exports.myFunction = functions.https.onCall((data, context) =&gt; { const id = context.auth.uid; const message = data.message; admin.firestore()... // Do something with Firestore // }); </code></pre> <p><em>Client call :</em> </p> <pre><code>const message = { message: 'Hello.' }; firebase.functions().httpsCallable('myFunction')(message) .then(result =&gt; { // Do something // }) .catch(error =&gt; { // Error handler // }); </code></pre>
0debug
Dockerfile replicate the host user UID and GID to the image : <p>Similar to the <a href="https://stackoverflow.com/q/32397496/362754">SO post about replicating UID/GID in container from host</a> but how do you build the image with a user with replicate UID and GID? Preferably, how do you do it with a dockerfile? </p> <p>I can do it with a bash script: </p> <pre><code>#!/bin/bash # current uid and gid curr_uid=`id -u` curr_gid=`id -g` # create bb.dockerfile: cat &lt;&lt; EOF1 &gt; bb.dockerfile FROM ubuntu:xenial-20170214 ARG UNAME=testuser EOF1 echo ARG UID=${curr_uid} &gt;&gt; bb.dockerfile echo ARG GID=${curr_gid} &gt;&gt; bb.dockerfile cat &lt;&lt; EOF2 &gt;&gt; bb.dockerfile RUN groupadd -g \$GID \$UNAME RUN useradd -m -u \$UID -g \$GID -s /bin/bash \$UNAME USER \$UNAME CMD /bin/bash EOF2 docker build -f bb.dockerfile -t testimg . </code></pre> <p>This bash will generate a docker file as the following and build on it. </p> <pre><code> FROM ubuntu:xenial-20170214 ARG UNAME=testuser ARG UID=1982 ARG GID=1982 RUN groupadd -g $GID $UNAME RUN useradd -m -u $UID -g $GID -s /bin/bash $UNAME USER $UNAME CMD /bin/bash </code></pre> <p>What I'm asking for, is to remove the hardcoded host UID 1982 and GID 1982 from the dockerfile. </p>
0debug
Is it possible create data base using only JDK? Without external libaries? : <p>I have got question. Cen you tell me is it possible create data base using only JDK? Without external libaries? I look for information in the internet and I think that i have to import for example mysql via Maven. But please tell me: it possible create data base using only JDK?</p> <p>EDIT: Data in normal files (like txt) is not this for what I am looking for.</p>
0debug
Is there a way to group by monthly period? : <p>I have data that I need to query to find out which person spent the most over a 9 month period. My data spans 5 years and the 9 month period may consist of months from one year and through the next year.</p> <p>For example October 2005 through July 2006.</p> <p>I've managed to group by personid and month and year, but is there a way for me to group by 9 month periods? I figured if I can do that then I can just find the max value in that grouping.</p>
0debug
Apply only to IE 11 within media query for screen size : <p>I currently have following width specific media query.</p> <pre><code> @media only screen and (max-width: 1920px) { .toggleMultiSelect .filter { width: 566px; } } </code></pre> <p>But the width for '<strong>.toggleMultiSelect .filter</strong>' changes in IE from Chrome/Firefox. So basically need to apply different width for the same css class in 1920px for IE. From the Stackoverflow search I found that IE specific behavior can be achieved like below.</p> <pre><code>@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { .toggleMultiSelect .filter { width: 575px; } } </code></pre> <p>So now I need to achieve both resolution and css class. <strong>575px</strong> width only should apply to IE and Chrome or firefox should get <strong>566px</strong>.</p> <p>Thanks in advance for any help. </p>
0debug
Full Screen Notification : <p>I want to make App Like Uber But I Don't know how to make full screen notification,When Driver receiver new Request a new Screen Pop up that will show timer ,accept , reject button. even when driver app is in background , I am newbiew here is a video link what i want to do <a href="https://drive.google.com/file/d/1dhqSDexUKYY---ARHjWcg3bM0tYWRmLo/view?usp=sharing" rel="nofollow noreferrer">https://drive.google.com/file/d/1dhqSDexUKYY---ARHjWcg3bM0tYWRmLo/view?usp=sharing</a></p> <p>Sorry for English</p> <p>I have tried to use heads up notification with full screen but it didn't work well ; I have tried to make background service to but i am not good in it so that also did not go well; I am working on Oreo ;</p>
0debug
Flutter - Draw Graphs on the screen : <p>Is there any library for Flutter (Dart) for drawing Graphs on the screen with a coordinate system? Or how would I approach doing it from scratch?</p>
0debug
Indexing one array by another in numpy : <p>Suppose I have a matrix <strong>A</strong> with some arbitrary values:</p> <pre><code>array([[ 2, 4, 5, 3], [ 1, 6, 8, 9], [ 8, 7, 0, 2]]) </code></pre> <p>And a matrix <strong>B</strong> which contains indices of elements in A:</p> <pre><code>array([[0, 0, 1, 2], [0, 3, 2, 1], [3, 2, 1, 0]]) </code></pre> <p>How do I select values from <strong>A</strong> pointed by <strong>B</strong>, i.e.:</p> <pre><code>A[B] = [[2, 2, 4, 5], [1, 9, 8, 6], [2, 0, 7, 8]] </code></pre>
0debug
I have written Verilog code for FSM based Serial Adder Circuit, but m getting lot of errors. Someone please make it work : [Block diagram][1] Design is a serial adder. It takes 8-bit inputs A and B and adds them in a serial fashion when the goinput is set to 1. The result of the operation is stored in a 9-bit sum register, The block diagram is attached. I am using Quartus II 13.0sp1 (64-bit) Web Edition. Following is the Code written :- module LAB9b(A, B, start, resetn, clock, sum); input [7:0] A, B; input resetn, start, clock; output [8:0] LEDR; // Registers wire [7:0] A_reg,B_reg; wire [8:0] sum; reg [1:0] temp; reg cin; // Wires wire reset, enable, load; wire bit_sum, bit_carry; // Confrol FSM FSM my_control(start, clock, resetn, reset, enable, load); // Datapath shift_reg reg_A( clock, 1’b0, A, 1’b0, enable, load, A_reg); shift_reg reg_B( clock, 1’b0, B, 1’b0, enable, load, B_reg); // a full adder assign temp [1:0] = A_reg[0] + B_reg[0] + cin; assign bit_sum = temp [0]; assign bit_carry = temp [1]; always @(posedge clock) begin if (enable) begin if (reset) cin <= 1’b0; end else cin <= bit_carry; end shift_reg reg_sum( clock, reset, 9’d0, bit_sum, enable, 1’b0, sum); defparam reg_sum.n = 9; endmodule module FSM(start, clock, resetn, reset, enable, load); parameter WAIT_STATE = 2’b00, WORK_STATE = 2’b01, END_STATE = 2’b11; input start, clock, resetn; output reset, enable, load; reg [1:0] current_state, next_state; reg [3:0] counter; // next state logic always@(*) begin case(current_state) WAIT_STATE: if (start) next_state <= WORK_STATE; else next_state <= WAIT_STATE; WORK_STATE: if (counter == 4’d8) next_state <= END_STATE; else next_state <= WORK_STATE; END_STATE: if (»start) next_state <= WAIT_STATE; else next_state <= END_STATE; default: next_state <= 2’bxx; endcase end // state registers and a counter always@(posedge clock or negedge resetn) begin if (»resetn) begin current_state <= WAIT_STATE; counter = ’d0; end else begin current_state <= next_state; if (current_state == WAIT_STATE) counter <= ’d0; else if (current_state == WORK_STATE) counter <= counter + 1’b1; end end // Outputs assign reset = (current_state == WAIT_STATE) & start; assign load = (current_state == WAIT_STATE) & start; assign enable = load | (current_state == WORK_STATE); endmodule // // module shift_reg( clock, reset, data, bit_in, enable, load, q); parameter n = 8; input clock, reset, bit_in, enable, load; input [n-1:0] data; output reg [n-1:0] q; always@(posedge clock) begin if (enable) if (reset) q <= ’d0; else begin if (load) q <= data; else begin q[n-2:0] <= q[n-1:1]; q[n-1] <= bit_in; end end end endmodule [1]: https://i.stack.imgur.com/kDdO4.png
0debug
Correctly formatting list of strings into list of dates in python : <p>I have a list of strings that I want to format into a list of dates, before getting the max date time.</p> <p>The list looks like:</p> <pre><code>StrList = ['date_range Date Posted: Thu, 08 11 2018 12:12:55 GMT', 'date_range Date Posted: Thu, 08 11 2018 10:53:49 GMT', 'date_range Date Posted: Thu, 08 11 2018 09:55:08 GMT', 'date_range Date Posted: Wed, 07 11 2018 14:23:56 GMT', 'date_range Date Posted: Wed, 07 11 2018 14:23:12 GMT', 'date_range Date Posted: Wed, 07 11 2018 09:07:47 GMT', 'date_range Date Posted: Tue, 06 11 2018 11:44:51 GMT', 'date_range Date Posted: Mon, 05 11 2018 16:17:51 GMT', 'date_range Date Posted: Mon, 05 11 2018 14:07:41 GMT', 'date_range Date Posted: Mon, 05 11 2018 14:03:19 GMT', 'date_range Date Posted: Mon, 05 11 2018 13:07:10 GMT', 'date_range Date Posted: Mon, 05 11 2018 13:05:56 GMT', 'date_range Date Posted: Mon, 05 11 2018 11:41:31 GMT'] </code></pre> <p>I want to get a list that contains only the extracted date and time part of each list element and then subsequently find the maximum of the date times of all the elements.</p> <p>E.g. Desired output:</p> <pre><code> DateList = ['08-11-2018 12:12:55', '08-11-2018 10:53:49 GMT', '08-11-2018 09:55:08 GMT', '07-11-2018 14:23:56 GMT', '07-11-2018 14:23:12 GMT', '07-11-2018 09:07:47 GMT', '06-11-2018 11:44:51 GMT', '05-11-2018 16:17:51 GMT', '05-11-2018 14:07:41 GMT', '05-11-2018 14:03:19 GMT', '05-11-2018 13:07:10 GMT', '05-11-2018 13:05:56 GMT', '05-11-2018 11:41:31 GMT'] </code></pre> <p>Then the final step will be to get the maximum date time which in this case will be:</p> <pre><code>MaxDate = 08-11-2018 12:12:55 </code></pre> <p>Any help will be appreciated.</p>
0debug
document.getElementById('input').innerHTML = user_input;
1threat
Is there a GUI in windows to do CRUD Operations on Oracle Database? : <p>I create my tables using sql developer and I'm looking for a simple GUI to do CRUDs operations instead of script to populate those tables.</p>
0debug
Use None instead of np.nan for null values in pandas DataFrame : <p>I have a pandas DataFrame with mixed data types. I would like to replace all null values with None (instead of default np.nan). For some reason, this appears to be nearly impossible. </p> <p>In reality my DataFrame is read in from a csv, but here is a simple DataFrame with mixed data types to illustrate my problem. </p> <pre><code>df = pd.DataFrame(index=[0], columns=range(5)) df.iloc[0] = [1, 'two', np.nan, 3, 4] </code></pre> <p>I can't do:</p> <pre><code>&gt;&gt;&gt; df.fillna(None) ValueError: must specify a fill method or value </code></pre> <p>nor:</p> <pre><code>&gt;&gt;&gt; df[df.isnull()] = None TypeError: Cannot do inplace boolean setting on mixed-types with a non np.nan value </code></pre> <p>nor:</p> <pre><code>&gt;&gt;&gt; df.replace(np.nan, None) TypeError: cannot replace [nan] with method pad on a DataFrame </code></pre> <p>I used to have a DataFrame with only string values, so I could do:</p> <pre><code>&gt;&gt;&gt; df[df == ""] = None </code></pre> <p>which worked. But now that I have mixed datatypes, it's a no go.</p> <p>For various reasons about my code, it would be helpful to be able to use None as my null value. Is there a way I can set the null values to None? Or do I just have to go back through my other code and make sure I'm using np.isnan or pd.isnull everywhere? </p>
0debug
How to intalize the structure with same value(not 0) in C : <p>I tried memset to assign all the structure members to 0 as given below, but it didn't work. </p> <pre><code>struct sample { int a; int b; int c; int d; int e; int f; }; int main(void) { struct sample s1; memset(&amp;s1, 1, sizeof(s1)); printf("%d",s1.e); return 0; } </code></pre>
0debug
Insert query works through SSMS but SqlCommand code gets error "Insufficient result space to convert uniqueidentifier value to char." : Table for the inserts: CREATE TABLE [dbo].[CcureMessage]( [CcureMessageId] [uniqueidentifier] NOT NULL, [Event] [varchar](20) NULL, [Type] [varchar](20) NULL, [Message] [varchar](max) NOT NULL, [Xml] [varchar](4000) NOT NULL, CONSTRAINT [PK_CcureMessage] PRIMARY KEY CLUSTERED ( [CcureMessageId] ASC)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO ALTER TABLE [dbo].[CcureMessage] ADD CONSTRAINT [DF_CcureMessage_CcureMessageId] DEFAULT (newid()) FOR [CcureMessageId] GO I made the PK table have a default value so that I'm not passing a GUID at all, yet it seems I'm still getting an error related to the guid. *** Insert command that works fine through SSMS: INSERT INTO CcureMessage (Event, Type, Message, Xml) VALUES ('event 3', 'type 3', 'big json 3', 'xml-ish'); *** C# Code: public void DoInsert(Message msg) { // hard-coding this to set test values TopicMessage tm = new TopicMessage(); tm.Event = "event 1"; tm.Type = "Type 1"; tm.Message = "json data message"; tm.Xml = "xml data goes here"; string connString = set to correct value; string sql = "INSERT INTO CcureMessage (Event, Type, Message, Xml) VALUES (@Event, @Type, @Message, @Xml)"; using (SqlConnection conn = new SqlConnection(connString)) { conn.Open(); SqlCommand cmd = new SqlCommand(sql, conn); cmd.CommandType = System.Data.CommandType.Text; SqlParameter eventParm = new SqlParameter("@Event", tm.CcureMessageId); SqlParameter typeParm = new SqlParameter("@Type", tm.Type); SqlParameter msgParm = new SqlParameter("@Message", tm.Message); SqlParameter xmlParm = new SqlParameter("@Xml", tm.Xml); cmd.Parameters.Add(eventParm); cmd.Parameters.Add(typeParm); cmd.Parameters.Add(msgParm); cmd.Parameters.Add(xmlParm); cmd.ExecuteNonQuery(); } } Running this results in the error "Insufficient result space to convert uniqueidentifier value to char."
0debug
static void noise(uint8_t *dst, const uint8_t *src, int dst_linesize, int src_linesize, int width, int start, int end, NoiseContext *n, int comp) { FilterParams *p = &n->param[comp]; int8_t *noise = p->noise; const int flags = p->flags; AVLFG *lfg = &p->lfg; int shift, y; if (!noise) { if (dst != src) av_image_copy_plane(dst, dst_linesize, src, src_linesize, width, end - start); return; } for (y = start; y < end; y++) { if (flags & NOISE_TEMPORAL) shift = av_lfg_get(lfg) & (MAX_SHIFT - 1); else shift = n->rand_shift[y]; if (flags & NOISE_AVERAGED) { n->line_noise_avg(dst, src, width, p->prev_shift[y]); p->prev_shift[y][shift & 3] = noise + shift; } else { n->line_noise(dst, src, noise, width, shift); } dst += dst_linesize; src += src_linesize; } }
1threat
infinity looping,c logical thinking : I'm facing a problem with what I enter with any unknown during the first time to the program.it will show me infinity problem program closing. The program won't read the else statement . I m tired with this char cont; printf("Do u want continue\n"); scanf("%c", &cont); getchar(); do { if (next == 'y' || next == 'Y') { selection(); } else if (next != 'n' || next != 'N') { printf("Program Closing \n"); } else { printf("Invalid Please Re-enter"); getchar(); scanf("%c", &cont); } } while (next != 'n'&& next != 'N');
0debug
static QObject *pci_get_dev_dict(PCIDevice *dev, PCIBus *bus, int bus_num) { int class; QObject *obj; obj = qobject_from_jsonf("{ 'bus': %d, 'slot': %d, 'function': %d," "'class_info': %p, 'id': %p, 'regions': %p," " 'qdev_id': %s }", bus_num, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), pci_get_dev_class(dev), pci_get_dev_id(dev), pci_get_regions_list(dev), dev->qdev.id ? dev->qdev.id : ""); if (dev->config[PCI_INTERRUPT_PIN] != 0) { QDict *qdict = qobject_to_qdict(obj); qdict_put(qdict, "irq", qint_from_int(dev->config[PCI_INTERRUPT_LINE])); } class = pci_get_word(dev->config + PCI_CLASS_DEVICE); if (class == PCI_CLASS_BRIDGE_HOST || class == PCI_CLASS_BRIDGE_PCI) { QDict *qdict; QObject *pci_bridge; pci_bridge = qobject_from_jsonf("{ 'bus': " "{ 'number': %d, 'secondary': %d, 'subordinate': %d }, " "'io_range': { 'base': %" PRId64 ", 'limit': %" PRId64 "}, " "'memory_range': { 'base': %" PRId64 ", 'limit': %" PRId64 "}, " "'prefetchable_range': { 'base': %" PRId64 ", 'limit': %" PRId64 "} }", dev->config[PCI_PRIMARY_BUS], dev->config[PCI_SECONDARY_BUS], dev->config[PCI_SUBORDINATE_BUS], pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_IO), pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_IO), pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_MEMORY), pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_MEMORY), pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_PREFETCH), pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_PREFETCH)); if (dev->config[PCI_SECONDARY_BUS] != 0) { PCIBus *child_bus = pci_find_bus(bus, dev->config[PCI_SECONDARY_BUS]); if (child_bus) { qdict = qobject_to_qdict(pci_bridge); qdict_put_obj(qdict, "devices", pci_get_devices_list(child_bus, dev->config[PCI_SECONDARY_BUS])); } } qdict = qobject_to_qdict(obj); qdict_put_obj(qdict, "pci_bridge", pci_bridge); } return obj; }
1threat
static int vnc_auth_sasl_check_access(VncState *vs) { const void *val; int err; int allow; err = sasl_getprop(vs->sasl.conn, SASL_USERNAME, &val); if (err != SASL_OK) { VNC_DEBUG("cannot query SASL username on connection %d (%s), denying access\n", err, sasl_errstring(err, NULL, NULL)); return -1; } if (val == NULL) { VNC_DEBUG("no client username was found, denying access\n"); return -1; } VNC_DEBUG("SASL client username %s\n", (const char *)val); vs->sasl.username = g_strdup((const char*)val); if (vs->vd->sasl.acl == NULL) { VNC_DEBUG("no ACL activated, allowing access\n"); return 0; } allow = qemu_acl_party_is_allowed(vs->vd->sasl.acl, vs->sasl.username); VNC_DEBUG("SASL client %s %s by ACL\n", vs->sasl.username, allow ? "allowed" : "denied"); return allow ? 0 : -1; }
1threat
Bootstrap 4 error "Bootstrap dropdown require Popper.js", with Aurelia CLI and Require.js : <p>I'm having trouble configuring Bootstrap 4 beta in an Aurelia CLI app (v0.31.1) with requirejs and using TypeScript. After having tried several config variations I keep on getting the following console error:</p> <blockquote> <p>Uncaught Error: Bootstrap dropdown require Popper.js</p> </blockquote> <p>Here are the steps to reproduce. First, install the packages:</p> <pre><code>$ npm install --save jquery bootstrap@4.0.0-beta popper.js </code></pre> <p>Next, I've configured <strong>aurelia.json</strong>:</p> <pre><code> "jquery", { "name": "popper.js", "path": "../node_modules/popper.js/dist/umd", "main": "popper" }, { "name": "bootstrap", "path": "../node_modules/bootstrap/dist", "main": "js/bootstrap.min", "deps": [ "jquery", "popper.js" ], "exports": "$", "resources": [ "css/bootstrap.css" ] } </code></pre> <p>Notice in the config above that: </p> <ul> <li>popper.js is registered before bootstrap</li> <li>the UMD module is used</li> <li>popper.js is set as a dependency for bootstrap, next to jquery</li> </ul> <p>Finally, in my <strong>app.ts</strong>:</p> <pre><code>import 'bootstrap'; </code></pre> <p>With this configuration, building using <code>au build</code> works fine. But upon running, using <code>au run --watch</code> I get the following console errors:</p> <blockquote> <p>Uncaught Error: Bootstrap dropdown require Popper.js (<a href="https://popper.js.org" rel="noreferrer">https://popper.js.org</a>) (defaults.js:19)<br> Uncaught Error: Bootstrap dropdown require Popper.js (<a href="https://popper.js.org" rel="noreferrer">https://popper.js.org</a>) (bootstrap.min.js:6)<br> ... a bit further on:<br> Uncaught TypeError: plugin.load is not a function at Module. (defaults.js:19)</p> </blockquote> <p>Unfortunately, the Bootstrap 4 docs only mention <a href="https://getbootstrap.com/docs/4.0/getting-started/webpack/" rel="noreferrer">instructions on webpack</a>. So does a search on both Aurelia's <a href="https://gitter.im/aurelia/Discuss" rel="noreferrer">Gitter.im channel</a> and on StackOverflow. I cannot find samples regarding Aurelia CLI with Require.js. Finally, Google hits shows only examples for embedding the alpha versions (which relied on 'tethering' rather than 'popper').</p> <p>Similar questions on SO, which have the same error but aren't applicable to my situation:</p> <ul> <li><a href="https://stackoverflow.com/questions/45645971/bootstrap-4-beta-importing-popper-js-with-webpack-3-x-throws-popper-is-not-a-con">Bootstrap 4 Beta importing Popper.js with Webpack 3.x throws Popper is not a constructor</a></li> <li><a href="https://stackoverflow.com/questions/45680644/angular-4-bootstrap-dropdown-require-popper-js">Angular 4 Bootstrap dropdown require Popper.js</a></li> <li><a href="https://stackoverflow.com/search?q=Bootstrap+dropdown+require+Popper.js">And several more...</a></li> </ul> <p>So, my question: how can I configure Bootstrap 4 with Popper.js in an Aurelia CLI app (using Require.js, not Webpack)?</p> <p>Thanks.</p>
0debug
How can Save Shared Preference Value in ClearData Application?[Android] : in clear Data Android, Shared Preference is clear. i want don't clear. excusme for poor English.
0debug
static int parse_str(StringInputVisitor *siv, const char *name, Error **errp) { char *str = (char *) siv->string; long long start, end; Range *cur; char *endptr; if (siv->ranges) { return 0; } do { errno = 0; start = strtoll(str, &endptr, 0); if (errno == 0 && endptr > str) { if (*endptr == '\0') { cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = start + 1; siv->ranges = range_list_insert(siv->ranges, cur); cur = NULL; str = NULL; } else if (*endptr == '-') { str = endptr + 1; errno = 0; end = strtoll(str, &endptr, 0); if (errno == 0 && endptr > str && start <= end && (start > INT64_MAX - 65536 || end < start + 65536)) { if (*endptr == '\0') { cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = end + 1; siv->ranges = range_list_insert(siv->ranges, cur); cur = NULL; str = NULL; } else if (*endptr == ',') { str = endptr + 1; cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = end + 1; siv->ranges = range_list_insert(siv->ranges, cur); cur = NULL; } else { goto error; } } else { goto error; } } else if (*endptr == ',') { str = endptr + 1; cur = g_malloc0(sizeof(*cur)); cur->begin = start; cur->end = start + 1; siv->ranges = range_list_insert(siv->ranges, cur); cur = NULL; } else { goto error; } } else { goto error; } } while (str); return 0; error: g_list_foreach(siv->ranges, free_range, NULL); g_list_free(siv->ranges); siv->ranges = NULL; error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null", "an int64 value or range"); return -1; }
1threat
static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set) { mxf->metadata_sets = av_realloc(mxf->metadata_sets, (mxf->metadata_sets_count + 1) * sizeof(*mxf->metadata_sets)); if (!mxf->metadata_sets) return -1; mxf->metadata_sets[mxf->metadata_sets_count] = metadata_set; mxf->metadata_sets_count++; return 0; }
1threat
How to make a time signal in angular2 : I need to make a traffic light that from 0 to 10 minutes is green from 10 to 20 yellow and from 20 to 30 red, time is by service So far this is my code This is service <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> import { Component, OnInit, Input } from '@angular/core'; import { TiempoService } from "app/servicios/tiempo.service" @Component({ selector: 'app-menu', templateUrl: './menu.component.html', styleUrls: ['./menu.component.css'] }) export class MenuComponent implements OnInit { @Input() tiemposervice: TiempoService; constructor() {} ngOnInit() { } } <!-- end snippet --> This is HTML <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <div class="row"> <div class="small-12 medium-6 columns"> <span>Tiempo transcurrido</span> <h5>{{tiempoTranscurrido | date:'mm:ss'}}</h5> </div> </div> <!-- end snippet --> This is component <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> import { Injectable } from '@angular/core'; import Rx from 'Rx'; @Injectable() export class TiempoService { tiempoTranscurrido: number; constructor() {} ngOnInit() { } tiempoTotal() { Rx.Observable.interval(1000).subscribe(segundos => { this.tiempoTranscurrido = segundos * 1000; }) } } <!-- end snippet --> I would greatly appreciate your help.
0debug
static void nvdimm_init_fit_buffer(NvdimmFitBuffer *fit_buf) { qemu_mutex_init(&fit_buf->lock); fit_buf->fit = g_array_new(false, true , 1); }
1threat
How to create an empty java trust store? : <p>I want to make a https client in java which initially does not have any CA certs to trust. Since I don't want the JVM to use the default cacerts file I should make an empty trust store and point it to the JVM.<br> How can I make an empty trust store?</p>
0debug
VS Marketplace Add Member displayes Invalid Domain error : <p>I am trying to add a member to Visual Studio Marketplace. In my account I go to Manage Publishers &amp; Extensions -> Members and click om '+ Add'. Whatever e-mail I provide shows "Invalid Domain" error:</p> <p><a href="https://i.stack.imgur.com/thBKP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/thBKP.png" alt="enter image description here"></a></p> <p>Is it a VS Marketplace bug or do I need to somehow link Azure directory (or any other users directory) first?</p>
0debug
Table of numbers in a pattern PHP : Back again with a newbie question :D Couple days ago, i made a post similar to this one: https://stackoverflow.com/questions/46197415/pattern-output-stuck I continued my work, but went back to this exercise after. I need 2 more patterns in a <b>table</b>. The last 2 tables, i did with <b>nested For-loops</b>, which worked excellent, but now i'm stuck again :S what I need: > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1 <br> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2 1 <br> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;3 2 1 <br> > &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;4 3 2 1 <br> > &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;5 4 3 2 1 <br> > &nbsp;&nbsp;&nbsp;6 5 4 3 2 1 what i tried: <table> <b>Patroon III</b> <?php $rows = 6; for($row = 1; $row <= $rows; $row++){ echo "<tr>"; for($col = 6; $col >= $row; $col--){ if($col <= $row){ echo "<td class='td2'>" . $col . "</td>"; } else { echo "<td class='td2'>" . " " . "</td>"; } } echo "</tr>"; } ?> </table> What I get: > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1 <br> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2 <br> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;3 <br> > &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;4 <br> > &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;5 <br> > &nbsp;&nbsp;&nbsp;6 and the second table i need: > 1 2 3 4 5 6<br> > &nbsp;&nbsp; 2 3 4 5 6<br> > &nbsp; &nbsp; &nbsp; 3 4 5 6<br> > &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 4 5 6<br> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5 6<br> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 6 what i tried: <table> <b>Patroon IV</b> <?php $rows = 6; for($row = 1; $row <= $rows; $row++){ echo "<tr>"; for($col = 1; $col <= $row; $col++){ if($col >= $row){ echo "<td class='td2'>" . $col . "</td>"; } else { echo "<td class='td2'>" . " " . "</td>"; } } echo "</tr>"; } ?> </table> what i get: > 1<br> > &nbsp;&nbsp; 2<br> > &nbsp; &nbsp; &nbsp; 3<br> > &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 4<br> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5<br> > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 6 Any suggestions? I'm thinking about another nested for-loop, but i dont know where to start anymore. Not sure if the if-else statement is needed.
0debug
static int has_duration(AVFormatContext *ic) { int i; AVStream *st; for(i = 0;i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->duration != AV_NOPTS_VALUE) return 1; } if (ic->duration) return 1; return 0; }
1threat
static void htab_save_first_pass(QEMUFile *f, sPAPREnvironment *spapr, int64_t max_ns) { int htabslots = HTAB_SIZE(spapr) / HASH_PTE_SIZE_64; int index = spapr->htab_save_index; int64_t starttime = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); assert(spapr->htab_first_pass); do { int chunkstart; while ((index < htabslots) && !HPTE_VALID(HPTE(spapr->htab, index))) { index++; CLEAN_HPTE(HPTE(spapr->htab, index)); } chunkstart = index; while ((index < htabslots) && HPTE_VALID(HPTE(spapr->htab, index))) { index++; CLEAN_HPTE(HPTE(spapr->htab, index)); } if (index > chunkstart) { int n_valid = index - chunkstart; qemu_put_be32(f, chunkstart); qemu_put_be16(f, n_valid); qemu_put_be16(f, 0); qemu_put_buffer(f, HPTE(spapr->htab, chunkstart), HASH_PTE_SIZE_64 * n_valid); if ((qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - starttime) > max_ns) { break; } } } while ((index < htabslots) && !qemu_file_rate_limit(f)); if (index >= htabslots) { assert(index == htabslots); index = 0; spapr->htab_first_pass = false; } spapr->htab_save_index = index; }
1threat
Iptables: Reasons for choosing pre-up/up/post-up rsp. pre-down/down/post-down : <p>Setting up iptables rules, what are the specific reasons for pre-up/up/post-up rsp. pre-down/down/post-down? </p> <p>E.g setting Default Policies in pre-up and explicit rules in up/post-up?</p> <p>In my understanding, if I only want to setup e.g iptables-save &lt; ..., it doesn't matter. Am I wrong?</p>
0debug
static void test_qemu_strtol_full_max(void) { const char *str = g_strdup_printf("%ld", LONG_MAX); long res; int err; err = qemu_strtol(str, NULL, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, LONG_MAX); }
1threat
Case statements: sql server : id date value 1 1 null 1 2 a 1 3 b 1 4 null 2 1 null 2 2 null 2 3 null 2 4 null 2 5 null if value is null in all id's then max of date of that id and if we have value then max of date with value id. required like this: id date value 1 3 b 2 5 null
0debug
how to understand initialization of 3d arrays? : <p>Been googling but can´t understand how this array is a 1,8,3 array? How can you see that X is 1, Y is 8, and Z is 3 from this array?</p> <pre><code> double[,,] points = { { {-1, 0, 3}, {-1, -1, -1}, {4, 1, 1 }, {2, 0.5, 9}, {3.5, 2, -1}, {3, 1.5, 3}, {-1.5, 4, 2}, { 5.5, 4, -0.5}} }; </code></pre>
0debug
static void *spapr_create_fdt_skel(const char *cpu_model, target_phys_addr_t rma_size, target_phys_addr_t initrd_base, target_phys_addr_t initrd_size, target_phys_addr_t kernel_size, const char *boot_device, const char *kernel_cmdline, long hash_shift) { void *fdt; CPUPPCState *env; uint64_t mem_reg_property[2]; uint32_t start_prop = cpu_to_be32(initrd_base); uint32_t end_prop = cpu_to_be32(initrd_base + initrd_size); uint32_t pft_size_prop[] = {0, cpu_to_be32(hash_shift)}; char hypertas_prop[] = "hcall-pft\0hcall-term\0hcall-dabr\0hcall-interrupt" "\0hcall-tce\0hcall-vio\0hcall-splpar\0hcall-bulk"; uint32_t interrupt_server_ranges_prop[] = {0, cpu_to_be32(smp_cpus)}; int i; char *modelname; int smt = kvmppc_smt_threads(); unsigned char vec5[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x80}; uint32_t refpoints[] = {cpu_to_be32(0x4), cpu_to_be32(0x4)}; uint32_t associativity[] = {cpu_to_be32(0x4), cpu_to_be32(0x0), cpu_to_be32(0x0), cpu_to_be32(0x0), cpu_to_be32(0x0)}; char mem_name[32]; target_phys_addr_t node0_size, mem_start; #define _FDT(exp) \ do { \ int ret = (exp); \ if (ret < 0) { \ fprintf(stderr, "qemu: error creating device tree: %s: %s\n", \ #exp, fdt_strerror(ret)); \ exit(1); \ } \ } while (0) fdt = g_malloc0(FDT_MAX_SIZE); _FDT((fdt_create(fdt, FDT_MAX_SIZE))); if (kernel_size) { _FDT((fdt_add_reservemap_entry(fdt, KERNEL_LOAD_ADDR, kernel_size))); if (initrd_size) { _FDT((fdt_add_reservemap_entry(fdt, initrd_base, initrd_size))); _FDT((fdt_finish_reservemap(fdt))); _FDT((fdt_begin_node(fdt, ""))); _FDT((fdt_property_string(fdt, "device_type", "chrp"))); _FDT((fdt_property_string(fdt, "model", "IBM pSeries (emulated by qemu)"))); _FDT((fdt_property_cell(fdt, "#address-cells", 0x2))); _FDT((fdt_property_cell(fdt, "#size-cells", 0x2))); _FDT((fdt_begin_node(fdt, "chosen"))); _FDT((fdt_property(fdt, "ibm,architecture-vec-5", vec5, sizeof(vec5)))); _FDT((fdt_property_string(fdt, "bootargs", kernel_cmdline))); _FDT((fdt_property(fdt, "linux,initrd-start", &start_prop, sizeof(start_prop)))); _FDT((fdt_property(fdt, "linux,initrd-end", &end_prop, sizeof(end_prop)))); if (kernel_size) { uint64_t kprop[2] = { cpu_to_be64(KERNEL_LOAD_ADDR), cpu_to_be64(kernel_size) }; _FDT((fdt_property(fdt, "qemu,boot-kernel", &kprop, sizeof(kprop)))); _FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device))); _FDT((fdt_end_node(fdt))); node0_size = (nb_numa_nodes > 1) ? node_mem[0] : ram_size; if (rma_size > node0_size) { rma_size = node0_size; mem_reg_property[0] = 0; mem_reg_property[1] = cpu_to_be64(rma_size); _FDT((fdt_begin_node(fdt, "memory@0"))); _FDT((fdt_property_string(fdt, "device_type", "memory"))); _FDT((fdt_property(fdt, "reg", mem_reg_property, sizeof(mem_reg_property)))); _FDT((fdt_property(fdt, "ibm,associativity", associativity, sizeof(associativity)))); _FDT((fdt_end_node(fdt))); if (node0_size > rma_size) { mem_reg_property[0] = cpu_to_be64(rma_size); mem_reg_property[1] = cpu_to_be64(node0_size - rma_size); sprintf(mem_name, "memory@" TARGET_FMT_lx, rma_size); _FDT((fdt_begin_node(fdt, mem_name))); _FDT((fdt_property_string(fdt, "device_type", "memory"))); _FDT((fdt_property(fdt, "reg", mem_reg_property, sizeof(mem_reg_property)))); _FDT((fdt_property(fdt, "ibm,associativity", associativity, sizeof(associativity)))); _FDT((fdt_end_node(fdt))); mem_start = node0_size; for (i = 1; i < nb_numa_nodes; i++) { mem_reg_property[0] = cpu_to_be64(mem_start); mem_reg_property[1] = cpu_to_be64(node_mem[i]); associativity[3] = associativity[4] = cpu_to_be32(i); sprintf(mem_name, "memory@" TARGET_FMT_lx, mem_start); _FDT((fdt_begin_node(fdt, mem_name))); _FDT((fdt_property_string(fdt, "device_type", "memory"))); _FDT((fdt_property(fdt, "reg", mem_reg_property, sizeof(mem_reg_property)))); _FDT((fdt_property(fdt, "ibm,associativity", associativity, sizeof(associativity)))); _FDT((fdt_end_node(fdt))); mem_start += node_mem[i]; _FDT((fdt_begin_node(fdt, "cpus"))); _FDT((fdt_property_cell(fdt, "#address-cells", 0x1))); _FDT((fdt_property_cell(fdt, "#size-cells", 0x0))); modelname = g_strdup(cpu_model); for (i = 0; i < strlen(modelname); i++) { modelname[i] = toupper(modelname[i]); spapr->cpu_model = g_strdup(modelname); for (env = first_cpu; env != NULL; env = env->next_cpu) { int index = env->cpu_index; uint32_t servers_prop[smp_threads]; uint32_t gservers_prop[smp_threads * 2]; char *nodename; uint32_t segs[] = {cpu_to_be32(28), cpu_to_be32(40), 0xffffffff, 0xffffffff}; uint32_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TIMEBASE_FREQ; uint32_t cpufreq = kvm_enabled() ? kvmppc_get_clockfreq() : 1000000000; uint32_t page_sizes_prop[64]; size_t page_sizes_prop_size; if ((index % smt) != 0) { continue; if (asprintf(&nodename, "%s@%x", modelname, index) < 0) { fprintf(stderr, "Allocation failure\n"); exit(1); _FDT((fdt_begin_node(fdt, nodename))); free(nodename); _FDT((fdt_property_cell(fdt, "reg", index))); _FDT((fdt_property_string(fdt, "device_type", "cpu"))); _FDT((fdt_property_cell(fdt, "cpu-version", env->spr[SPR_PVR]))); _FDT((fdt_property_cell(fdt, "dcache-block-size", env->dcache_line_size))); _FDT((fdt_property_cell(fdt, "icache-block-size", env->icache_line_size))); _FDT((fdt_property_cell(fdt, "timebase-frequency", tbfreq))); _FDT((fdt_property_cell(fdt, "clock-frequency", cpufreq))); _FDT((fdt_property_cell(fdt, "ibm,slb-size", env->slb_nr))); _FDT((fdt_property(fdt, "ibm,pft-size", pft_size_prop, sizeof(pft_size_prop)))); _FDT((fdt_property_string(fdt, "status", "okay"))); _FDT((fdt_property(fdt, "64-bit", NULL, 0))); for (i = 0; i < smp_threads; i++) { servers_prop[i] = cpu_to_be32(index + i); gservers_prop[i*2] = cpu_to_be32(index + i); gservers_prop[i*2 + 1] = 0; _FDT((fdt_property(fdt, "ibm,ppc-interrupt-server#s", servers_prop, sizeof(servers_prop)))); _FDT((fdt_property(fdt, "ibm,ppc-interrupt-gserver#s", gservers_prop, sizeof(gservers_prop)))); if (env->mmu_model & POWERPC_MMU_1TSEG) { _FDT((fdt_property(fdt, "ibm,processor-segment-sizes", segs, sizeof(segs)))); if (env->insns_flags & PPC_ALTIVEC) { uint32_t vmx = (env->insns_flags2 & PPC2_VSX) ? 2 : 1; _FDT((fdt_property_cell(fdt, "ibm,vmx", vmx))); if (env->insns_flags2 & PPC2_DFP) { _FDT((fdt_property_cell(fdt, "ibm,dfp", 1))); _FDT((fdt_end_node(fdt))); g_free(modelname); _FDT((fdt_end_node(fdt))); _FDT((fdt_begin_node(fdt, "rtas"))); _FDT((fdt_property(fdt, "ibm,hypertas-functions", hypertas_prop, sizeof(hypertas_prop)))); _FDT((fdt_property(fdt, "ibm,associativity-reference-points", refpoints, sizeof(refpoints)))); _FDT((fdt_end_node(fdt))); _FDT((fdt_begin_node(fdt, "interrupt-controller"))); _FDT((fdt_property_string(fdt, "device_type", "PowerPC-External-Interrupt-Presentation"))); _FDT((fdt_property_string(fdt, "compatible", "IBM,ppc-xicp"))); _FDT((fdt_property(fdt, "interrupt-controller", NULL, 0))); _FDT((fdt_property(fdt, "ibm,interrupt-server-ranges", interrupt_server_ranges_prop, sizeof(interrupt_server_ranges_prop)))); _FDT((fdt_property_cell(fdt, "#interrupt-cells", 2))); _FDT((fdt_property_cell(fdt, "linux,phandle", PHANDLE_XICP))); _FDT((fdt_property_cell(fdt, "phandle", PHANDLE_XICP))); _FDT((fdt_end_node(fdt))); _FDT((fdt_begin_node(fdt, "vdevice"))); _FDT((fdt_property_string(fdt, "device_type", "vdevice"))); _FDT((fdt_property_string(fdt, "compatible", "IBM,vdevice"))); _FDT((fdt_property_cell(fdt, "#address-cells", 0x1))); _FDT((fdt_property_cell(fdt, "#size-cells", 0x0))); _FDT((fdt_property_cell(fdt, "#interrupt-cells", 0x2))); _FDT((fdt_property(fdt, "interrupt-controller", NULL, 0))); _FDT((fdt_end_node(fdt))); _FDT((fdt_end_node(fdt))); _FDT((fdt_finish(fdt))); return fdt;
1threat
static inline FFAMediaCodec *codec_create(int method, const char *arg) { int ret = -1; JNIEnv *env = NULL; FFAMediaCodec *codec = NULL; jstring jarg = NULL; jobject object = NULL; jmethodID create_id = NULL; codec = av_mallocz(sizeof(FFAMediaCodec)); if (!codec) { return NULL; codec->class = &amediacodec_class; env = ff_jni_get_env(codec); if (!env) { av_freep(&codec); return NULL; if (ff_jni_init_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec) < 0) { goto fail; jarg = ff_jni_utf_chars_to_jstring(env, arg, codec); if (!jarg) { goto fail; switch (method) { case CREATE_CODEC_BY_NAME: create_id = codec->jfields.create_by_codec_name_id; break; case CREATE_DECODER_BY_TYPE: create_id = codec->jfields.create_decoder_by_type_id; break; case CREATE_ENCODER_BY_TYPE: create_id = codec->jfields.create_encoder_by_type_id; break; default: av_assert0(0); object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, create_id, jarg); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; codec->object = (*env)->NewGlobalRef(env, object); if (!codec->object) { goto fail; if (codec_init_static_fields(codec) < 0) { goto fail; if (codec->jfields.get_input_buffer_id && codec->jfields.get_output_buffer_id) { codec->has_get_i_o_buffer = 1; ret = 0; fail: if (jarg) { (*env)->DeleteLocalRef(env, jarg); if (object) { (*env)->DeleteLocalRef(env, object); if (ret < 0) { ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); av_freep(&codec); return codec;
1threat
if in the directory, files size is less than 2.1kb move the files to another directory : <p>I need to move file to another directory, if the files size is less than 2.1kb. There are multiple files in the directory. Please let me know how to resolve this. I can not use mv command as there are large number of files in the directory, it has to be using find command.</p>
0debug
Infowindow on mouseclick only works for one marker : I have a map with 5 markers and I need an infoWindow for each marker on mouseclick, I have one infoWindow that works. However when I add code/data for another infoWindow for another marker, it doesn't work (i.e. I click on the marker for Edinburgh and a bubble displays but the chart doesn't display and nothing displays at all when I click on the Inverness marker). LINK TO JSFIDDLE FILE: https://jsfiddle.net/MarnieMaclean/megx2cbo/30/ Code Snippet: I currently have data for an InfoWindow for 2/5 markers. google.charts.load('current', {packages: ['corechart']}); function drawChart(map, marker) { //set up data var data = google.visualization.arrayToDataTable([ ['Genre', '#'], ['Science Fiction', 55], ['Comedy', 33], ['Thriller', 21], ['Action', 63], ['Romance', 17], ]); //set up any options var options = { title: 'Film Genre Preferences' }; //Create node var node = document.createElement('div'), infoWindow = new google.maps.InfoWindow(), chart = new google.visualization.BarChart(node); //chjjeck which marker it is if (marker.id == 'c4') { chart.draw(data, options); } infoWindow.setContent(node); infoWindow.open(map,marker); } google.charts.load('current', {packages: ['corechart']}); function drawChart(map, marker) { //set up data var data = google.visualization.arrayToDataTable([ ['Genre', '#'], ['Science Fiction', 41], ['Comedy', 27], ['Thriller', 13], ['Action', 15], ['Romance', 19], ]); //set up any options var options = { title: 'Film Genre Preferences' }; //Create node var node = document.createElement('div'), infoWindow = new google.maps.InfoWindow(), chart = new google.visualization.BarChart(node); //chjjeck which marker it is if (marker.id == 'c1') { chart.draw(data, options); } infoWindow.setContent(node); infoWindow.open(map,marker); } // Initialize and add the map function initMap() { //The location of Inverness var inverness = {lat: 57.480819, lng: -4.224250}; var city1 = {position: inverness}; // The map, centered at Inverness var map = new google.maps.Map( document.getElementById('map'), {zoom: 4, center: inverness}); // The marker positioned at Inverness var marker1 = new google.maps.Marker({position: inverness, map: map, id: 'c1', title: 'Number Of Cinemas: 2'}); //The location of Dundee var dundee = {lat: 56.467546, lng: -2.969593}; var city2 = {position: dundee}; // The marker, positioned at Dundee var marker2 = new google.maps.Marker({position: dundee, map: map, id: 'c2', title: 'Number Of Cinemas: 2'}); //The location of Glasgow var glasgow = {lat: 55.875362, lng: -4.250252}; var city3 = {position: glasgow}; // The marker, positioned at Glasgow var marker3 = new google.maps.Marker({position: glasgow, map: map, id: 'c3', title: 'Number Of Cinemas: 11'}); //The location of Edinburgh var edinburgh = {lat: 55.959425, lng: -3.189161}; var city4 = {position: edinburgh}; // The marker, positioned at Edinburgh var marker4 = new google.maps.Marker({position: edinburgh, map: map, id: 'c4', title: 'Number Of Cinemas: 3'}); //The location of Aberdeen var aberdeen = {lat: 57.155988, lng: -2.095139}; var city5 = {position: aberdeen}; // The marker, positioned at Aberdeen var marker5 = new google.maps.Marker({position: aberdeen, map: map, id: 'c5', title: 'Number Of Cinemas: 3'}); marker4.addListener('click', function() { drawChart(map,this); }); } [Proof of infoWindow working for one marker][1] [What happens after I've added code for a 2nd infoWindow][2] [Click on marker, no infoWindow][3] [1]: https://i.stack.imgur.com/38taB.png [2]: https://i.stack.imgur.com/TmS3G.png [3]: https://i.stack.imgur.com/vRf8q.png
0debug
void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, const char *boot_device, DisplayState *ds, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { CPUState *env; struct etraxfs_pic *pic; void *etraxfs_dmac; struct etraxfs_dma_client *eth[2] = {NULL, NULL}; int kernel_size; int i; ram_addr_t phys_ram; ram_addr_t phys_flash; ram_addr_t phys_intmem; if (cpu_model == NULL) { cpu_model = "crisv32"; } env = cpu_init(cpu_model); qemu_register_reset(main_cpu_reset, env); phys_ram = qemu_ram_alloc(ram_size); cpu_register_physical_memory(0x40000000, ram_size, phys_ram | IO_MEM_RAM); phys_intmem = qemu_ram_alloc(INTMEM_SIZE); cpu_register_physical_memory(0x38000000, INTMEM_SIZE, phys_intmem | IO_MEM_RAM); phys_flash = qemu_ram_alloc(FLASH_SIZE); i = drive_get_index(IF_PFLASH, 0, 0); pflash_cfi02_register(0x0, phys_flash, i != -1 ? drives_table[i].bdrv : NULL, (64 * 1024), FLASH_SIZE >> 16, 1, 2, 0x0000, 0x0000, 0x0000, 0x0000, 0x555, 0x2aa); pic = etraxfs_pic_init(env, 0x3001c000); etraxfs_dmac = etraxfs_dmac_init(env, 0x30000000, 10); for (i = 0; i < 10; i++) { etraxfs_dmac_connect(etraxfs_dmac, i, pic->irq + 7 + i, i & 1); } eth[0] = etraxfs_eth_init(&nd_table[0], env, pic->irq + 25, 0x30034000); if (nb_nics > 1) eth[1] = etraxfs_eth_init(&nd_table[1], env, pic->irq + 26, 0x30036000); etraxfs_dmac_connect_client(etraxfs_dmac, 0, eth[0]); etraxfs_dmac_connect_client(etraxfs_dmac, 1, eth[0] + 1); if (eth[1]) { etraxfs_dmac_connect_client(etraxfs_dmac, 6, eth[1]); etraxfs_dmac_connect_client(etraxfs_dmac, 7, eth[1] + 1); } etraxfs_timer_init(env, pic->irq + 0x1b, pic->nmi + 1, 0x3001e000); etraxfs_timer_init(env, pic->irq + 0x1b, pic->nmi + 1, 0x3005e000); for (i = 0; i < 4; i++) { if (serial_hds[i]) { etraxfs_ser_init(env, pic->irq + 0x14 + i, serial_hds[i], 0x30026000 + i * 0x2000); } } if (kernel_filename) { uint64_t entry, high; int kcmdline_len; kernel_size = load_elf(kernel_filename, -0x80000000LL, &entry, NULL, &high); bootstrap_pc = entry; if (kernel_size < 0) { kernel_size = load_image(kernel_filename, phys_ram_base + 0x4000); bootstrap_pc = 0x40004000; env->regs[9] = 0x40004000 + kernel_size; } env->regs[8] = 0x56902387; if (kernel_cmdline && (kcmdline_len = strlen(kernel_cmdline))) { if (kcmdline_len > 256) { fprintf(stderr, "Too long CRIS kernel cmdline (max 256)\n"); exit(1); } pstrcpy_targphys(high, 256, kernel_cmdline); env->regs[10] = 0x87109563; env->regs[11] = high; } } env->pc = bootstrap_pc; printf ("pc =%x\n", env->pc); printf ("ram size =%ld\n", ram_size); }
1threat
static int local_mkdir(FsContext *ctx, const char *path, mode_t mode) { return mkdir(rpath(ctx, path), mode); }
1threat
static int v9fs_synth_mkdir(FsContext *fs_ctx, V9fsPath *path, const char *buf, FsCred *credp) { errno = EPERM; return -1; }
1threat
how to make my custom directive depends on ng-model? : <p>I am new to angular js. I want to know how to make my custom directive depends on ng-model? Which line to add in <code>app.directive('myDirective',...</code> so that myDirective module will depend on ngModel?</p>
0debug
Best way to find a string in a PHP array? : <p>If I have an array that contains some strings like so</p> <pre><code>$roleNames = ['sales_agent', 'admin']; </code></pre> <p>And I want to check if that array contains the string 'sales_agent', what would be the best way to go about this with PHP?</p> <p>Ideally I would like to have the check return a boolean value.</p>
0debug
Google "auto answers" what are they called and is there an API? : <p>When you query google for information, google itself usually offers an answer before you click on any site.</p> <p>For example "Who is the richest person in the world"</p> <p>Google : "Bill gates". I am wondering A: what this service's name is. And B: if there is an API we can use</p>
0debug
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; MOVStreamContext *sc = (MOVStreamContext *)st->priv_data; int entries, i; print_atom("stss", atom); get_byte(pb); get_byte(pb); get_byte(pb); get_byte(pb); entries = get_be32(pb); sc->keyframe_count = entries; #ifdef DEBUG av_log(NULL, AV_LOG_DEBUG, "keyframe_count = %ld\n", sc->keyframe_count); #endif sc->keyframes = (long*) av_malloc(entries * sizeof(long)); if (!sc->keyframes) return -1; for(i=0; i<entries; i++) { sc->keyframes[i] = get_be32(pb); #ifdef DEBUG #endif } return 0; }
1threat
PHP: put_file_content not working : <p>I have a php-script which saves a pdf from a eclipse birt report to pdf. I'm using get file content as imput. The birt report pdf takes some time to create.</p> <p>I think this is the problem. </p> <p>In the following, the script:</p> <pre><code>&lt;?php $rname = 'reportname'; $wname = $rname . '_' . date('d.m.Y') . '.pdf'; $pdf = file_get_contents("http://xxx.xxx.xxx.x:8080/Birt/run?__report=" . $rname . ".rptdesign&amp;sample=my+parameter&amp;__format=pdf"); file_put_contents('/tmp/report' . $wname, $pdf); ?&gt; </code></pre> <p>What is the problem?</p> <p>Thanks for your help :)</p>
0debug
void qio_channel_socket_dgram_async(QIOChannelSocket *ioc, SocketAddress *localAddr, SocketAddress *remoteAddr, QIOTaskFunc callback, gpointer opaque, GDestroyNotify destroy) { QIOTask *task = qio_task_new( OBJECT(ioc), callback, opaque, destroy); struct QIOChannelSocketDGramWorkerData *data = g_new0( struct QIOChannelSocketDGramWorkerData, 1); data->localAddr = QAPI_CLONE(SocketAddress, localAddr); data->remoteAddr = QAPI_CLONE(SocketAddress, remoteAddr); trace_qio_channel_socket_dgram_async(ioc, localAddr, remoteAddr); qio_task_run_in_thread(task, qio_channel_socket_dgram_worker, data, qio_channel_socket_dgram_worker_free); }
1threat
static void ppc_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs = CPU(dev); PowerPCCPU *cpu = POWERPC_CPU(dev); PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); Error *local_err = NULL; #if !defined(CONFIG_USER_ONLY) int max_smt = kvm_enabled() ? kvmppc_smt_threads() : 1; #endif #if !defined(CONFIG_USER_ONLY) if (smp_threads > max_smt) { error_setg(errp, "Cannot support more than %d threads on PPC with %s", max_smt, kvm_enabled() ? "KVM" : "TCG"); return; } #endif if (kvm_enabled()) { if (kvmppc_fixup_cpu(cpu) != 0) { error_setg(errp, "Unable to virtualize selected CPU with KVM"); return; } } else if (tcg_enabled()) { if (ppc_fixup_cpu(cpu) != 0) { error_setg(errp, "Unable to emulate selected CPU with TCG"); return; } } #if defined(TARGET_PPCEMB) if (!ppc_cpu_is_valid(pcc)) { error_setg(errp, "CPU does not possess a BookE or 4xx MMU. " "Please use qemu-system-ppc or qemu-system-ppc64 instead " "or choose another CPU model."); return; } #endif create_ppc_opcodes(cpu, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); return; } init_ppc_proc(cpu); if (pcc->insns_flags & PPC_FLOAT) { gdb_register_coprocessor(cs, gdb_get_float_reg, gdb_set_float_reg, 33, "power-fpu.xml", 0); } if (pcc->insns_flags & PPC_ALTIVEC) { gdb_register_coprocessor(cs, gdb_get_avr_reg, gdb_set_avr_reg, 34, "power-altivec.xml", 0); } if (pcc->insns_flags & PPC_SPE) { gdb_register_coprocessor(cs, gdb_get_spe_reg, gdb_set_spe_reg, 34, "power-spe.xml", 0); } qemu_init_vcpu(cs); pcc->parent_realize(dev, errp); #if defined(PPC_DUMP_CPU) { CPUPPCState *env = &cpu->env; const char *mmu_model, *excp_model, *bus_model; switch (env->mmu_model) { case POWERPC_MMU_32B: mmu_model = "PowerPC 32"; break; case POWERPC_MMU_SOFT_6xx: mmu_model = "PowerPC 6xx/7xx with software driven TLBs"; break; case POWERPC_MMU_SOFT_74xx: mmu_model = "PowerPC 74xx with software driven TLBs"; break; case POWERPC_MMU_SOFT_4xx: mmu_model = "PowerPC 4xx with software driven TLBs"; break; case POWERPC_MMU_SOFT_4xx_Z: mmu_model = "PowerPC 4xx with software driven TLBs " "and zones protections"; break; case POWERPC_MMU_REAL: mmu_model = "PowerPC real mode only"; break; case POWERPC_MMU_MPC8xx: mmu_model = "PowerPC MPC8xx"; break; case POWERPC_MMU_BOOKE: mmu_model = "PowerPC BookE"; break; case POWERPC_MMU_BOOKE206: mmu_model = "PowerPC BookE 2.06"; break; case POWERPC_MMU_601: mmu_model = "PowerPC 601"; break; #if defined (TARGET_PPC64) case POWERPC_MMU_64B: mmu_model = "PowerPC 64"; break; #endif default: mmu_model = "Unknown or invalid"; break; } switch (env->excp_model) { case POWERPC_EXCP_STD: excp_model = "PowerPC"; break; case POWERPC_EXCP_40x: excp_model = "PowerPC 40x"; break; case POWERPC_EXCP_601: excp_model = "PowerPC 601"; break; case POWERPC_EXCP_602: excp_model = "PowerPC 602"; break; case POWERPC_EXCP_603: excp_model = "PowerPC 603"; break; case POWERPC_EXCP_603E: excp_model = "PowerPC 603e"; break; case POWERPC_EXCP_604: excp_model = "PowerPC 604"; break; case POWERPC_EXCP_7x0: excp_model = "PowerPC 740/750"; break; case POWERPC_EXCP_7x5: excp_model = "PowerPC 745/755"; break; case POWERPC_EXCP_74xx: excp_model = "PowerPC 74xx"; break; case POWERPC_EXCP_BOOKE: excp_model = "PowerPC BookE"; break; #if defined (TARGET_PPC64) case POWERPC_EXCP_970: excp_model = "PowerPC 970"; break; #endif default: excp_model = "Unknown or invalid"; break; } switch (env->bus_model) { case PPC_FLAGS_INPUT_6xx: bus_model = "PowerPC 6xx"; break; case PPC_FLAGS_INPUT_BookE: bus_model = "PowerPC BookE"; break; case PPC_FLAGS_INPUT_405: bus_model = "PowerPC 405"; break; case PPC_FLAGS_INPUT_401: bus_model = "PowerPC 401/403"; break; case PPC_FLAGS_INPUT_RCPU: bus_model = "RCPU / MPC8xx"; break; #if defined (TARGET_PPC64) case PPC_FLAGS_INPUT_970: bus_model = "PowerPC 970"; break; #endif default: bus_model = "Unknown or invalid"; break; } printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64 "\n" " MMU model : %s\n", object_class_get_name(OBJECT_CLASS(pcc)), pcc->pvr, pcc->msr_mask, mmu_model); #if !defined(CONFIG_USER_ONLY) if (env->tlb.tlb6) { printf(" %d %s TLB in %d ways\n", env->nb_tlb, env->id_tlbs ? "splitted" : "merged", env->nb_ways); } #endif printf(" Exceptions model : %s\n" " Bus model : %s\n", excp_model, bus_model); printf(" MSR features :\n"); if (env->flags & POWERPC_FLAG_SPE) printf(" signal processing engine enable" "\n"); else if (env->flags & POWERPC_FLAG_VRE) printf(" vector processor enable\n"); if (env->flags & POWERPC_FLAG_TGPR) printf(" temporary GPRs\n"); else if (env->flags & POWERPC_FLAG_CE) printf(" critical input enable\n"); if (env->flags & POWERPC_FLAG_SE) printf(" single-step trace mode\n"); else if (env->flags & POWERPC_FLAG_DWE) printf(" debug wait enable\n"); else if (env->flags & POWERPC_FLAG_UBLE) printf(" user BTB lock enable\n"); if (env->flags & POWERPC_FLAG_BE) printf(" branch-step trace mode\n"); else if (env->flags & POWERPC_FLAG_DE) printf(" debug interrupt enable\n"); if (env->flags & POWERPC_FLAG_PX) printf(" inclusive protection\n"); else if (env->flags & POWERPC_FLAG_PMM) printf(" performance monitor mark\n"); if (env->flags == POWERPC_FLAG_NONE) printf(" none\n"); printf(" Time-base/decrementer clock source: %s\n", env->flags & POWERPC_FLAG_RTC_CLK ? "RTC clock" : "bus clock"); dump_ppc_insns(env); dump_ppc_sprs(env); fflush(stdout); } #endif }
1threat
integration of Coded UI : is it possible to integrate coded ui with any other scripting or languages? since, Coded UI doesn't support few custom controls and third party controls. it would be better if we integrate coded ui with scripting like perl scripting.
0debug
import re def remove_all_spaces(text): return (re.sub(r'\s+', '',text))
0debug
print_syscall_ret(int num, abi_long ret) { int i; for(i=0;i<nsyscalls;i++) if( scnames[i].nr == num ) { if( scnames[i].result != NULL ) { scnames[i].result(&scnames[i],ret); } else { if( ret < 0 ) { gemu_log(" = -1 errno=" TARGET_ABI_FMT_ld " (%s)\n", -ret, target_strerror(-ret)); } else { gemu_log(" = " TARGET_ABI_FMT_ld "\n", ret); } } break; } }
1threat
static av_cold int audio_write_header(AVFormatContext *s1) { AlsaData *s = s1->priv_data; AVStream *st; unsigned int sample_rate; enum AVCodecID codec_id; int res; st = s1->streams[0]; sample_rate = st->codec->sample_rate; codec_id = st->codec->codec_id; res = ff_alsa_open(s1, SND_PCM_STREAM_PLAYBACK, &sample_rate, st->codec->channels, &codec_id); if (sample_rate != st->codec->sample_rate) { av_log(s1, AV_LOG_ERROR, "sample rate %d not available, nearest is %d\n", st->codec->sample_rate, sample_rate); goto fail; } avpriv_set_pts_info(st, 64, 1, sample_rate); return res; fail: snd_pcm_close(s->h); return AVERROR(EIO); }
1threat
Make bootstrap modal draggable and keep background usable : <p>I'm trying to make a bootstrap modal draggable anywhere on the page and when the modal is open, I want the user to be able to continue using the page.</p> <p>I was able to make the modal draggable with jquery-ui but I'm stuck on making the page usable while the modal is open. Tried several suggestions with CSS but none work quite as I'd like them to.</p> <p>This makes the page usable but the modal is limited to only a part of the page: <a href="https://stackoverflow.com/questions/34095636/bootstrap-modal-make-background-clickable-without-closing-out-modal">Bootstrap Modal - make background clickable without closing out modal</a></p> <p>Same as this one: <a href="https://stackoverflow.com/questions/35388375/enable-background-when-open-bootstrap-modal-popup">Enable background when open bootstrap modal popup</a></p> <p>Is it possible to achieve this with bootstrap modal at all?</p> <p>This is my JS:</p> <pre><code>$('#btn1').click(function() { var modalDiv = $('#myModal'); modalDiv.modal({backdrop: false, show: true}); $('.modal-dialog').draggable({ handle: ".modal-header" }); }); </code></pre> <p>JSFiddle link: <a href="https://jsfiddle.net/ntLpg6hw/1/" rel="noreferrer">https://jsfiddle.net/ntLpg6hw/1/</a></p>
0debug
How do i make a nested "while loop" that will generate this output with the given lists : <p>Using two lists. numSet = [1,2,3] alphaSet = ['A', 'B', 'C'] Provide for both the while and for loops, create nested loops that print a table that looks like this 1 A 1 B 1 C 2 A 2 B 2 C 3 A 3 B 3 C</p>
0debug
Why does my while loop still run even if the conditions for it to run aren't met? : <p>I am currently working on a make your own adventure game. In the code, there is a while loop to check if the input given by the person running the game is valid or invalid.</p> <pre><code>actions = ['turn light on'] while True: while player_input not in actions: print('i dont know what you mean by',player_input) player_input = input('&gt;') if player_input == ('turn light on'): actions.remove('turn light on') actions.append('go to kitchen') actions.append('turn light off') points = int(points+100) print('you have',points,'points') print('it is bright in your room') print('you hear your dad say something in the kitchen') player_input = input('&gt;') if player_input == ('go to kitchen'): actions.remove('go to kitchen') actions.remove('turn light off') actions.append('eat eggs') actions.append('eat bacon') actions.append('eat dad') print('you go to the kitchen and your dad asks what you want for breakfast') print('do you want to eat bacon or eggs') </code></pre> <p>It works fine when you are at the 'turn light on part', but when you get to the go to the kitchen part and type 'go to kitchen' it prints what it is supposed to (you go to the kitchen and your dad asks what you want for breakfast, do you want bacon or eggs) but it also prints (i don't know what you mean by go to kitchen).</p>
0debug
Batch file that compare prefix : im really lost now.. --( FOLDER ) RAW_123432542_343.text 231453254_213.text RAW_324324_32432423.text 32432423_4543.text that is a sample files inside the folder what i want is.. to raname all the files that doesn't have RAW_ prefix the folder have thousand of file inside
0debug
How to use Join query between CTE and two table.? : I want to use a join query in cte between two table Employee Details and second one is Machine Attendance,but getting confuse how it will use.? ;With CTE As ( `select ed.EmpName from EmployeeDetails ed)` `,cte1;` `AS` `( SELECT ma.EmpID, CAST(MA.Datetime as Date) AS [Date], CASE WHEN MA.INOUT = 1 THEN DateTime END AS INOUT_INTIME, CASE WHEN MA.INOUT = 2 THEN DateTime END AS INOUT_OUTTIME From MachineAttendance MA ), cte2 ` `as ( select EmpID, [Date], MAX(INOUT_INTIME) AS INTIME, MAX(INOUT_OUTTIME) AS OUTTIME , DATEDIFF(Hour, MAX(INOUT_INTIME), MAX(INOUT_OUTTIME)) as [Hours] FROM CTE1 GROUP BY EmpID, [Date] ) select EmpID, [Date], INTIME, OUTTIME, [Hours] , CASE WHEN [Hours] >= 8 THEN 1 WHEN [Hours] = 0 THEN 0 WHEN [Hours] >= 6 THEN 0.5 END AS [Day], CASE WHEN [Hours] > 8 then [Hours] - 8 else 0 End as OT, CASE WHEN [Hours] >= 8 then ([Hours] - 8) * 100 else 0 END AS OTAMount, Convert(varchar(10),Date,120) as [Date], Convert(varchar(10),INTIME,108) as [Time], Case When Convert(Time,INTIME,108) > '09:10' Then 1 else 0 end as Late from cte2 INNER Join cte On cte.EmpID=cte2.EmpID`
0debug
static void coroutine_fn mirror_pause(BlockJob *job) { MirrorBlockJob *s = container_of(job, MirrorBlockJob, common); mirror_drain(s); }
1threat
static void compare_refcounts(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix, int64_t *highest_cluster, uint16_t *refcount_table, int64_t nb_clusters) { BDRVQcowState *s = bs->opaque; int64_t i; int refcount1, refcount2, ret; for (i = 0, *highest_cluster = 0; i < nb_clusters; i++) { refcount1 = get_refcount(bs, i); if (refcount1 < 0) { fprintf(stderr, "Can't get refcount for cluster %" PRId64 ": %s\n", i, strerror(-refcount1)); res->check_errors++; continue; } refcount2 = refcount_table[i]; if (refcount1 > 0 || refcount2 > 0) { *highest_cluster = i; } if (refcount1 != refcount2) { int *num_fixed = NULL; if (refcount1 > refcount2 && (fix & BDRV_FIX_LEAKS)) { num_fixed = &res->leaks_fixed; } else if (refcount1 < refcount2 && (fix & BDRV_FIX_ERRORS)) { num_fixed = &res->corruptions_fixed; } fprintf(stderr, "%s cluster %" PRId64 " refcount=%d reference=%d\n", num_fixed != NULL ? "Repairing" : refcount1 < refcount2 ? "ERROR" : "Leaked", i, refcount1, refcount2); if (num_fixed) { ret = update_refcount(bs, i << s->cluster_bits, 1, refcount2 - refcount1, QCOW2_DISCARD_ALWAYS); if (ret >= 0) { (*num_fixed)++; continue; } } if (refcount1 < refcount2) { res->corruptions++; } else { res->leaks++; } } } }
1threat
static inline void tcg_out_ld_ptr(TCGContext *s, TCGReg ret, uintptr_t arg) { TCGReg base = TCG_REG_G0; if (!check_fit_tl(arg, 10)) { tcg_out_movi(s, TCG_TYPE_PTR, ret, arg & ~0x3ff); base = ret; } tcg_out_ld(s, TCG_TYPE_PTR, ret, base, arg & 0x3ff); }
1threat
static gboolean qio_channel_websock_handshake_io(QIOChannel *ioc, GIOCondition condition, gpointer user_data) { QIOTask *task = user_data; QIOChannelWebsock *wioc = QIO_CHANNEL_WEBSOCK( qio_task_get_source(task)); Error *err = NULL; int ret; ret = qio_channel_websock_handshake_read(wioc, &err); if (ret < 0) { trace_qio_channel_websock_handshake_fail(ioc); qio_task_abort(task, err); error_free(err); return FALSE; } if (ret == 0) { trace_qio_channel_websock_handshake_pending(ioc, G_IO_IN); return TRUE; } object_ref(OBJECT(task)); trace_qio_channel_websock_handshake_reply(ioc); qio_channel_add_watch( wioc->master, G_IO_OUT, qio_channel_websock_handshake_send, task, (GDestroyNotify)object_unref); return FALSE; }
1threat
static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target, const char *replaces, int64_t speed, uint32_t granularity, int64_t buf_size, BlockdevOnError on_source_error, BlockdevOnError on_target_error, bool unmap, BlockCompletionFunc *cb, void *opaque, Error **errp, const BlockJobDriver *driver, bool is_none_mode, BlockDriverState *base) { MirrorBlockJob *s; BlockDriverState *replaced_bs; if (granularity == 0) { granularity = bdrv_get_default_bitmap_granularity(target); } assert ((granularity & (granularity - 1)) == 0); if (buf_size < 0) { error_setg(errp, "Invalid parameter 'buf-size'"); return; } if (buf_size == 0) { buf_size = DEFAULT_MIRROR_BUF_SIZE; } if (replaces) { replaced_bs = bdrv_lookup_bs(replaces, replaces, errp); if (replaced_bs == NULL) { return; } } else { replaced_bs = bs; } if (replaced_bs->blk && target->blk) { error_setg(errp, "Can't create node with two BlockBackends"); return; } s = block_job_create(driver, bs, speed, cb, opaque, errp); if (!s) { return; } s->replaces = g_strdup(replaces); s->on_source_error = on_source_error; s->on_target_error = on_target_error; s->target = target; s->is_none_mode = is_none_mode; s->base = base; s->granularity = granularity; s->buf_size = ROUND_UP(buf_size, granularity); s->unmap = unmap; s->dirty_bitmap = bdrv_create_dirty_bitmap(bs, granularity, NULL, errp); if (!s->dirty_bitmap) { g_free(s->replaces); block_job_unref(&s->common); return; } bdrv_op_block_all(s->target, s->common.blocker); s->common.co = qemu_coroutine_create(mirror_run); trace_mirror_start(bs, s, s->common.co, opaque); qemu_coroutine_enter(s->common.co, s); }
1threat
List all subdomains Python : I am trying to list all subdomains of a site in Python for scraping with BeautifulSoup. I tried using Dot, but it didn't work/I didn't apply it correctly. Help?
0debug
Visual Studio Code: format is not using indent settings : <p>When using the <code>Format Code</code> command in Visual Studio Code, it is not honoring my indent settings (<code>"editor.tabSize": 2</code>). It is using a tab size of 4 instead. Any ideas why this is happening?</p> <p>Thanks!</p>
0debug
Get the bounding box coordinates in the TensorFlow object detection API tutorial : <p>I am new to both python and Tensorflow. I am trying to run the object_detection_tutorial file from the <a href="https://github.com/tensorflow/models/tree/master/research/object_detection" rel="noreferrer">Tensorflow Object Detection API</a>, but I cannot find where I can get the coordinates of the bounding boxes when objects are detected.</p> <p>Relevant code:</p> <pre><code> # The following processing is only for single image detection_boxes = tf.squeeze(tensor_dict['detection_boxes'], [0]) detection_masks = tf.squeeze(tensor_dict['detection_masks'], [0]) </code></pre> <p>...</p> <p>The place where I assume bounding boxes are drawn is like this:</p> <pre><code> # Visualization of the results of a detection. vis_util.visualize_boxes_and_labels_on_image_array( image_np, output_dict['detection_boxes'], output_dict['detection_classes'], output_dict['detection_scores'], category_index, instance_masks=output_dict.get('detection_masks'), use_normalized_coordinates=True, line_thickness=8) plt.figure(figsize=IMAGE_SIZE) plt.imshow(image_np) </code></pre> <p>I tried printing output_dict['detection_boxes'] but I am not sure what the numbers mean. There are a lot.</p> <pre><code>array([[ 0.56213236, 0.2780568 , 0.91445708, 0.69120586], [ 0.56261235, 0.86368728, 0.59286624, 0.8893863 ], [ 0.57073039, 0.87096912, 0.61292225, 0.90354401], [ 0.51422435, 0.78449738, 0.53994244, 0.79437423], </code></pre> <p>......</p> <pre><code> [ 0.32784131, 0.5461576 , 0.36972913, 0.56903434], [ 0.03005961, 0.02714229, 0.47211722, 0.44683522], [ 0.43143299, 0.09211366, 0.58121657, 0.3509962 ]], dtype=float32) </code></pre> <p>I found answers for similar questions, but I don't have a variable called boxes as they do. How can I get the coordinates? Thank you!</p>
0debug
How executable locates functions from DLL file? : <p>How executable locates functions from DLLs exactly? I know that DLL files have entry points but how does the executable locate those entry points with name since everything inside a DLL is 1s and 0s?</p>
0debug
Making an input icon (search icon) responsive : <p>Typical for a search bar, I've added a magnifying glass icon on the left side for UI purposes. On desktop it looks fine and stays at the position nicely. However, when switching to mobile the icon is repositioning itself according to the device width.</p> <p>I thought by increasing the <code>left</code> parameter for <code>@media (max-width: 768px)</code> it will be fixed but it seems to behave differently.</p> <p>A gif of the issue with the code on the right side is added. What am I doing wrong?</p> <p><a href="https://i.stack.imgur.com/15qtK.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/15qtK.gif" alt="Search icon behaving differently for mobile sizes"></a></p>
0debug
output of the functions based on nodes : im new at coding cpp and i dont undertstand how we can get the following outputs about the nodes subject? can anyone help thanks in advance :) the output of the following program is 10 3 22 33 5 7 6 3 22 33 2 4 6 here is the code: void display(Node *head){ if(head == NULL) cout<<"head is NULL"<<endl; for(Node *tmp=head; tmp!=NULL; tmp = tmp->next ) cout<<" "<<tmp->data; cout<<endl; } Node *func1(int value1, int value2, int value3){ Node *head = new Node; head->next = new Node; head->next->next = new Node; head->next->next->next = NULL; head->data = value1; head->next->data = value2; head->next->next->data = value3; return head; } void func2(Node *head1, Node *head2, Node *head3){ head1->next = head3; head1->next->data =3; head1= head2; head1->data = 5; head1->next->data = 7; head2 = head1; head3 = head1; } void func3(Node *head){ for(; head!= NULL; head = head->next) head->data *=2; } int main(){ Node *head1 = func1(10,20,30); Node *head2 = func1(2,4,6); Node *head3 = func1(11,22,33); func2(head1, head2, head3); display(head1); display(head2); display(head3); head1 = func1(1,2,3); func3(head1); display(head1); return 0; }
0debug
find out the percentage for each in sql : I got two table here, trip and users [![enter image description here][1]][1] [![enter image description here][2]][2] [1]: https://i.stack.imgur.com/iL2V8.jpg [2]: https://i.stack.imgur.com/S05AQ.jpg my question is Between Oct 1, 2013 at 10am PDT and Oct 22, 2013 at 5pm PDT, what percentage of requests made by unbanned clients each day were canceled in each city?_
0debug
How to call a public void from a private class : <p>So i'm trying to make a rock paper scissors game for school and the teacher doesnt help me or answer my questions, so if someone can help me that would be great</p> <p>so i need to disable the buttons after the user has pressed them and i have done so like this:</p> <pre><code>public void TurnOffButtons() { myRock.disable(); myScissors.disable(); myPaper.disable(); } </code></pre> <p>myRock, myPaper and myScissors are the button names</p> <p>i have 3 different private classes, which run whenever the user presses the buttons, and i want to call the method TurnOffButtons in these classes to temporarily disable them so that the user cannot keep pressing them before pressing new game where the buttons are then re enabled (this prevents the user from continuously winning) </p> <p>my question is how do i call them? i tried using this line of code:</p> <pre><code>new TurnOffButtons(); </code></pre> <p>but it gave me an error if anyone could help that would be amazing</p>
0debug
Error on Vagrant Up on Linux : <p>I try to run vagrant on my Ubuntu 14.04. So for, I did these steps:</p> <p>-Install vagrant -Install virtualbox -added box for provider</p> <p>then I run the </p> <blockquote> <p>vagrant up</p> </blockquote> <p>command.</p> <p>After running the command, I take these output and at the and there is an error message which I cannot figure out how can I solve and run it correctly.</p> <blockquote> <p>Bringing machine 'default' up with 'virtualbox' provider...</p> <p>==> default: Checking if box 'udacity/ud381' is up to date...</p> <p>==> default: Clearing any previously set forwarded ports...</p> <p>==> default: Clearing any previously set network interfaces...</p> <p>==> default: Preparing network interfaces based on configuration...</p> <pre><code>default: Adapter 1: nat </code></pre> <p>==> default: Forwarding ports...</p> <pre><code>default: 5000 (guest) =&gt; 5000 (host) (adapter 1) default: 22 (guest) =&gt; 2222 (host) (adapter 1) </code></pre> <p>==> default: Booting VM... There was an error while executing <code>VBoxManage</code>, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below.</p> <p>Command: ["startvm", "0399f946-6a87-4310-a22d-c1a4525ae2f0", "--type", "headless"]</p> <p>Stderr: VBoxManage: error: The virtual machine 'ud381_default_1463617458900_49294' has terminated unexpectedly during startup with exit code 1 (0x1) VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine</p> </blockquote> <p>What should I do to fix these error ? </p>
0debug
JQuery how to call a function when the div load completes : I have a page where i will have many buttons and links. On clicking of the buttons and links, i have a div tag called "scriptWPQ2" which will refresh. On refresh of this div completes, i need to write a function to change some data in the div dynamically. At the moment i tried document.ready or window.load it does not help please enlighten me on this $(document).ready(function () { $('#scriptWPQ2').load(function () { //dosomething }); });
0debug
static int vqa_decode_init(AVCodecContext *avctx) { VqaContext *s = avctx->priv_data; unsigned char *vqa_header; int i, j, codebook_index; s->avctx = avctx; avctx->pix_fmt = PIX_FMT_PAL8; dsputil_init(&s->dsp, avctx); if (s->avctx->extradata_size != VQA_HEADER_SIZE) { av_log(s->avctx, AV_LOG_ERROR, " VQA video: expected extradata size of %d\n", VQA_HEADER_SIZE); return -1; } vqa_header = (unsigned char *)s->avctx->extradata; s->vqa_version = vqa_header[0]; s->width = AV_RL16(&vqa_header[6]); s->height = AV_RL16(&vqa_header[8]); if(avcodec_check_dimensions(avctx, s->width, s->height)){ s->width= s->height= 0; return -1; } s->vector_width = vqa_header[10]; s->vector_height = vqa_header[11]; s->partial_count = s->partial_countdown = vqa_header[13]; if ((s->vector_width != 4) || ((s->vector_height != 2) && (s->vector_height != 4))) { return -1; } s->codebook_size = MAX_CODEBOOK_SIZE; s->codebook = av_malloc(s->codebook_size); s->next_codebook_buffer = av_malloc(s->codebook_size); if (s->vector_height == 4) { codebook_index = 0xFF00 * 16; for (i = 0; i < 256; i++) for (j = 0; j < 16; j++) s->codebook[codebook_index++] = i; } else { codebook_index = 0xF00 * 8; for (i = 0; i < 256; i++) for (j = 0; j < 8; j++) s->codebook[codebook_index++] = i; } s->next_codebook_buffer_index = 0; s->decode_buffer_size = (s->width / s->vector_width) * (s->height / s->vector_height) * 2; s->decode_buffer = av_malloc(s->decode_buffer_size); s->frame.data[0] = NULL; return 0; }
1threat
can someone explain load average in flower? : <p>I use flower to monitor my rabbitmq queues, I am not able to understand how load average is calculated, if someone can explain then that would be of great help.<br> I've a quad core processor .<br> Thank You.</p>
0debug
What browser will PWA (Progressive Web App) use after adding to home screen? : <p>I"m curious about what browser PWA will use under the hood after adding to home screen. Is it the one where you originally chose "Add to home screen"? If yes, what if I add a PWA to home screen from Chrome on my phone and later delete Chrome (Assuming there's only Safari left on my phone now)? Will the PWA still work when clicking its icon on home screen?</p>
0debug
Java regular expression "( *|)": what does the pipe do? : <p>I'm studying a Java code that uses the regular expression <code>"( *|)"</code>. What does the pipe do in this expression?</p> <p>So far I understood it works the same way as the expression for a group of optional spaces, i.e. <code>"( *)</code>.</p>
0debug
How to dispatch multiple actions one after another : <p>In my react / redux application I often want to dispatch multiple actions after another.</p> <p>Given the following example: After a successful login I want to store the user data and <strong>after that</strong> I want to initiate another async action that loads application configuration from the server.</p> <p>I know that I can use <code>redux-thunk</code>to build an action creator like this</p> <pre><code>function loginRequestSuccess(data) { return function(dispatch) { dispatch(saveUserData(data.user)) dispatch(loadConfig()) } } </code></pre> <p>So my questions are:</p> <ol> <li>When the first <code>dispatch</code>returns, is the state already changed by all reducers listening for that action? I'm wondering if the two dispatch calls are run strictly sequential.</li> <li>Is this approach considered best practice for dispatching multiple actions? If not, what would you suggest alternatively?</li> </ol> <p>Thanks for any help!</p>
0debug
static void glib_pollfds_poll(void) { GMainContext *context = g_main_context_default(); GPollFD *pfds = &g_array_index(gpollfds, GPollFD, glib_pollfds_idx); if (g_main_context_check(context, max_priority, pfds, glib_n_poll_fds)) { g_main_context_dispatch(context); } }
1threat
How can i restart currentTimeMillis or make this currentTimeMillis work properly : So the problem here is that when i try to run again it won't do anything. It will run the while once then break. I know that i'm not using currentTimeMillis right does any one know what's the problem here. I'm not good at coding if you have some suggestions to improve my code feel free to tell me. And yes I tried to look anwsers online but i didn't find anything. Sorry for bad English! public static String list(ArrayList<String> lause2) { Collections.shuffle(lause2); String pleb = lause2.get(lause2.size() - 1); return pleb; } public static void main(String[] args) throws Exception { Scanner printer = new Scanner(System.in); ArrayList<String> lause2 = new ArrayList<>(); ArrayList<Integer> keskiarvo = new ArrayList<>(); long start = System.currentTimeMillis(); long end = start + 10 * 6000; int laskuri = 0; boolean go = true; boolean run = true; System.out.println("Welcome to Typefaster"); System.out.println("Program will give you random words you will write them as fast as you can for an minute if you fail ones it's over Good luck!"); lause2.add("hello"); //Loads of different lause2.add("random"); lause2.add("vacation"); System.out.println(list(lause2)); while (System.currentTimeMillis() < end) { laskuri++; String something = list(lause2); System.out.println("Write " + something); String kirjoitus = printer.nextLine(); if (kirjoitus.equals(something)) { System.out.println("yee"); } else { break; } } System.out.println("You wrote " + laskuri + " words"); keskiarvo.add(laskuri); int laskuri2 = 0; System.out.println("Run again?"); char again = printer.next().charAt(0); if (again == 'y') { run = true; } else if (again == 'n') { System.out.println("Byebye"); go = false; } long start2 = System.currentTimeMillis(); long end2 = start2 + 10*6000; while (System.currentTimeMillis() < end2 && run) { laskuri2++; String something1 = list(lause2); System.out.println("Write " + something1); String kirjoitus1 = printer.nextLine(); if (kirjoitus1.equals(something1)) { System.out.println("yee"); } else { break; } System.out.println("You wrote " + laskuri2 + " words"); keskiarvo.add(laskuri2); } }
0debug
int avresample_convert(AVAudioResampleContext *avr, void **output, int out_plane_size, int out_samples, void **input, int in_plane_size, int in_samples) { AudioData input_buffer; AudioData output_buffer; AudioData *current_buffer; int ret; if (avr->in_buffer) { avr->in_buffer->nb_samples = 0; ff_audio_data_set_channels(avr->in_buffer, avr->in_buffer->allocated_channels); } if (avr->resample_out_buffer) { avr->resample_out_buffer->nb_samples = 0; ff_audio_data_set_channels(avr->resample_out_buffer, avr->resample_out_buffer->allocated_channels); } if (avr->out_buffer) { avr->out_buffer->nb_samples = 0; ff_audio_data_set_channels(avr->out_buffer, avr->out_buffer->allocated_channels); } av_dlog(avr, "[start conversion]\n"); if (output) { ret = ff_audio_data_init(&output_buffer, output, out_plane_size, avr->out_channels, out_samples, avr->out_sample_fmt, 0, "output"); if (ret < 0) return ret; output_buffer.nb_samples = 0; } if (input) { ret = ff_audio_data_init(&input_buffer, input, in_plane_size, avr->in_channels, in_samples, avr->in_sample_fmt, 1, "input"); if (ret < 0) return ret; current_buffer = &input_buffer; if (avr->upmix_needed && !avr->in_convert_needed && !avr->resample_needed && !avr->out_convert_needed && output && out_samples >= in_samples) { av_dlog(avr, "[copy] %s to output\n", current_buffer->name); ret = ff_audio_data_copy(&output_buffer, current_buffer); if (ret < 0) return ret; current_buffer = &output_buffer; } else if (avr->mixing_needed || avr->in_convert_needed) { if (avr->in_convert_needed) { ret = ff_audio_data_realloc(avr->in_buffer, current_buffer->nb_samples); if (ret < 0) return ret; av_dlog(avr, "[convert] %s to in_buffer\n", current_buffer->name); ret = ff_audio_convert(avr->ac_in, avr->in_buffer, current_buffer, current_buffer->nb_samples); if (ret < 0) return ret; } else { av_dlog(avr, "[copy] %s to in_buffer\n", current_buffer->name); ret = ff_audio_data_copy(avr->in_buffer, current_buffer); if (ret < 0) return ret; } ff_audio_data_set_channels(avr->in_buffer, avr->in_channels); if (avr->downmix_needed) { av_dlog(avr, "[downmix] in_buffer\n"); ret = ff_audio_mix(avr->am, avr->in_buffer); if (ret < 0) return ret; } current_buffer = avr->in_buffer; } } else { if (!avr->resample_needed) return handle_buffered_output(avr, output ? &output_buffer : NULL, NULL); current_buffer = NULL; } if (avr->resample_needed) { AudioData *resample_out; int consumed = 0; if (!avr->out_convert_needed && output && out_samples > 0) resample_out = &output_buffer; else resample_out = avr->resample_out_buffer; av_dlog(avr, "[resample] %s to %s\n", current_buffer->name, resample_out->name); ret = ff_audio_resample(avr->resample, resample_out, current_buffer, &consumed); if (ret < 0) return ret; if (resample_out->nb_samples == 0) { av_dlog(avr, "[end conversion]\n"); return 0; } current_buffer = resample_out; } if (avr->upmix_needed) { av_dlog(avr, "[upmix] %s\n", current_buffer->name); ret = ff_audio_mix(avr->am, current_buffer); if (ret < 0) return ret; } if (current_buffer == &output_buffer) { av_dlog(avr, "[end conversion]\n"); return current_buffer->nb_samples; } if (avr->out_convert_needed) { if (output && out_samples >= current_buffer->nb_samples) { av_dlog(avr, "[convert] %s to output\n", current_buffer->name); ret = ff_audio_convert(avr->ac_out, &output_buffer, current_buffer, current_buffer->nb_samples); if (ret < 0) return ret; av_dlog(avr, "[end conversion]\n"); return output_buffer.nb_samples; } else { ret = ff_audio_data_realloc(avr->out_buffer, current_buffer->nb_samples); if (ret < 0) return ret; av_dlog(avr, "[convert] %s to out_buffer\n", current_buffer->name); ret = ff_audio_convert(avr->ac_out, avr->out_buffer, current_buffer, current_buffer->nb_samples); if (ret < 0) return ret; current_buffer = avr->out_buffer; } } return handle_buffered_output(avr, &output_buffer, current_buffer); }
1threat
static void s390_pcihost_hot_unplug(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { PCIDevice *pci_dev = NULL; PCIBus *bus; int32_t devfn; S390PCIBusDevice *pbdev = NULL; S390pciState *s = s390_get_phb(); if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_BRIDGE)) { error_setg(errp, "PCI bridge hot unplug currently not supported"); return; } else if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) { pci_dev = PCI_DEVICE(dev); QTAILQ_FOREACH(pbdev, &s->zpci_devs, link) { if (pbdev->pdev == pci_dev) { break; } } assert(pbdev != NULL); } else if (object_dynamic_cast(OBJECT(dev), TYPE_S390_PCI_DEVICE)) { pbdev = S390_PCI_DEVICE(dev); pci_dev = pbdev->pdev; } switch (pbdev->state) { case ZPCI_FS_RESERVED: goto out; case ZPCI_FS_STANDBY: break; default: s390_pci_generate_plug_event(HP_EVENT_DECONFIGURE_REQUEST, pbdev->fh, pbdev->fid); pbdev->release_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, s390_pcihost_timer_cb, pbdev); timer_mod(pbdev->release_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + HOT_UNPLUG_TIMEOUT); return; } if (pbdev->release_timer && timer_pending(pbdev->release_timer)) { timer_del(pbdev->release_timer); timer_free(pbdev->release_timer); pbdev->release_timer = NULL; } s390_pci_generate_plug_event(HP_EVENT_STANDBY_TO_RESERVED, pbdev->fh, pbdev->fid); bus = pci_dev->bus; devfn = pci_dev->devfn; object_unparent(OBJECT(pci_dev)); s390_pci_msix_free(pbdev); s390_pci_iommu_free(s, bus, devfn); pbdev->pdev = NULL; pbdev->state = ZPCI_FS_RESERVED; out: pbdev->fid = 0; QTAILQ_REMOVE(&s->zpci_devs, pbdev, link); g_hash_table_remove(s->zpci_table, &pbdev->idx); object_unparent(OBJECT(pbdev)); }
1threat
I would like to output an the data returned from an observable, but it seems not working: : Am working in Angular and the problem seems to be: When I subscribe to the observable in my component, I can console.log() the data successfully, but I cannot assign the data to any afore declared variables and view it in the view template. This is the code: I understand that logging in the console is a synchronous process while the observable subscription in itself is asynchronous, but outputting a value from an asynchronous operation in the view template seems to be the problem. I have seen quite a number of solutions on stack overflow but it does not resolve the problem since it doesn't address this kind of problem. **This is a sample of the code** <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> //The getData function returns an obsverbale favoriteShirt; const gtc = this; gtc.getData().subscribe({ next: (data) => { console.log(data.favShirtFromStore) // this returns an objects with the shirts (this is a sync op) return gtc.favoriteShirt = data.favShirtFromStore; //this returns undefined <= where the problem is }, error:(err)=>{console.log(`There was an error ${err}`)}, complete:()=>{console.log("Completed...")} });; <!-- end snippet -->
0debug
Someone point my website with his domain, how can I block? : <p>the sorgarden.se domain is pointing to my server. I have lost SEO ranking for duplicate contents...</p> <p>how can i block this? from htaccess?</p>
0debug
A second operation started on this context before a previous asynchronous operation completed : <p><strong>Message:</strong></p> <pre><code>"System.NotSupportedException was unhandled Message: An unhandled exception of type 'System.NotSupportedException' occurred in mscorlib.dll Additional information: A second operation started on this context before a previous asynchronous operation completed. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context. Any instance members are not guaranteed to be thread safe." </code></pre> <p><strong>Code:</strong></p> <pre><code>public async Task&lt;IEnumerable&lt;UserLangDTO&gt;&gt; ImportLang(int userId) { var userLangs = new List&lt;UserLangDTO&gt;(); using (FirstContext ctx = new FirstContext()) { if (await (ctx.UserLang.AnyAsync(u =&gt; u.UserId == userId)) == false) //some exception here userLangs = await ctx.UserLang.AsNoTracking() .Where(ul =&gt; ul.UserId == userId) .Join(ctx.Language, u =&gt; u.LangID, l =&gt; l.LangID, (u, l) =&gt; new { u, l }) .Join(ctx.Level, ul =&gt; ul.u.LevelID, le =&gt; le.LevelID, (ul, le) =&gt; new { ul, le }) .Select(r =&gt; new UserLangDTO { UserId = r.ul.u.UserId, Language = r.ul.l.Language, Level = r.le.Level, }).ToListAsync().ConfigureAwait(false); } using (SecondContext ctx = new SecondContext()) { if ( await (ctx.UserLangs.AnyAsync(u =&gt; u.UserId == userId)) == true &amp;&amp; userLangs.Any()) ctx.UserLangs.RemoveRange(ctx.UserLangs.Where(u =&gt; u.UserId == userId)); if (await hasUserLangs &amp;&amp; userLangs.Any()) { userLangs.ForEach(async l =&gt; { var userLanguage = new UserLang(); userLanguage.UserId = userId; userLanguage.LanguageId = await ctx.Languages.AsNoTracking() .Where(la =&gt; la.NameEn == l.Language) .Select(la =&gt; la.Id).FirstOrDefaultAsync().ConfigureAwait(false); userLanguage.LevelId = await ctx.Levels.AsNoTracking() .Where(la =&gt; la.NameEn == l.Language) .Select(la =&gt; la.Id).FirstOrDefaultAsync().ConfigureAwait(false); ctx.UserLangs.Add(userLanguage); }); } await ctx.SaveChangesAsync().ConfigureAwait(false); } return userLangs; } </code></pre> <p><strong>What I Tried:</strong></p> <p>I'm not sure what I'm doing wrong, I tried different stuff like : </p> <p>1.</p> <pre><code>await Task.Run(() =&gt; Parallel.ForEach(strings, s =&gt; {     DoSomething(s); })); </code></pre> <p>2.</p> <pre><code>var tasks = userLangs.Select(async l =&gt; { //rest of the code here } await Task.WhenAll(tasks); </code></pre> <p>3.</p> <pre><code>var tasks = userLangs.Select(async l =&gt; { //rest of the code here } await Task.WhenAll(tasks); await ctx.SaveChangesAsync().ConfigureAwait(false); </code></pre> <ol start="4"> <li>Other trial and error attempts, that i do not rember now</li> </ol> <p>What am I doing wrong?</p>
0debug
what the problem in this program? it doesn't use the second number, and doesn't print the last line? : <p>/<em>This program gets two positive numbers, declare "error" if the one of the numbers is negative, and then gets list of numbers again and again until the amount of the list is bigger than the first number, or until the quantity of the numbers in the list is equal to the second number, and ther prints the sum of the list.</em>/</p> <pre><code>#include &lt;iostream&gt; using namespace std; int main() { int num1, num2, num_list, tempSum, finalSum = 0, count = 0; cout &lt;&lt; "enter 2 positive numbers:" &lt;&lt; endl; cin &gt;&gt; num1; while (num1 &lt; 0) { cout &lt;&lt; "ERROR" &lt;&lt; endl; cin &gt;&gt; num1; } cin &gt;&gt; num2; while (num2 &lt; 0) { cout &lt;&lt; "ERROR" &lt;&lt; endl; cin &gt;&gt; num2; } cout &lt;&lt; "enter a list of numbers:" &lt;&lt; endl; do { cin &gt;&gt; num_list; tempSum = num_list; finalSum += tempSum; count = count + 1; } while (count &lt; num2 || finalSum &lt;= num1); cout &lt;&lt; finalSum &lt;&lt; endl; return 0; } </code></pre>
0debug
static void qapi_dealloc_end_list(Visitor *v) { QapiDeallocVisitor *qov = to_qov(v); void *obj = qapi_dealloc_pop(qov); assert(obj == NULL); }
1threat
void visit_start_alternate(Visitor *v, const char *name, GenericAlternate **obj, size_t size, bool promote_int, Error **errp) { Error *err = NULL; assert(obj && size >= sizeof(GenericAlternate)); assert(v->type != VISITOR_OUTPUT || *obj); if (v->start_alternate) { v->start_alternate(v, name, obj, size, promote_int, &err); } if (v->type == VISITOR_INPUT) { assert(v->start_alternate && !err != !*obj); } error_propagate(errp, err); }
1threat
ASP.NET Core 2.2 Site Warmup : <p>I've migrated a .NET Framework 4.6 WebApi to .NETCore 2.2 and am having trouble getting the IIS ApplicationInitialization module to call my endpoints on a startup/slot swap/scale out. </p> <p>I added a Web.Config like:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;configuration&gt; &lt;location path="." inheritInChildApplications="false"&gt; &lt;system.webServer&gt; &lt;handlers&gt; &lt;add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" /&gt; &lt;/handlers&gt; &lt;aspNetCore processPath="dotnet" arguments=".\FR911.Api.Core.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" hostingModel="inprocess" /&gt; &lt;applicationInitialization doAppInitAfterRestart="true"&gt; &lt;add initializationPage="api/Warmup&gt; &lt;add initializationPage="/" /&gt; &lt;/applicationInitialization&gt; &lt;/system.webServer&gt; &lt;/location&gt; &lt;/configuration&gt; </code></pre> <p>But if I keep the default hosting model of "inprocess" my warmup never gets called. If I change to "outofprocess" hosting, my warmup does get called before the swap is completed. </p> <p>I think the issue below is likely related:</p> <p><a href="https://github.com/aspnet/AspNetCore/issues/8057" rel="noreferrer">https://github.com/aspnet/AspNetCore/issues/8057</a></p> <p>I'm not looking to just manually ping or otherwise hit my endpoint because I want the existing feature in the module that IIS is Azure won't actually swap the endpoints until the warmup requests have finished (thus initing EFCore etc.)</p> <p>Has anyone had any luck getting this to work with the inprocess hosting model?</p>
0debug
static void host_x86_cpu_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); X86CPUClass *xcc = X86_CPU_CLASS(oc); uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0; xcc->kvm_required = true; host_cpuid(0x0, 0, &eax, &ebx, &ecx, &edx); x86_cpu_vendor_words2str(host_cpudef.vendor, ebx, edx, ecx); host_cpuid(0x1, 0, &eax, &ebx, &ecx, &edx); host_cpudef.family = ((eax >> 8) & 0x0F) + ((eax >> 20) & 0xFF); host_cpudef.model = ((eax >> 4) & 0x0F) | ((eax & 0xF0000) >> 12); host_cpudef.stepping = eax & 0x0F; cpu_x86_fill_model_id(host_cpudef.model_id); xcc->cpu_def = &host_cpudef; host_cpudef.cache_info_passthrough = true; dc->props = host_x86_cpu_properties; }
1threat
Can i pull html content from a exterior file? : <p>This might be a really stupid question... But i'm making a menu. Would it be possible to write the code for that menu in an outside source? and then pull it using Jquery or javascript and have it replaced in a location or something?</p> <p>The menu would look like:</p> <pre><code>&lt;span class="menulist"&gt; &lt;span id="homemenu"&gt; &lt;button id="home"&gt;Home&lt;/button&lt; &lt;/span&gt; &lt;span id="onemenu"&gt; &lt;button id="one"&gt;Page One&lt;/button&lt; &lt;/span&gt; &lt;/span&gt; </code></pre> <p>And have all that saved in a seperate file. I dn't care what type of file, .js, .txt, .html. and just pull the text and dump it as objects in a location specified for menu?</p> <p>If this theoretically works here, I could use it elsewhere. such as writing the story narrative in one file and revealing it, or revealing it in part, and having the layout and technical workings on another file.</p>
0debug
How to access html content of AccessibilityNodeInfo of a WebView element using Accessibility Service in Android? : <p>I'm trying to access the textual content of another app which is probably built using a non-native(js+html) based framework.</p> <p>Hence, I figured I'll try to access the data from an accessibility node corresponding to a WebView element. However, I'm unable to grab textual/html data using the usual methods since methods like getText() work only if it is a native android element such as a TextView, Button etc.</p> <pre><code>public class MyAccessibilityService extends AccessibilityService { @Override public void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) { AccessibilityNodeInfo accessibilityNodeInfo = accessibilityEvent.getSource(); if (accessibilityNodeInfo == null) { return; } int childCount = accessibilityNodeInfo.getChildCount(); for (int i = 0; i &lt; childCount; i++) { AccessibilityNodeInfo accessibilityNodeInfoChild = accessibilityNodeInfo.getChild(i); myRecursiveFunc(accessibilityNodeInfoChild); } } @Override public void onInterrupt() { } private void myRecursiveFunc(AccessibilityNodeInfo accessibilityNodeInfoChild) { if (accessibilityNodeInfoChild.getChildCount() &gt; 0) { for (int j = 0; j &lt; accessibilityNodeInfoChild.getChildCount(); j++) { AccessibilityNodeInfo child = accessibilityNodeInfoChild.getChild(j); if (child != null) { myRecursiveFunc(child); } } } else { if ("android.webkit.WebView".equals(accessibilityNodeInfoChild.getClassName())) { //===========This is a WebView's AccessibilityNodeInfo !!!! //===========How to get HTML data from nodeinfo object here ?? } } } </code></pre> <p>}</p>
0debug
static void gen_sync(DisasContext *ctx) { uint32_t l = (ctx->opcode >> 21) & 3; if (((l == 2) || !(ctx->insns_flags & PPC_64B)) && !ctx->pr) { gen_check_tlb_flush(ctx); } }
1threat
i need a help in FILES in C : <p>i am using code blocks trying to a write a simple code to display a file content on screen using a condition if the file didnt exist already the problem here is tht i already have a file in the directory but i get : "unable to open file " ? i am a beginner and i cant see where is the problem ...</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; int main() { FILE *f ; char ch ; f= fopen("C/:f.txt","r"); if (f == NULL) { printf("unable to open file \n"); system("PAUSE"); return 0 ; } do { ch = getc(f); fprintf(f,ch); }while(ch !=EOF) ; fclose(f); printf("/n"); system("pause"); return 0 ; } </code></pre>
0debug
static Aml *build_crs(PCIHostState *host, GPtrArray *io_ranges, GPtrArray *mem_ranges) { Aml *crs = aml_resource_template(); uint8_t max_bus = pci_bus_num(host->bus); uint8_t type; int devfn; for (devfn = 0; devfn < ARRAY_SIZE(host->bus->devices); devfn++) { int i; uint64_t range_base, range_limit; PCIDevice *dev = host->bus->devices[devfn]; if (!dev) { continue; } for (i = 0; i < PCI_NUM_REGIONS; i++) { PCIIORegion *r = &dev->io_regions[i]; range_base = r->addr; range_limit = r->addr + r->size - 1; if (!range_base || range_base > range_limit) { continue; } if (r->type & PCI_BASE_ADDRESS_SPACE_IO) { aml_append(crs, aml_word_io(AML_MIN_FIXED, AML_MAX_FIXED, AML_POS_DECODE, AML_ENTIRE_RANGE, 0, range_base, range_limit, 0, range_limit - range_base + 1)); crs_range_insert(io_ranges, range_base, range_limit); } else { aml_append(crs, aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, AML_NON_CACHEABLE, AML_READ_WRITE, 0, range_base, range_limit, 0, range_limit - range_base + 1)); crs_range_insert(mem_ranges, range_base, range_limit); } } type = dev->config[PCI_HEADER_TYPE] & ~PCI_HEADER_TYPE_MULTI_FUNCTION; if (type == PCI_HEADER_TYPE_BRIDGE) { uint8_t subordinate = dev->config[PCI_SUBORDINATE_BUS]; if (subordinate > max_bus) { max_bus = subordinate; } range_base = pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_IO); range_limit = pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_IO); if (range_base || range_base > range_limit) { aml_append(crs, aml_word_io(AML_MIN_FIXED, AML_MAX_FIXED, AML_POS_DECODE, AML_ENTIRE_RANGE, 0, range_base, range_limit, 0, range_limit - range_base + 1)); crs_range_insert(io_ranges, range_base, range_limit); } range_base = pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_MEMORY); range_limit = pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_MEMORY); if (range_base || range_base > range_limit) { aml_append(crs, aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, AML_NON_CACHEABLE, AML_READ_WRITE, 0, range_base, range_limit, 0, range_limit - range_base + 1)); crs_range_insert(mem_ranges, range_base, range_limit); } range_base = pci_bridge_get_base(dev, PCI_BASE_ADDRESS_MEM_PREFETCH); range_limit = pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_MEM_PREFETCH); if (range_base || range_base > range_limit) { aml_append(crs, aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, AML_NON_CACHEABLE, AML_READ_WRITE, 0, range_base, range_limit, 0, range_limit - range_base + 1)); crs_range_insert(mem_ranges, range_base, range_limit); } } } aml_append(crs, aml_word_bus_number(AML_MIN_FIXED, AML_MAX_FIXED, AML_POS_DECODE, 0, pci_bus_num(host->bus), max_bus, 0, max_bus - pci_bus_num(host->bus) + 1)); return crs; }
1threat
expanding R data.table by splitting on one column : <p>I have an R <code>data.table</code> like this:</p> <pre><code>&gt; old_table id values 1: 1 A,B,C 2: 2 D,E 3: 3 F 4: 4 G,H,I,J </code></pre> <p>I want to expand the table by splitting up the values column by commas (,) like so:</p> <pre><code>&gt; new_table id value 1: 1 A 2: 1 B 3: 1 C 4: 2 D 5: 2 E 6: 3 F 7: 4 G 7: 4 H 7: 4 I 7: 4 J </code></pre> <p>Is there an easy way to do this?</p>
0debug
Password handling with MD5 and CRYPT isn't working as expected : <p>What I am trying to do is self explanatory: I get a "username" and a "password" set by a user, and try to encrypt it.</p> <p>Here's what I've tried so far:</p> <pre><code>//Firstly i recieve user and pswd $usua=SQLite3::escapeString($_POST['usuario']); $psw=SQLite3::escapeString($_POST['psw']); //Then i proceed to encrypt $key = md5('firstWord'); $salt = md5('secondWord'); function hashword($string,$salt){ $string= crypt($string, '$1$'.$salt.'$'); } $psw = hashword($psw, $salt); </code></pre> <p>Some how this code always returns the same result: "$1$7b77d82".</p> <p>What's wrong?</p> <p>How would you do this? </p> <p>Should i use Bcrypt? </p> <p>Clearly this process should return different values for each password used but it doesn't.</p>
0debug
Actionscript error :( : im just a beginner at this and i would really appreciate some help :) This is my code: import flash.events.MouseEvent; import flash.display.MovieClip; var currentButton:MovieClip button1.addEventListener(MouseEvent.CLICK, mouseClick); button2.addEventListener(MouseEvent.CLICK, mouseClick); button3.addEventListener(MouseEvent.CLICK, mouseClick); button4.addEventListener(MouseEvent.CLICK, mouseClick); function mouseClick(event:MouseEvent):void { currentButton.alpha = 1; currentButton.mouseEnabled = true; currentButton = event.target as MovieClip; trace("CLICK"); currentButton.alpha = 0.7; currentButton.mouseEnabled = false; } But i get this error when i click on a button: TypeError: Error #1009: Cannot access a property or method of a null object reference. at Untitled_fla::MainTimeline/mouseClick() sorry if i didnt post this question right, im just new here
0debug