Id
int64
34.6M
60.5M
Title
stringlengths
15
150
Body
stringlengths
33
36.7k
Tags
stringlengths
3
112
CreationDate
stringdate
2016-01-01 00:21:59
2020-02-29 17:55:56
Y
stringclasses
3 values
57,948,062
how can open another activity by action buttons in the dialog box which is opened with a button?
<p>I am trying to make an app where I open a dialog box with a button. Then the dialog box would have two action buttons which opens two different activities.</p>
<java><android><android-studio>
2019-09-15 20:46:33
LQ_CLOSE
57,948,597
Simulink integrator in library Python
<p>i have a question, about for the block the simulink integrator, i looking for alternative in python with scipy or other library, please.</p> <p>Integer block ----> Scipy Python or other</p>
<python><matlab><simulink>
2019-09-15 22:20:03
LQ_CLOSE
57,949,085
checkbox in MVC controller to convert into bit
I have a scenario in MVC where in One table from my DB row contains Active(bit) how to update the row in MVC using Checkbox. If it's checked then the value must be 1 if not it must take 0 how to do these any one please help here. Please help me out by model view and controller script without using entity framework Thanx in advance
<c#><html><asp.net-mvc-5>
2019-09-16 00:09:25
LQ_EDIT
57,949,812
How to get Database Messages while executing any query from JAVA
Is it possible to get Database console messages using JDBC after a query is being executed? select * from staff [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/pw5hy.png
<java><sql-server><jdbc>
2019-09-16 02:45:44
LQ_EDIT
57,950,691
How to insert a javascript variable in <a href="">
<pre><code>I have a javascript variable BASE_URL='http://localhost/BKTHP_WEB_NEW/'; </code></pre> <p>Now I want to insert it inside a </p> <pre><code>something like &lt;a href="BASE_URL+\view"&gt; </code></pre>
<javascript><html>
2019-09-16 05:10:07
LQ_CLOSE
57,951,548
Use Transpiled FlowJS or Typescript in Pure Javascript
i have question regarding FlowJS or Typescript (which quite popular these days). While both do great job doing static type check, but not all project will be compatible with superset language. So, how do i use transpiled superset language (preferable CommonJS) in PURE JS. If you came from Java, this questions similar to Scala in Java. I have fair knowledge to setup Webpack, so expected answer is explaining how to use FlowJS and Typescript transpiled in CommonJS in Pure JS.
<javascript><typescript><flowtype><pure-js>
2019-09-16 06:39:17
LQ_EDIT
57,952,685
-> What does this mean in php? $blabla->blabla
<p>$blabla->blab, just wondering what this means something to do with an object going into another? </p> <p>Sorry for being a bit vague . </p>
<php>
2019-09-16 08:05:05
LQ_CLOSE
57,956,609
joi_1.default.validate is not a function
<p>I want to validate my Express routes before calling the controller logic. I use joi and created a validator which is able to validate the Request object against the schema object</p> <pre><code>import { Request, Response, NextFunction } from 'express'; import joi, { SchemaLike, ValidationError, ValidationResult } from '@hapi/joi'; import { injectable } from 'inversify'; @injectable() export abstract class RequestValidator { protected validateRequest = (validationSchema: SchemaLike, request: Request, response: Response, next: NextFunction): void =&gt; { const validationResult: ValidationResult&lt;Request&gt; = joi.validate(request, validationSchema, { abortEarly: false }); const { error }: { error: ValidationError } = validationResult; if (error) { response.status(400).json({ message: 'The request validation failed.', details: error.details }); } else { next(); } } } </code></pre> <p>Next I created a deriving class which creates the validationSchema and calls the <code>validateRequest</code> method. For the sake of simplicity I will show the "deleteUserById" validation</p> <pre><code>import { Request, Response, NextFunction } from 'express'; import joi, { SchemaLike } from '@hapi/joi'; import { injectable } from 'inversify'; import { RequestValidator } from './RequestValidator'; @injectable() export class UserRequestValidator extends RequestValidator { public deleteUserByIdValidation = async (request: Request, response: Response, next: NextFunction): Promise&lt;void&gt; =&gt; { const validationSchema: SchemaLike = joi.object().keys({ params: joi.object().keys({ id: joi.number().required(), }) }); this.validateRequest(validationSchema, request, response, next); } } </code></pre> <p><strong>Important note:</strong> I create the <code>SchemaLike</code> that way because some routes might have <code>params, body, query</code> which need to get validated in one run. </p> <p>When calling the Route </p> <blockquote> <p>DELETE /users/1</p> </blockquote> <p>the validation always fails. I get this error</p> <blockquote> <p>UnhandledPromiseRejectionWarning: TypeError: joi_1.default.validate is not a function</p> </blockquote> <p>The error occurs with every validation, whether called correctly or not. Does someone know how to fix it?</p>
<javascript><node.js><typescript><express><joi>
2019-09-16 12:09:42
HQ
57,956,845
How to change the location of a groupbox programmatically
<p>Hello guys i Need to know how to Change the Location of the groupbox with code. The Groupbox is in a Canvas.</p>
<c#><wpf>
2019-09-16 12:23:23
LQ_CLOSE
57,957,168
How do I disable a gcc warning which has no command line switch?
<p>I get the following warning:</p> <pre><code>warning: 'X' is initialized and declared 'extern' </code></pre> <p>and it <a href="https://stackoverflow.com/a/21585233/57428">looks like it's no big deal</a> and I could disable it. Changing the code is not really a good idea in my case because I have no control over the code, I just need to compile it. So I want to disable the warning.</p> <p>If it had a <code>-WSomeDefect</code> key next to it then I could use a <code>-Wno-SomeDefect</code> command line switch but it looks like there's no distinct switch for this warning.</p> <p>How do I disable such warning? </p>
<c++><c><gcc><command-line><gcc-warning>
2019-09-16 12:44:24
HQ
57,959,438
Retrieve data from mySQL table in a array
<p>I have a data table named <code>CallTriggers</code> with the attributs </p> <pre><code>cloturer = 0 or 1 created_at </code></pre> <p>and I want to get all the data like this</p> <pre><code>$array = [ ['Month', 'Total Call', 'Close'], ['Jan', 57, 50], ['Feb', 67, 60], ['Mar', 40, 40], ['Apr', 33, 30], ['May', 70, 66] ]; </code></pre> <p><code>Example:</code> ['Jan', 57, 50] here jan is the month, 57 is number of call in the month with value 1 and 50 is number of that the value is 0 in database.</p> <p>How can I perform that kind of operation with <code>Laravel 5.6</code>? Thanks</p>
<php><mysql><laravel>
2019-09-16 14:54:11
LQ_CLOSE
57,961,909
How to access data from a list in python and for the program to recognise whether it is even or odd
<p>I am trying to make it so that when a random number from 1 to 6 is generated the program will recognise it is an even or an odd number for example if i have a list of odd number and even numbers e.g</p> <pre><code>even=[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30]; odd=[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]; </code></pre> <p>and the number generated is 3 i want the code to recognise it and print("odd") and same with even.</p>
<python><list>
2019-09-16 17:42:51
LQ_CLOSE
57,962,350
How to get return value from callback function in Node
<p>The <code>get_customers()</code> function queries the database for the <code>playlists</code> records and logs to the console each row. But the <code>data</code> array is returned as an empty list array. How to return the data from the get_playlists function? </p> <pre><code>...result undefined </code></pre> <pre><code>const sqlite3 = require('sqlite3').verbose(); let db = new sqlite3.Database('mydb.db', (err) =&gt; { if (err) { console.error(err.message); } console.log('Connected to the database.'); }); function get_playlists(db){ let sql = `SELECT DISTINCT Name name FROM playlists ORDER BY name`; let data = [] db.all(sql, [], (err, rows) =&gt; { if (err) { throw err; } rows.forEach((row) =&gt; { console.log(row.name); data.push(row.name); }); return data }); } result = get_playlists(db) console.log('...result', result); db.close(); </code></pre>
<javascript><node.js><sqlite>
2019-09-16 18:15:07
LQ_CLOSE
57,964,304
JAVA How to save multiple arrays into a single array
I'm currently trying to save multiple arrays into a single array where the data can later be called in a next function. The data is currently in an ArrayList<ArrayList> which is then getting called. N number of indexes are then output on the console. I want to save those indexes into an array that can be used. Example: You start off with ``` [[1.52101, 13.64, 4.49, 1.1, 71.78, 0.06, 8.75, 0.0, 0.0], [1.51761, 13.89, 3.6, 1.36, 72.73, 0.48, 7.83, 0.0, 0.0], [1.51618, 13.53, 3.55, 1.54, 72.99, 0.39, 7.78, 0.0, 0.0]] ``` If your numCen = 2. You'll get one of these array outputed such as: ``` [1.52101, 13.64, 4.49, 1.1, 71.78, 0.06, 8.75, 0.0, 0.0] [1.51761, 13.89, 3.6, 1.36, 72.73, 0.48, 7.83, 0.0, 0.0] ``` I need to save both arrays into one array now. ``` public static void ranCentroid() { Random randomPoint = new Random(); for (int i = 0; i < numCen; i++) { int randomP = randomPoint.nextInt(Points.size()); System.out.println(Points.get(randomP)); } } ```
<java><arrays>
2019-09-16 20:56:01
LQ_EDIT
57,966,494
Python 3: Activity 1 of task 1 prompt a user to input firstname, lastname and initials
Hi everyone I have been trying to figure out the best way to do this question I have to fix for my task 1. The teacher asks me to not hard code the answer or the name because I have to prompt user input. These are his errors he wrote out: Activity 1: 2 errors By the end of it I should be able to prompt him to enter a first name, a last name and initials without hard [enter image description here][1]coding By the way this is my code I have attempted so far: Activity 1 Part B is fine he said but its just part A and Activity 2 [attempted code I have done][2] [1]: https://i.stack.imgur.com/vR6lG.png [2]: https://i.stack.imgur.com/8SbUr.png
<python><python-3.x>
2019-09-17 02:13:15
LQ_EDIT
57,967,193
i need to get id when i have another tag a
i have my code is <a class="btn btn-outline-primary" id="1" href="<?php echo site_url(); ?>/InchatroomController/LikeMessage/1" style=""> </a> <a class="btn btn-outline-primary" id="2" href="<?php echo site_url(); ?>/InchatroomController/LikeMessage/2" style=""> </a> <a class="btn btn-outline-primary" id="3" href="<?php echo site_url(); ?>/InchatroomController/LikeMessage/3" style=""> </a> <a class="btn btn-outline-primary" id="4" href="<?php echo site_url(); ?>/InchatroomController/LikeMessage/4" style=""> </a> and id = n i need to know how to write jquery ajax go to InchatroomController/LikeMessage/id" don't refresh page or how can i get id tag a when i click
<javascript><jquery><codeigniter><codeigniter-3>
2019-09-17 04:04:35
LQ_EDIT
57,967,425
Automating the solitaire game
<p>I want to write a program by C# or python for automating the solitaire game. First, I need to detect images. For example, I must detect the position of hearts, clubs, diamonds and spades as well as numbers. What is the best way?</p>
<c#><python>
2019-09-17 04:36:38
LQ_CLOSE
57,968,914
What are the unknown issues of using try/except block in functions in python?
<p>I want to know the side effects or unknown issues of using try/except block in the below approaches?</p> <p>Approach 1:</p> <pre class="lang-py prettyprint-override"><code>def f1(): try: # some code here except Exception as e: print(str(e)) def f2(): try: f1() except Exception as e: print(str(e)) </code></pre> <p>Approach 2: Same logic as in approach 1 but without try/block in f1()</p> <pre class="lang-py prettyprint-override"><code>def f1(): # some code here def f2(): try: f1() except Exception as e: print(str(e)) </code></pre> <p>Approach 3: Using multiple nested functions</p> <pre class="lang-py prettyprint-override"><code>def f1(): # some code here def f4(): # some code here def f3(): f4() # some code here def f2(): try: f1() f3() except Exception as e: print(str(e)) </code></pre> <p>Approach 4: Adding multiple try/except in every function</p> <pre class="lang-py prettyprint-override"><code>def f1(): try: # some code here except Exception as e: print(str(e)) def f4(): try: # some code here except Exception as e: print(str(e)) def f3(): try: f4() # some code here except Exception as e: print(str(e)) def f2(): try: f1() f3() except Exception as e: print(str(e)) </code></pre>
<python><try-except>
2019-09-17 07:00:05
LQ_CLOSE
57,969,526
why is the output contains 4 time 0's?
<p>why is the output contains 4 time 0's.The main call again and again until if condition become false and then it should be exit from if block.</p> <pre><code>#include &lt;stdio.h&gt; int main() { static int i=5; if(--i) { main(); printf("%d ",i); } } </code></pre>
<c>
2019-09-17 07:41:08
LQ_CLOSE
57,969,823
Xcode 11 PDF image assets "Preserve Vector Data" not working in SwiftUI?
<p>I'm trying to use vector-based PDF images using "Single-Scale" in an app I'm working on using SwiftUI in Xcode 11, but the image always looks blurry when I scale it up in size. </p> <p>I had no trouble with this in UIKit in Xcode 11. I created a dummy app with 2 scenes, both displaying the same vector image. I created the first scene in a storyboard, then used a HostingViewController to embed an identical scene made in SwiftUI. When I ran the app, the first scene (UIKit) displayed a crisp, non blurry image. The second (SwiftUI) scene however, was blurry and didn't appear to be using vector data, despite using the same source image asset.</p> <p>I was able to "work around" this by creating a UIImage with the vector image, then using this UIImage extension to resize the UIImage before it's passed into <code>Image</code>. However, the size I enter in the <code>resized(to:)</code> method makes no difference at runtime, so I also have to add <code>.frame(w:,h:)</code> to <code>image</code> in 'var body' to make it show the correct size.</p> <pre><code>let uiImage = UIImage(named: "Logo-vector")! var image: Image { Image(uiImage: uiImage.resized(to: CGSize(width: 500, height: 500))) .resizable() } var body: some View { NavigationView { VStack(alignment: .center, spacing: 8) { Spacer() Text("Logo vector SwiftUI") image .frame(width: 240, height: 216) ... } ... } } } extension UIImage { func resized(to size: CGSize) -&gt; UIImage { return UIGraphicsImageRenderer(size: size).image { _ in draw(in: CGRect(origin: .zero, size: size)) } } } </code></pre> <p>The image is clear and properly resized at runtime with this workaround, but it feels like a bit of a hack.</p> <p>I've looked everywhere online for a different solution or anyone else having this issue specifically with SwiftUI, but haven't found anything at all.</p> <p>Has anyone else had this issue or does anyone have a better solution?</p>
<pdf><swiftui><vector-graphics><xcode11>
2019-09-17 08:00:06
HQ
57,970,255
Helm V3 - Cannot find the official repo
<p>I have been trying to install nginx ingress using helm version 3</p> <pre><code>helm install my-ingress stable/nginx-ingress </code></pre> <p>But Helm doesn't seem to be able to find it's official <code>stable</code> repo. It gives the message: </p> <blockquote> <p>Error: failed to download "stable/nginx-ingress" (hint: running <code>helm repo update</code> may help)</p> </blockquote> <hr> <p>I tried <code>helm repo update</code>. But it doesn't help.</p> <p>I tried listing the repos <code>helm repo list</code> but it is empty.</p> <hr> <p>I tried to add the stable repo: </p> <pre><code>helm repo add stable https://github.com/helm/charts/tree/master/stable </code></pre> <p>But it fails with: </p> <blockquote> <p>Error: looks like "<a href="https://github.com/helm/charts/tree/master/stable" rel="noreferrer">https://github.com/helm/charts/tree/master/stable</a>" is not a valid chart repository or cannot be reached: failed to fetch <a href="https://github.com/helm/charts/tree/master/stable/index.yaml" rel="noreferrer">https://github.com/helm/charts/tree/master/stable/index.yaml</a> : 404 Not Found</p> </blockquote>
<kubernetes><kubernetes-helm><kubernetes-deployment>
2019-09-17 08:26:29
HQ
57,971,880
When writing JSP code and running on tomcat server, nothing displays
<p>Im really new to this but, when Im writing a really simple JSP site, it just displays a blank page. And when I inspect the site, the code doesnt show up.</p> <p><a href="https://i.stack.imgur.com/E5XC7.png" rel="nofollow noreferrer">This is my JSP file called BookList.jsp</a></p> <p><a href="https://i.stack.imgur.com/RjktJ.png" rel="nofollow noreferrer">My Servlet File, called ControllerServlet.java</a></p> <p><a href="https://i.stack.imgur.com/mDOse.png" rel="nofollow noreferrer">What appears in my browser and when I inspect</a></p>
<java><eclipse><jsp><tomcat>
2019-09-17 10:01:34
LQ_CLOSE
57,974,294
can someone help to write this code more efficiently please?
As you can see in first picture I'm checking that a certain value contains in a document from firestore and returns a boolean value. now I'm calling that function in a build and based on that return value I'm changing a chip color(Second picture). Now the problem is maybe because I'm calling it in a build function so its being called continuously and on that build and it costing me aton of reads in firestore or maybe the function is inefficient idk ..... so can anyone help to write the code or give a more efficient way for this please ??
<flutter><dart><google-cloud-firestore>
2019-09-17 12:32:10
LQ_EDIT
57,975,344
Nested URL in Golang
I'm totally new to Golang I started like tomorrow. So What I want to achieve is routes like `user/profile` `user/cart` `user/products` Currently, I'm doing this ``` r.HandleFunc("user/signup", signupHandler).Methods("POST") r.HandleFunc("user/signin", signinHandler).Methods("POST") r.HandleFunc("user/profile", profileHandler).Methods("GET") r.HandleFunc("user/cart", cartHandler).Methods("POST") r.HandleFunc("user/products", productsHandler).Methods("GET") ``` As you can see these routes starts with `user` so can how can I know it's a `user` routes so I can send handle it in a different file. I want something like ``` r.HandleFunc("user/", handlerWhichHandelAllTheRequestFromUser) ``` It should handle all the URL which starts from `users`. P.S I'm using mux
<go><gorilla>
2019-09-17 13:29:39
LQ_EDIT
57,976,551
How can ı convert png to base64 and than use it in asp.net mvc project?
I have an ımage list an ı want it to be in html export .So the way that ı need to achive is base64.But ı didnt find valuable information how to transform to base64 and in html use it.Can you help me on this?
<c#><html><asp.net>
2019-09-17 14:31:42
LQ_EDIT
57,976,755
Java, private access in main()
<p>I am studying for the OCA Exam and came across this code:</p> <pre><code>public class Driver { private void printColor(String color) { color = "purple"; System.out.print(color); } public static void main(String[] args) { new Driver().printColor("blue"); } } </code></pre> <p>The question asks "What is the outcome of this piece of code". I initially thought it will be "it does not compile" because you have an object instance trying to access a private method. But, it turns out to be "purple". </p> <p>Why is it "purple" and not "it does not compile"? I know the <code>Driver</code> instances lives in the same class it is declared in, but why it still have the privilege to access private methods?</p> <p>Thank you</p>
<java>
2019-09-17 14:43:04
LQ_CLOSE
57,977,409
TypeError: collections.Map is not a function
<p>My page appears with TypeError: collections. Map is not a function This here is my JS code. I dont know what the problem is </p> <pre><code> this.state = { collections: SHOP_DATA }; } render() { const {collections} = this.state; return ( &lt;div className='shop-page'&gt; { collections.Map(({id, ...otherCollectionProps}) =&gt; ( &lt;CollectionPreview key={id} {...otherCollectionProps} /&gt; ))} &lt;/div&gt; ); } </code></pre> <p>}</p> <p>export default ShopPage; </p>
<javascript><reactjs>
2019-09-17 15:20:29
LQ_CLOSE
57,978,465
Web interface for a command line interface
<p>I am using a command-line program and I'd like to build a web interface for ease of access</p> <p>I mean, the interface should have textfield, some popup-menu to let the users insert the input. Then, I've to show the output when the user click the "Execute" button.</p> <p>When I hit a button from Web GUI, it should go hit the cli and run the command, display output on cli. Now I need to display this output on web gui.</p> <p>Do you have any suggestion? I need to build this interface as soon as possible. So what's the fastest way to build such web app?</p> <p>My question is exactly same as asked in below link, but I didnt get the proper answer for that: <a href="https://stackoverflow.com/questions/11692641/web-interface-for-a-command-line-program">Web interface for a command-line program</a></p>
<user-interface><command-line><webui>
2019-09-17 16:30:24
LQ_CLOSE
57,978,671
SSMS crashes when try to modify database diagram (v18.2)
<p>When I try to modify a database diagram created before the application restart and crashes when trying to access. It happen only when I save the diagram and close the application. When I try to reopen it throws me an error then restart the SSMS.</p> <p>I'm running SQL Server 14.0.100 Express Edition.</p> <p>I reviewed the Microsoft Event Viewer and I get this:</p> <blockquote> <p>Faulting application name: Ssms.exe, version: 2019.150.18142.0, time stamp: 0x5d3573be Faulting module name: DataDesigners.dll, version: 2019.150.18142.0, time stamp: 0x5d3573f0 Exception code: 0xc0000005 Fault offset: 0x00004be8 Faulting process id: 0x5ec8 Faulting application start time: 0x01d56d761e232f6c Faulting application path: C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe Faulting module path: C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Tools\VDT\DataDesigners.dll Report Id: e797c8be-6448-4547-9f6f-146cd92d8178 Faulting package full name: Faulting package-relative application ID: </p> </blockquote>
<sql-server><database><ssms><diagram><designer>
2019-09-17 16:45:10
HQ
57,978,688
How to organise your go project in the right way?
I have problems setting up my first go project. I want to keep my packages out of my git repository. ```go get``` installs my packages by default in my ```/src``` folder. This way I can't simply ignore a folder to ignore all packages. Can I install all my packages in for example ```/pkg``` and how would I do this? Is there a ```golang``` way of solving this issue?
<go><go-get>
2019-09-17 16:46:24
LQ_EDIT
57,980,475
I have to append last n element of LL to font
node* append_LinkedList(node* head,int n) { //write your code here int count=0; node *temp=head; while(count<n-1) { temp=temp->next; count++; } cout<<temp->data; return head; } next step I am not able to think.after getting nth node pointer what to do next.
<c++><data-structures><linked-list>
2019-09-17 18:58:30
LQ_EDIT
57,980,900
Flutter: Could not find the built application bundle at build/ios/iphonesimulator/Runner.app
<p>I am trying to run my application in debug mode from VSCode. However, every time, regardless if I am running on a simulator or a real device, the debug console outputs </p> <pre><code>Could not find the built application bundle at build/ios/iphonesimulator/Runner.app. </code></pre> <p>or </p> <pre><code>Could not find the built application bundle at build/ios/iphoneos/Runner.app. </code></pre> <p>When I went to the specified directory, my app bundle is being built every time but instead of being named Runner.app it is named MyAppName.app. I suspect the difference in name is causing the VSCode compiler to not being able to locate Runner.app. </p> <p>My question: How do I change my build settings so that the build bundle is named Runner.app again? </p>
<ios><xcode><flutter><visual-studio-code>
2019-09-17 19:31:27
HQ
57,980,942
Howto rename bunch of filenames which are calculated
<p>I want rename bunch of filenames. The rename is based on the calculation of the filename. That means the actual filename + 3600 = new filename. Important is that the underscore in the pid files have to stay.</p> <p>Thanks in advance!</p> <p>My system is Debian Stretch.</p> <p>Actual Filename:</p> <pre><code>134235.error 134235_.pid 134235.tiff 13893.error 13893_.pid 13893.tiff 1.error 1_.pid 1.tiff </code></pre> <p>Rename to:</p> <pre><code>137835.error 137835_.pid 137835.tiff 17493.error 17493_.pid 17493.tiff 3601.error 3601_.pid 3601.tiff </code></pre>
<bash><awk><sed><find><mv>
2019-09-17 19:34:23
LQ_CLOSE
57,981,559
MySql, where clause filter off entries even with LEFT join
<p>3 tables: classes, students and class_student (association table). Following query output student count of each class. When there is no students in a class, the count(..) is 0 but class name is still in result.</p> <pre><code>select c.name, count(s.id) from classes c left join class_student cs on cs.classId = c.id left join students s on s.id = cs.studentId group by c.id; </code></pre> <p>Now want to count students with score 100% of each class so a WHERE is added:</p> <pre><code>select c.name, count(s.id) from classes c left join class_student cs on cs.classId = c.id left join students s on s.id = cs.studentId where s.score = 100 &lt;-- newly added group by c.id; </code></pre> <p>then the classes that do not have any 100% students do not show up in the result. Considering LEFT JOIN is used, I'm expecting count(s.id) returns 0 when there is no 100% students. How can I make all classes are in result and those without any 100% student have count(..) output 0. Thanks</p>
<mysql><sql>
2019-09-17 20:21:26
LQ_CLOSE
57,982,176
I'm having a problem with nested loop c++
I am a noobe in c++ ans I'm having problem with nested loops. Could you please help me and tell me where I'm mistaking main() { int n, sum=0; printf("ENTER NUMBER:"); scanf("%i",n); while(n>0) { sum+=n; n--; } printf("\n sum is:",sum); return 0; } Thank you in advance.
<c++><printf>
2019-09-17 21:17:12
LQ_EDIT
57,982,270
Template specialization vs. Function overloading
<p>The question is pretty simple. Is there any difference between:</p> <pre><code>template &lt;typename T&gt; T add(T a, T b) { return a + b; } template &lt;&gt; int add&lt;int&gt;(int a, int b) { return a + b; //no reason to specialize, but still... } </code></pre> <p>And:</p> <pre><code>template &lt;typename T&gt; T add(T a, T b) { return a + b; } int add(int a, int b) { return a + b; //no reason to overload, but still... } </code></pre> <p>They seem to be the same.</p>
<c++>
2019-09-17 21:27:45
HQ
57,982,490
Why is my program saying that the length function is not in my std library?
<p>My program is saying that the function length() is not in the standard library and is producing an error that does not let me run my code</p> <p>I have tried to place two different libraries into the #include statements. I then tried to place the length function on different variables but the same error occurs.</p> <pre><code>int main() { string line; ifstream out_file_DOI("declaration_of_independence.txt"); if (out_file_DOI.is_open()) { int i = 0; while (getline(cout, out_file_DOI, i)) { cout &lt;&lt; line &lt;&lt; endl; cout &lt;&lt; line.length(); //error is on this line... i++; } out_file_DOI.close(); } } else { cout &lt;&lt; "Unable to open file..."; } //creates the declaration file out_file_DOI.open("declaration_of_independence.txt"); } </code></pre> <p>I expect the code to run and show the proper results (proper results being the program encrypting the file (Declaration of Independence).</p>
<c++><getline>
2019-09-17 21:49:47
LQ_CLOSE
57,982,945
How to apt-get install in a GitHub action?
<p>In the new GitHub actions, I am trying to install a package in order to use it in one of the next steps.</p> <pre><code>name: CI on: [push, pull_request] jobs: translations: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 with: fetch-depth: 1 - name: Install xmllint run: apt-get install libxml2-utils # ... </code></pre> <p>However this fails with</p> <pre><code>Run apt-get install libxml2-utils apt-get install libxml2-utils shell: /bin/bash -e {0} E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root? ##[error]Process completed with exit code 100. </code></pre> <p>What's the best way to do this? Do it need to reach for Docker?</p>
<github-actions>
2019-09-17 22:51:27
HQ
57,985,891
How to read test files one by one in vb.net
i am working on a project in which i need to read text files in programs directory and check for specific keywords in it. Eg. A folder contains files with some name (not specific) and i want to read them one by one to check for specific string in them. until all are checked. ive been looking for method to read files like that but couldnt find any.
<vb.net>
2019-09-18 05:52:48
LQ_EDIT
57,986,146
which one the best tools PHP either Bootstrap.?
<p>To create dynamic pages for hosting purpose,what are the tools are required. </p>
<php><bootstrap-4>
2019-09-18 06:15:15
LQ_CLOSE
57,987,951
javascript join array to another
<p>I want to write a function to join an array to another but different way :</p> <pre><code>var myNumbers = [10,20,3,4,2] var myOperations = ['+','-','*','/'] </code></pre> <p>I want the operators locate between myNumbers element : 10+20-3*4/2 = 54</p> <p>thank you </p>
<javascript>
2019-09-18 08:08:03
LQ_CLOSE
57,988,558
Flutter: How to capitalize a single word
<p>In Flutter, how would you capitalize a single word? I know of <strong>Text().toUpperCase()</strong>, but I'd like to capitalize only the first letter, not the whole word. Will I need to use Regex, or does Flutter have a built-in function for that?</p>
<flutter>
2019-09-18 08:42:17
LQ_CLOSE
57,988,736
match 2 columns in sheet 1 with the columns in sheet 2 and return the value of column 3 of the sheet 1
I have 2 sheets. sheet 1 contains col 1,col 2, col 3. Similary, sheet 2 has col 1, col 2, col 3. I wish to match a produce a output in this way: if ((col 1(of sheet 1)==col 1 (of sheet 2)) && (col 2(of sheet 1)==col 2 (of sheet 2))), then col 3(of sheet 1)= col 3 (of sheet 2) (I hope I have made the question clear)
<excel>
2019-09-18 08:50:55
LQ_EDIT
57,988,889
iOS 13 - UIPopoverPresentationController sourceview content visible in the arrow
<p>When I am displaying some view in UIPopoverPresentationController and presenting it as popover</p> <pre><code>popoverCon?.modalPresentationStyle = UIModalPresentationStyle.popover </code></pre> <p>the content have moved upward toward and a some part is being display in the arrow. </p> <p><a href="https://i.stack.imgur.com/HtQPI.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/HtQPI.jpg" alt="enter image description here"></a></p> <p>Further I had border around the popover</p> <pre><code>popoverCon?.view.layer.borderColor = .orange popoverCon?.view.layer.borderWidth = 1.0; popoverCon?.view.layer.cornerRadius = 10.0; popoverCon?.view.layer.masksToBounds = false; </code></pre> <p>it is not showing toward the part where arrow is but it displays a little of the border line in the tip of the arrow.</p> <p><a href="https://i.stack.imgur.com/Z7dQU.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/Z7dQU.jpg" alt="enter image description here"></a></p> <p>This was working fine until iOS 12 but in iOS 13 this issue is coming. </p> <p>Any suggestions on how I can solve this?</p>
<popover><ios13><uipopoverpresentationcontroller>
2019-09-18 08:59:19
HQ
57,989,316
how can i read list of object of array
how can i read with ngfor unter lebens = [ { lebenslage: "Arbeit & Ruhestand", kata: [ { unter: "altervorsorge", unterunter: [ "Erbschein", "Zusätzliche Altersvorsorgeförderung", "Urkundenverwahrung und -registrierung" ] }, { unter: "Arbeitsplatzwechsel", unterunter: [ "Gesundheitszeugnis", "Zulassung für reglementierte Berufe", "Anerkennung akademischer Abschlüsse" ] } ] }, { lebenslage: "Bauen & Wohnen", kata: [ { unter: "Wohnen & Umzug", unterunter: [ "Abfallentsorgung", "Baumfällgenehmigung", "Rundfunkbeitrag" ] }, { unter: "Bauen & Immobilien", unterunter: [ "Abbruchgenehmigung", "Baulastenverzeichnis", "Denkmalförderung" ] } ] } ]
<angular>
2019-09-18 09:21:11
LQ_EDIT
57,990,243
Header with lines on either side
<p>I<code>m writing a website, i</code>m newbie. Needs help with header, i don`t know how to create line on either side of header. Here is image [1]: <a href="https://imgur.com/a/slm22Pg" rel="nofollow noreferrer">https://imgur.com/a/slm22Pg</a> with that's what I mean.</p>
<html><css>
2019-09-18 10:08:07
LQ_CLOSE
57,994,898
How To Write Query To Show The Result like Picture
I want to use query showing top two best Quantity. But If My table like picture,How to show the result like this? Thanks! [Lick here to see picture][1] [1]: https://i.stack.imgur.com/IZ26g.png
<sql><oracle>
2019-09-18 14:15:41
LQ_EDIT
57,995,001
how to run the python script file which contains some arguments to pass?
I have a module which contains the python code and I execute using the following code: python script.py \ --eps 12 \ --minpts \ --train \ --predict \ --lower_case \ --input_file data.csv \ --dev_file devdata.csv \ --output_dir /output/ I use the parameters that are provided within the script and i don't have any methods or functions in it. But I wanted to take those parameters as input parameters to a function and the function has to execute the above python script with the given parameters. Is there any way of doing it?? Note: I know that I can write the entire code in script.py file into functions or classes but i just wanted to know if i can do it in this way just like an sql statement executed within the python code?
<python-3.x>
2019-09-18 14:20:40
LQ_EDIT
57,997,393
Converting seven segment to number
<p>I want to convert seven segment <strong>numbers</strong> to normal string in java. For example, if input string like this</p> <p>input</p> <pre><code> _ _ _ _ _ _ _ _ | _| _||_||_ |_ ||_||_|| | ||_ _| | _||_| ||_| _||_| </code></pre> <p>output should be like</p> <pre><code>1234567890 </code></pre> <p>I have found <a href="https://stackoverflow.com/a/42178177/9114020">this JavaScript</a> answer, and I'm trying to convert it to java.</p> <p>for now I have:</p> <pre><code>private static void get7segment(String ascii) { String[] splited="909561432".split(""); HashMap&lt;Integer,Integer&gt; map=new HashMap&lt;Integer,Integer&gt;(); map.put(0, 63); map.put(1, 6); map.put(2, 91); map.put(3, 79); map.put(4, 102); map.put(5, 109); map.put(6, 125); map.put(7, 7); map.put(8, 127); map.put(9, 111); } </code></pre> <p>any help would be appricheate</p>
<javascript><java><seven-segment-display>
2019-09-18 16:44:35
LQ_CLOSE
57,998,403
What is better to return a pointer to an array for have the function set values in a existing array
What is considered better to have something like this: int * foo(int n) { int * output = new int[n]; for (int i = 0; i < n; i++) { output[i] = i; } return output; } int main() { int * arr = foo(10); return 0; } and have the fuction return a pointer to the array or is it better to have something like this: void foo(int n, int output[]) { for (int i = 0; i < n; i++) { output[i] = i; } } int main() { int arr[10]; foo(10, arr); return 0; } where the function doesn't return anything but just sets the values of an array given in the parameters. Thanks.
<c++>
2019-09-18 17:57:02
LQ_EDIT
57,999,111
Count unique strings by column in pandas DataFrame
<p>I need to find how many times one of my four unique strings occurs in each column of my dataframe.</p> <p>does anyone know a formula that would work for this?</p>
<python><pandas>
2019-09-18 18:47:44
LQ_CLOSE
58,000,123
Visual Studio Can't Target .NET Framework 4.8
<p>I'm having some issues creating a project that targets .NET Framework 4.8. I am using Visual Studio 2019, upgraded to version 16.2.5. I have also installed the <a href="https://dotnet.microsoft.com/download/dotnet-framework/net48" rel="noreferrer">.NET Framework 4.8 Developer Pack</a>. From the Visual Studio Installer, I don't see any option for enabling 4.8 development tools <a href="https://stackoverflow.com/questions/43316307/cant-choose-net-4-7">similar to 4.7</a>.</p>
<.net><visual-studio><.net-4.8>
2019-09-18 20:12:32
HQ
58,000,474
How can i add more than one container in body
So, im really new to flutter or dart. I looked at many tutoriais, a bit hard to learn. i need to know, if i can, and how can i add more containers that contain Texts or Button in flutter. I already tried many things, but everything give me a error. i want to put some buttons at one container, and in other container i want to add some labels. and i need to put this two containers at my Scaffold, how i do it? or maybe how can i add two scaffold at same page, so i need labels at one and buttons in other.. import 'package:flutter/material.dart'; void main() => runApp (MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'My Tittle', debugShowCheckedModeBanner: false, home: Scaffold( appBar:AppBar( title: Text('My Title'), ), body: Container( child: Text('Hello World), ), //Container # I WANT TO ADD ANOTHER CONTAINER HERE ), //Scaffold ); //MaterialApp } }
<flutter><flutter-layout>
2019-09-18 20:42:25
LQ_EDIT
58,000,751
Using AWS Secrets Manager with Python (Lambda Console)
<p>I am attempting to use Secrets Manager a Lambda function in AWS. Secrets a manager is used to store database credentials to Snowflake (username, password).</p> <p>I managed to set up a secret in Secrets Manager which contains several key/value pairs (e.g. one for username, another for password).</p> <p>Now I am trying to refer to these values in my Python function code. AWS documentation kindly provides the following snippet:</p> <pre><code>import boto3 import base64 from botocore.exceptions import ClientError def get_secret(): secret_name = "MY/SECRET/NAME" region_name = "us-west-2" # Create a Secrets Manager client session = boto3.session.Session() client = session.client( service_name='secretsmanager', region_name=region_name ) # In this sample we only handle the specific exceptions for the 'GetSecretValue' API. # See https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_GetSecretValue.html # We rethrow the exception by default. try: get_secret_value_response = client.get_secret_value( SecretId=secret_name ) except ClientError as e: if e.response['Error']['Code'] == 'DecryptionFailureException': # Secrets Manager can't decrypt the protected secret text using the provided KMS key. # Deal with the exception here, and/or rethrow at your discretion. raise e elif e.response['Error']['Code'] == 'InternalServiceErrorException': # An error occurred on the server side. # Deal with the exception here, and/or rethrow at your discretion. raise e elif e.response['Error']['Code'] == 'InvalidParameterException': # You provided an invalid value for a parameter. # Deal with the exception here, and/or rethrow at your discretion. raise e elif e.response['Error']['Code'] == 'InvalidRequestException': # You provided a parameter value that is not valid for the current state of the resource. # Deal with the exception here, and/or rethrow at your discretion. raise e elif e.response['Error']['Code'] == 'ResourceNotFoundException': # We can't find the resource that you asked for. # Deal with the exception here, and/or rethrow at your discretion. raise e else: # Decrypts secret using the associated KMS CMK. # Depending on whether the secret is a string or binary, one of these fields will be populated. if 'SecretString' in get_secret_value_response: secret = get_secret_value_response['SecretString'] else: decoded_binary_secret = base64.b64decode(get_secret_value_response['SecretBinary']) # Your code goes here. </code></pre> <p>Later in my <code>def lambda_handler(event, context)</code> function, I have the following snippet to establish a connection to my database:</p> <pre><code> conn = snowflake.connector.connect( user=USERNAME, password=PASSWORD, account=ACCOUNT, warehouse=WAREHOUSE, role=ROLE ) </code></pre> <p>However, I am unable to figure out how to use the <code>get_secret()</code> function to return values for parameters like <code>USERNAME</code> or <code>PASSWORD</code>. </p> <p>How can this be accomplished? Thank you for the help!</p>
<python><amazon-web-services><aws-lambda><aws-secrets-manager>
2019-09-18 21:09:16
HQ
58,001,156
What is exit status 42?
<p>I would like to know what that means, Im doing a program with matrix, kinda like pacman, but whenever I try to interact with the program it ends and returns "Exit status 42"</p>
<c++>
2019-09-18 21:48:25
LQ_CLOSE
58,001,769
Codeigniter 4 Modules not working perperly
I have been trying to setup codeigniter 4 modules but it seems something is not working properly it takes me to 404 or not found. i have gone through this doc : https://codeigniter4.github.io/CodeIgniter4/general/modules.html?highlight=modules I have simply installed Ci4 and follow this doc did not tweaked anything else as we do in previous ci 3 hmvc practice. is there anything else beside autoload ? I'm basic php dev. please guide. thanks.
<codeigniter><module><hmvc>
2019-09-18 23:09:05
LQ_EDIT
58,002,754
I've installed pytorch, but cuda is not recognized
I installed pytorch using this command pip3 install torch===1.2.0 torchvision===0.4.0 -f https://download.pytorch.org/whl/torch_stable.html and it seemed to work. When importing torch, there is no error. My laptop has a geforce 1060 ti, which I assumed would work with cuda. [Here is the error in the ide (eclipse)][1] [1]: https://i.stack.imgur.com/ey7wU.png
<python><pytorch>
2019-09-19 02:05:16
LQ_EDIT
58,004,334
Client connect to server problem using winsock TCP c++
I try to make a application that client send a message and the server respond on the same machine using winsock TCP c++. The problem is that after the server waited for client to connect, I ran the client code and it stopped at the accept and exit. This is my code. Server: #include <stdio.h> #include <tchar.h> #include <winsock2.h> #include <iostream> #define MY_PORT 8888 using namespace std; int _tmain(int argc, _TCHAR* argv[]) { //Init Winsock WSADATA SData; if (WSAStartup(0x0202, &SData) != 0) { cout << "KHONG THE KHOI DONG WINSOCK"; return 1; } //Init Socket int listeningSocket; if ((listeningSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { perror("socket failed"); WSACleanup(); exit(EXIT_FAILURE); } //Set IP and PORT sockaddr_in server_addr; server_addr.sin_family = AF_INET; server_addr.sin_port = htons(MY_PORT); server_addr.sin_addr.s_addr = INADDR_ANY; //Bind if (bind(listeningSocket, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) { perror("bind failed"); closesocket(listeningSocket); WSACleanup(); exit(EXIT_FAILURE); } //Listen if (listen(listeningSocket, 5) < 0) { perror("listen failed"); closesocket(listeningSocket); WSACleanup(); exit(EXIT_FAILURE); } //Accept int new_socket; sockaddr_in client_addr; int nSizeAddr = sizeof(sockaddr); if (new_socket = accept(listeningSocket, (struct sockaddr *)&client_addr, &nSizeAddr) < 0) { perror("accept failed"); closesocket(listeningSocket); WSACleanup(); exit(EXIT_FAILURE); } while (1) { //recv char buff[100]; if (recv(new_socket, buff, 100, 0) < 0) { perror("recv failed"); closesocket(listeningSocket); WSACleanup(); exit(EXIT_FAILURE); } cout << buff << endl; //send string sndStr = "Da nhan"; if (send(new_socket, sndStr.c_str(), sndStr.size(), 0) < 0) { perror("send failed"); closesocket(listeningSocket); WSACleanup(); exit(EXIT_FAILURE); } } //close socket closesocket(new_socket); //Cleanup winsock WSACleanup(); return 0; } Client: #include <stdio.h> #include <tchar.h> #include <winsock2.h> #include <iostream> #include <string> #define MY_PORT 8888 using namespace std; int _tmain(int argc, _TCHAR* argv[]) { //Init winsock WSADATA SData; if (WSAStartup(0x0202, &SData) != 0) { cout << "KHONG THE KHOI DONG WINSOCK"; return 1; } //Init socket int clientSocket; if (clientSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) < 0) { perror("socket failed"); WSACleanup(); exit(EXIT_FAILURE); } //Set IP and PORT sockaddr_in server_addr; server_addr.sin_family = AF_INET; server_addr.sin_port = htons(MY_PORT); server_addr.sin_addr.s_addr = INADDR_ANY; //Vi Client-Server chung 1 may //Connect if (connect(clientSocket, (SOCKADDR*)&server_addr, sizeof(server_addr)) < 0) { perror("connect failed"); closesocket(clientSocket); WSACleanup(); exit(EXIT_FAILURE); } while (1) { //Send string sndStr; getline(cin, sndStr); if (send(clientSocket, sndStr.c_str(), sndStr.size(), 0) < 0) { perror("send failed"); closesocket(clientSocket); WSACleanup(); exit(EXIT_FAILURE); } //Recv char buff[100]; if (recv(clientSocket, buff, 100, 0) < 0) { perror("recv failed"); closesocket(clientSocket); WSACleanup(); exit(EXIT_FAILURE); } cout << buff << endl; } //Close socket closesocket(clientSocket); //Cleanup Winsock WSACleanup(); } It had an error at the accept step but I don't know what was the error name. How can I fix it. Thanks for all your help
<c++><tcp><winsock>
2019-09-19 05:37:27
LQ_EDIT
58,004,692
How to redirect to html error page when error 403 occurs on Google Cloud Plateform?
I'm looking for a way to redirect 403 errors to a html error page on Google Cloud Plateform.
<google-app-engine><redirect><google-cloud-platform><http-status-code-403>
2019-09-19 06:11:01
LQ_EDIT
58,005,282
Is decimal quadruple precision?
<p>Float is 32 bits and is single precision (floating point format). Double is 64 bits and is double precision (floating point format). Decimal is 128 bits, but is it quadruple precision (floating point format)?</p>
<c#>
2019-09-19 06:52:29
LQ_CLOSE
58,006,152
.net core 3 not having ReferenceLoopHandling in AddJsonOptions
<p>My csproject file is indicating: <code>&lt;TargetFramework&gt;netcoreapp3.0&lt;/TargetFramework&gt;</code></p> <p>In my startup im using the followinhg:</p> <pre><code> services.AddMvc(x =&gt; x.Filters.AddService&lt;TransactionFilter&gt;()) .AddJsonOptions(options =&gt; options.JsonSerializerOptions... ) </code></pre> <p>But, ReferenceLoopHandling is not available inside <code>options.JsonSerializerOptions</code>.</p> <p><a href="https://i.stack.imgur.com/0cqfc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0cqfc.png" alt="enter image description here"></a></p> <pre><code>&lt;Project Sdk="Microsoft.NET.Sdk.Web"&gt; &lt;PropertyGroup&gt; &lt;TargetFramework&gt;netcoreapp3.0&lt;/TargetFramework&gt; &lt;/PropertyGroup&gt; &lt;ItemGroup&gt; &lt;PackageReference Include="FluentNHibernate" Version="2.1.2" /&gt; &lt;PackageReference Include="FullContact.Contacts.API" Version="1.0.3" /&gt; &lt;PackageReference Include="Google.Cloud.Storage.V1" Version="2.3.0" /&gt; &lt;PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.2.0" /&gt; &lt;PackageReference Include="Microsoft.AspNetCore.Mvc.Cors" Version="2.2.0" /&gt; &lt;PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.2.0" /&gt; &lt;PackageReference Include="Microsoft.IdentityModel.Tokens" Version="5.5.0" /&gt; &lt;PackageReference Include="MySql.Data" Version="8.0.17" /&gt; &lt;PackageReference Include="piplclient" Version="5.0.9" /&gt; &lt;PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.5.0" /&gt; &lt;/ItemGroup&gt; &lt;/Project&gt; </code></pre>
<json><asp.net-core>
2019-09-19 07:46:28
HQ
58,006,473
Web Scrapping with beautifulSoup and unchanging URL
I am trying to Web Scrap ''' url='https://classicalnumismaticgallery.com/advancesearch.aspx?auctioncode=0&pricerange=0&keyword=Indore&category=&material=0&lotno=&endlotno' r = requests.get(url) soup = BeautifulSoup(r.text , 'lxml') details = soup.find_all('span', {'class' : 'src'}) i=0 for d in details: det = d.text det = det + d.string print(det) ''' but it scraps only one webpage. I inspected the `XHR` but nothing gets triggered when we change the page. I also inspected the `FORM DATA` in advancesearch.aspx but it also doesn't have page Index related information. On page click event I found `ctl00$ContentPlaceHolder1$gvItem$ctl01$ctl03` but not sure how to use this in 'URL'. What URL should I use to access the other pages?
<python><selenium><selenium-webdriver><web-scraping><beautifulsoup>
2019-09-19 08:06:31
LQ_EDIT
58,010,655
Is adb remount broken on android api 29?
<p><code>adb remount</code> does not work correctly on api 29 when running from the emulator. The command works fine on all other emulators that have been tried (18, 23, 25, 26, 27 and 28).</p> <p>Any ideas why this might be?</p> <pre><code>Skip mounting partition: /product_services Skip mounting partition: /product Skip mounting partition: /product_services Skip mounting partition: /product Skip mounting partition: /product_services Skip mounting partition: /product Skip mounting partition: /product_services Skip mounting partition: /product Skip mounting partition: /product_services Skip mounting partition: /product Skip mounting partition: /product_services W Disabling verity for /system E Skipping /system Skip mounting partition: /product Skip mounting partition: /product_services Skip mounting partition: /product Skip mounting partition: /product_services Skip mounting partition: /product Skip mounting partition: /product_services Skip mounting partition: /product Skip mounting partition: /product_services Skip mounting partition: /product Skip mounting partition: /product_services Skip mounting partition: /product Skip mounting partition: /product_services Skip mounting partition: /product Skip mounting partition: /product_services Skip mounting partition: /product Skip mounting partition: /product_services Skip mounting partition: /product Skip mounting partition: /product_services Skip mounting partition: /product Skip mounting partition: /product_services Skip mounting partition: /product Skip mounting partition: /product_services /system/bin/remount exited with status 7 remount failed </code></pre>
<android><android-emulator><adb><android-10.0>
2019-09-19 12:05:51
HQ
58,012,250
get number's from user and put them in a list and find the biggest odd number
I'm a beginner in python 3 and I want to 1)ask 10 number from user and put them in a list and then 2)check the beggest odd number. the following code just put the last number in the value(number) and I have no idea about how to check for the beggest odd number for i in range(1,11): number = list((input(f"please enter the {i}th number: "))) print(number)
<python-3.x>
2019-09-19 13:32:06
LQ_EDIT
58,017,215
What typescript type do I use with useRef() hook when setting current manually?
<p>How can I use a React ref as a mutable instance, with Typescript? The current property appears to be typed as read-only.</p> <p>I am using React + Typescript to develop a library that interacts with input fields that are NOT rendered by React. I want to capture a reference to the HTML element and then bind React events to it. </p> <pre><code> const inputRef = useRef&lt;HTMLInputElement&gt;(); const { elementId, handler } = props; // Bind change handler on mount/ unmount useEffect(() =&gt; { inputRef.current = document.getElementById(elementId); if (inputRef.current === null) { throw new Exception(`Input with ID attribute ${elementId} not found`); } handler(inputRef.current.value); const callback = debounce((e) =&gt; { eventHandler(e, handler); }, 200); inputRef.current.addEventListener('keypress', callback, true); return () =&gt; { inputRef.current.removeEventListener('keypress', callback, true); }; }); </code></pre> <p>It generates compiler errors: <code>semantic error TS2540: Cannot assign to 'current' because it is a read-only property.</code></p> <p>I also tried <code>const inputRef = useRef&lt;{ current: HTMLInputElement }&gt;();</code> This lead to this compiler error:</p> <pre><code>Type 'HTMLElement | null' is not assignable to type '{ current: HTMLInputElement; } | undefined'. Type 'null' is not assignable to type '{ current: HTMLInputElement; } | undefined'. </code></pre>
<reactjs><typescript><react-hooks>
2019-09-19 18:40:58
HQ
58,018,542
Spring Boot: How to keep DDD entities clean from JPA/Hibernate Annotations?
<p>I am writing an application that I wish to follow the DDD patterns, a typical entity class looks like this:</p> <pre><code>@Entity @Table(name = "mydomain_persons") class Person { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; @Column(name="fullname") private String fullName; @OneToMany(cascade=ALL, mappedBy="item") private Set&lt;Item&gt; items; } </code></pre> <p>As you see, since the JPA/Hibernate heavily relies on annotations on entity classes, my domain entity classes are now polluted by persistence-aware annotations. This violates DDD principles, as well as separation of layers. Also it gives me problems with properties unrelated to ORM, such as events. If I use @Transient, it will not initialize a List of events and I have to do this manually or get weird errors. </p> <p>Id like the domain entity to be a POJO(or POKO as I use Kotlin), so I do not want to have such annotations on the entity class. However I definitely do not wish to use XML configurations, its a horror and the reason why Spring developers moved on to annotations in the first place. </p> <p>What are the options I have available? Should I define a DTO class that contains such annotations and a Mapper class that converts each DTO into the corresponding Domain Entity? Is this a good practice? </p> <p>Edit: I know in C# the Entity Framework allows creation of mapping classes outside of Entity classes with Configuration classes, which is a way better alternative than XML hell. I aint sure such technique is available in the JVM world or not, anyone knows the below code can be done with Spring or not? </p> <pre><code>public class PersonDbContext: DbContext { public DbSet&lt;Person&gt; People { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { //Write Fluent API configurations here //Property Configurations modelBuilder.Entity&lt;Person&gt;().Property(p =&gt; p.id).HasColumnName("id").IsRequired(); modelBuilder.Entity&lt;Person&gt;().Property(p =&gt; p.name).hasColumnName("fullname").IsRequired(); modelBuilder.Entity&lt;Person&gt;().HasMany&lt;Item&gt;(p =&gt; p.items).WithOne(i =&gt; i.owner).HasForeignKey(i =&gt; i.ownerid) } </code></pre>
<spring><hibernate><spring-boot><orm><domain-driven-design>
2019-09-19 20:29:13
HQ
58,018,627
Getting 'you cannot reject the app version in the current state' error trying to reject binary waiting for review
<p>I'm trying to reject an app binary from app store connect because I discovered a bug and made a new build. The application status is 'waiting for review'.</p> <p>There's a button to reject the binary shown here.</p> <p><a href="https://i.stack.imgur.com/RvOWf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RvOWf.png" alt="enter image description here"></a></p> <p>Clicking 'remove this version from review' presents me with the dialog below. When I click 'Remove' the red error message appears and the page is redirected to app store connect home page</p> <p><a href="https://i.stack.imgur.com/3iRIW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/3iRIW.png" alt="When I click &#39;Remove&#39; the red error message appears and the page is redirected to app store connect home page"></a></p> <p>I tried a lot but I get the same error and redirection every time.</p> <p>Thanks for advance.</p>
<ios><xcode><app-store-connect>
2019-09-19 20:36:09
HQ
58,018,633
SwiftUI: How to remove margin between views in VStack?
<p>Using SwiftUI, I created a VStack, which contains some fixed elements and a list element. The reason is, that the user should only scroll the area under the fixed elements. Now I see a space between the second fixed element and the list. I don't know where this space is coming from and want to get rid of it, but have no idea, how. The area is marked in red.</p> <pre><code>struct DashboardView : View, CoreDataInjected { var body: some View { GeometryReader { geometry in VStack { ScopeSelectorView().frame(maxWidth: .infinity).background(ColorPalette.gray) BalanceNumberView().frame(maxWidth: .infinity) List { DashboardNavigationView( height: geometry.size.height - ScopeSelectorView.height - BalanceNumberView.height ).frame(maxWidth: .infinity).listRowInsets(.zero) } } }.background(Color.red).edgesIgnoringSafeArea(.all) } } </code></pre> <p><a href="https://i.stack.imgur.com/0wWsp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0wWsp.png" alt="Screenshot of view"></a></p>
<swiftui><vstack>
2019-09-19 20:36:50
HQ
58,018,659
Split Access database in separat files
I want to export each table of one database in separt accdb-files and I don't get it. With the following code -> https://www.devhut.net/2012/09/27/ms-access-vba-export-database-objects-to-another-database/ the destination database must already exist. How can I create e.g. for table1 the file table1.accdb and export only one table in to this database. If the main database has 10 table 10 files should be created and the belonging table should exported as well.
<vba><ms-access>
2019-09-19 20:38:47
LQ_EDIT
58,019,311
Check all type from element in list in python
<p>What is the most elegant way for me to check element type from the list. I use all, isinstance and list comprehensive. but if there is more pythonic way to do it?</p> <pre><code>from collections import Mapping from enum import Enum class Company(Enum): apple = 'Apple' google = 'Google' a = {'key': 'xxxx'} a = {'key': ({'sub_dic', 'value'})} a = [Company.apple, Company.google] if all(isinstance(i, Mapping) for i in a): print('dict') elif all(isinstance(i, tuple) for i in a): if all(isinstance(i, Mapping) for i in a): print('tuple with dict') else: print('tuple') elif all(isinstance(i, Enum) for i in a): print('Enum') else print('Invalid type') </code></pre>
<python><python-3.x>
2019-09-19 21:48:58
LQ_CLOSE
58,019,335
python3.7.4 pip install mysqlclient on windows i cant install
<p>pip install mysqlclient Collecting mysqlclient Using cached <a href="https://files.pythonhosted.org/packages/4d/38/c5f8bac9c50f3042c8f05615f84206f77f03db79781db841898fde1bb284/mysqlclient-1.4.4.tar.gz" rel="nofollow noreferrer">https://files.pythonhosted.org/packages/4d/38/c5f8bac9c50f3042c8f05615f84206f77f03db79781db841898fde1bb284/mysqlclient-1.4.4.tar.gz</a> Installing collected packages: mysqlclient Running setup.py install for mysqlclient ... error ERROR: Command errored out with exit status 1: command: 'c:\users\amirhossein\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\AMIRHO~1\AppData\Local\Temp\pip-install-0khbcyo4\mysqlclient\setup.py'"'"'; <strong>file</strong>='"'"'C:\Users\AMIRHO~1\AppData\Local\Temp\pip-install-0khbcyo4\mysqlclient\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(<strong>file</strong>);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, <strong>file</strong>, '"'"'exec'"'"'))' install --record 'C:\Users\AMIRHO~1\AppData\Local\Temp\pip-record-0w16kjrt\install-record.txt' --single-version-externally-managed --compile cwd: C:\Users\AMIRHO~1\AppData\Local\Temp\pip-install-0khbcyo4\mysqlclient\ Complete output (24 lines): running install running build running build_py creating build creating build\lib.win32-3.7 creating build\lib.win32-3.7\MySQLdb copying MySQLdb__init__.py -> build\lib.win32-3.7\MySQLdb copying MySQLdb_exceptions.py -> build\lib.win32-3.7\MySQLdb copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb creating build\lib.win32-3.7\MySQLdb\constants copying MySQLdb\constants__init__.py -> build\lib.win32-3.7\MySQLdb\constants copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\constants copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants running build_ext building 'MySQLdb._mysql' extension error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": <a href="https://visualstudio.microsoft.com/downloads/" rel="nofollow noreferrer">https://visualstudio.microsoft.com/downloads/</a><br> ---------------------------------------- ERROR: Command errored out with exit status 1: 'c:\users\amirhossein\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\AMIRHO~1\AppData\Local\Temp\pip-install-0khbcyo4\mysqlclient\setup.py'"'"'; <strong>file</strong>='"'"'C:\Users\AMIRHO~1\AppData\Local\Temp\pip-install-0khbcyo4\mysqlclient\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(<strong>file</strong>);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, <strong>file</strong>, '"'"'exec'"'"'))' install --record 'C:\Users\AMIRHO~1\AppData\Local\Temp\pip-record-0w16kjrt\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.</p>
<python><mysql><pip><installation>
2019-09-19 21:52:21
LQ_CLOSE
58,020,721
How to replace missing characters in a string with a dictionary
<p>I want to replace missing characters in a string with a dictionary. Take <strong>t-a-19-/</strong> for example. I want to replace the dashes with every possible letter or number from an array.</p> <p>I tried using the replace() function, but it can't take arrays. How would I do the same function but with arrays?</p> <p>Here's my code:</p> <pre><code>word = "t-a-19-/" # Alpha numeric dictionary alphanumericdict = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] # Replaces string with dictionary brute = word.replace('-', alphanumericdict); print(brute); </code></pre> <p>I get this error because the replace() function only takes strings, not lists.</p> <pre><code>Traceback (most recent call last): File "bruteforce.py", line 17, in &lt;module&gt; brute = word.replace('-', alphanumericdict); TypeError: replace() argument 2 must be str, not list </code></pre>
<python>
2019-09-20 01:39:31
LQ_CLOSE
58,021,784
Can you load other website html source code using only js?
I wanted to retrieve a webpage example "http://google.com". Not from your own website. I wanted to extract all url then only download the picture. Can this be achieved using only own js code without using ajax or jquery? Because I wanted it to be as lightweight as possible Note: I don't wish to use other site api. I hope this can be achived using own written js only. ``` <p id="demo">here is your downloadable picture link: </p> <script> function analyseURL() { var url1 = "http://google.com"; var HtmlPageSource = get url1 inner sourcode var finalPic = filter HtmlPageSource here document.getElementById("demo").innerHTML = finalPic; } </script> ```
<javascript><html>
2019-09-20 04:29:16
LQ_EDIT
58,022,066
text file reading with dict in python
From bellow text file, read the text file into a python proram and group all the words according to their first letter. Represent the groups in form of dictionary. Where the staring alphabet is the "key" and all the words starting with the alphabets are list of "values". text file is : Among other public buildings in a certain town, which for many reason it will be prudent to refine from mentioning, and to which i will assign no fictitious name, there is one anciently common to most towns, great or small.
<file-handling>
2019-09-20 05:05:03
LQ_EDIT
58,022,332
I Want to move a div to another div on a specific time frame like on 7 am in the morning the code runs and move a div to other div
here is my code <script type="text/javascript"> jQuery(document).ready(function(){ var tomorrow_sec = jQuery("#day").html(); jQuery("#day-dest").html(tomorrow_sec); jQuery("#day").html(" "); }); </script>
<javascript><jquery>
2019-09-20 05:35:09
LQ_EDIT
58,022,552
Class path contains multiple SLF4J bindings, pls tell me which dependency should I remove from the pom to resolved this problem
<p>In my pom.xml file, I found following dependencies, in my parent pom.xml contain logback-classic dependency and another module contain slf4j-api dependency,</p> <pre><code> &lt;dependency&gt; &lt;groupId&gt;org.slf4j&lt;/groupId&gt; &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt; &lt;version&gt;${slf4j.version}&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt; &lt;artifactId&gt;logback-classic&lt;/artifactId&gt; &lt;version&gt;${logback.version}&lt;/version&gt; &lt;/dependency&gt; logback-classic-1.0.13.jar!/org/slf4j/impl/StaticLoggerBinder.class slf4j-simple-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class </code></pre>
<java><spring-boot><logback><slf4j>
2019-09-20 05:59:04
LQ_CLOSE
58,023,642
when i use "=" copy a object ,why source value and destination value are different?
i am copy a object ,but source value and destination value are different ,i am not sure what happened.temp_mode not same as default_mode after copy,[details as attachemnt][1] bool display_device_info::change_resolution(int width,int height) { DEVMODE temp_mode; temp_mode.dmSize = sizeof(DEVMODE); temp_mode.dmDriverExtra = 0; temp_mode=default_mode; temp_mode.dmPelsWidth = width; temp_mode.dmPelsHeight = height; bool res=ChangeDisplaySettings(&temp_mode, 0); return res; } [1]: https://i.stack.imgur.com/VQo9J.png
<c++>
2019-09-20 07:23:44
LQ_EDIT
58,024,039
Creating layout using flex (html, css)
I'm trying to create the following layout for one of my web projects. What's the best way to create that using HTML, CSS (Flex)? I'm struggling with bottom-margin for C & D in Desktop screens, for D in Mobile screens. [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/rhOWn.png
<html><css><flexbox><frontend>
2019-09-20 07:47:49
LQ_EDIT
58,025,101
Move Image from one DB to another MySQL with PHP
I need to move an image (blob field) from a MySQL database to another that are located on two different servers. I tried to get blob field from the first database and I tried to upload the second, but something went wrong (no errors showing, btw). ```php /* SERVER #1 */ /* connection to server1... */ $sql_u="SELECT PHOTO, PHOTO_NAME FROM database1 WHERE ID='1'"; $query_u = mysqli_query($conn, $sql_u); $record_u = mysqli_fetch_array($query_u); $photo = $record_u['PHOTO']; $photo_name = $record_u['PHOTO_NAME']; /* SERVER #2 */ /* connection to server2... */ $sql_i = "UPDATE database2 SET PHOTO = '$photo', PHOTO_NAME = '$photo_name' WHERE ID='1'"; $query_i = mysqli_query($conn, $sql_i); ``` I need to update the second database with the BLOB field of the first one. I tried to use base64_encode() but still not work. I think I have to handle the BLOB field in some way, but I don't know how. PHOTO : BLOB TYPE PHOTO_NAME : VARCHAR TYPE
<php><mysql><image><mysqli>
2019-09-20 08:57:56
LQ_EDIT
58,025,349
i want to create login in laravel, i have problem in cmd with: php artisan make:auth
[**this is the image of the CMD!! **][1] [1]: https://i.stack.imgur.com/GtJRj.png i have problem in "CMD" with: php artisan "make:auth". how can i create login in laravel
<php><html><laravel>
2019-09-20 09:13:33
LQ_EDIT
58,025,420
How can I add a click event to the v-data-table?
<p>I want to call the editItem function when the table row is clicked. Current what happens is I click on the table row and it doesn't display the details page. Yet when I put this click event on a particular table data the editItem function gets called. How can I make this same function to be called on the table row itself? </p> <p>Here in my code I have tried using the the v-data-table template and slot and included the click event on the row but it is not working either</p> <pre><code>&lt;template slot="items" slot-scope="props"&gt; &lt;tr @click="editItem(item), selected = item.id"&gt; &lt;td&gt;{{ props.item.member }}&lt;/td&gt; &lt;td&gt;{{ props.item[1] }}&lt;/td&gt; &lt;td&gt;{{ props.item[2] }}&lt;/td&gt; &lt;td&gt;{{ props.item[3] }}&lt;/td&gt; &lt;td&gt;{{ props.item[4] }}&lt;/td&gt; &lt;td&gt;{{ props.item[5] }}&lt;/td&gt; &lt;td&gt;{{ props.item[6] }}&lt;/td&gt; &lt;td&gt;{{ props.item[7] }}&lt;/td&gt; &lt;td&gt;{{ props.item[8] }}&lt;/td&gt; &lt;td&gt;{{ props.item[9] }}&lt;/td&gt; &lt;td&gt;{{ props.item[10] }}&lt;/td&gt; &lt;td&gt;{{ props.item[11] }}&lt;/td&gt; &lt;td&gt;{{ props.item[12] }}&lt;/td&gt; &lt;td&gt;{{ props.item[13] }}&lt;/td&gt; &lt;/tr&gt; &lt;/template&gt; </code></pre> <p>I expect that when the row is clicked, the editItem function is called</p>
<vue.js><vuetify.js>
2019-09-20 09:17:35
HQ
58,025,465
Variable initialization in Delphi 10 Rio
<p>My company has been using Delphi for decades, and our core program was made in a quite old version. It has about 1.3 million lines of code.</p> <p>After upgrading to Delphi 10 Rio, a major problem occured. Where our local function variables used to be initialized with a default value (integer would be 0, boolean would be false), it seems they no longer are. Now all my variables get a random value as they are created, so an integer gets something like 408796 as it's value.</p> <p>I suppose this isn't an issue with new development, but I am sure you can see the problem in our large code base. We have never manually assigned default values to these variables as it worked fine. Object variables, however, have always had this problem. All properties get random values, so we have adressed that as we went. But now our program completely breaks, as all counters etc. are starting at high values instead of 0. And running through the entire project to fix this would take months.</p> <p>Is there perhaps a compiler option to change this? Seems very backwards that they would have changed this intentionally, as it would be pretty stupid. Why remove functionality that all developers expect? I had actually expected it to go the other way, that object variables would no longer need manual default values, and that they maybe implemented a garbage collector. But is seems Delphi has seriously regressed?</p> <p>If there is some option to fix this, PLEASE let me know.</p>
<delphi><variables><default>
2019-09-20 09:20:32
LQ_CLOSE
58,026,229
Turn off a screenshot on the phone by javascript
<p>How can I prevent a screenshot from the phone on my site by javascript or jquery</p>
<javascript><jquery><html>
2019-09-20 10:07:30
LQ_CLOSE
58,026,865
Angular 8 - Stop ng serve if build fail
<p>I need the way to stop the "ng serve" when the build failed. At the moment, app start anyway.</p> <p>Thanks.</p>
<angular><typescript>
2019-09-20 10:45:13
LQ_CLOSE
58,027,378
How to replace certain data frame value with it's unknown column name?
<p>I have a large data frame with unknown column names and numeric values 1, 2, 3, or 4. Now I want to replace all 4 values with it's column name and all 1, 2 and 3's with an empty value. </p> <p>Ofcourse I can make a loop of some kind, like this:</p> <pre><code>df &lt;- data.frame(id=1:8,unknownvarname1=c(1:4,1:4),unknownvarname2=c(4:1,4:1)) for (i in 2:length(df)){ df[,i] &lt;- as.character(df[,i]) df[,i] &lt;- mgsub::mgsub(df[,i],c(1,2,3,4),c("","","",names(df)[i])) } </code></pre> <p>This would be the result:</p> <pre><code> id unknownvarname1 unknownvarname2 1 1 unknownvarname2 2 2 3 3 4 4 unknownvarname1 5 5 unknownvarname2 6 6 7 7 8 8 unknownvarname1 unknownvarname2 </code></pre> <p>For a data frame this size that's no problem at all. But when I try this loop on large data frames with up to 30k and up to 40 uknown variables, the loop takes ages to complete.</p> <p>Does anyone know of a faster way to do this? I tried functions like <code>mutate()</code> of <code>dplyr package</code> but I could not manage to make it work.</p> <p>Many thanks in advance!</p>
<r>
2019-09-20 11:18:48
HQ
58,027,923
Object from AWS S3 folder
How can i get a single object from a particular folder in AWS S3 bucket ? By Using the Asp.Net C# language, i don't know how to retrieve a single object that are on a folder in bucket of Amazon S3 Service ?
<c#><asp.net-mvc><amazon-web-services><amazon-s3>
2019-09-20 11:55:25
LQ_EDIT
58,028,635
Android match_parent with max_width
I have an ImageView and I want to set something like this: `min_with=match_parent and max_width=value` does someone know how to do that?
<android><android-layout><android-imageview>
2019-09-20 12:43:39
LQ_EDIT
58,028,854
Please help me with this PROBLEM :( "Choose some element a of A and some element b of B such that a + b doesn't belong to A and doesn't belong to B"
readInts = fmap (map read.words) getLine readInts :: IO [Int] main = do putStrLn "List number of A: " num1 <- readInts let a = [] ++ num1 putStrLn "List number of B: " num2 <- readInts let b = [] ++ num2
<haskell>
2019-09-20 12:58:10
LQ_EDIT
58,031,440
what difference there are between x 509 certificate and X509CertificateHolder java?
So i have a problem, i cant´t understand the difference between x509certificate and X509CertificateHolder java, because there are not who explain, of correct form, everybody do code but, they are not specific, what do in those lines, and the documentation is a little hard to understand, if someone can help me, i'll be very grateful, thanks.
<java><x509certificate><bouncycastle>
2019-09-20 15:38:29
LQ_EDIT
58,032,439
Trying ot create an admin "login"
I am trying to make an "admin" login and it isn't working, help? @echo off title RPG BETA color 0b set /p player=Welcome to Xero, what's your name?: if '%player%' == 'Admin' goto admin :intro echo Hello %player%! pause goto start :admin set /p password:What is the admin password?: if %password% == [not giving out password] goto true if %password not [not giving out password] goto false
<batch-file>
2019-09-20 16:53:32
LQ_EDIT
58,032,692
Understanding a little syntaxis
load data infile 'D:\\diiet\\subir\\a.txt' Into table reporte_dts_empresa_2015_sut CHARACTER SET latin1 fields terminated by '\t' why I have to do this step? LINES TERMINATED BY '\r\n' IGNORE 1 LINES; I am new on sql, i am trying to create a table whith excel data i already done it, but im not sure how.
<mysql><sql><excel><heidisql>
2019-09-20 17:16:34
LQ_EDIT
58,034,392
chmod "file permission" error during docker build from dockerfile
I am trying to copy a .war file from my host desktop to a location inside my docker container. Then i want to extract this .war file and afterwards change the permission to all the files which lies under one of the extracted file folder. Thereafter i again want to rebuild a .war file (after deleting the old .war file) at same location that would ultimately contain the edited files with granted read/write permissions.This new .war file i can then copy under my tomcat/webapps folder inside docker to get deployed. For this purpose i have written a docker file as shown FROM tomcat:8.5-jdk11 MAINTAINER derek RUN mkdir -p /usr/src/temp COPY SP-files/WAR/SP.war /usr/src/temp/ RUN jar -xvf /usr/src/temp/SP.war RUN rm -rf SP.war RUN chmod 777 /usr/src/temp/WEB-INF/native/* RUN jar -cvf /usr/src/temp/SP.war . RUN cp /usr/src/temp/SP.war /usr/local/tomcat/webapps/ During the docker build process i get the error chmod: cannot access '/usr/src/temp/WEB-INF/native/*': No such file or directory Indeed, my exploded SP.war has folder WEB-INF/native/{*all files to be edited are here*}.I have no clue why is it unable to locate the files. Is there some other way to specify the chmod command in docker file ? I have also attaches a screenshot of error. [ERROR-IMAGE][1] [1]: https://i.stack.imgur.com/YEym1.png [2]: https://i.stack.imgur.com/QAj2Y.png
<linux><docker><dockerfile>
2019-09-20 19:49:27
LQ_EDIT
58,035,325
list comprehension of a nested list to update list element on that nested list in python
<p>I have below snippets. I have used <strong>for loop</strong> to get 'updated_orders'. How can I make list comprehension to get 'updated_orders'. </p> <pre><code>orders = [[30, 'Seana', 'Nutter', 5, 'Classic Leather Jacket', 7, '$94.26'], [13, 'Katy', 'Furmonger', 2, 'Yellow Wool Jumper', 1, '$175.31']] updated_orders = [] for order in orders: order.append(order[5] * float(order[6].split('$')[1])) updated_orders.append(order) print(updated_orders) </code></pre> <p>output:</p> <pre><code>[[30, 'Seana', 'Nutter', 5, 'Classic Leather Jacket', 7, '$94.26', 659.82], [13, 'Katy', 'Furmonger', 2, 'Yellow Wool Jumper', 1, '$175.31', 175.31]] </code></pre>
<python><list-comprehension>
2019-09-20 21:21:40
LQ_CLOSE
58,035,332
Randomly changing background of JButtons in array?
<p>I'm currently attempting to create a Battleship game. The part I'm having trouble with is when I select the "Randomize" button, I would like it to put the ships at a random part of the grid.</p> <p>For example, the Carrier ship would cover 5 JButtons within the array. How do I randomly select 5 JButtons within the array that are next to each other?</p> <pre><code>import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; import java.awt.GridLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JButton; import java.util.Random; public class View { private JFrame frame; private JPanel panel1; private JPanel panel2; private JButton grid1[][]; private JButton randomize; private String[] alphabet = { "", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }; private String[] numbers = { "", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" }; public View() { configureFrame(); configurePanels(); configureComponents(); frame.setVisible(true); } private void configureFrame() { frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(900, 600); frame.setResizable(false); frame.setLocationRelativeTo(null); } private void configurePanels() { panel1 = new JPanel(); panel1.setLayout(new GridLayout(11, 11)); frame.getContentPane().add(panel1, BorderLayout.WEST); panel2 = new JPanel(); panel2.setSize(frame.getWidth(), frame.getHeight()); panel2.setLayout(null); frame.getContentPane().add(panel2); } private void configureComponents() { grid1 = new JButton[11][11]; for(int i = 0; i &lt; grid1.length; i++) { for(int j = 0; j &lt; grid1[i].length; j++) { grid1[i][j] = new JButton(); panel1.add(grid1[i][j]); } } for(int i = 0; i &lt; alphabet.length &amp;&amp; i &lt; numbers.length; i++) { grid1[0][i].setText(alphabet[i]); grid1[i][0].setText(numbers[i]); grid1[0][i].setFont(new Font("Tahoma", Font.BOLD, 19)); grid1[i][0].setFont(new Font("Tahoma", Font.BOLD, 19)); grid1[0][i].setEnabled(false); grid1[i][0].setEnabled(false); grid1[0][i].setBackground(Color.BLACK); grid1[i][0].setBackground(Color.BLACK); } grid1[0][0].setBackground(Color.BLACK); randomize = new JButton("Randomize"); randomize.setLocation(50, 65); randomize.setSize(100, 50); randomize.setFocusPainted(false); randomize.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { /* Want to randomly put the carrier on the grid somewhere grid1[2][3].setBackground(Color.LIGHT_GRAY); grid1[3][3].setBackground(Color.LIGHT_GRAY); grid1[4][3].setBackground(Color.LIGHT_GRAY); grid1[5][3].setBackground(Color.LIGHT_GRAY); grid1[6][3].setBackground(Color.LIGHT_GRAY); */ } }); panel2.add(randomize); } } </code></pre> <p>I'm very new to Java, so I apologize in advance if I'm not making any sense.</p>
<java><swing>
2019-09-20 21:22:19
LQ_CLOSE
58,035,394
in html / css how can i use two stuff having the same rel "stylesheet"??? (like what i wrote down)
skip thiss fdl;;;;;;;;;;;;;;;;;gksjfoiowlfyh fhsa yqa yted ay ted tdg its my first time posting here i got suck it asks for more details! i just have a small question sry for alot of confusion help me understand how to get to defferent links of css with same (rel) like "stylesheet" <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-css --> li:hover {color: green;} .nothing {color: purple;} p {font-family:monospace;} .new_font { font-family: 'Tangerine', serif; font-size: 48px;} body { text-shadow: 8px 8px 8px #aaa;} <!-- language: lang-html --> <!DOCTYPE html> <html lang="en"> <head> <title>Notes File</title> <link rel="stylesheet" href="style.css";> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Tangerine"> </head> <body> <h1>My HTML notes.</h1> <br> <strong>Markup</strong> <em>is a way of writing and structuring your HTML </em><br> <p>This is a story<br> all about how <mark>my life</mark> <sub>got flipped,</sub> turned <sup><em>upside</em> <strong>down</strong></sup>...</p> <br><br><br> <sub>X</sub><sup>2</sup><br><br> <strong>What have optional closing tags are:</strong><br> <ol> <li>"p" <ol> <li>can have end</li> <li>can leave it without end</li> </ol> <li>"li"</li> </ol> <p class="nothing">This text is inside the <strong>first</strong> paragraph element. <p style="color: blue;">This text is inside the second paragraph element—and it's BLUE!.</p> This text isn't inside<br> any paragraph element ...<br> ...yet! <p>This text is inside the third paragraph element.<br> <a href="https://www.udacity.com" target="_blank" style="color: red;"><strong>My favourite web page</strong></a> <br> <a href="https://placebear.com/600/500" target="_blank"><strong>A pic from web</strong><br><img src="https://placebear.com/600/500" alt="Bear img"></a> <br> <a href="AOT.jpg" target="_blank">A pic from my pc <br><img src="AOT.jpg" alt="Anime img"></a> <p style="text-align: center; color: red;" class=:"new_font" >this is a text aligned at the center and have a red color</p> <p style="color:blue; text-align:center;">Hello!</p> </body> </html> <!-- end snippet -->
<html><css><hyperlink><rel>
2019-09-20 21:30:47
LQ_EDIT
58,035,840
How I Can Keybind a Button?
I Need help to keybind this button, Wich mainly got this function: Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Toggle = Toggle + 1 If Toggle = 1 Then Timer1.Start() Button1.Text = "Toggle Off" Else Timer1.Stop() Toggle = 0 Button1.Text = "Toggle On" End If
<vb.net><winforms>
2019-09-20 22:38:06
LQ_EDIT
58,035,888
How can I sort through JSON in Python
I'm trying to sort through some JSON I get from a webpage and set specific attributes of part of the JSON to variables. Here is an example of the JSON {"name":"Duffle Bag","id":172614...}, {"name":"Backpack","id":172607...} I want to sort through the JSON based on the name, and then pull the id associated with it.
<python><json>
2019-09-20 22:47:05
LQ_EDIT
58,036,294
How to convert Single to Binary?
We may use a `Convert.ToString()` overload to convert these types to binary: Byte Short Integer Long For example: Dim iInteger As Integer Dim sBinary As String iInteger = Integer.MaxValue sBinary = Convert.ToString(iInteger, 2) But there isn't an overload for `Single` that accepts the base value. The single-argument overload returns scientific notation, not the binary value. I've tried this code: Public Function ToBinary(Value As Single) As String Dim aBits As Integer() Dim _ iLength, iIndex As Integer Select Case Value Case < BitLengths.BYTE : iLength = 7 Case < BitLengths.WORD : iLength = 15 Case < BitLengths.DWORD : iLength = 31 Case < BitLengths.QWORD : iLength = 63 End Select aBits = New Integer(iLength) {} For iIndex = 0 To iLength aBits(iLength - iIndex) = Value Mod 2 Value \= 2 Next ToBinary = String.Empty aBits.ForEach(Sub(Bit) ToBinary &= Bit End Sub) End Function Unfortunately, however, it returns inaccurate results. Given these, how may we reliably convert a `Single` value to a binary string?
<c#><vb.net><binary><type-conversion>
2019-09-21 00:10:53
LQ_EDIT
58,036,668
How do I cause a "post" request based on text field change? (without the use of a submit button)
I want to have an app where a user types into a text field. After the user is done, the form automatically "submits" a post request (there should be a delay of say, 2 seconds after the user stops typing). I don't know how to do this--I imagine it requires some java-script or more machinery. I'm working in flask/Python. I've extensively searched through SO for these solutions but can't find somewhere to get started.
<javascript><html><flask>
2019-09-21 01:45:16
LQ_EDIT
58,037,277
how to make a series of number jumps based on the numbers of variables
<p>I want to make row of number jumps, example I have <code>$a = 1</code> and <code>$b = 2</code>. then I want loop $a and $b and the result is <code>$a = '1', '5', '9', '13', '17'</code> and <code>$b = '2', '6', '10', '14', '18'</code> . How to make it?</p>
<php><codeigniter>
2019-09-21 04:27:13
LQ_CLOSE