problem
stringlengths
26
131k
labels
class label
2 classes
How do I use allow_tags in django 2.0 admin? : <blockquote> <p>Support for the allow_tags attribute on ModelAdmin methods is removed.</p> </blockquote>
0debug
Verify if the user exists using Bcrypt and Spring : <p>I'm developing a login with sping and currently I have my password encrypted with Bcrypt. I have a user on my h2 database and to verify if the user credentials are correct and don't know what is advised.Should decrypt both passwords and compare them (I think that not the correct way to do it of course) or should I use another mechanism to verify if the user's credetials are right?</p>
0debug
(Newbie) Why can a function be defined in json object? : I am reading a React doc, https://reacttraining.com/react-router/web/example/auth-workflow, and trying to understand the following piece of code: Looks like a the function definition happens in a json object, but my understanding is that we can't have funciton inside json const fakeAuth = { isAuthenticated: false, authenticate(cb) { this.isAuthenticated = true; setTimeout(cb, 100); // fake async }, signout(cb) { this.isAuthenticated = false; setTimeout(cb, 100); } };
0debug
Create a new dataframe column with the first element of elements in another column in R : <p>I want to create a new column in my dataframe such that it is formed by the first element (or 2 elements) of elements in another column in the same dataframe. E.g.</p> <pre><code> columnA 1 "1234" 2 "9876" 3 "4567" </code></pre> <p>Turns into:</p> <pre><code> columnA columnB 1 "1234" "12" 2 "9876" "98" 3 "4567" "45" </code></pre> <p>I tried with the dplyr library like this:</p> <pre><code>dataframe %&gt;% mutate( columnB = columnA[1:2] ) </code></pre> <p>But this is trying to retrieve the first two rows.</p> <p>If anyone knows anyway to do this fast (preferably with dplyr library), I would appreciate it a lot. Thanks in advance.</p>
0debug
Can I generate script of a migration with EF code first and .net core : <p>I'm building a MVC application with .Net Core and I need to generate the script of a migration.</p> <p>With EF6 I did run the command </p> <pre><code>update-database -script </code></pre> <p>but when I try to do the same with .net Core is throwing the next exception:</p> <blockquote> <p>Update-Database : A parameter cannot be found that matches parameter name 'script'</p> </blockquote> <p>Do you know if there is an equivalent for EF7?</p>
0debug
How to Visual c++ like javascript date? : <p>Visual c++ like Javascrit (new Date()).getTime() function? Function return (1475262776012) milliseconds.</p>
0debug
'mat-card' is not a known element in Angular 7 : <p>I've seen a lot of questions on this but doesn't seem to be the same issue Im encountering. I have just created my 2nd angular project. I have a new component under <code>src/app/employees</code> where I am trying to use in employees.component.html . The error I am getting is:</p> <pre><code>Uncaught Error: Template parse errors: 'mat-card' is not a known element: 1. If 'mat-card' is an Angular component, then verify that it is part of this module. 2. If 'mat-card' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("[ERROR -&gt;]&lt;mat-card&gt; &lt;/mat-card&gt; </code></pre> <p>Now, in app.module.ts I have:</p> <pre><code>import { BrowserModule } from "@angular/platform-browser"; import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; import { LOCALE_ID, NgModule } from "@angular/core"; import { HttpClientModule, HTTP_INTERCEPTORS } from "@angular/common/http"; import { AppRoutingModule } from "./app-routing.module"; import { AppComponent } from "./app.component"; import { MatButtonModule, MatFormFieldModule, MatIconModule, MatInputModule, MatListModule, MatSelectModule, MatSidenavModule, MatCardModule, MatTableModule } from "@angular/material"; @NgModule({ declarations: [AppComponent], imports: [ BrowserModule, BrowserAnimationsModule, AppRoutingModule, HttpClientModule, MatButtonModule, MatFormFieldModule, MatIconModule, MatListModule, MatInputModule, MatSelectModule, MatSidenavModule, MatCardModule, MatTableModule ],.... }) export class AppModule {} </code></pre> <p>And there aren't any errors if I use <code>mat-card</code> in <code>app.component.html</code>. What am I missing here? </p>
0debug
How to get the id of selected option in datalist : <p>I know the method to get the id while the value in option is unique but my case is different</p> <pre><code>&lt;select id="product-list"&gt; &lt;option value="Product" id="1"&gt; &lt;option value="Product1" id="2"&gt; &lt;option value="Product1" id="3"&gt; &lt;option value="Product2" id="4"&gt; &lt;/select&gt; </code></pre> <p>Options are dynamically generated from database depending on the search query typed in input field. There are situations when multiple products come with same name but other different properties like rate or unit. So in order to solve the issue i want get the id of the selected option </p>
0debug
Subtract last modified date to current date : <p>I want to subtract the last modified date of a file to the current date. Is there a proper way that I can use in java? My problem is I don't know how to do it. </p>
0debug
Tracking the progress between Queues in a Map : <p>I have currently two queues and items traveling between them. Initially, an item gets put into <code>firstQueue</code>, then one of three dedicated thread moves it to <code>secondQueue</code> and finally another dedicated thread removes it. These moves obviously include some processing. I need to be able to get the status of any item (<code>IN_FIRST</code>, <code>AFTER_FIRST</code>, <code>IN_SECOND</code>, <code>AFTER_SECOND</code>, or <code>ABSENT</code>) and I implemented it manually by doing the update of the <code>statusMap</code> where the queue gets modified like</p> <pre><code>while (true) { Item i = firstQueue.take(); statusMap.put(i, AFTER_FIRST); process(i); secondQueue.add(i); statusMap.put(i, IN_SECOND); } </code></pre> <p>This works, but it's ugly and leaves a time window where the status is inconsistent. The inconsistency is no big deal and it'd solvable by synchronization, but this could backfire as the queue is of limited capacity and may block. The ugliness bothers me more.</p> <p>Efficiency hardly matters as the processing takes seconds. Dedicated threads are used in order to control concurrency. No item should ever be in multiple states (but this is not very important and not guaranteed by my current racy approach). There'll be more queues (and states) and they'll of different kinds (<code>DelayQueue</code>, <code>ArrayBlockingQueue</code>, and maybe <code>PriorityQueue</code>).</p> <p><em>I wonder if there's a nice solution generalizable to multiple queues?</em></p>
0debug
Go: invalid operation - type *map[key]value does not support indexing : <p>I'm trying to write a function that modifies original map that is passed by pointer but Go does not allow it. Let's say I have a big map and don't want to copy it back and forth.</p> <p>The code that uses passing by value is working and is doing what I need but involves passing by value (<a href="https://play.golang.org/p/-UUiJ9vbMa" rel="noreferrer">playground</a>):</p> <pre><code>package main import "fmt" type Currency string type Amount struct { Currency Currency Value float32 } type Balance map[Currency]float32 func (b Balance) Add(amount Amount) Balance { current, ok := b[amount.Currency] if ok { b[amount.Currency] = current + amount.Value } else { b[amount.Currency] = amount.Value } return b } func main() { b := Balance{Currency("USD"): 100.0} b = b.Add(Amount{Currency: Currency("USD"), Value: 5.0}) fmt.Println("Balance: ", b) } </code></pre> <p>But if I try to pass parameter as pointer like here (<a href="https://play.golang.org/p/kVCAt7074j" rel="noreferrer">playground</a>):</p> <pre><code>func (b *Balance) Add(amount Amount) *Balance { current, ok := b[amount.Currency] if ok { b[amount.Currency] = current + amount.Value } else { b[amount.Currency] = amount.Value } return b } </code></pre> <p>I'm getting compilation error:</p> <pre><code>prog.go:15: invalid operation: b[amount.Currency] (type *Balance does not support indexing) prog.go:17: invalid operation: b[amount.Currency] (type *Balance does not support indexing) prog.go:19: invalid operation: b[amount.Currency] (type *Balance does not support indexing) </code></pre> <p>How should I deal with this?</p>
0debug
How to open/run YML compose file? : <p>How can I open/run a YML compose file on my computer? I've installed Docker for Windows and Docker tools but couldn't figure out how.</p>
0debug
def square_Sum(n): return int(2*n*(n+1)*(2*n+1)/3)
0debug
Multiple application under single project in Angular 6 : <p>How to create multiple application under single project in Angular 6? In new angular.json file, there is no <code>"app":[]</code> array, where before we used to create/add multiple applications manually. Also there is no proper documentation I found at this stage, which elaborate how to create multiple application in single project. Any help would be appreciated. Thank you.</p>
0debug
Connect to host mongodb from docker container : <p>So I want to connect to my mongodb running on my host machine (DO droplet, Ubuntu 16.04). It is running on the default <code>27017</code> port on localhost.</p> <p>I then use <a href="https://github.com/zodern/meteor-up" rel="noreferrer">mup</a> to deploy my Meteor app on my DO droplet, which is using docker to run my Meteor app inside a container. So far so good. A standard <code>mongodb://...</code> connection url is used to connect the app to the mongodb. Now I have the following problem:</p> <p><code>mongodb://...@localhost:27017...</code> obviously does not work inside the docker container, as <code>localhost</code> is not the host's localhost.</p> <p>I already read many stackoverflow posts on this, I already tried using:</p> <ul> <li><code>--network="host"</code> - did not work as it said <code>0.0.0.0:80</code> is already in use or something like that (nginx proxy)</li> <li><code>--add-host="local:&lt;MY-DROPLET-INTERNET-IP&gt;"</code> and connect via <code>mongodb://...@local:27017...</code>: also not working as I can access my mongodb only from localhost, not from the public IP</li> </ul> <p>This has to be a common problem!</p> <p><strong>tl;dr</strong> - What is the proper way to expose the hosts <code>localhost</code> inside a docker container so I can connect to services running on the host? (including their ports, e.g. 27017).</p> <p>I hope someone can help!</p>
0debug
int ff_ccitt_unpack(AVCodecContext *avctx, const uint8_t *src, int srcsize, uint8_t *dst, int height, int stride, enum TiffCompr compr, int opts) { int j; GetBitContext gb; int *runs, *ref, *runend; int ret; int runsize= avctx->width + 2; runs = av_malloc(runsize * sizeof(runs[0])); ref = av_malloc(runsize * sizeof(ref[0])); ref[0] = avctx->width; ref[1] = 0; ref[2] = 0; init_get_bits(&gb, src, srcsize*8); for(j = 0; j < height; j++){ runend = runs + runsize; if(compr == TIFF_G4){ ret = decode_group3_2d_line(avctx, &gb, avctx->width, runs, runend, ref); if(ret < 0){ av_free(runs); av_free(ref); return -1; } }else{ int g3d1 = (compr == TIFF_G3) && !(opts & 1); if(compr!=TIFF_CCITT_RLE && find_group3_syncmarker(&gb, srcsize*8) < 0) break; if(compr==TIFF_CCITT_RLE || g3d1 || get_bits1(&gb)) ret = decode_group3_1d_line(avctx, &gb, avctx->width, runs, runend); else ret = decode_group3_2d_line(avctx, &gb, avctx->width, runs, runend, ref); if(compr==TIFF_CCITT_RLE) align_get_bits(&gb); } if(ret < 0){ put_line(dst, stride, avctx->width, ref); }else{ put_line(dst, stride, avctx->width, runs); FFSWAP(int*, runs, ref); } dst += stride; } av_free(runs); av_free(ref); return 0; }
1threat
static void dp8393x_writel(void *opaque, target_phys_addr_t addr, uint32_t val) { dp8393x_writew(opaque, addr, val & 0xffff); dp8393x_writew(opaque, addr + 2, (val >> 16) & 0xffff); }
1threat
R Reshaping data to wide format : I'd like to get my data to a specific format, but don't know how to get done with reshape(). My data looks like: df<-data.frame(Cues=c("A","B","C","A","B","C"), Targets=rep(1:3,2), Rater=rep(1:2, each=3), Rating=c(1,3,5,2,4,6)) And I would like to get it like: df2<-data.frame(Targets=rep(1:3,2), Cues=c("A","B","C","A","B","C"), Rater_1= c(1,2), Rater_2=c(3,5), Rater_3C=c(5,6)) I tried my best with the forum, reshape() and doesn't really get further. Could you guys help me? Thanks in advance and best, Josh
0debug
Firebase authentication vs AWS Cognito : <p>We are building a mobile and web app on AWS using API Gateway and Lambda and are currently evaluating if we should use all the AWS Mobile Servcies (Cognito, Analytics, Mobile Hub, etc) or if we should use Firebase instead (which offers some advantages like remote config).</p> <p>I think using the non-funtional part of firebase like Analytics, Remote Config, Crash Reports, Notification should be fine with the AWS backend. The part were I am not certain is the Authentication Layer. </p> <p>AWS Cognito integrates nicely into API Gateway and Lamdba e.g. only authenticated users can execute certain API calls. </p> <p>Can the same behaviour be reached if we use Firebase Authentication instead? Any good or bad experience with this?</p>
0debug
Most recent value or last seen value : <p>Prometheus is built around returning a <em>time series</em> representation of metrics. In many cases, however, I only care about what the state of a metric is <em>right now</em>, and I'm having a hard time figuring out a reliable way to get the "most recent" value of a metric.</p> <p>Since right now it's getting metrics every 30 seconds, I tried something like this:</p> <pre><code>my_metric[30s] </code></pre> <p>But this feels fragile. If metrics are dated any more or less than 30 seconds between data points, then I either get back more than one or zero results.</p> <p>How can I get the most recent value of a metric?</p>
0debug
java equals true with different hashcodes : I am going through the java.lang.Object API which states the below the point on objects equality: https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html **public boolean equals(Object obj):** > It is generally necessary to override the hashCode method whenever > this method is overridden, so as to maintain the general contract for > the hashCode method, which states that equal objects must have equal > hash codes. **Now to test the above theory on "equal objects must have equal hash codes", I have come up with the below simple code:** public class Product { private String name; public Product(String name) { this.name = name; } @Override public boolean equals(Object obj) { //always returns true for all objects return true; } @Override public int hashCode() { //Different hascodes for different objects if(name.equals("PRODUCT1")) { return 10; } else { return 20; } } public static void main(String[] args) { Product p1 = new Product("PRODUCT1"); Product p2 = new Product("PRODUCT2"); if(p1.equals(p2)) { System.out.println(" p1 p2 are equal **** "); } else { System.out.println(" p1 p2 are NOT equal **** "); } } } ***Output:*** p1 p2 are equal **** **So, is n't the above code violating/contradicting the API statement "equal objects must have equal hash codes" i.e., equal objects need NOT have same hashcodes ? Or else what am I missing in the above code ?** Please help.
0debug
What is difference between React vs React Fiber? : <p>I just heard that react-fiber is ready. What is the big differences between react and react-fiber? Is it worth it to learn the whole new concept for that differences ?</p>
0debug
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat
static int vmdk_open_desc_file(BlockDriverState *bs, int flags, char *buf, Error **errp) { int ret; char ct[128]; BDRVVmdkState *s = bs->opaque; if (vmdk_parse_description(buf, "createType", ct, sizeof(ct))) { error_setg(errp, "invalid VMDK image descriptor"); ret = -EINVAL; goto exit; } if (strcmp(ct, "monolithicFlat") && strcmp(ct, "vmfs") && strcmp(ct, "vmfsSparse") && strcmp(ct, "twoGbMaxExtentSparse") && strcmp(ct, "twoGbMaxExtentFlat")) { error_setg(errp, "Unsupported image type '%s'", ct); ret = -ENOTSUP; goto exit; } s->create_type = g_strdup(ct); s->desc_offset = 0; ret = vmdk_parse_extents(buf, bs, bs->file->exact_filename, errp); exit: return ret; }
1threat
how to uninstall Xampp completely in Mac? : actually when i tried to uninstall it , and reinstall it , it restore automatically all old files , without creating new ones . i had the latest Xampp 7.2.10 , i removed it frommy mac to reinstall new one , the Xampp that i removed i had changed mistakenly it's etc folder files , however when i reinstalled it i got same old etc folder which are corrupted , and i got same everything as the old Xampp which i already deleted . this problem i tried to solved it the whole day but i got same problem over and over again . thank you so much for your help !
0debug
Match only first and last 4 numbers using regex : <p>So i want to match the first number and the last four numbers using regex.</p> <p>I am able to get the last 4 numbers using <code>\d(?=\d{4})</code> but unable to get the first and last four numbers together. Tried multiple combinations.</p>
0debug
C++ hour calculations : <p>how can i write a source code for the calculations of time? For example,the user enter at 2.45 pm and check out at 3.15 . If we use simple mathematics , 3.15-2.45=0.7 . But if we use hour calculations 3.15-2.45=0.3(30minutes) . please help me .</p>
0debug
How to Display Dataframe next to Plot in Jupyter Notebook : <p>I understand how to display two plots next to each other (horizontally) in Jupyter Notebook, but I don't know if there is a way to display a plot with a dataframe next to it. I imagine it could look something like this:</p> <p><a href="https://i.stack.imgur.com/Dlsl9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Dlsl9.png" alt="enter image description here"></a></p> <p>However, I'm not able to do this, and whenever I print out the dataframe, it appears below my plot...</p> <p><a href="https://stackoverflow.com/questions/38783027/jupyter-notebook-display-two-pandas-tables-side-by-side">Here</a> is a similar question, but I am also outputting plots within this same cell that I want to be vertically oriented. </p> <p>I currently have this:</p> <pre><code># line plots df_plot[['DGO %chg','DLM %chg']].plot(figsize=(15,5),grid=True) plt.ylim((-ylim,ylim)) df_plot[['Diff']].plot(kind='area',color='lightgrey',figsize=(15,1)) plt.xticks([]) plt.xlabel('') plt.ylim((0,ylim_diff)) plt.show() # scatter plots plt.scatter(x=df_scat[:-7]['DGO'],y=df_scat[:-7]['DLM']) plt.scatter(x=df_scat[-7:]['DGO'],y=df_scat[-7:]['DLM'],color='red') plt.title('%s Cluster Last 7 Days'%asset) plt.show() # display dataframe # display(df_scat[['DGO','DLM']][:10]) &lt;-- prints underneath, not working </code></pre> <p><a href="https://i.stack.imgur.com/9TfH4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/9TfH4.png" alt="enter image description here"></a></p> <p>Where the red box shows where I want my dataframe to appear. Does anyone have any ideas about how to do this?</p> <p>Thanks for your thoughts!</p>
0debug
Stack around the variable ' ' was corrupted in c++ : <p>I m getting a run-time error when I try to call a constructor , and I think I m not doing right the memory deletion. Here is my construcor :</p> <pre><code>const int id_ferma; int suprafata; int nr_produse; char* produse[]; Ferma(int id_ferma, int suprafata, int nr_produse, char* produse[]) :id_ferma(id_ferma){ this-&gt;suprafata = suprafata; this-&gt;nr_produse = nr_produse; for (int i = 0; i &lt; nr_produse; i++){ this-&gt;produse[i] = new char[strlen(produse[i]) + 1]; strcpy(this-&gt;produse[i], produse[i]); cout &lt;&lt; produse[i] &lt;&lt; endl; } } </code></pre> <p>And here is my destructor:</p> <pre><code>~Ferma(){ for (int i = 0; i &lt; nr_produse; i++){ if (this-&gt;produse[i] != NULL) delete produse[i]; } } </code></pre> <p>And main:</p> <pre><code>int main(){ char* produse1[] = { "Lapte oaie", "Branza vaca", "Muschi de porc", "Oua de gaina" }; for (int i = 0; i &lt; 4; i++){ cout &lt;&lt; produse1[i]; } Ferma f1(14, 1500, 4, produse1); } </code></pre>
0debug
DBSCAN for clustering of geographic location data : <p>I have a dataframe with latitude and longitude pairs.</p> <p>Here is my dataframe look like.</p> <pre><code> order_lat order_long 0 19.111841 72.910729 1 19.111342 72.908387 2 19.111342 72.908387 3 19.137815 72.914085 4 19.119677 72.905081 5 19.119677 72.905081 6 19.119677 72.905081 7 19.120217 72.907121 8 19.120217 72.907121 9 19.119677 72.905081 10 19.119677 72.905081 11 19.119677 72.905081 12 19.111860 72.911346 13 19.111860 72.911346 14 19.119677 72.905081 15 19.119677 72.905081 16 19.119677 72.905081 17 19.137815 72.914085 18 19.115380 72.909144 19 19.115380 72.909144 20 19.116168 72.909573 21 19.119677 72.905081 22 19.137815 72.914085 23 19.137815 72.914085 24 19.112955 72.910102 25 19.112955 72.910102 26 19.112955 72.910102 27 19.119677 72.905081 28 19.119677 72.905081 29 19.115380 72.909144 30 19.119677 72.905081 31 19.119677 72.905081 32 19.119677 72.905081 33 19.119677 72.905081 34 19.119677 72.905081 35 19.111860 72.911346 36 19.111841 72.910729 37 19.131674 72.918510 38 19.119677 72.905081 39 19.111860 72.911346 40 19.111860 72.911346 41 19.111841 72.910729 42 19.111841 72.910729 43 19.111841 72.910729 44 19.115380 72.909144 45 19.116625 72.909185 46 19.115671 72.908985 47 19.119677 72.905081 48 19.119677 72.905081 49 19.119677 72.905081 50 19.116183 72.909646 51 19.113827 72.893833 52 19.119677 72.905081 53 19.114100 72.894985 54 19.107491 72.901760 55 19.119677 72.905081 </code></pre> <p>I want to cluster this points which are nearest to each other(200 meters distance) following is my distance matrix.</p> <pre><code>from scipy.spatial.distance import pdist, squareform distance_matrix = squareform(pdist(X, (lambda u,v: haversine(u,v)))) array([[ 0. , 0.2522482 , 0.2522482 , ..., 1.67313071, 1.05925366, 1.05420922], [ 0.2522482 , 0. , 0. , ..., 1.44111548, 0.81742536, 0.98978355], [ 0.2522482 , 0. , 0. , ..., 1.44111548, 0.81742536, 0.98978355], ..., [ 1.67313071, 1.44111548, 1.44111548, ..., 0. , 1.02310118, 1.22871515], [ 1.05925366, 0.81742536, 0.81742536, ..., 1.02310118, 0. , 1.39923529], [ 1.05420922, 0.98978355, 0.98978355, ..., 1.22871515, 1.39923529, 0. ]]) </code></pre> <p>Then I am applying DBSCAN clustering algorithm on distance matrix.</p> <pre><code> from sklearn.cluster import DBSCAN db = DBSCAN(eps=2,min_samples=5) y_db = db.fit_predict(distance_matrix) </code></pre> <p>I don't know how to choose eps &amp; min_samples value. It clusters the points which are way too far, in one cluster.(approx 2 km in distance) Is it because it calculates euclidean distance while clustering? please help.</p>
0debug
Inheriting Mongoose schemas : <p>I wanted to make a base 'Entity Schema', and other model entities would inherit from it. I did it, kinda, but then strange thing happened. </p> <p>Those are my schemas: </p> <ul> <li>AbstractEntitySchema</li> <li>MessageSchema</li> <li>UserSchema</li> <li>RoomSchema</li> </ul> <p>File: <a href="https://github.com/mihaelamj/nodechat/blob/master/models/db/mongo/schemas.js" rel="noreferrer">https://github.com/mihaelamj/nodechat/blob/master/models/db/mongo/schemas.js</a></p> <p>But in MongoDB, they are all saved in the same document store: 'entity models' not separate ones, like Messages, Users.. Did I get what was supposed to happen, but not what I wanted, separate stores? If so I will just make a basic JSON/object as entity and append the appropriate properties for each entity. Or is there a better way? Thanks.</p>
0debug
jQuery(...).autoComplete is not a function : <p>I'm trying to get autoComplete() to work from jQuery-ui. I've created a fiddle to show my code:</p> <p><a href="https://jsfiddle.net/4s4dzwn1/" rel="nofollow">https://jsfiddle.net/4s4dzwn1/</a></p> <p>My JS:</p> <pre><code>jQuery(function(){ jQuery('#autocomplete').autoComplete({ source: ["ActionScript", "Bootstrap", "C", "C++", "Ecommerce", "Jquery", "Groovy", "Java", "JavaScript", "Lua", "Perl", "Ruby", "Scala", "Swing", "XHTML"] }); }); </code></pre> <p>My HTML:</p> <pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"&gt;&lt;/script&gt; &lt;form&gt; &lt;input id="autocomplete"&gt; &lt;/form&gt; </code></pre> <p>It's throwing an error that says autoComplete is not a function. My understanding is that autoComplete is a part of jQuery-ui (which is included), and that jQuery-ui should be included <strong>after</strong> jquery. Please correct me where I'm wrong.</p>
0debug
const AVOption *av_set_string(void *obj, const char *name, const char *val){ const AVOption *o= av_find_opt(obj, name, NULL, 0, 0); if(o && o->offset==0 && o->type == FF_OPT_TYPE_CONST && o->unit){ return set_all_opt(obj, o->unit, o->default_val); } if(!o || !val || o->offset<=0) return NULL; if(o->type != FF_OPT_TYPE_STRING){ for(;;){ int i; char buf[256]; int cmd=0; double d; char *error = NULL; if(*val == '+' || *val == '-') cmd= *(val++); for(i=0; i<sizeof(buf)-1 && val[i] && val[i]!='+' && val[i]!='-'; i++) buf[i]= val[i]; buf[i]=0; val+= i; d = ff_eval2(buf, const_values, const_names, NULL, NULL, NULL, NULL, NULL, &error); if(isnan(d)) { const AVOption *o_named= av_find_opt(obj, buf, o->unit, 0, 0); if(o_named && o_named->type == FF_OPT_TYPE_CONST) d= o_named->default_val; else if(!strcmp(buf, "default")) d= o->default_val; else if(!strcmp(buf, "max" )) d= o->max; else if(!strcmp(buf, "min" )) d= o->min; else if(!strcmp(buf, "none" )) d= 0; else if(!strcmp(buf, "all" )) d= ~0; else { if (!error) av_log(NULL, AV_LOG_ERROR, "Unable to parse option value \"%s\": %s\n", val, error); return NULL; } } if(o->type == FF_OPT_TYPE_FLAGS){ if (cmd=='+') d= av_get_int(obj, name, NULL) | (int64_t)d; else if(cmd=='-') d= av_get_int(obj, name, NULL) &~(int64_t)d; }else if(cmd=='-') d= -d; av_set_number(obj, name, d, 1, 1); if(!*val) return o; } return NULL; } memcpy(((uint8_t*)obj) + o->offset, val, sizeof(val)); return o; }
1threat
static void musb_packet(MUSBState *s, MUSBEndPoint *ep, int epnum, int pid, int len, USBCallback cb, int dir) { int ret; int idx = epnum && dir; int ttype; ttype = epnum ? (ep->type[idx] >> 4) & 3 : 0; ep->timeout[dir] = musb_timeout(ttype, ep->type[idx] >> 6, ep->interval[idx]); ep->interrupt[dir] = ttype == USB_ENDPOINT_XFER_INT; ep->delayed_cb[dir] = cb; ep->packey[dir].p.pid = pid; ep->packey[dir].p.devaddr = ep->faddr[idx]; ep->packey[dir].p.devep = ep->type[idx] & 0xf; ep->packey[dir].p.data = (void *) ep->buf[idx]; ep->packey[dir].p.len = len; ep->packey[dir].ep = ep; ep->packey[dir].dir = dir; if (s->port.dev) ret = usb_handle_packet(s->port.dev, &ep->packey[dir].p); else ret = USB_RET_NODEV; if (ret == USB_RET_ASYNC) { ep->status[dir] = len; return; } ep->status[dir] = ret; musb_schedule_cb(&s->port, &ep->packey[dir].p); }
1threat
Android AlarmManager triggers every "round" 10 minutes : <p>I use the AlarmManager in my app as follows:</p> <pre><code>alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), AlarmManager.INTERVAL_HALF_DAY, intent); </code></pre> <p>Which I'd expect to trigger the alarm somewhere between 12 and 24 hours from each trigger. However, the behavior specifically on HTC devices is rather weird:</p> <p>Each time the alarm is triggered, we send an HTTP request to our servers. On all devices, we see requests coming to the server uniformly over time, but on HTC devices there are spikes every "round" 10 minutes (XX:10, XX:20, ...): <a href="https://i.stack.imgur.com/ZDXJK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZDXJK.png" alt="enter image description here"></a></p> <p>What can be the cause for these spikes? And why would it only be on HTC devices?</p>
0debug
Send Footer To the End of The Page : <p>How can I send my footer towards the bottom of my screen and how can I extend it to the full screen in a responsive way? <a href="https://i.stack.imgur.com/19lSB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/19lSB.jpg" alt="enter image description here"></a></p> <p>Footer.css:</p> <pre><code>* { margin: 0; } html, body { height: 100%; } .page-wrap { min-height: 100%; margin-bottom: -142px; } .page-wrap:after { content: ""; display: block; } .site-footer, .page-wrap:after { height: 142px; } .site-footer { background: black; } .text{ color: white; } </code></pre> <p>Footer.tsx:</p> <pre><code>const Footer = () =&gt; ( &lt;footer className="site-footer"&gt; &lt;p className = 'text'&gt; APP&lt;/p&gt; &lt;/footer&gt; ); export default Footer; </code></pre>
0debug
Room persistance library. Delete all : <p>How can I delete all entries on specific table using Room Persistence Library? I need to drop table, but I cannot to find any information how to do this.</p> <p>Only when database is migrating or to load all entries and delete them :)</p>
0debug
Java: string replace : I have to replace all the commas that are between double quotes with a dot. I'm trying to do that with the replace and replaceAll Java's methods. But I still didn't sort out a solution. Can someone help me?
0debug
window.location.href = 'http://attack.com?user=' + user_input;
1threat
static int ftp_send_command(FTPContext *s, const char *command, const int response_codes[], char **response) { int err; if ((err = ftp_flush_control_input(s)) < 0) return err; s->conn_control_block_flag = 0; if ((err = ffurl_write(s->conn_control, command, strlen(command))) < 0) return err; if (!err) return -1; if (response_codes) { return ftp_status(s, response, response_codes); } return 0; }
1threat
what's the point of having both Iterator.forEachRemaining() and Iterable.forEach()? : <p>and both of them get a Consumer as parameter. so if Java 8, is meant to avoid confusions, like it has done in Time API, why has it added a new confusion? or am I missing some point?</p>
0debug
int do_balloon(Monitor *mon, const QDict *params, MonitorCompletion cb, void *opaque) { int ret; if (kvm_enabled() && !kvm_has_sync_mmu()) { qerror_report(QERR_KVM_MISSING_CAP, "synchronous MMU", "balloon"); return -1; } ret = qemu_balloon(qdict_get_int(params, "value")); if (ret == 0) { qerror_report(QERR_DEVICE_NOT_ACTIVE, "balloon"); return -1; } cb(opaque, NULL); return 0; }
1threat
How to hide any div inside html form if internet is not availaible : <p>Hello Guys I would like to know if it is possible to hide the div if the internet is not availaible. Here is the code</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>if(navigator.onLine) { //show } else{ //Hide } </code></pre> </div> </div> </p> <p>Thanks in advance.</p>
0debug
static void vhost_user_cleanup(NetClientState *nc) { VhostUserState *s = DO_UPCAST(VhostUserState, nc, nc); vhost_user_stop(s); qemu_purge_queued_packets(nc); }
1threat
Suppose that n women check their coats at a concert : <p>I have a seemingly difficult algorithm that I must construct, and I'm not sure where to even start. Here it is:</p> <p>Suppose that n women check their coats at a concert. However, at the end of the night, the attendant has lost the claim checks and does not know which coat belongs to whom. All of the women came dressed in black coats that were nearly identical, but of different sizes. The attendant can have a woman try a coat, and find out whether the coat fits (meaning it belongs to that woman), or the coat is too big, or the coat is too small. However, the attendant cannot compare the sizes of two coats directly, or compare the sizes of two women directly. Describe how the attendant can determine which coat belongs to which woman in expected O(n log n) time. </p> <p>I've thought of ways to do this, but none come close to O(n log n) time. Any help with this would be greatly appreciated.</p>
0debug
Extracting table names from multiple strings using perl regex : I want to extract the table names after FROM from this code : from DS_RAN_CORID t1, NAMON_GNS t4, NA_VAL_ROL t6, A_TI_G_V t7, PTSM_TCR t2 left outer join T_TR_COR_LAG t3 on t2.inp_seq = t3.inp_seq and t3.ti_number = t2.ti_number left outer join OUT_TR_COR t5 on t2.inp_seq=t5.inp_seq and t5.ti_number=t2.ti_number where t1.inp_seq = t2.inp_seq and t2.ti_number = t6.interval_number and t1.ti_grp = t7.dm_group and t2.ti_number = t7.interval_number; The tables i need to extract:DS_RAN_CORID/ NAMON_GNS/ NA_VAL_ROL/ A_TI_G_V/ PTSM_TCR/ I tried something like this: 1.Match the t1. , t2. etc , this is for any letter . any digit $string=~m/(\S).\d/gi; 2.Assuming that my code is correct i need to compare the t1. with TABLE_NAME t1 and extract the table name with something like this: $string=~m/\w+\s+(S)\d/gi;
0debug
Chnage Jmeter Threads Pool size : In **Response data**, I am Getting Error message. **I want to Increse Pool Size 10 to 100 !** Urgent Help me pls. {"errorCode":"INTERNAL_SERVER_ERROR","message":"Task java.util.concurrent.FutureTask@428373db rejected from java.util.concurrent.ThreadPoolExecutor@7114477d[Running, pool size = 10, active threads = 10, queued tasks = 0, completed tasks = 30014]"}
0debug
void vnc_init_state(VncState *vs) { vs->initialized = true; VncDisplay *vd = vs->vd; vs->last_x = -1; vs->last_y = -1; vs->as.freq = 44100; vs->as.nchannels = 2; vs->as.fmt = AUD_FMT_S16; vs->as.endianness = 0; qemu_mutex_init(&vs->output_mutex); vs->bh = qemu_bh_new(vnc_jobs_bh, vs); QTAILQ_INSERT_HEAD(&vd->clients, vs, next); graphic_hw_update(vd->dcl.con); vnc_write(vs, "RFB 003.008\n", 12); vnc_flush(vs); vnc_read_when(vs, protocol_version, 12); reset_keys(vs); if (vs->vd->lock_key_sync) vs->led = qemu_add_led_event_handler(kbd_leds, vs); vs->mouse_mode_notifier.notify = check_pointer_type_change; qemu_add_mouse_mode_change_notifier(&vs->mouse_mode_notifier); }
1threat
Avro Serialization/Deserialization to/from Kafka Topic : <p>I am trying to create a generic utility which would read avro files from Kafka topic and write avro files to the topic in Java. I could not find much documentation on the same. Appreciate any working code.</p>
0debug
What's the best way to return List of data from controller : <p>I have a <code>List&lt;MyModel&gt;</code> that I am returning from controller to <code>view</code></p> <p>Shall I create a new class to hold this <code>List</code> and return object of the new class or I can return the <code>List</code> itself..</p> <p>which one is a better programming practice ??</p>
0debug
static int img_resize(int argc, char **argv) { Error *err = NULL; int c, ret, relative; const char *filename, *fmt, *size; int64_t n, total_size; bool quiet = false; BlockBackend *blk = NULL; QemuOpts *param; static QemuOptsList resize_options = { .name = "resize_options", .head = QTAILQ_HEAD_INITIALIZER(resize_options.head), .desc = { { .name = BLOCK_OPT_SIZE, .type = QEMU_OPT_SIZE, .help = "Virtual disk size" }, { } }, }; bool image_opts = false; if (argc < 3) { error_exit("Not enough arguments"); return 1; } size = argv[--argc]; fmt = NULL; for(;;) { static const struct option long_options[] = { {"help", no_argument, 0, 'h'}, {"object", required_argument, 0, OPTION_OBJECT}, {"image-opts", no_argument, 0, OPTION_IMAGE_OPTS}, {0, 0, 0, 0} }; c = getopt_long(argc, argv, "f:hq", long_options, NULL); if (c == -1) { break; } switch(c) { case '?': case 'h': help(); break; case 'f': fmt = optarg; break; case 'q': quiet = true; break; case OPTION_OBJECT: { QemuOpts *opts; opts = qemu_opts_parse_noisily(&qemu_object_opts, optarg, true); if (!opts) { return 1; } } break; case OPTION_IMAGE_OPTS: image_opts = true; break; } } if (optind != argc - 1) { error_exit("Expecting one image file name"); } filename = argv[optind++]; if (qemu_opts_foreach(&qemu_object_opts, user_creatable_add_opts_foreach, NULL, NULL)) { return 1; } switch (size[0]) { case '+': relative = 1; size++; break; case '-': relative = -1; size++; break; default: relative = 0; break; } param = qemu_opts_create(&resize_options, NULL, 0, &error_abort); qemu_opt_set(param, BLOCK_OPT_SIZE, size, &err); if (err) { error_report_err(err); ret = -1; qemu_opts_del(param); goto out; } n = qemu_opt_get_size(param, BLOCK_OPT_SIZE, 0); qemu_opts_del(param); blk = img_open(image_opts, filename, fmt, BDRV_O_RDWR | BDRV_O_RESIZE, false, quiet); if (!blk) { ret = -1; goto out; } if (relative) { total_size = blk_getlength(blk) + n * relative; } else { total_size = n; } if (total_size <= 0) { error_report("New image size must be positive"); ret = -1; goto out; } ret = blk_truncate(blk, total_size); switch (ret) { case 0: qprintf(quiet, "Image resized.\n"); break; case -ENOTSUP: error_report("This image does not support resize"); break; case -EACCES: error_report("Image is read-only"); break; default: error_report("Error resizing image: %s", strerror(-ret)); break; } out: blk_unref(blk); if (ret) { return 1; } return 0; }
1threat
I have this join sql statement but i cant seem to get the output that i want : SELECT * FROM tblcheck as ch INNER JOIN rooms as r on ch.room_id = r.room_id INNER JOIN roomtype as c on c.RoomType_id = r.RoomType_id INNER JOIN guest as g on g.room_id = ch.room_id the i output i want is to display this Guest Name || Room Name || Roomtype || Check-in Date and Time but i have an error in the guest name. It displays everyone in the Guest Table :( Please help me
0debug
Angular 2 Input Directive Modifying Form Control Value : <p>I have a simple Angular 2 directive that modifies the input value of a textbox. Note that i'm using the Model-Driven form approach.</p> <pre><code>@Directive({ selector: '[appUpperCase]' }) export class UpperCaseDirective{ constructor(private el: ElementRef, private control : NgControl) { } @HostListener('input',['$event']) onEvent($event){ console.log($event); let upper = this.el.nativeElement.value.toUpperCase(); this.control.valueAccessor.writeValue(upper); } } </code></pre> <p>The dom updates properly, however the model updates after every other keystroke. Take a look at the <a href="http://plnkr.co/edit/qKM1Fpfwanub3nFoSMTA?p=preview" rel="noreferrer">plnkr</a></p>
0debug
Nested for loop ( c#) : it seems that I'm kinda stuck with an assignment. I need to use nested for loops to get this outcome: 0**** 01*** 012** 0123* 01234 but whatever I do I just don't seem to get there. I know it's a pretty basic assignment. If anyone could help me out I would be very gratefull.
0debug
My Simple javascript code isn't working. Can someone help me out with document.get ElementById? Thanks? : function even()for(i=0;i<10;i++){ if (i%2 == 0){ alert(i);}} document.getElementById("even").innerHTML = i + '<br>' ;}
0debug
static int decode_pulses(Pulse *pulse, GetBitContext *gb, const uint16_t *swb_offset, int num_swb) { int i, pulse_swb; pulse->num_pulse = get_bits(gb, 2) + 1; pulse_swb = get_bits(gb, 6); if (pulse_swb >= num_swb) return -1; pulse->pos[0] = swb_offset[pulse_swb]; pulse->pos[0] += get_bits(gb, 5); if (pulse->pos[0] > 1023) return -1; pulse->amp[0] = get_bits(gb, 4); for (i = 1; i < pulse->num_pulse; i++) { pulse->pos[i] = get_bits(gb, 5) + pulse->pos[i - 1]; if (pulse->pos[i] > 1023) return -1; pulse->amp[i] = get_bits(gb, 4); } return 0; }
1threat
No resource found that matches the given name (at 'cardBackgroundColor' with value '?android:attr/colorBackgroundFloating') : <p>I am getting these two error messages when trying to compile:</p> <pre><code>/Users/dericw/coding/myApplication/lfdate/android/app/build/intermediates/exploded-aar/com.android.support/cardview-v7/23.2.1/res/values-v23/values-v23.xml Error:(3, 5) No resource found that matches the given name (at 'cardBackgroundColor' with value '?android:attr/colorBackgroundFloating'). Error:Execution failed for task ':app:processDebugResources'. &gt; com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/dericw/Library/Android/sdk/build-tools/23.0.2/aapt'' finished with non-zero exit value 1 </code></pre> <p>Android Studio then opens up <code>v23/values-23.xml</code> with this style:</p> <pre><code> &lt;style name="CardView" parent="Base.CardView"&gt; &lt;item name="cardBackgroundColor"&gt;?android:attr/colorBackgroundFloating&lt;/item&gt; &lt;/style&gt; </code></pre> <p>But I don't have that defined anywhere in my app. It is a generated file that is giving me the error. I am pretty stumped on how to fix this issue? Has anyone every encountered this before? How do I fix this?</p> <p><strong>Project Build File</strong></p> <pre><code>buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.5.0' classpath 'com.google.gms:google-services:2.0.0-alpha6' } } allprojects { repositories { jcenter() } } </code></pre> <p><strong>App Build File</strong></p> <pre><code>buildscript { repositories { mavenCentral() maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'io.fabric.tools:gradle:1.+' } } apply plugin: 'com.android.application' apply plugin: 'io.fabric' android { compileSdkVersion 22 buildToolsVersion '23.0.2' defaultConfig { applicationId "com.something.myapp" minSdkVersion 16 targetSdkVersion 22 versionCode 200 versionName "1.7.1" } buildTypes { debug { versionNameSuffix '-debug' } release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release zipAlignEnabled true } } packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' } sourceSets { androidTest.setRoot('src/test') } } repositories { mavenCentral() maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } maven { url 'https://maven.fabric.io/public' } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile('com.crashlytics.sdk.android:crashlytics:2.4.0@aar') { transitive = true; } compile('org.apache.httpcomponents:httpmime:4.3.6') { exclude module: 'httpclient' } compile project(':viewPagerIndicator') compile 'com.android.support:appcompat-v7:22.2.1' compile 'com.android.support:cardview-v7:22.2.1' compile 'com.android.support:recyclerview-v7:22.2.1' compile 'com.android.support:design:22.2.1' compile 'com.facebook.android:facebook-android-sdk:4.+' compile 'com.mcxiaoke.volley:library:1.+' compile 'com.parse.bolts:bolts-android:1.+' compile 'com.parse:parse-android:1.+' compile 'com.google.android.gms:play-services-gcm:8.3.0' compile 'com.google.android.gms:play-services-analytics:8.3.0' compile 'joda-time:joda-time:2.+' compile 'com.koushikdutta.async:androidasync:2.+' compile 'com.edmodo:rangebar:1.+' compile 'org.lucasr.twowayview:twowayview:0.+' compile 'com.github.amlcurran.showcaseview:library:5.4.+' compile 'com.nostra13.universalimageloader:universal-image-loader:1.+' compile 'com.getbase:floatingactionbutton:1.+' compile 'com.mixpanel.android:mixpanel-android:4.+' compile 'org.apache.httpcomponents:httpclient-android:4.3.5' compile 'com.wefika:flowlayout:0.+' compile 'com.hudomju:swipe-to-dismiss-undo:1.+' compile 'com.soundcloud.android:android-crop:1.0.1@aar' compile 'com.squareup.picasso:picasso:2.+' } apply plugin: 'com.google.gms.google-services' </code></pre>
0debug
how 'while (*dst++ = *src++) ;' be executed? : <p>I read this in a strcpy funciton. </p> <pre><code>while (*dst++ = *src++) ; </code></pre> <p>I'm not really sure the execute order. who can help me?</p>
0debug
Strange error with C++ console app when running a for loop : <p>So I was messing around with the dimensions of an array, starting it with [25][25]. I've eventually found the best dimensions of it ([21][25]) but I've forgot to change the condition in the for loop which is displaying the array (Initially it was y&lt;25 and it had to be y&lt;21). The program ran just fine but there was a strange error. What the array was displaying was pretty strange and also it made sounds (the sound is very familiar, although I can't tell exactly what it is. I can guess it is the one you get when you try to open a shortcut which file's destination was deleted but I'm not very sure, as I've said very familiar tho.)<a href="https://i.stack.imgur.com/z6SrE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z6SrE.png" alt="enter image description here"></a> I have also uploaded a screenshot and you can see the error for yourself ( the 2 lines before the "Process returned 0" one). Any idea why these specific characters tho ( I mean a smiley face? come on.)?</p>
0debug
How to count dynamic submitting by button : <p>I have html structure like this</p> <p><a href="https://i.stack.imgur.com/5wzqJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5wzqJ.png" alt="enter image description here"></a></p> <pre><code>&lt;div class="count-box cocuk-count"&gt; &lt;span class="count-text"&gt;Çocuk:&lt;/span&gt; &lt;span class="kisi-down"&gt;&lt;/span&gt; &lt;span class="kisi-sayi-text"&gt;1&lt;/span&gt; &lt;span class="kisi-up"&gt;&lt;/span&gt; &lt;/div&gt; </code></pre> <p>and if I click first button (minus) it must counting forwards or if I click second button (plus) it must counting how can be possible by jquery ?</p>
0debug
static int do_create(struct iovec *iovec) { int ret; V9fsString path; int flags, mode, uid, gid, cur_uid, cur_gid; v9fs_string_init(&path); ret = proxy_unmarshal(iovec, PROXY_HDR_SZ, "sdddd", &path, &flags, &mode, &uid, &gid); if (ret < 0) { goto unmarshal_err_out; } cur_uid = geteuid(); cur_gid = getegid(); ret = setfsugid(uid, gid); if (ret < 0) { ret = -errno; goto err_out; } ret = open(path.data, flags, mode); if (ret < 0) { ret = -errno; } err_out: setfsugid(cur_uid, cur_gid); unmarshal_err_out: v9fs_string_free(&path); return ret; }
1threat
static int nbd_co_receive_request(NBDRequest *req, struct nbd_request *request) { NBDClient *client = req->client; int csock = client->sock; int rc; client->recv_coroutine = qemu_coroutine_self(); if (nbd_receive_request(csock, request) == -1) { rc = -EIO; goto out; } if (request->len > NBD_BUFFER_SIZE) { LOG("len (%u) is larger than max len (%u)", request->len, NBD_BUFFER_SIZE); rc = -EINVAL; goto out; } if ((request->from + request->len) < request->from) { LOG("integer overflow detected! " "you're probably being attacked"); rc = -EINVAL; goto out; } TRACE("Decoding type"); if ((request->type & NBD_CMD_MASK_COMMAND) == NBD_CMD_WRITE) { TRACE("Reading %u byte(s)", request->len); if (qemu_co_recv(csock, req->data, request->len) != request->len) { LOG("reading from socket failed"); rc = -EIO; goto out; } } rc = 0; out: client->recv_coroutine = NULL; return rc; }
1threat
static inline void RENAME(rgb32to24)(const uint8_t *src,uint8_t *dst,long src_size) { uint8_t *dest = dst; const uint8_t *s = src; const uint8_t *end; #ifdef HAVE_MMX const uint8_t *mm_end; #endif end = s + src_size; #ifdef HAVE_MMX __asm __volatile(PREFETCH" %0"::"m"(*s):"memory"); mm_end = end - 31; while(s < mm_end) { __asm __volatile( PREFETCH" 32%1\n\t" "movq %1, %%mm0\n\t" "movq 8%1, %%mm1\n\t" "movq 16%1, %%mm4\n\t" "movq 24%1, %%mm5\n\t" "movq %%mm0, %%mm2\n\t" "movq %%mm1, %%mm3\n\t" "movq %%mm4, %%mm6\n\t" "movq %%mm5, %%mm7\n\t" "psrlq $8, %%mm2\n\t" "psrlq $8, %%mm3\n\t" "psrlq $8, %%mm6\n\t" "psrlq $8, %%mm7\n\t" "pand %2, %%mm0\n\t" "pand %2, %%mm1\n\t" "pand %2, %%mm4\n\t" "pand %2, %%mm5\n\t" "pand %3, %%mm2\n\t" "pand %3, %%mm3\n\t" "pand %3, %%mm6\n\t" "pand %3, %%mm7\n\t" "por %%mm2, %%mm0\n\t" "por %%mm3, %%mm1\n\t" "por %%mm6, %%mm4\n\t" "por %%mm7, %%mm5\n\t" "movq %%mm1, %%mm2\n\t" "movq %%mm4, %%mm3\n\t" "psllq $48, %%mm2\n\t" "psllq $32, %%mm3\n\t" "pand %4, %%mm2\n\t" "pand %5, %%mm3\n\t" "por %%mm2, %%mm0\n\t" "psrlq $16, %%mm1\n\t" "psrlq $32, %%mm4\n\t" "psllq $16, %%mm5\n\t" "por %%mm3, %%mm1\n\t" "pand %6, %%mm5\n\t" "por %%mm5, %%mm4\n\t" MOVNTQ" %%mm0, %0\n\t" MOVNTQ" %%mm1, 8%0\n\t" MOVNTQ" %%mm4, 16%0" :"=m"(*dest) :"m"(*s),"m"(mask24l), "m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh) :"memory"); dest += 24; s += 32; } __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #endif while(s < end) { #ifdef WORDS_BIGENDIAN s++; dest[2] = *s++; dest[1] = *s++; dest[0] = *s++; dest += 3; #else *dest++ = *s++; *dest++ = *s++; *dest++ = *s++; s++; #endif } }
1threat
static int qesd_init_in (HWVoiceIn *hw, audsettings_t *as) { ESDVoiceIn *esd = (ESDVoiceIn *) hw; audsettings_t obt_as = *as; int esdfmt = ESD_STREAM | ESD_RECORD; int err; sigset_t set, old_set; sigfillset (&set); esdfmt |= (as->nchannels == 2) ? ESD_STEREO : ESD_MONO; switch (as->fmt) { case AUD_FMT_S8: case AUD_FMT_U8: esdfmt |= ESD_BITS8; obt_as.fmt = AUD_FMT_U8; break; case AUD_FMT_S16: case AUD_FMT_U16: esdfmt |= ESD_BITS16; obt_as.fmt = AUD_FMT_S16; break; case AUD_FMT_S32: case AUD_FMT_U32: dolog ("Will use 16 instead of 32 bit samples\n"); esdfmt |= ESD_BITS16; obt_as.fmt = AUD_FMT_S16; break; } obt_as.endianness = AUDIO_HOST_ENDIANNESS; audio_pcm_init_info (&hw->info, &obt_as); hw->samples = conf.samples; esd->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); if (!esd->pcm_buf) { dolog ("Could not allocate buffer (%d bytes)\n", hw->samples << hw->info.shift); return -1; } esd->fd = -1; err = pthread_sigmask (SIG_BLOCK, &set, &old_set); if (err) { qesd_logerr (err, "pthread_sigmask failed\n"); goto fail1; } esd->fd = esd_record_stream (esdfmt, as->freq, conf.adc_host, NULL); if (esd->fd < 0) { qesd_logerr (errno, "esd_record_stream failed\n"); goto fail2; } if (audio_pt_init (&esd->pt, qesd_thread_in, esd, AUDIO_CAP, AUDIO_FUNC)) { goto fail3; } err = pthread_sigmask (SIG_SETMASK, &old_set, NULL); if (err) { qesd_logerr (err, "pthread_sigmask(restore) failed\n"); } return 0; fail3: if (close (esd->fd)) { qesd_logerr (errno, "%s: close on esd socket(%d) failed\n", AUDIO_FUNC, esd->fd); } esd->fd = -1; fail2: err = pthread_sigmask (SIG_SETMASK, &old_set, NULL); if (err) { qesd_logerr (err, "pthread_sigmask(restore) failed\n"); } fail1: qemu_free (esd->pcm_buf); esd->pcm_buf = NULL; return -1; }
1threat
void helper_fstoq(CPUSPARCState *env, float32 src) { clear_float_exceptions(env); QT0 = float32_to_float128(src, &env->fp_status); check_ieee_exceptions(env); }
1threat
static void pcx_palette(const uint8_t **src, uint32_t *dst, unsigned int pallen) { unsigned int i; for (i = 0; i < pallen; i++) *dst++ = bytestream_get_be24(src); if (pallen < 256) memset(dst, 0, (256 - pallen) * sizeof(*dst)); }
1threat
How to show 20 fake items when loading the recyclerview? : <p>I'm trying to show some list of items in a recyclerview, following the next article <a href="https://github.com/giolaoit/LoadMoreRecyclerView" rel="nofollow noreferrer">GIT REPO</a>. I need to load 20 fake items before the recyclerview loads the next real items, as a loading. But I don´t know how to insert this cells and later.</p> <p>Someone could give me a hand?</p> <p><a href="https://i.stack.imgur.com/uhczQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uhczQ.png" alt="enter image description here"></a></p>
0debug
void arm_debug_excp_handler(CPUState *cs) { ARMCPU *cpu = ARM_CPU(cs); CPUARMState *env = &cpu->env; CPUWatchpoint *wp_hit = cs->watchpoint_hit; if (wp_hit) { if (wp_hit->flags & BP_CPU) { cs->watchpoint_hit = NULL; if (check_watchpoints(cpu)) { bool wnr = (wp_hit->flags & BP_WATCHPOINT_HIT_WRITE) != 0; bool same_el = arm_debug_target_el(env) == arm_current_el(env); if (extended_addresses_enabled(env)) { env->exception.fsr = (1 << 9) | 0x22; } else { env->exception.fsr = 0x2; } env->exception.vaddress = wp_hit->hitaddr; raise_exception(env, EXCP_DATA_ABORT, syn_watchpoint(same_el, 0, wnr), arm_debug_target_el(env)); } else { cpu_resume_from_signal(cs, NULL); } } } else { uint64_t pc = is_a64(env) ? env->pc : env->regs[15]; bool same_el = (arm_debug_target_el(env) == arm_current_el(env)); if (cpu_breakpoint_test(cs, pc, BP_GDB) || !cpu_breakpoint_test(cs, pc, BP_CPU)) { return; } if (extended_addresses_enabled(env)) { env->exception.fsr = (1 << 9) | 0x22; } else { env->exception.fsr = 0x2; } raise_exception(env, EXCP_PREFETCH_ABORT, syn_breakpoint(same_el), arm_debug_target_el(env)); } }
1threat
How to Style form radio button input to achieve push button look? : <p>I want to create a donation form that is similar to the one at <a href="https://www.charitywater.org/donate" rel="nofollow noreferrer">https://www.charitywater.org/donate</a> ,i believe those blue horizontal buttons are radio buttons that have have been styled with some custom code.</p> <p>How do I achieve such look without the 'hole' in a normal radio button showing?</p> <p>Thanks</p>
0debug
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) { DynBuffer *d; int size; static const char padbuf[AV_INPUT_BUFFER_PADDING_SIZE] = {0}; int padding = 0; if (!s) { *pbuffer = NULL; return 0; } if (!s->max_packet_size) { avio_write(s, padbuf, sizeof(padbuf)); padding = AV_INPUT_BUFFER_PADDING_SIZE; } avio_flush(s); d = s->opaque; *pbuffer = d->buffer; size = d->size; av_free(d); av_free(s); return size - padding; }
1threat
How to remove array inside an array in javscript : let array = [ { id: "455", some: [ { id: "21", }, ], }, { id: "12", some: [ { id: "21", }, ], }, { id: "12", some: [ { id: "21", }, ], } ]; array.slice("some"); here i was trying to remove an array inside an array but it's not working. here i only want to remove "some" array from all objects.
0debug
You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings : [This is my pycharm settings and my django app manage.py, view.py and wsgi.py][1] [1]: http://i.stack.imgur.com/BGPEV.png
0debug
How does OSGi application work on Java 9? : <p>I am trying to understand how OSGi application works in Java 9 assuming that OSGi bundle is not JPMS module (as far as I know there is still no solution that OSGi bundle could be at the same time JPMS module for production). And I have several questions:</p> <ol> <li>Do I understand right that all OSGi application will be one unnamed module?</li> <li>If #1 yes, then how does <code>Bundle.update()</code> works? Is bundle reloaded to unnamed module?</li> </ol> <p>If I understand everything wrong, please explain main principles.</p>
0debug
I want to convert 00 to string in c#. How to convert this : int num = 00; string s=num.ToString(); it is giving value 0.. I want required result in 00. How to do this. Can anyone Help me
0debug
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
1threat
How do I get the django HttpRequest from a django rest framework Request? : <p>I'm trying to use the <a href="https://docs.djangoproject.com/en/1.9/ref/contrib/messages/" rel="noreferrer">django messages framework</a> to show messages after <code>ModelViewSet.create()</code>:</p> <pre><code>class DomainModelViewSet(ModelViewSet): def create(self, request): super(DomainModelViewSet, self).create(request) messages.success(self.request, "Domain Added.") return HttpResponseRedirect(reverse('home')) </code></pre> <p>But I get:</p> <pre><code>TypeError: add_message() argument must be an HttpRequest object, not 'Request'. </code></pre> <p>So, how can use the Django <code>HttpRequest</code> from django rest framework <code>Request</code>?</p>
0debug
How to change tests execution order in JUnit5? : <p>JUnit4 has <code>@FixMethodOrder</code> annotation which allows to use alphabetical order of test methods execution. Is there analogous JUnit5 mechanism?</p>
0debug
connection.query('SELECT * FROM users WHERE username = ' + input_string)
1threat
static void virtio_gpu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) { VirtIOGPUPCI *vgpu = VIRTIO_GPU_PCI(vpci_dev); VirtIOGPU *g = &vgpu->vdev; DeviceState *vdev = DEVICE(&vgpu->vdev); int i; qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); vpci_dev->flags &= ~VIRTIO_PCI_FLAG_DISABLE_MODERN; vpci_dev->flags |= VIRTIO_PCI_FLAG_DISABLE_LEGACY; object_property_set_bool(OBJECT(vdev), true, "realized", errp); for (i = 0; i < g->conf.max_outputs; i++) { object_property_set_link(OBJECT(g->scanout[i].con), OBJECT(vpci_dev), "device", errp); } }
1threat
static coroutine_fn int dmg_co_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors) { int ret; BDRVDMGState *s = bs->opaque; qemu_co_mutex_lock(&s->lock); ret = dmg_read(bs, sector_num, buf, nb_sectors); qemu_co_mutex_unlock(&s->lock); return ret; }
1threat
How set variable in alamofire and get to another function : import Alamofire import SwiftyJson public class MyExample{ var myarray=[String]() func onCreate(){ Alamofire.request(.GET, "https://myurl.org/get", ).responseJSON { response in let json = JSON(value) let list: Array<JSON> = json.arrayValue for element in list{ myarray.append(element["name"].stringValue) } } func getMyArray(){return myarray} }
0debug
static inline void mix_3f_1r_to_dolby(AC3DecodeContext *ctx) { int i; float (*output)[256] = ctx->audio_block.block_output; for (i = 0; i < 256; i++) { output[1][i] += (output[2][i] - output[4][i]); output[2][i] += (output[3][i] + output[4][i]); } memset(output[3], 0, sizeof(output[3])); memset(output[4], 0, sizeof(output[4])); }
1threat
C++ std::variant vs std::any : <p>C++17 presents <a href="https://en.cppreference.com/w/cpp/utility/variant" rel="noreferrer"><code>std::variant</code></a> and <a href="https://en.cppreference.com/w/cpp/utility/any" rel="noreferrer"><code>std::any</code></a>, both able to store different type of values under an object. For me, they are somehow similar (are they?).</p> <p>Also <code>std::variant</code> restricts the entry types, beside this one. Why we should prefer <code>std::variant</code> over <code>std::any</code> which is simpler to use?</p>
0debug
static int start_auth_vencrypt(VncState *vs) { vnc_write_u8(vs, 0); vnc_write_u8(vs, 2); vnc_read_when(vs, protocol_client_vencrypt_init, 2); return 0; }
1threat
Warning: mysqli_close(): Couldn't fetch mysqli : <p>I'm getting this error:</p> <pre><code>Warning: mysqli_close(): Couldn't fetch mysqli in sendinvoice.php on line 54 </code></pre> <p>Here is my code:</p> <pre><code> &lt;?php include 'dbconfig.php'; ob_start(); $taxcb = $_POST['taxcb']; $taxrate = $_POST['taxrate']; $bcctocb = $_POST['bcctocb']; $bcctotxt = $_POST['bcctotxt']; $duedate = $_POST['duedate']; $issuedate = $_POST['issuedate']; $additemscb = $_POST['additemscb']; $additemname = $_POST['additemname']; $additemprice = $_POST['additemprice']; $q = $_POST['rowid']; $sql="SELECT * FROM clients WHERE id = '".$q."'"; $result = mysqli_query($conn,$sql); while($row = mysqli_fetch_array($result)) { $to = $row[email]; $subject = "Invoice Test " . date('m/d/Y h:i:s a', time()); include 'invoice.html'; $message = ob_get_clean(); // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // More headers $headers .= 'From: &lt;billing@example.com&gt;' . "\r\n"; if ($bcctocb == "y"){ $headers .= 'BCC: ' . $bcctotxt . "\r\n"; } mail($to,$subject,$message,$headers); $sql = "UPDATE clients SET last_billed='" . date("Y-m-d H:i:s") . "' WHERE id=" . $q; if ($conn-&gt;query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "&lt;br&gt;" . $conn-&gt;error; } $conn-&gt;close(); } mysqli_close($conn); ?&gt; </code></pre> <p>I only want it to update the MySQL entry if everything was successful. I suspect it's an error with having two MySQL things going on at once, is there a more efficient way to combine them? </p>
0debug
add unique constraint in room database to multiple column : <p>I have one entity in room</p> <pre><code>@Entity(foreignKeys ={ @ForeignKey(entity = Label.class, parentColumns = "_id", childColumns = "labelId", onDelete = CASCADE), @ForeignKey(entity = Task.class, parentColumns = "_id", childColumns = "taskId", onDelete = CASCADE) }) public class LabelOfTask extends Data{ @ColumnInfo(name = "labelId") private Integer labelId; @ColumnInfo(name = "taskId") private Integer taskId; } </code></pre> <p>sql syntax of this entity is as below</p> <pre><code>CREATE TABLE `LabelOfTask` ( `_id` INTEGER PRIMARY KEY AUTOINCREMENT, `labelId` INTEGER, `taskId` INTEGER, FOREIGN KEY(`labelId`) REFERENCES `Label`(`_id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`taskId`) REFERENCES `Task`(`_id`) ON UPDATE NO ACTION ON DELETE CASCADE ); </code></pre> <p>but what change or annotation I need to add in entity class if I want to append below constraint to the auto generated sql schema of the table</p> <pre><code>unique (labelId, taskId) </code></pre> <p>Ultimately I want to make combination of labelId and taskId unique in a table(or entity of room) using room library.</p>
0debug
Arrow function would change the context of this : <p>Is it by design that arrow functions can redefine existing functions behavior? Using jQuery's get (yes, I know) - I'm getting two different values of this inside success depending on whether arrow function is used or not. Can anyone explain why it happens?</p> <pre><code>var get = (e) =&gt; { return new window.Promise((resolve, reject) =&gt; { $.ajax({ context: {test: 1}, // this type: "GET", url: "...", complete: function () { // this is only correct when using old syntax, arrow // function would redefine the value of this to the function's parent }, complete: ()=&gt;{ } // Is not working, this is not what I'd expect. }); }); </code></pre>
0debug
static int save_user_regs(CPUPPCState *env, struct target_mcontext *frame, int sigret) { target_ulong msr = env->msr; int i; target_ulong ccr = 0; for (i = 0; i < ARRAY_SIZE(env->gpr); i++) { if (__put_user(env->gpr[i], &frame->mc_gregs[i])) { return 1; } } if (__put_user(env->nip, &frame->mc_gregs[TARGET_PT_NIP]) || __put_user(env->ctr, &frame->mc_gregs[TARGET_PT_CTR]) || __put_user(env->lr, &frame->mc_gregs[TARGET_PT_LNK]) || __put_user(env->xer, &frame->mc_gregs[TARGET_PT_XER])) return 1; for (i = 0; i < ARRAY_SIZE(env->crf); i++) { ccr |= env->crf[i] << (32 - ((i + 1) * 4)); } if (__put_user(ccr, &frame->mc_gregs[TARGET_PT_CCR])) return 1; if (env->insns_flags & PPC_ALTIVEC) { for (i = 0; i < ARRAY_SIZE(env->avr); i++) { ppc_avr_t *avr = &env->avr[i]; ppc_avr_t *vreg = &frame->mc_vregs.altivec[i]; if (__put_user(avr->u64[0], &vreg->u64[0]) || __put_user(avr->u64[1], &vreg->u64[1])) { return 1; } } msr |= MSR_VR; if (__put_user((uint32_t)env->spr[SPR_VRSAVE], &frame->mc_vregs.altivec[32].u32[3])) return 1; } if (env->insns_flags & PPC_FLOAT) { for (i = 0; i < ARRAY_SIZE(env->fpr); i++) { if (__put_user(env->fpr[i], &frame->mc_fregs[i])) { return 1; } } if (__put_user((uint64_t) env->fpscr, &frame->mc_fregs[32])) return 1; } if (env->insns_flags & PPC_SPE) { #if defined(TARGET_PPC64) for (i = 0; i < ARRAY_SIZE(env->gpr); i++) { if (__put_user(env->gpr[i] >> 32, &frame->mc_vregs.spe[i])) { return 1; } } #else for (i = 0; i < ARRAY_SIZE(env->gprh); i++) { if (__put_user(env->gprh[i], &frame->mc_vregs.spe[i])) { return 1; } } #endif msr |= MSR_SPE; if (__put_user(env->spe_fscr, &frame->mc_vregs.spe[32])) return 1; } if (__put_user(msr, &frame->mc_gregs[TARGET_PT_MSR])) return 1; if (sigret) { if (__put_user(0x38000000UL | sigret, &frame->tramp[0]) || __put_user(0x44000002UL, &frame->tramp[1])) { return 1; } } return 0; }
1threat
How to upgrade Angular CLI to the latest version : <p>Using <code>ng --version</code> I got:</p> <blockquote> <p>@angular/cli: 1.0.0</p> </blockquote> <p>which is not the latest release available.</p> <p>Since I have Angular CLI globally installed on my system, in order to upgrade it I tried:</p> <p><code>npm update angular-cli -g</code></p> <p>But it does not work, because it stays to 1.0.0 version.</p>
0debug
file opening and writing in c : <pre><code>FILE *fp1; if((fp1 = fopen("abc.txt", "w")) != NULL) { fprintf(something); fclose(fp1); } </code></pre> <p>I am trying to compile this file and all related file using developer command prompt and trying to run it from there. But while running it says this filename.exe has stopped working. It is not able to create the file abc.txt .</p>
0debug
Need to replace numbers between [...] with Javascript or jQuery : <p>Inside a string: I need to replace the number between <code>[ ]</code> by another number with Javascript or jQuery.</p> <p>What is the best way to proceed ?</p> <p>Eamples</p> <pre><code>"[12345].Checked" &gt; "[1].Checked" "[123].RequestID" &gt; "[21].RequestID" </code></pre> <p>Thanks for your help.</p>
0debug
QEMUFile *qemu_fopen(const char *filename, const char *mode) { QEMUFileStdio *s; if (qemu_file_mode_is_not_valid(mode)) { return NULL; } s = g_malloc0(sizeof(QEMUFileStdio)); s->stdio_file = fopen(filename, mode); if (!s->stdio_file) { goto fail; } if (mode[0] == 'w') { s->file = qemu_fopen_ops(s, &stdio_file_write_ops); } else { s->file = qemu_fopen_ops(s, &stdio_file_read_ops); } return s->file; fail: g_free(s); return NULL; }
1threat
VBA & Macros code : I'm trying to get into VBA for the first time in order to be more productive at work. Now I'm starting with something simple, here it goes. I changed the color and other things of a specific cell in a worksheet ("M1" cell), but I need to do the same thing in all the next worksheets of my workbook (is the same cell in all the sheets), but there are too many sheets (about 40), so I need to programming this task with VBA, how can I do that?. First attempt - When I changed the look of the cell I recorded the procedure in a macro, but don't know how to write the right code in order to do this in all the worksheets.
0debug
How to connect Html with MySQL using PHP : I am stuck after writing all the code, the Website just doesn't connect with mysql at all!
0debug
Explain why it is important to make mutable data members of a Java class private : Explain why it is important to make mutable data members of a Java class private. What consequences does this have, and how do we commonly get around them? Appreciate any help. Have been googling around but i've only came across answers that say how to create an immutable class etc.
0debug
How to concate string using strcat() : <p>This code want to concate the string but it do not show the output</p> <pre><code>#include&lt;stdio.h&gt; #include&lt;string.h&gt; main( ) { char *str1 = "United" ; char *str2 = "Front" ; char *str3 ; str3 = strcat ( str1, str2 ) ; printf ( "\n%s", *str3 ) ; } </code></pre>
0debug
Retrireving data fro shared prefrences : I am saving some data in shared prefrences, but when i press back button and again go to profile, the data clears. What can i keep data stored with the help of shared pref package www.edukeen.in.eduaspire; public class Profile extends AppCompatActivity { EditText editTextName, editDOB, editphone, editcity, editclass, editboard, editschool, edithobbies, editachievements; Button buttonSave; public static final String MyPREFERENCES = "MyPrefs" ; public static final String Name = "nameKey"; public static final String DOB = "DOBKey"; public static final String Phone = "phoneKey"; public static final String City = "cityKey"; public static final String Class = "classKey"; public static final String Board = "boardKey"; public static final String School = "schoolKey"; public static final String Hobbies = "hobbiesKey"; public static final String Achievements = "achievementsKey"; SharedPreferences sharedpreferences; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile); editTextName = (EditText) findViewById(R.id.editTextName); editDOB = (EditText) findViewById(R.id.editDOB); editphone = (EditText) findViewById(R.id.editphone); editcity = (EditText) findViewById(R.id.editcity); editclass = (EditText) findViewById(R.id.editclass); editboard = (EditText) findViewById(R.id.editboard); editschool = (EditText) findViewById(R.id.editschool); edithobbies = (EditText) findViewById(R.id.edithobbies); editachievements = (EditText) findViewById(R.id.editachievements); buttonSave=(Button)findViewById(R.id.buttonSave); sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE); buttonSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String Name = editTextName.getText().toString(); String DOB = editDOB.getText().toString(); String Phone = editphone.getText().toString(); String City = editcity.getText().toString(); String Class = editclass.getText().toString(); String Board = editboard.getText().toString(); String School = editschool.getText().toString(); String Hobbies = edithobbies.getText().toString(); String Achievements = editachievements.getText().toString(); SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putString(Name, Name); editor.putString(DOB, DOB); editor.putString(Phone, Phone); editor.putString(City, City); editor.putString(Class, Class); editor.putString(Board, Board); editor.putString(School, School); editor.putString(Hobbies, Hobbies); editor.putString(Achievements, Achievements); editor.commit(); Toast.makeText(Profile.this,"Data saved",Toast.LENGTH_LONG).show(); } }); } } Also if I want to get this data in my database what should I do, I have already signed in user, using firebase.
0debug
SQL:create table column, "as constant value" : create table factura ( importe money, unidades_vendidas int, subtotal as (unidades_vendidas * importe), total as (subtotal * 1.18), -- (1.18 needs to be a constant value) ) how to define "total" to be as a 1.18 value of "subtotal"
0debug
regex for filtering a python list : I have python list trying to filter it to new list, how i make regex which will give me final_list, note down single and double quotes in list1 list1 = ["{name, 'test1'}", '{name, "test2"}', '{name, 'test3'}', '{name, "test4"}'] final_list = ['test1', 'test2', 'test3', 'test4'] thanks for help.
0debug
static DeviceState *apic_init(void *env, uint8_t apic_id) { DeviceState *dev; SysBusDevice *d; static int apic_mapped; dev = qdev_create(NULL, "apic"); qdev_prop_set_uint8(dev, "id", apic_id); qdev_prop_set_ptr(dev, "cpu_env", env); qdev_init_nofail(dev); d = sysbus_from_qdev(dev); if (apic_mapped == 0) { sysbus_mmio_map(d, 0, MSI_ADDR_BASE); apic_mapped = 1; } msi_supported = true; return dev; }
1threat