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,115,232
get error code 400 when send request on stripe for get token
This is My Object for get bank account token this.myObject= { country: 'US', currency: 'usd', routing_number: '110000000', account_number: '000123456789', account_holder_name: 'Jenny Rosen', account_holder_type: 'individual', }; This is my function to get the token from stripe... How can i get bank account token from stripe `getTokenOFBankAccount(myObject: any): Observable<any> { this.spinner.show(); const headers = { headers: new HttpHeaders({Authorization: "Bearer "+ environment.stripeToken, "Content-Type": "application/x-www-form-urlencoded"}) } return this.http .post<any>("https://api.stripe.com/v1/tokens", myObject, headers) .pipe( tap(response => { debugger; this.spinner.hide(); if (response["status"] === "successful") { } else { } }) ); }` How can i get Bank account token from Stripe. what is the best way to get Bank account token from Stripe. How can i get Bank account token from Stripe. what is the best way to get Bank account token from Stripe.
<angular><angular6><stripe-payments>
2019-07-19 15:08:26
LQ_EDIT
57,115,272
How can/could/should I increment a date/time parameter in JMeter?
<p>I am sending post requests which have as parameters time and date (among others).</p> <p>Is there a way in which after sending a request (that fills in an appointment and displays in the UI a Calendar) the time parameter would increase with 30 minutes? </p> <p>And to cherry on the cake would be that after sending a number of requests for a certain day to be able to change the date and send another bulk of request without copy pasting and manually filling in date and time for each post?</p> <p>basically today is 07/19/2019, I would have to send out request with time parameter that would be 00:00:00, 00:30:00 and so on. It would total 48 requests.</p> <p>after sending those the date parameter would change into 07/20/2019 and the time parameter will continue to update the 30 minute mark.</p> <p>I am not asking for someone to create a script for me (sure that helps), but some guidance because I find it hard to copy paste so many times.</p> <p>Thank you in advance!</p>
<jmeter><timestamp><increment>
2019-07-19 15:10:56
LQ_CLOSE
57,116,949
How to get a value from a website using html and VBA
Here is a screenshot from the webpage i am searching informations from: [![enter image description here][1]][1] And here is a snippet of the HTML code of that page: [![enter image description here][2]][2] I want to get the value highlighted in yellow in the HTML code and copy it. But what i know to do in vba-html is to search for buttons and click them. Can anyone tell me a way to access the value that is highlighted in yellow? I really don't know how to do it because it is outside of a tag. Thank you for any help! :) [1]: https://i.stack.imgur.com/VsUdx.png [2]: https://i.stack.imgur.com/9VTwP.png
<html><excel><vba><internet-explorer>
2019-07-19 17:11:27
LQ_EDIT
57,117,121
Object reference not set to an instance of an object Unity
<p>The script is attached to a coin that when picked does that issue. There is nothing to attach in the inspector.</p> <p>The <code>CoinMagnet state</code> is assigned to another object (as a magnet).</p> <pre><code>public void Start() { Player = GameObject.FindGameObjectWithTag("Player"); pu = Player.GetComponent&lt;PowerUps&gt;(); } private void Update() { if (pu.CurrentPowerState == PowerUps.State.CoinMagnet) //issue here { if (Vector3.Distance(Player.transform.position, transform.position) &lt; CoinMagnetRadius) ... ... } } </code></pre> <p>Here is the Powerups class</p> <pre><code>public State CurrentPowerState; public enum State { None, Invincible, CoinMagnet, }; </code></pre>
<c#><unity3d>
2019-07-19 17:24:35
LQ_CLOSE
57,117,962
I'm trying to edge detecetion. But it works on just one image
i'm trying to create a simple edge detection filter. And as i said it works with only one image. I'm trying to create this filter with 2 steps. 1)Blurring image 2)calculate ( Original image-Blurring image) First step works well. And code of second one is simple like first one. But i see an error message: System.ArgumentOutOfRangeException: 'Parameter must be positive and < Height. Parameter name: y' Working image:https://i.hizliresim.com/dLXkbn.png ``` public void edgedetectionfilter( ) { Bitmap InputPicture,BlurredPicture, OutputPicture; InputPicture = new Bitmap(pBox_SOURCE.Image); BlurredPicture = new Bitmap(pBox_PROCESSED.Image); int PicWidth = InputPicture.Width; int PicHeight= InputPicture.Height; OutputPicture = new Bitmap(PicWidth, PicHeight); OutputPicture = InputPicture; int x, y, difR, difG, difB; Color OrgPicColoValue,BluredPicColorValue; for (x = 0; x < PicWidth; x++) { for (y = 0; y < PicWidth; y++) { BluredPicColorValue = BlurredPicture.GetPixel(x, y); OrgPicColoValue = InputPicture.GetPixel(x, y); //ERROR LINE difR = Convert.ToInt16(OrgPicColoValue.R -BluredPicColorValue.R); difG = Convert.ToInt16(OrgPicColoValue.G- BluredPicColorValue.G ); difB = Convert.ToInt16(OrgPicColoValue.B- BluredPicColorValue.B); if (difR > 255) difR = 255; if (difG > 255) difG = 255; if (difB > 255) difB = 255; if (difR < 0) difR = 0; if (difG < 0) difG = 0; if (difB < 0) difB = 0; OutputPicture.SetPixel(x, y, Color.FromArgb(difR, difG, difB)); } } pBoxMedian.Image = OutputPicture; } ```
<c#><image-processing>
2019-07-19 18:32:19
LQ_EDIT
57,119,742
How can i scale the dates (from oldest to most recent) in my file using python?
<p>i am currently trying to use datetime to re-organize dates from oldest to most recent in a .txt file. In the file i am reading in, the dates have the following format: 1 2019 06 27 05 47 57 464. The first column is the ID number, second is the year, third is the month, forth is the day, fifth is the hour, sixth is minutes, seventh is seconds and eight is millisecs. Is there an efficient way to organize it from oldest (in this case: 2000 2018 07 16 08 57 34 344) to most recent (1 2019 06 27 05 47 57 464)?</p> <p>I have tried importing datetime in python and reading in my file and setting the variables equal to their appropriate positions, but i cannot figure it out.</p>
<python><numpy><date><datetime>
2019-07-19 21:25:11
LQ_CLOSE
57,119,947
check alpha numeric password in php using js
I am using to js to check if the password is alphanumeric, below is the code, not sure why but it is not throwing the alert when password is not alphanumeric.Please note I am using php version 5. if (!input_string.match(/^[0-9a-z]+$/)) { alert("please enter alpha numeric password") }
<javascript>
2019-07-19 21:52:26
LQ_EDIT
57,122,086
Is the algorithm that involves n choose k exponetial
Say if we have an algorithm needs to choose k elements from n elements (k>=n), is the time complexity of the particular algorithm exponential and why?
<big-o><complexity-theory>
2019-07-20 05:33:30
LQ_EDIT
57,125,906
Cant clean memory with delete[] in C++
After uncommenting `delete[] array;` Im getting this error `CRT detected that the application wrote to memory after end of heap buffer` What do I have to do to correct this problem? ``` #include <iostream> using namespace std; int main(){ char ch; char* array = new char[0]; int array_index = 0; while(cin>>ch){ if(ch != '!'){ array[array_index++] = ch; }else{ break; } } //delete[ ] array; } ```
<c++><pointers>
2019-07-20 15:03:25
LQ_EDIT
57,126,573
Using Intellij Java Apache Poi, how to get rid of java.lang.nullpointerexception reading non-empty integer value from Excel file
<p>I want to read two integer values 100 and 200 in cell A1 and A2 using Intellij with Apache Poi. </p> <p>Issue: I am getting java.lang.nullpointerexception at the line num1 below.</p> <p>I've checked that I have apache poi jars added and correct import directives added. Excel row and column index starts at 1. Hence, getRow(1).getCell(1) refers to cell A1. Also, getSheetAt(0) refers to the first and only sheet that I have in my excel file. </p> <pre><code>import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFSheet; import java.io.File; import java.io.FileInputStream; import java.lang.Exception; int num1, num2, sum1; File src=new File("C:/test/testdata.xlsx"); FileInputStream fis=new FileInputStream(src); XSSFWorkbook wb=new XSSFWorkbook(fis); XSSFSheet sheet = wb.getSheetAt(0); num1 = Integer.parseInt(sheet.getRow(1).getCell(1).getStringCellValue()); num2 = Integer.parseInt(sheet.getRow(2).getCell(1).getStringCellValue()); sum1 = num1 + num2; System.out.println("The sum: " + sum1); </code></pre> <p>When running the code successfully, I should see num1 and num2 populated from excel file, and the sum is printed in the console.</p>
<java><apache-poi>
2019-07-20 16:26:03
LQ_CLOSE
57,127,001
I am getting some erron in most recent call last
Traceback (most recent call last): File "C:/Users/HP/PycharmProjects/HelloWorld/app.py", line 24, in <module> wb.save('transactions2.xlsx') File "C:\Users\HP\PycharmProjects\HelloWorld\venv\lib\site-packages\openpyxl\workbook\workbook.py", line 397, in save save_workbook(self, filename) File "C:\Users\HP\PycharmProjects\HelloWorld\venv\lib\site-packages\openpyxl\writer\excel.py", line 292, in save_workbook archive = ZipFile(filename, 'w', ZIP_DEFLATED, allowZip64=True) File "C:\Users\HP\AppData\Local\Programs\Python\Python37-32\lib\zipfile.py", line 1204, in __init__ self.fp = io.open(file, filemode) PermissionError: [Errno 13] Permission denied: 'transactions2.xlsx'
<python>
2019-07-20 17:19:59
LQ_EDIT
57,127,346
error in a C program using dynamic memory allocation and array
programming in C for finding maximum in 2D aaray using dynamic memory allocation. int main() { int i,arr[m][n],j,m,n; int max=0; int *ptr; printf("enter the value m"); scanf("%d",m); printf("enter the vaue of n"); scanf("%d",n); ptr=(int*)malloc(m*n*4); printf("enter the values\n"); for (i=0;i<m;i++) { for(j=0;j<n;j++) { scanf("%d",((ptr+i*n)+j)); } } max=arr[0][0]; for (i=0;i<m;i++) { for(j=0;j<n;j++) { if(max<*((ptr+i*n)+j)); max=*((ptr+i*n)+j); } } printf("%d",max); }
<c><ubuntu>
2019-07-20 18:06:03
LQ_EDIT
57,128,561
Hello, new person here with simple coding problems
I keep getting this nagging error on a code to convert currency in python. This code comes from python_scripts on instagram. Everything is checking out but this little bug is stopping the show. What have or am I doing wrong. This is the error that pops up. File "C:/Users/Pig Toy's PC/Documents/PythonPrograms/currencyconverter.py", line 70 + "&to_currency=" toCur + "&apikey=" + apiKey I ran all the other functions and they check out. ~~~~# -*- coding: utf-8 -*- """ Created on Sun May 19 17:15:47 2019 @author: ArtOfDHT """ #real time currency conversion. #importing necessary packages import requests import tkinter as tk from tkinter import * from tkinter import ttk #list of currencies currencylist = [ 'AED', 'AUD', 'BHD', 'BRL', 'CAD', 'CNY' , 'EUR', 'KHD' , 'INR' , 'USD' ] #defining inputs and widgets for GUI def CreateWidgets(): inputAMTL = label(root, text="Enter The Amount:", bg="SpringGreen4") inputAMTL.grid(row=1, column=2, columnspan=2, pady=10) inputAMTxt = Entry(root, width=20, textvariable=getAMT) inputAMTxt.grid(row=1, column=3, columnspan=2, pady=10) fromLabel = Label(root, text="FROM:", bg="SpringGreen4") fromLabel.grid(row=2, column=1) root.fromCombo = ttk.Combobox(root, values=currencyList) root.fromCombo.grid(row=2, column=2) toLabel = Label(root, text="TO:", bg="SpringGreen4") toLabel.grid(row=2, column=3) root.toCombo = ttk.Combobox(root, values=currencyList) root.toCombo.grid(row=2, column=4) convertButton = button(root, text="Convert", width=52, command=Convert) convertButton.grid(row=3, column=1, columnspan=2, pady=50) outputANTL = label(root, text ="Converted Amount:", font=('Helvetica', 10),bg="SpringGreen4") outputANTL.grid(row=4, column=2, columnspan=2, pady=50) root.outputAMTAns = Label(root, font=("Helvetica", 20),bg="SpringGreen4") root.outputAMTans.grid(row=4, column=3, columnspan=2, pady=50) def Convert(): #fetch and storing user-input in responsive variables inputAmt = float(getAmt.get()) fromCur = root.fromCombo.get() toCur = root.toCombo.get() #storing API key apikey ="FP6UEQWASCREGU57" #storing the base URL baseURL = r"http://www.alphavantage.co/query?function=CURRENCY_EXCHANGE_RATE" #storing the inputs inputURL = baseURL + "&to_currency=" + toCur + "&apiKey" + apiKey #return requests inputURL = baseURL + "&from_currency=" + fromCur\ + "&to_currency=" toCur + "&apikey=" + apiKey #response return requestObj = requests.get(inputURL) #converting the json format data to Python result = requestObj.json() #getting the exchange rate exchangeRate = float(result["Realtime Currency Exchange Rate"] ['5, Exchange Rate'] #calculate the converted amount and rounding to nearest 2 places calculateAmt = round(inputAmt * exchangeRate, 2) #Display the converted amount in the respected label root.outputAMTAns.config(text=str(calculateAmt)) #creating root class root = tk.Tk() #setting gui structure root.geometry("400x250") root.resizable(False, False) root.title("PyCurrencyConverter") root.config(bg = "SpringGreen4") #Create tkinter variable getAMT = StringVar() #Calling the CreateWidgets() function CreateWidgets() #defining infinite loop to run app root.mainloop() ~~~~ This is the error that pops up. File "C:/Users/Pig Toy's PC/Documents/PythonPrograms/currencyconverter.py", line 70 + "&to_currency=" toCur + "&apikey=" + apiKey I ran all the other functions and they check out.
<python>
2019-07-20 21:00:47
LQ_EDIT
57,128,974
C function fopen(); error: too many arguements to the function
why cannot I do this ? fopen("%s",stringarray,fpointer); --- says too many arguements to function But this : fopen("file.txt",fpointer); ---works How can I get around this problem? do I have to modify headers code?
<c><gcc><compiler-errors><fopen>
2019-07-20 22:14:16
LQ_EDIT
57,129,668
UI state restoration for a scene in iOS 13 while still supporting iOS 12. No storyboards
<p><em>This is a little long but it's not trivial and it takes a lot to demonstrate this issue.</em></p> <p>I'm trying to figure out how to update a little sample app from iOS 12 to iOS 13. This sample app doesn't use any storyboards (other than the launch screen). It's a simple app that shows one view controller with a label that is updated by a timer. It uses state restoration so the counter starts from where it left off. I want to be able to support iOS 12 and iOS 13. In iOS 13 I want to update to the new scene architecture.</p> <p>Under iOS 12 the app works just fine. On a fresh install the counter starts at 0 and goes up. Put the app in the background and then restart the app and the counter continues from where it left off. The state restoration all works.</p> <p>Now I'm trying to get that working under iOS 13 using a scene. The problem I'm having is figuring out the correct way to initialize the scene's window and restore the navigation controller and the main view controller to the scene.</p> <p>I've been through as much of the Apple documentation as I can find related to state restoration and scenes. I've watched WWDC videos related to windows and scenes (<a href="https://developer.apple.com/videos/play/wwdc2019/258/" rel="noreferrer">212 - Introducing Multiple Windows on iPad</a>, <a href="https://developer.apple.com/videos/play/wwdc2019/258/" rel="noreferrer">258 - Architecting Your App for Multiple Windows</a>). But I seem to be missing a piece that puts it all together.</p> <p>When I run the app under iOS 13, all of the expected delegate methods (both AppDelegate and SceneDelegate) are being called. The state restoration is restoring the nav controller and the main view controller but I can't figure out how to set the <code>rootViewController</code> of the scene's window since all of the UI state restoration is in the AppDelegate.</p> <p>There also seems to be something related to an <code>NSUserTask</code> that should be used but I can't connect the dots.</p> <p><strong>The missing pieces seem to be in the <code>willConnectTo</code> method of <code>SceneDelegate</code>. I'm sure I also need some changes in <code>stateRestorationActivity</code> of <code>SceneDelegate</code>. There may also need to be changes in the <code>AppDelegate</code>. I doubt anything in <code>ViewController</code> needs to be changed.</strong></p> <hr> <p>To replicate what I'm doing, create a new iOS project with Xcode 11 (beta 4 at the moment) using the Single View App template. Set the Deployment Target to iOS 11 or 12.</p> <p>Delete the main storyboard. Remove the two references in the Info.plist to Main (one at the top level and one deep inside the Application Scene Manifest. Update the 3 swift files as follows.</p> <p>AppDelegate.swift:</p> <pre class="lang-swift prettyprint-override"><code>import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -&gt; Bool { print("AppDelegate willFinishLaunchingWithOptions") // This probably shouldn't be run under iOS 13? self.window = UIWindow(frame: UIScreen.main.bounds) return true } func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -&gt; Bool { print("AppDelegate didFinishLaunchingWithOptions") if #available(iOS 13.0, *) { // What needs to be here? } else { // If the root view controller wasn't restored, create a new one from scratch if (self.window?.rootViewController == nil) { let vc = ViewController() let nc = UINavigationController(rootViewController: vc) nc.restorationIdentifier = "RootNC" self.window?.rootViewController = nc } self.window?.makeKeyAndVisible() } return true } func application(_ application: UIApplication, viewControllerWithRestorationIdentifierPath identifierComponents: [String], coder: NSCoder) -&gt; UIViewController? { print("AppDelegate viewControllerWithRestorationIdentifierPath") // If this is for the nav controller, restore it and set it as the window's root if identifierComponents.first == "RootNC" { let nc = UINavigationController() nc.restorationIdentifier = "RootNC" self.window?.rootViewController = nc return nc } return nil } func application(_ application: UIApplication, willEncodeRestorableStateWith coder: NSCoder) { print("AppDelegate willEncodeRestorableStateWith") // Trigger saving of the root view controller coder.encode(self.window?.rootViewController, forKey: "root") } func application(_ application: UIApplication, didDecodeRestorableStateWith coder: NSCoder) { print("AppDelegate didDecodeRestorableStateWith") } func application(_ application: UIApplication, shouldSaveApplicationState coder: NSCoder) -&gt; Bool { print("AppDelegate shouldSaveApplicationState") return true } func application(_ application: UIApplication, shouldRestoreApplicationState coder: NSCoder) -&gt; Bool { print("AppDelegate shouldRestoreApplicationState") return true } // The following four are not called in iOS 13 func applicationWillEnterForeground(_ application: UIApplication) { print("AppDelegate applicationWillEnterForeground") } func applicationDidEnterBackground(_ application: UIApplication) { print("AppDelegate applicationDidEnterBackground") } func applicationDidBecomeActive(_ application: UIApplication) { print("AppDelegate applicationDidBecomeActive") } func applicationWillResignActive(_ application: UIApplication) { print("AppDelegate applicationWillResignActive") } // MARK: UISceneSession Lifecycle @available(iOS 13.0, *) func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -&gt; UISceneConfiguration { print("AppDelegate configurationForConnecting") return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) } @available(iOS 13.0, *) func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set&lt;UISceneSession&gt;) { print("AppDelegate didDiscardSceneSessions") } } </code></pre> <p>SceneDelegate.swift:</p> <pre class="lang-swift prettyprint-override"><code>import UIKit @available(iOS 13.0, *) class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { print("SceneDelegate willConnectTo") guard let winScene = (scene as? UIWindowScene) else { return } // Got some of this from WWDC2109 video 258 window = UIWindow(windowScene: winScene) if let activity = connectionOptions.userActivities.first ?? session.stateRestorationActivity { // Now what? How to connect the UI restored in the AppDelegate to this window? } else { // Create the initial UI if there is nothing to restore let vc = ViewController() let nc = UINavigationController(rootViewController: vc) nc.restorationIdentifier = "RootNC" self.window?.rootViewController = nc window?.makeKeyAndVisible() } } func stateRestorationActivity(for scene: UIScene) -&gt; NSUserActivity? { print("SceneDelegate stateRestorationActivity") // What should be done here? let activity = NSUserActivity(activityType: "What?") activity.persistentIdentifier = "huh?" return activity } func scene(_ scene: UIScene, didUpdate userActivity: NSUserActivity) { print("SceneDelegate didUpdate") } func sceneDidDisconnect(_ scene: UIScene) { print("SceneDelegate sceneDidDisconnect") } func sceneDidBecomeActive(_ scene: UIScene) { print("SceneDelegate sceneDidBecomeActive") } func sceneWillResignActive(_ scene: UIScene) { print("SceneDelegate sceneWillResignActive") } func sceneWillEnterForeground(_ scene: UIScene) { print("SceneDelegate sceneWillEnterForeground") } func sceneDidEnterBackground(_ scene: UIScene) { print("SceneDelegate sceneDidEnterBackground") } } </code></pre> <p>ViewController.swift:</p> <pre class="lang-swift prettyprint-override"><code>import UIKit class ViewController: UIViewController, UIViewControllerRestoration { var label: UILabel! var count: Int = 0 var timer: Timer? static func viewController(withRestorationIdentifierPath identifierComponents: [String], coder: NSCoder) -&gt; UIViewController? { print("ViewController withRestorationIdentifierPath") return ViewController() } override init(nibName nibNameOrNil: String? = nil, bundle nibBundleOrNil: Bundle? = nil) { print("ViewController init") super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) restorationIdentifier = "ViewController" restorationClass = ViewController.self } required init?(coder: NSCoder) { print("ViewController init(coder)") super.init(coder: coder) } override func viewDidLoad() { print("ViewController viewDidLoad") super.viewDidLoad() view.backgroundColor = .green // be sure this vc is visible label = UILabel(frame: .zero) label.translatesAutoresizingMaskIntoConstraints = false label.text = "\(count)" view.addSubview(label) NSLayoutConstraint.activate([ label.centerXAnchor.constraint(equalTo: view.centerXAnchor), label.centerYAnchor.constraint(equalTo: view.centerYAnchor), ]) } override func viewWillAppear(_ animated: Bool) { print("ViewController viewWillAppear") super.viewWillAppear(animated) timer = Timer.scheduledTimer(withTimeInterval: 1, repeats: true, block: { (timer) in self.count += 1 self.label.text = "\(self.count)" }) } override func viewDidDisappear(_ animated: Bool) { print("ViewController viewDidDisappear") super.viewDidDisappear(animated) timer?.invalidate() timer = nil } override func encodeRestorableState(with coder: NSCoder) { print("ViewController encodeRestorableState") super.encodeRestorableState(with: coder) coder.encode(count, forKey: "count") } override func decodeRestorableState(with coder: NSCoder) { print("ViewController decodeRestorableState") super.decodeRestorableState(with: coder) count = coder.decodeInteger(forKey: "count") label.text = "\(count)" } } </code></pre> <p>Run this under iOS 11 or 12 and it works just fine.</p> <p>You can run this under iOS 13 and on a fresh install of the app you get the UI. But any subsequent run of the app gives a black screen because the UI restored via state restoration isn't connected to the scene's window.</p> <p>What am I missing? Is this just missing a line or two of code or is my entire approach to iOS 13 scene state restoration wrong?</p> <p>Keep in mind that once I get this figured out the next step will be supporting multiple windows. So the solution should work for multiple scenes, not just one.</p>
<ios><ios13><state-restoration><uiscene>
2019-07-21 01:05:40
HQ
57,130,138
Jupyter notebook taking forever to iterate over a for loop
<p>I an using the following for loop to iterate over df (droping a row if condition match) :</p> <pre><code>for index, row in df.iterrows(): if(pd.isnull(row["CR Date"])): df.drop(index, inplace=True) </code></pre> <p>the df shape 240,000*30 It is working BUT It is taking more than 1.5 hours. Is there any faster way? I am using Anaconda JupyterLab</p>
<python>
2019-07-21 03:35:05
LQ_CLOSE
57,132,218
OpenGLRenderer: Davey
<p>I have noticed that from time to time, android shows the following log message:</p> <pre><code>I/OpenGLRenderer( 4958): Davey! duration=1923ms; Flags=1, IntendedVsync=12247... </code></pre> <p>Does anyone know the reason why my OpenGLRenderer is calling <code>Davey!</code>?</p>
<android>
2019-07-21 10:19:35
HQ
57,132,428
Augmentations for the global scope can only be directly nested in external modules or ambient module declarations(2669)
<p>I would like to store my NodeJS config in the global scope.</p> <p>I tried to follow this => <a href="https://stackoverflow.com/questions/35074713/extending-typescript-global-object-in-node-js">Extending TypeScript Global object in node.js</a> and other solution on stackoverflow, </p> <p>I made a file called global.d.ts where I have the following code </p> <pre><code>declare global { namespace NodeJS { interface Global { config: MyConfigType } } } </code></pre> <blockquote> <p>Augmentations for the global scope can only be directly nested in external modules or ambient module declarations.ts(2669)</p> </blockquote> <p>but doing this works fine =></p> <pre><code>declare module NodeJS { interface Global { config: MyConfigType } } </code></pre> <p>the problem is, I need to import the file <code>MyConfigType</code> to type the config, but the second option do not allow that.</p>
<typescript>
2019-07-21 10:44:58
HQ
57,132,491
SwiftUI adding custom UIViewControllerTransitioningDelegate
<p>I'm trying to create <code>SwiftUI</code> custom segue animation, like this </p> <p><a href="https://i.stack.imgur.com/RLLSH.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/RLLSH.gif" alt="enter image description here"></a> </p> <p>I try to chain the animation to <code>Destination</code> but no use, it just animates inside the contents of <code>Destination</code> after presentation animation finish.</p> <pre><code>struct ContentView : View { var body: some View { NavigationView { VStack { List { NavigationButton(destination: withAnimation{ Destination() }.frame(width: 300, height: 300) .animation(.basic())) { CellView() } } } } } } struct CellView : View { var body: some View { VStack { Text("Cell") } } } struct Destination : View { var body: some View { VStack { Text("GFD") } } } </code></pre>
<ios><swift><uistoryboardsegue><swiftui>
2019-07-21 10:53:55
HQ
57,134,105
Finding difficulty in creating SQL Trigger
I am writing a SQL query (2012) to create a trigger but it gives me an error. I have tried several different ways. Find the code that I am using CREATE TRIGGER after_table_update After_hsi.keyrecorddata202_UPDATE FOR EACH ROW Begin UPDATE hsi.keyrecorddata202 set kg563 = hsi.keyrecorddata202.kg275 * ['Price_List$'].Unitprice FROM hsi.keyrecorddata202 INNER JOIN ['Price_List$'] ON hsi.keyrecorddata202.kg487 = ['Price_List$'].NO# where kg568 = 'FOOD' END;
<sql-server><triggers><database-trigger>
2019-07-21 14:27:18
LQ_EDIT
57,134,589
How to call a function with some return type from function of Main class in Java?
<p>I am writing a java program to search a character/word in multiple files, so I am accepting the list of Keywords to search in command line argument i.e. String[] args, and I want to store there values in a ArrayList object.</p> <p>I have main class name : <strong>CharSearchTool</strong>, Another class in same package : <strong>ArrayListFromParameters</strong></p> <pre><code>package com.charsearchtool; public class CharSearchTool { public static void main(String[] args) { ArrayListFromParameters arrayList = new ArrayListFromParameters(args); System.out.println(arrayList.list); } } package com.charsearchtool; import java.util.ArrayList; public class ArrayListFromParameters { ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); public ArrayList&lt;String&gt; ArrayListFromParameters(String[] argument) { for (int i = 0; i &lt; argument.length; i++) { list.add(argument[i]); } return (list); } } </code></pre> <p>I am getting error on below line :</p> <pre><code>ArrayListFromParameters arrayList = new ArrayListFromParameters(args); </code></pre> <p><strong>Error : The constructor ArrayListParameters(String[]) is undefined.</strong></p>
<java><collections>
2019-07-21 15:30:23
LQ_CLOSE
57,135,062
Google Ads solution for PWA/SPA?
<p>I've made a single page app via Angular, and plan to also make it a progressive web app in the next few days. </p> <p>I recently realized that Google AdSense apparently doesn't like SPAs and my application has been denied twice. My app is a tool that allows users to create, manage, and share specific content, which I believe offers a ton of value. When I was researching AdSense a while back, I definitely thought I would qualify as I didn't realize 'valuable content' specifically referred only to having a ton of words.</p> <p>With that being said, it's 2019...is there no solution for serving Google ads on a web app that's not focused on articles, etc?? Google has tons of articles talking about how great PWAs are for users, yet it doesn't seem that they support ads for PWAs at all. I don't want to make a native mobile app, because I think a PWA that works on any device just makes more sense, so AdMob isn't an option. I've come across a few articles that indicate Doubleclick for Publishers (DFP) may be a solution, but when I try to login to that platform, it seems to be linked to my AdSense application and is either showing pending or access denied, depending on my current AdSense application status. I don't have another website that I could get approved first and then piggy back this app on that. </p> <p>I'm also using firebase as my backed, which is why I'm pretty keen on advertising with Google as well. But obviously, if I have to go in a totally different direction to generate ad revenue with my app, I will. </p> <p>Any insight into how I could make Google Ads work for my app or another good solution would be very much appreciated. </p>
<single-page-application><progressive-web-apps><adsense><double-click-advertising>
2019-07-21 16:34:57
HQ
57,135,276
on my list I want to detect when it's -1 or 0 in length otherwise i want it to give me the second [1] index
The function second_item below returns the second item in the list l. However, what if l has length 0 or 1? Then taking the second item makes no sense and will result in an error. Change the code so that it detects these cases and returns -1 for lists of length 0 or 1, rather than causing an error. For any other list, the function should still return the second item. **def second_item(l): if len(l) <= 1: return l else: return l[1]**
<python>
2019-07-21 17:02:10
LQ_EDIT
57,135,530
How to fix Parse error: syntax error, unexpected 'else' (T_ELSE), expecting end of file
<p>This code provides this error Parse error: syntax error, unexpected 'else' (T_ELSE), expecting end of file. The code is probably terrible I have no clue what i am doing at all.</p> <pre><code>I have tried altering the curly brackets but it still provides the same error &lt;?php $conn = mysqli_connect($servername, $username, $password, $dbname); if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } $sql = "INSERT INTO posts (userid, artist, link) VALUES ('2', '".$_POST["artist"]."', '".$_POST["link"]."')"; if (mysqli_query($conn, $sql)); { echo "New record created successfully"; } else { echo "Error: " . $sql . "&lt;br&gt;" . mysqli_error($conn); } mysqli_close($conn); ?&gt; </code></pre>
<php><mysql><mysqli>
2019-07-21 17:37:44
LQ_CLOSE
57,136,816
bash eval in if with piped command
<p>piped eval in bash for string length comparison</p> <p>i am trying to check if a certain device with a given id is plugged in and trigger a action based on that </p> <p>i tried eval / exec</p> <p>here is what i have so far</p> <pre><code>#!/bin/bash KBP='[["lsusb -d 1c11:b04d | wc -c" == "0"]]' if eval $KBP; then echo expression evaluated as true else echo expression evaluated as false fi </code></pre> <p>expected result:</p> <p>if device is plugged in and string is not 0 it would hop in the false condition </p> <p>actual result - cant evaluate the piped condition </p>
<bash><eval><concat>
2019-07-21 20:34:33
LQ_CLOSE
57,138,498
How to find where nginx installs?
<p>Sorry for that I am not familiar with linux. I tried to search the answer and tried this command:</p> <pre><code>ps aux | grep nginx </code></pre> <p>But I only get the result like this:</p> <pre><code>nginx: master process ./sbin/nginx </code></pre> <p>I got confused because as far as I know, dot means current directory where I execute linux command.</p> <p>But I can not find sbin/nginx from current folder. So where I can find nginx and where is the configuration it actually works.</p>
<linux><nginx>
2019-07-22 02:27:36
LQ_CLOSE
57,139,523
How to display the last four blog posts using Json api in div tag
display latest blog post wordpress api in html html <div id="content" class="content"> </div> javascript <script> $(document).ready(function(){ $.getJSON( "https://startupet.com/blog/wp-json/wp/v2/posts", function( data ) { console.log(data); }); }) </script> "im get image post and title " json file : https://startupet.com/blog/wp-json/wp/v2/posts
<javascript><jquery><json><wordpress><api>
2019-07-22 05:14:22
LQ_EDIT
57,142,734
{"multicast_id":8972998920482382311,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]}
i want to send push notification from web to android devices but it responses invallid registration i tried to send from firebase consol but is does not include message data <?php //$con= new mysqli("localhost","root","","doctor_appointment"); include('connection.php'); $sql = " Select * From token_register where id = 1"; $result = mysqli_query($connection_to_db,$sql); $tokens = array(); if(mysqli_num_rows($result) > 0 ){ while ($row = mysqli_fetch_assoc($result)) { $tokens[] = $row["token"]; // $token = $row["token"]; // echo "$token"; } } mysqli_close($connection_to_db); function send_notification ($tokens, $message) { // define( 'API_ACCESS_KEY', 'AIzaSyDt2xaRw4XGzghfxAMRFVy-I8ZeacBDbHA'); $url = 'https://fcm.googleapis.com/fcm/send'; $fields = array( 'registration_ids' => array($tokens), 'data' => array( "message" => $message ), ); $headers = array( 'Authorization:key = AIzaSyDdHTdvqzN8lrUqhZKOeuiR2d9cETRBhNw', 'Content-Type: application/json' ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); $result = curl_exec($ch); if ($result === FALSE) { die('Curl failed: ' . curl_error($ch)); } curl_close($ch); return $result; } $message = array("message" => " FCM PUSH NOTIFICATION TEST MESSAGE"); $message_status = send_notification($tokens, $message); echo $message_status; ?> i expected to be {"multicast_id":7068539387015084016,"success":1,"failure":0,"results":[{"RegistrationSuccess"}]} but responses {"multicast_id":7068539387015084016,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]}
<php><firebase><firebase-cloud-messaging>
2019-07-22 09:14:21
LQ_EDIT
57,142,813
Why if else is different form guard let and if let?
<p>Because we can identify nil value using if else. Same thing we do using guard let and if let. What is the use of these..</p>
<ios><swift><cocoa-touch>
2019-07-22 09:18:46
LQ_CLOSE
57,144,319
Errors that can be caught in php
version PHP 7+ ``` first: $i = 0; try { if ( $i == 0 ) $link = mysqli_connect("1.1.1.1", "my_user", "my_password", "my_db"); else echo 'Another link.'; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; $i = 1; goto first; } // Continue execution echo 'repair complete!'; ``` This error can be caught. ``` Warning: mysqli_connect(): (HY000/2002): repair complete! ```` BUT ,If it looks like this ``` first: $i = 0; try { if ( $i == 0 ) $link = mysql_connect("1.1.1.1", "my_user", "my_password", "my_db"); else echo 'Another link.'; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; $i = 1; goto first; } // Continue execution echo 'repair complete!'; ``` This error cannot be caught. ``` Fatal error: Uncaught Error: Call to undefined function mysql_connect() in D:\wamp64\www\test.php:409 Stack trace: #0 {main} thrown in D:\wamp64\www\test.php on line 409 ``` So ,I wonder what types of errors can be caught.Then I can do something about it.
<php>
2019-07-22 10:45:29
LQ_EDIT
57,145,629
How to Consume API GET method that accepts FromBody parameter
<p>How can I consume Web API 2 GET command in C# that accepts one FromUri parameter and 2nd FromBody parameter. I dont know how to send body in GET command, do i need to use POST command? but how? below is the code I have written so far. Thank you. </p> <p>API Code</p> <pre><code>[HttpGet] [ResponseType(typeof(IEnumerable&lt;Student&gt;))] public IHttpActionResult Find([FromUri]string searchText,[FromBody]SearchType searchType) { //EF code to get data from DB using (handler) { return Ok(handler.Find(searchText, searchType)); } } </code></pre> <p>HttpClient Code </p> <pre><code>static void Main(string[] args) { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:55587/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml")); string aSearchText ="John"; SearchType aSearchType = SearchType.Name; //this is enum Task&lt;HttpResponseMessage&gt; responseTask = client.GetAsync($"api/Student/{aSearchText}"); responseTask.Wait(); //////////////////// /// Code missing how to send "aSearchType" as a body in Get Command? //////////////////// var ListTask = responseTask.Content.ReadAsAsync&lt;IEnumerable&lt;Student&gt;&gt;(); ListTask.Wait(); IEnumerable&lt;Student&gt; list = ListTask.Result; foreach(Student s in list) { Console.WriteLine(s.Name); } } </code></pre>
<c#><asp.net-web-api2><httpclient>
2019-07-22 12:01:56
LQ_CLOSE
57,146,469
Read incoming sms at every time in Oreo
<p>I want to read all sms messages from specific number at any time not relating when app is runned or not runned. How can I read all messages when app is not runned, in newer versions of android?</p>
<android>
2019-07-22 12:51:46
LQ_CLOSE
57,146,571
Restricting user to NOT input decimal in c#
Hi I'm new in C# i just want to ask if this is possible? How to not allow the user to input decimal in console app in c#
<c#>
2019-07-22 12:57:35
LQ_EDIT
57,148,053
I want to add key up and key down support in my live search result in angular js. My search result is coming in a table
I am using table for displaying live search result. Result is showing good but I have a problem that I cannot use up and down key to navigate through the search result. <table class="table table-hover" class="input-text full-width" style="background-color:#f9f9f9; overflow: hidden; "> <tbody class="input-text full-width" > <tr ng-repeat="city in cities | limitTo:2"> <td id="start" ng-click="result([[city]],'city')"> <i class="soap-icon-departure" style="color: #01b7f2; font-size: 16px; transition-delay: 6s;"></i> &nbsp [[city]]</td> </tr> <tr ng-repeat="name in names | limitTo:2"> <td ng-click="result([[name]],'name')"> <i class="soap-icon-address" style="color:#01b7f2; font-size: 16px;"></i> &nbsp [[name]]</td> </tr> <tr ng-if="resp"> <td>No result found</td> </tr> </tbody> </table>
<javascript><jquery><angularjs><ajax>
2019-07-22 14:20:21
LQ_EDIT
57,148,624
how to pass id from javacript to laravel php script?
<p>i am technically new to javascript and trying to pass a value to php script to use it in where clause...</p> <p><strong>Blade html</strong> </p> <pre><code> &lt;div class="tab-content blog_tabs"&gt; &lt;div class="tab-pane" name="schedule" id="" &gt; &lt;?php $tabSchedule = App\Schedule::where('route_id', ) -&gt;latest() -&gt;get(); ?&gt; @foreach ($tabSchedule as $schedule) &lt;ul class="list-group"&gt; &lt;li class="list-group-item"&gt;{{ $schedule-&gt;schedule_number}}&lt;/li&gt; &lt;/ul&gt; @endforeach &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>javascript</strong></p> <pre><code>$("ul.nav-tabs &gt; li &gt; a").click(function() { var id = $(this).attr("href").replace("#", ""); console.log(id); if(id) { $.ajax({ url: "{{ route('user.schedule.getId') }}", type: "GET", data:{'id':id}, dataType: "json", success:function(data) { var route_id = 1; } }); } }); </code></pre> <p>So here is a picture of what i want to pass:</p> <p><a href="https://i.stack.imgur.com/oJuNi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oJuNi.png" alt="enter image description here"></a></p> <p><strong><em>As picture tells i am trying to pass route_id to laravel php script to use it in where clause</em></strong></p> <p>If any one, please help me out? thanks!</p>
<javascript><html><laravel>
2019-07-22 14:52:53
LQ_CLOSE
57,149,410
how to fix SytaxError in conda
I'm testing new software, everything is ok and set up. while running this command on terminal python data-processing/run_pipeline.py default.yaml test.fasta ./tmp_feature I'm getting this error > File "data-processing/run_pipeline.py", line 29 print "=" * 60 ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print("=" * 60)? Please, can you help me to fix this error? I tried to change the command by adding a parentheses, python (data-processing/run_pipeline.py) default.yaml test.fasta ./tmp_feature since run_pipeline.py is file included in data-processing but it didn't work and I got this error > bash: syntax error near unexpected token `data-processing/run_pipeline.py'
<python><python-2.7>
2019-07-22 15:38:12
LQ_EDIT
57,149,668
How to debug a g++ segmentation fault using gdb?
<p>I got a segfault when running my program. Then I googled my question and tried to follow steps from <a href="https://www.gnu.org/software/gcc/bugs/segfault.html" rel="nofollow noreferrer">https://www.gnu.org/software/gcc/bugs/segfault.html</a>.</p> <p>I did not configure GCC with <code>--enable-checking</code> then my first question is - </p> <p>1) is it necessary to configure it and compile with <code>-v -da -Q</code> ?</p> <p>But I always do compile with flags such as <code>-g -o0</code>. After running the program in GDB with arguments I get this:</p> <p><a href="https://i.stack.imgur.com/EMdFw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EMdFw.png" alt="gdb_screenshot"></a></p> <p>2) I can not print variables after segfault, is it okay ?</p> <p>3) How to figure out the line of my source code where segfault happens ?</p>
<c++><debugging><gdb>
2019-07-22 15:54:48
LQ_CLOSE
57,150,745
I am developing a "rhythm game" auto playing using Python, but I have a problem
[enter image description here][1] I am developing a "rhythm game" auto playing using Python, but I have a problem. My plan is as follows. 1 Capture a specific range in the game.(Infinite repeat) 2 "1" to from detect pre-stored pictures. 3 When detected, enter the keyboard "S" button. "1" was successfully implemented But I could not implement number "2". P.s i'm using python Ver [enter image description here][2] Capture range [enter image description here][3] Photos to detect [1]: https://i.stack.imgur.com/CzJU4.png [2]: https://i.stack.imgur.com/F4xNG.png [3]: https://i.stack.imgur.com/EuNnj.png
<python><machine-learning><neural-network>
2019-07-22 17:09:37
LQ_EDIT
57,150,765
Compare two files and append the difference at the bottom
I would like to first compare two files (`POSCAR.init` and `POSCAR.final`) in the link https://www.dropbox.com/sh/w9z7psuzq3qo9jm/AAAhySzuiYv08LPWpfFTaxtoa?dl=0 and then append the differences at the end of the respective files. The final files should look like `test.init` and `test.final` where one can see I manually put the differences at the bottom. If one uses `sdiff test.init test.final` one can see the difference appears now in the last line (ignore the first line). Since I have many folders like `stack` in the link given above, I am looking for some loop where basically I go to every folder, pick the difference between two files and then append the difference at the end as I explained above. Please let me know if anyone has some idea, I would very much appreciate it. N.B: Please note that I already looked a bit related-type queries such as here (https://stackoverflow.com/questions/4544709/compare-two-files-line-by-line-and-generate-the-difference-in-another-file) but that still not exactly the solution I am looking for here.
<bash><shell><unix>
2019-07-22 17:10:43
LQ_EDIT
57,150,813
Logo on mobile view not centered
<p>Sorry for the noob question.I've bought a template in order to practice and I have the next situation. I'm trying to obtain a centered logo for mobile device and I simply can not figure what is the problem.</p> <p>I've uploaded the code on a domain: <a href="http://digitalicus.com/" rel="nofollow noreferrer">http://digitalicus.com/</a> to simplify the process of explaining.</p> <p>Any advice's are much appreciated.</p> <p>Vlad</p>
<javascript><html><css>
2019-07-22 17:15:10
LQ_CLOSE
57,151,926
How do I turn an image (200x200 Black and White photos) into a single list of 40,000 values using numpy?
<p>As the title says I have an image (well a bunch of images) and I want to turn it from a 200x200 image into a 1-D list of 40,000.</p>
<numpy><image-processing>
2019-07-22 18:37:16
LQ_CLOSE
57,152,223
How to calculate duration & distance with setAvoid()
I receive the same duration & distance whether or not I am expecting to avoid highways or tolls I suspect the issue is either in my order of operations, or the way I am calculating distance & duration I have tried setting up setAvoid in two different ways (see code), as well as changed my if statements to accommodate what the HTML form (check box) might return. I have also tried switching the if statement to "return formObject.avoid1" this showed me that the if statement is functioning properly - so either the .setAvoid is not working the way I have written it, or the distance & duration calculations are not considering the setAvoid if (formObject.avoid1 == "TRUE"){ mapObj.setAvoid(Maps.DirectionFinder.Avoid.HIGHWAYS); } if (formObject.avoid2 == "yes"){ mapObj.setAvoid("tolls"); } var directions = mapObj.getDirections(); var bestRoute = directions["routes"][0]; var numLegs = bestRoute["legs"].length; for (var c=0; c<numLegs; ++c){ var legNum = directions["routes"][0]["legs"][c]; var legDistance = legNum["distance"]["value"]; var legDuration = legNum["duration"]["value"]; totalDistance += legDistance; totalDuration += legDuration; } If we are in fact avoiding highways, I expect the duration to increase, but I get the same duration whether or not we avoid highways
<google-maps><google-apps-script><google-api>
2019-07-22 18:59:58
LQ_EDIT
57,154,578
How to fix 'onClick to show content'
I have simple side navigation on my webpage, and have little problem i think with javascript code. What i need? When user open that page and choose to see content from category of 'Audi' to show sub-category in this case to show ( audi a4 and audi a5). Now is set to opened so user don't need to click on category 'Audi' to see content. <h4>Side navigation</h4> <nav class="checklist side-nav-toggle ajax"> <h5><a href="#" class="opened">Audi</h5> <ul class="scroll-list" style="display:block;"> <li><a href="#" rel="nofollow">Audi A3</a></li> <li><a href="#" rel="nofollow">Audi A5</a></li> </ul> </nav> If you need more information, please write me i will answer immediately. Thanks all, and sorry for my bad english. Thanks all
<javascript><html><css>
2019-07-22 22:39:18
LQ_EDIT
57,154,598
Facebook login on localhost - connection not secure
<p>I am adding a Facebook login to our React project, using Facebook Javascript SDK. I followed this <a href="https://developers.facebook.com/docs/facebook-login/web" rel="noreferrer">tutorial</a>.</p> <p>When I click the login button which I added to the page, following error is shown:</p> <p><strong>Facebook has detected X isn't using a secure connection to transfer information. Until X updates its security settings, you won't be able to use Facebook to log into it.</strong></p> <p><a href="https://i.stack.imgur.com/p6s5G.png" rel="noreferrer"><img src="https://i.stack.imgur.com/p6s5G.png" alt="enter image description here"></a></p> <p>My app is in development mode, which should mean (according Facebook docs) that localhost redirects are allowed, but it isn't so.</p> <p>I have also tried adding localhost to Valid OAuth Redirect URIs in Facebook developers page, but it didn't solve the problem.</p> <p>I have managed to solve the problem partially by using ngrok following this <a href="https://www.chrisjmendez.com/2018/04/16/using-ngrok-with-facebook-oauth-login/" rel="noreferrer">tutorial</a>, but it is very buggy (sometimes doesn't work) and impractical to work with, as I often have to restart whole server and everything.</p>
<javascript><reactjs><facebook><http><https>
2019-07-22 22:42:01
HQ
57,155,164
How to return the last element in a byte array of integers in golang
In Golang, I want to find the last element in an array of integers. But it seems like this needs to be done manually or in such a complex way. So if I have a list of 0.0.1, 0.0.2, 0.0.3 I just want 0.0.3 to be returned. Every time I try to return the last element the console returns ``` %!(EXTRA uint8=10) ``` Which I assume means I need to convert a byte array to a slice? WHY DOES THIS GOT TO BE SO COMPLEX? IN JAVASCRIPT I CAN JUST DO `pop()` Here's my code: ``` cmd := exec.Command("git", "tag") out, err := cmd.CombinedOutput() if err != nil { log.Fatalf("cmd.Run() failed with %s\n", err) } fmt.Printf("Variable Type:\n%s\n", reflect.TypeOf(out)) fmt.Printf("Variable:\n%s\n", (out)) slice := out[0:len(out)] releaseVersion := slice[len(slice)-1] fmt.Printf("release version:", releaseVersion) ``` Here's the output: ``` Variable Type: []uint8 Variable: 0.0.1 0.0.2 0.0.3 release version:%!(EXTRA uint8=10) ```
<arrays><go><slice>
2019-07-23 00:15:03
LQ_EDIT
57,158,834
How to align a text inside a <div> element horizontally?
<p>How to align the text inside a div centrally vertically?</p> <p>I have a div element inside my html page where and the height of the div is the screen size and the text inside that div need to be at the center. I have used text-align : center property to align it horizontally but i need to do that horizontally as well.</p>
<css>
2019-07-23 07:27:37
LQ_CLOSE
57,159,250
XML code in TextView to make an android learning app
I am developing an android app for beginners to Learn Android I have developed most of it but now it is not allowing me to paste XML code in text view(that code i want to be visible in TextView). I did not got much help but i tried to use resources>value>string and tried pasting the code in text field. How can i fix it
<android>
2019-07-23 07:52:28
LQ_EDIT
57,159,300
Thread Safety in ArrayList
<p>Why the ArrayList class in Java doesn't implemented with thread safety. But prior class Vector is implemented with thread safety ? Is there any particular reason for not implementing with thread safe ?</p>
<java><collections>
2019-07-23 07:54:53
LQ_CLOSE
57,159,494
How to handle global variables to be tha same for all users in PHP?
<p>I want to create simple multiplayer game with php using global variables that will be shared among all users, without using sockets.</p> <p>I tried write php server that have on global variable called "connections" and code to handle GET request with url parameter that called "myName". when the user send the GET request to the php server, "connections" is incremented and sent back to the user as the GET response.</p> <pre><code>&lt;?php $connections = 0; if(isset($_GET['myName'])) { $connections = $connections+ 1; echo json_encode($connections); exit(); } ?&gt; &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;form action="Test/testServer.php"&gt; &lt;input type="text" name="myName"&gt; &lt;input type="submit" value="submit"&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I am new to php and perhaps i missing something about how php server is actually work. I expected the "connections" to be the number of connected users that send GET request along all the "server life".</p>
<php><server><multiplayer>
2019-07-23 08:05:57
LQ_CLOSE
57,161,431
how do i move the + sign to the left?
how can I move the + sign to the left? `enter code here` *{ margin: 0; padding: 0;}.content{ justify-content: center; align-items: center; height:100vh; }details{ font-family: 'Raleway', sans-serif;}summary { transition: background .75s ease; width: 960px; outline: 0; text-lign: center; font-size: 85%; display: flex; align-items: center; justify-content: space-between; cursor: pointer; border-bottom: 1px solid black;}h50 { color: rgb(0, 0, 255); text-align: left; margin-bottom: 0; padding: 15px; text-shadow: none;font-size: small; font-weight: bold;}details p { padding: 0 25px 15px 25px; margin: 0; text-shadow: none; text-align: justify; line-height: 1.3em;}summary::after { font-family: "Font Awesome 5 Free"; font-weight: 900; content: '\02795'; /* Unicode character for "plus" sign (+) */ font-size: 13px; color: #777; float: right; margin-left: 5px; display: inline-block; padding-right: 15px; font-size: 90%; color: rgb(0, 0, 255);}details[open] summary::after { content: "\2796"; /* Unicode character for "minus" sign (-) */ display: inline-block; padding-right: 15px; font-size: 90%;}details[open] summary:hover { background:none;}summary:hover { background: #d3d3d3;}details summary::-webkit-details-marker { display:none;}`enter code here`
<javascript><html><css>
2019-07-23 09:54:39
LQ_EDIT
57,161,576
PyTorch Binary Classification - same network structure, 'simpler' data, but worse performance?
<p>To get to grips with PyTorch (and deep learning in general) I started by working through some basic classification examples. One such example was classifying a non-linear dataset created using sklearn (full code available as notebook <a href="https://github.com/philipobrien/colab-notebooks/blob/master/Non_Linear_Data_Classification.ipynb" rel="noreferrer">here</a>)</p> <pre><code>n_pts = 500 X, y = datasets.make_circles(n_samples=n_pts, random_state=123, noise=0.1, factor=0.2) x_data = torch.FloatTensor(X) y_data = torch.FloatTensor(y.reshape(500, 1)) </code></pre> <p><a href="https://i.stack.imgur.com/w20Tb.png" rel="noreferrer"><img src="https://i.stack.imgur.com/w20Tb.png" alt="enter image description here"></a></p> <p>This is then accurately classified using a pretty basic neural net</p> <pre><code>class Model(nn.Module): def __init__(self, input_size, H1, output_size): super().__init__() self.linear = nn.Linear(input_size, H1) self.linear2 = nn.Linear(H1, output_size) def forward(self, x): x = torch.sigmoid(self.linear(x)) x = torch.sigmoid(self.linear2(x)) return x def predict(self, x): pred = self.forward(x) if pred &gt;= 0.5: return 1 else: return 0 </code></pre> <p>As I have an interest in health data I then decided to try and use the same network structure to classify some a basic real-world dataset. I took heart rate data for one patient from <a href="https://physionet.org/physiobank/database/bidmc/" rel="noreferrer">here</a>, and altered it so all values > 91 would be labelled as anomalies (e.g. a <code>1</code> and everything &lt;= 91 labelled a <code>0</code>). This is completely arbitrary, but I just wanted to see how the classification would work. The complete notebook for this example is <a href="https://github.com/philipobrien/colab-notebooks/blob/master/Basic_Heart_rate_Classification.ipynb" rel="noreferrer">here</a>.</p> <p><a href="https://i.stack.imgur.com/6izzI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6izzI.png" alt="enter image description here"></a></p> <p>What is not intuitive to me is why the first example reaches <strong>a loss of 0.0016 after 1,000 epochs</strong>, whereas the second example only reaches <strong>a loss of 0.4296 after 10,000 epochs</strong></p> <p><a href="https://i.stack.imgur.com/rDag4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rDag4.png" alt="Training Loss for Example 1"></a></p> <p><a href="https://i.stack.imgur.com/PMubT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PMubT.png" alt="Training Loss for Heart Rate Example"></a></p> <p>Perhaps I am being naive in thinking that the heart rate example would be much easier to classify. Any insights to help me understand why this is not what I am seeing would be great!</p>
<python><machine-learning><deep-learning><artificial-intelligence><pytorch>
2019-07-23 10:03:48
HQ
57,165,778
Getting 'no such module' error when importing a Swift Package Manager dependency
<p>I'm running Xcode 11 Beta 4. I'm using CocoaPods, and wanted to use one of my dependencies with Swift Package Manager as a static library instead of as a framework. On a fresh project created with Xcode 11, the dependency can be imported successfully, but on my existing CocoaPods workspace, it does not.</p> <p>I think it's likely related, but I'm also getting this link warning in Xcode:</p> <pre><code>directory not found for option '-L/Users/username/Library/Developer/Xcode/DerivedData/App-axanznliwntexmdfdskitsxlfypz/Build/Products/Release-iphoneos </code></pre> <p>I went to see if the directory exists after the warning is emitted, and it does. I could not find any meaningful difference between the newly-created project and my old one, other than the existence of CocoaPods.</p> <p>Would appreciate any pointers.</p>
<cocoapods><swift-package-manager><xcode11>
2019-07-23 13:54:22
HQ
57,166,340
How do I compile code using Clang with the MinGW C/C++ Library? (Particular issue with float.h)
<p>I have a simple program which I can successfully compile with clang, using MinGW's C/C++ Library:</p> <pre><code>#include &lt;stdio.h&gt; int main(int argc, char **argv) { printf("Hello world!\n"); return 0; } </code></pre> <p>I am able to compile this with mingw-gcc successfully:</p> <pre><code> $ gcc test.c -o test $ ./test Hello world! </code></pre> <p>I am also able to compile it successfully using clang+mingw:</p> <pre><code> $ clang test.c -o test -target $ ./test Hello world! </code></pre> <p>However, if I make a small change to my program (include float.h), it continues to compile with gcc but no longer compiles with clang:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;float.h&gt; int main(int argc, char **argv) { printf("Hello world!\n"); return 0; } </code></pre> <pre><code> $ gcc test.c -o test $ ./test Hello world! $ clang test.c -o test -target x86_64-pc-windows-gnu In file included from test.c:2: In file included from C:\llvm\built\lib\clang\8.0.0\include\float.h:45: C:\mingw64-8.1.0\x86_64-w64-mingw32\include\float.h:28:15: fatal error: 'float.h' file not found #include_next &lt;float.h&gt; ^~~~~~~~~ 1 error generated. </code></pre> <p>Is there some configuration issue with clang or some missing command line argument? Googling around a bit, it appears that the order of paths when including float.h is important, but this is all supposed to be handled internally by the clang driver. </p>
<c><gcc><clang><mingw><llvm>
2019-07-23 14:24:52
HQ
57,167,724
How to change gravatar picture programmatically?
I'm using gravatar to display my user contact in wordpress but I want to allow them to change their picture. I don't see any way to set it with the API.. Is it possible ? Thank
<php><wordpress><gravatar>
2019-07-23 15:38:00
LQ_EDIT
57,167,834
Is there a program on which to make a quiz that runs Python code? I.e. The person enters code, then the quiz runs it on a kernel
<p>Every single query of this sort I could find simply involved making some kind of Multiple Choice Quiz using Python that took in values like "a" or "b" as input.</p> <p>What I'm thinking involves the user actually having to write proper python code and running it in a kernel, while it gets checked against the correct answers.</p> <p>For instance the user might be asked to use python code to solve a problem, then assign the final answer to the variable "ans".</p> <p>The quiz program would then check whether the "ans" value was correct based on what the value the test-setter determined it should be.</p>
<python>
2019-07-23 15:44:05
LQ_CLOSE
57,168,810
Date conversion with condition
Please feel free to suggest me to change the title. I have a hire date column and I want to assign specific Tiers depending on employee work years with the following conditions: 1-4 years = T1 5-9 years = T2 10-15 years = T3 15+ years = T4 For example, if the hire date is 12/07/2002, the tier should equal T4. 10/03/2016 = T1 01/18/2010 = T2 01/14/2006 = T3 12/07/2002 = T4 Is there any way to accomplish this? Your help will be greatly appreciated.
<sql><sql-server><case>
2019-07-23 16:44:55
LQ_EDIT
57,169,604
HOW CAN I ALTERNATE row colors but 4 row at a time?
for example, row 1-4 would have red background, row 5-9 would be blue, then 10-13 would be back to red, etc all the tutorial i found only covers alternating each row
<google-sheets><google-sheets-formula><gs-conditional-formatting>
2019-07-23 17:44:24
LQ_EDIT
57,169,775
"Please tell me who you are" problem (mac)
<p>In order i simply wrote on terminal</p> <pre><code>git config --global user.mail "[my mail]" git config --global user.name "[my name]" Hugos-MBP:ProjetOpenSource beelee_the_bee$ git commit -m "Salan" *** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: unable to auto-detect email address (got 'beelee_the_bee@Hugos-MBP.(none)') </code></pre> <hr> <p>(beelee_the_bee is my mac name)</p> <p>when i wrote <code>git config -l</code> i have the following answer : user.mail=hugo.vast@gmail.com and user.name=Huugoo147</p> <p>So in fact my name and mail are in, but i already have the message and i cant commit :?</p> <p>I read all questions around my subject and i didnt found any solutions Please help me ^^</p>
<git><macos>
2019-07-23 17:56:32
LQ_CLOSE
57,169,793
Error [ERR_REQUIRE_ESM]: How to use es6 modules in node 12?
<p>From <a href="https://2ality.com/2019/04/nodejs-esm-impl.html" rel="noreferrer">https://2ality.com/2019/04/nodejs-esm-impl.html</a> Node 12 should support es6 modules; however, I just keep getting the error:</p> <p>Question: How do I make a MVP of using es6 modules in node 12?</p> <p><strong>package.json</strong></p> <pre><code>{ "name": "dynamic-es6-mod", "version": "1.0.0", "description": "", "main": "src/index.mjs", "scripts": { "test": "echo \"Error: no test specified\" &amp;&amp; exit 1", "start": "node src/index.mjs" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "globby": "^10.0.1" } } </code></pre> <pre><code>$ node -v $ 12.6.0 $ npm run start internal/modules/cjs/loader.js:821 throw new ERR_REQUIRE_ESM(filename); Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/dev/dynamic-es6-mod/src/index.mjs at Object.Module._extensions..mjs (internal/modules/cjs/loader.js:821:9) at Module.load (internal/modules/cjs/loader.js:643:32) at Function.Module._load (internal/modules/cjs/loader.js:556:12) at Function.Module.runMain (internal/modules/cjs/loader.js:839:10) at internal/main/run_main_module.js:17:11 </code></pre>
<javascript><node.js><import><es6-modules>
2019-07-23 17:58:12
HQ
57,169,862
Building numpy with ATLAS/LAPACK support
<p>I am trying to compile <code>numpy</code> v1.12 in order to get support for ATLAS/LAPACK routines. </p> <p><strong>The problem</strong></p> <p>The settings I am using for compilation do not appear to work in bringing ATLAS/LAPACK libraries into <code>numpy</code>.</p> <p><strong>The setup</strong></p> <p>I do not have admin privileges on the host(s) I am working on (a computational cluster). </p> <p>However, the nodes offer access to <code>gcc</code> 4.7.2 and 5.3.0, <code>glibc</code> 2.17 and 2.22, and ATLAS/LAPACK libraries and headers v3.10.2 via GNU modules.</p> <p>For compatibility reasons, I am working with a virtual environment that contains Python 2.7.16. Likewise, I am installing an older version of <code>numpy</code> for the same reason. If things work, I may explore newer versions of <code>numpy</code> but at this time, that is what I am working with. </p> <p>My source directory for <code>numpy</code> has a configuration file called <code>site.cfg</code>, which includes these directives:</p> <pre><code>[ALL] library_dirs = /usr/local/lib:/net/module/sw/glibc/2.22/lib64:/net/module/sw/atlas-lapack/3.10.2/lib include_dirs = /usr/local/include:/net/module/sw/glibc/2.22/include:/net/module/sw/atlas-lapack/3.10.2/include [atlas] libraries = lapack,f77blas,cblas,atlas library_dirs = /net/module/sw/atlas-lapack/3.10.2/lib include_dirs = /net/module/sw/atlas-lapack/3.10.2/include </code></pre> <p>I am compiling <code>numpy</code> via the following command:</p> <pre><code>$ CFLAGS="${CFLAGS} -std=c99 -fPIC" LDFLAGS="-L/home/areynolds/.conda/envs/genotyping_environment/lib -Wl,-rpath=/home/areynolds/.conda/envs/genotyping_environment/lib -Wl,--no-as-needed -Wl,--sysroot=/,-L/net/module/sw/glibc/2.22/lib64" python setup.py build --fcompiler=gnu95 </code></pre> <p>I am using <code>--fcompiler=gnu95</code> as the ATLAS/LAPACK libraries were compiled with GNU Fortran. I am overriding <code>CFLAGS</code> and <code>LDFLAGS</code> variables in order for the GCC toolkit to be able to compile and link properly.</p> <p><strong>The question</strong></p> <p>After compilation, I test the <code>numpy</code> library to see what is installed via one method:</p> <pre><code>$ python ... &gt;&gt;&gt; import numpy.distutils.system_info as sysinfo &gt;&gt;&gt; sysinfo.get_info('atlas') ATLAS version 3.10.2 built by root on Wed Jun 1 15:39:08 PDT 2016: UNAME : Linux module0.altiusinstitute.org 3.10.0-327.10.1.el7.x86_64 #1 SMP Tue Feb 16 17:03:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux INSTFLG : -1 0 -a 1 -l 1 ARCHDEFS : -DATL_OS_Linux -DATL_ARCH_UNKNOWNx86 -DATL_CPUMHZ=2876 -DATL_AVXMAC -DATL_AVX -DATL_SSE3 -DATL_SSE2 -DATL_SSE1 -DATL_USE64BITS -DATL_GAS_x8664 F2CDEFS : -DAdd_ -DF77_INTEGER=int -DStringSunStyle CACHEEDGE: 229376 F77 : /net/module/sw/gcc/5.3.0/bin/gfortran, version GNU Fortran (GCC) 5.3.0 F77FLAGS : -O -mavx2 -mfma -m64 -fPIC SMC : /usr/bin/x86_64-redhat-linux-gcc, version x86_64-redhat-linux-gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4) SMCFLAGS : -O -fomit-frame-pointer -mavx2 -mfma -m64 -fPIC SKC : /usr/bin/x86_64-redhat-linux-gcc, version x86_64-redhat-linux-gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4) SKCFLAGS : -O -fomit-frame-pointer -mavx2 -mfma -m64 -fPIC {'libraries': ['lapack', 'f77blas', 'cblas', 'atlas', 'f77blas', 'cblas'], 'library_dirs': ['/net/module/sw/atlas-lapack/3.10.2/lib'], 'define_macros': [('ATLAS_INFO', '"\\"3.10.2\\""')], 'language': 'f77', 'include_dirs': ['/net/module/sw/atlas-lapack/3.10.2/include']} </code></pre> <p>This looks okay, maybe?</p> <p>But when I check via another method, I get a different answer:</p> <pre><code>&gt;&gt;&gt; np.show_config() lapack_opt_info: libraries = ['openblas', 'openblas'] library_dirs = ['/usr/local/lib'] define_macros = [('HAVE_CBLAS', None)] language = c blas_opt_info: libraries = ['openblas', 'openblas'] library_dirs = ['/usr/local/lib'] define_macros = [('HAVE_CBLAS', None)] language = c openblas_info: libraries = ['openblas', 'openblas'] library_dirs = ['/usr/local/lib'] define_macros = [('HAVE_CBLAS', None)] language = c blis_info: NOT AVAILABLE openblas_lapack_info: libraries = ['openblas', 'openblas'] library_dirs = ['/usr/local/lib'] define_macros = [('HAVE_CBLAS', None)] language = c lapack_mkl_info: NOT AVAILABLE blas_mkl_info: NOT AVAILABLE </code></pre> <p>Despite the manual setup described in <code>site.cfg</code>, there are no mentions of ATLAS, nor is LAPACK apparently pointed to the correct module directory (<code>/net/module/sw/atlas-lapack/3.10.2</code>).</p> <p>How do I correctly compile support for ATLAS/LAPACK into <code>numpy</code>, or truly test that I have a working ATLAS/LAPACK setup integrated into <code>numpy</code>, which gives me a consistent (and reliable) answer?</p>
<python><python-2.7><numpy><lapack><atlas>
2019-07-23 18:03:09
HQ
57,171,345
Does matlab simulate "0" for infinitely-many solutions?
Matlab simulates solve(a==a)=0. The solution should have been infinitely many (the solution should have looked like a=a) but it simulates the solution equal to zero which is incorrect. How to fix this?
<matlab><symbolic-math>
2019-07-23 19:58:05
LQ_EDIT
57,172,610
What switches can run a .exe file with no human interaction?
I am in the process of automating the installation of different programs on a Windows system. I am having a hard time getting programs that end in .EXE to run on their own but I am able to have scripts that end in .MSI run with the appropriate switches. 1. I am not in a position to download additional software to accomplish this goal. 2. In the command Prompt I would enter: "\\temp\Notepad++\Current Installer\npp current installer.exe" /(? or h or help) to see what switches were available. I expect the program to install and that the batch script that contains this process proceeds to close on its own. Instead the process requires user input an becomes manual than automatic
<windows><batch-file><windows-installer><exe>
2019-07-23 21:44:23
LQ_EDIT
57,174,836
How to toggle setContextMenu content in google map
I am working on google-map api. I have problem with google map setcontextmenu. When the user right-clicks the map, the context menu will appear. I tried to change the content of context menu option from "measure distance" to "stop measure distance". Below is the code when the user right-clicks, it displays two menus : "measure distance" and "stop measuring". I want it to be toggle. How can i do this? Any help would be appreciated so much. I tried to put flag variable inside the contextmenu but it just didn't work. map_2.setContextMenu({ control: 'map', options: [ { title: 'Measure Distance', name: 'measure_distance', action: function(e) { // some codes here } }, { title: 'Stop Measuring', name: 'stop_measure_distance', action: function(e) { // some codes here } } ] }); When the user clicks "measure distance" menu, i want the "measure distance" menu disappear and "stop measuring" menu appears.
<google-maps><google-maps-api-3><contextmenu><gmaps.js>
2019-07-24 03:31:17
LQ_EDIT
57,175,228
How to we know user is enable or disable for notification service for our app in swift?
I using the Push notification in my application by using of Firebase. Here my problem is how to user is enable the notification service or not in his settings for our app. I want to fetch that data and send every time to backend. Any one give some idea on that.
<ios><swift><push-notification><settings>
2019-07-24 04:23:03
LQ_EDIT
57,175,434
How can I reduce search time looking for a list in a list of lists?
<p>I have a list containing many lists each of length between 60 and 120. I want a faster way than linear search to look through the list for finding the index of the array which has values close to the inputted array.</p>
<python>
2019-07-24 04:47:02
LQ_CLOSE
57,176,013
Javascript Instanciate new Object with dynamic parameter from String
I would like to instantiate a new object with dynamic parameters coming from an exernal String. Here is the code: const editorInstance = new Editor('#edit', placeholderText: null, theme: 'dark', language: 'en', linkList:[{text: 'test',href: 'test',target: '_blank'}], events: { initialized: function () { const editor = this this.el.closest('form').addEventListener('submit', function (e) { jQuery('#gs_editor_content').hide(); jQuery(this).append('<div class="loadingDiv">&nbsp;</div>'); o.script}); texta = jQuery('#myeditor').find('textarea'); targetFile = texta.attr('rel'); content = editor.$oel.val(); e.preventDefault(); var fd = new FormData(); fd.append( 'name' ,targetFile); fd.append( 'html', editor.$oel.val() ); $.ajax({ url : 'http://localhost/Update', type : 'POST', data: fd, processData : false, contentType : false, async : false, success : function(data, textStatus, request) { } }); jQuery('#myeditor').dialog("close"); }) } } }) I would need to modify the parameters `linkList` before instantiating my object as I receive a new list received from my server. I tried to use eval or parseFunction but I encounter an unexpected identifier error. any idea how I can achieve this ?
<javascript>
2019-07-24 05:43:24
LQ_EDIT
57,176,184
Anomaly in printf() function
<p>I am seeing anomalous behavior in print function while dealing with int and float numbers.</p> <pre><code>float y = 9/5; printf("%f", y); printf("%f", 9/5); </code></pre> <p>First print statement outputs 1.000000 which is acceptable while other outputs 0.000000. Why outputs are different in both cases?</p>
<c><floating-point><printf>
2019-07-24 06:00:16
LQ_CLOSE
57,176,916
Join columns of the same data.frame in rstudio
How to join 2 columns in rstudio from a single data.frame For example: Column A : a,b,c,d,e Column B : b,c,a,b,e The column i want New Column : a,b,c,d,e,b,c,a,b,e Basically i want to get all data under both columns into a single column using rstudio
<r>
2019-07-24 06:54:51
LQ_EDIT
57,177,182
Why did not work jQuery button in this code
<p><a href="https://i.imgur.com/WtzTa3g.png" rel="nofollow noreferrer">https://i.imgur.com/WtzTa3g.png</a> </p> <p>what is my mistake ? why this click function is did not work ? i made this function without each loop, then that function working properly, but why did not work this place ? </p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt; NG - REPEAT &lt;/title&gt; &lt;script src="https://code.jquery.com/jquery-3.4.1.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;table border="1"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;ID&lt;/th&gt; &lt;th&gt;NAME&lt;/th&gt; &lt;th&gt;VERSION&lt;/th&gt; &lt;th&gt;PRICE&lt;/th&gt; &lt;th&gt;ACTION&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody class="tr"&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;script&gt; $(document).ready(function() { $.ajax({ url:'data.json', dataType:'json', success: function(data) { console.log(data); $.each(data.product, function(name, value) { var result = '&lt;tr&gt;&lt;td&gt;'+name+'&lt;/td&gt;&lt;td&gt;'+value.name+'&lt;/td&gt; &lt;td&gt;'+value.version+'&lt;/td&gt; &lt;td&gt;'+value.price+'&lt;/td&gt;&lt;td&gt;&lt;button id="btn"&gt;Load&lt;/button&gt;&lt;/td&gt;&lt;/tr&gt;'; $(".tr").append(result); }); } }); $("button").click(function(){ alert("hi"); }); }); &lt;/script&gt; &lt;/body&gt; </code></pre> <p></p>
<jquery>
2019-07-24 07:12:09
LQ_CLOSE
57,177,494
Splitting the values of an array based on a property and then form a new array of objects
<p>I have an objects that contains arrays with following structure:</p> <pre><code>var obj = { "feature1" : ["val1","val2"], "feature2" : ["val3"] } </code></pre> <p>Now I want to split the values that are present inside of this each array and form a new array of objects that should like :</p> <pre><code>var result = [ { "field": "feature1", "value": "val1", "type": "add" }, { "field": "feature1", "value": "val2", "type": "add" }, { "field": "feature2", "value": "val3", "type": "add" } ] </code></pre> <p>Here splitting must happen based on the "field" and it show something that is similar to above.here "type" is an extra field that is hardcoded</p> <p>Help would be appreciated.</p>
<javascript><arrays><ecmascript-6>
2019-07-24 07:30:32
LQ_CLOSE
57,177,923
Null object reference on database cursor
<p>Been trying to retrieve data from database, my database has values and I don't know which causes this error. </p> <pre><code>public void popList(String date, String time, String type, String game, String place){ Cursor data = databaseHelper.getReports(date, time, type, game, place); while (data.moveToNext()) { HashMap&lt;String, String&gt; datax = new HashMap&lt;&gt;(); datax.put("id", (data.getString(data.getColumnIndex("betid")))); datax.put("betnumber", (data.getString(data.getColumnIndex("betnum")))); datax.put("betamount", (data.getString(data.getColumnIndex("betamt")))); mData3.add(datax); } bettorAdapter = new MyAdapter(mData3); listViewx.setAdapter(bettorAdapter); bettorAdapter.notifyDataSetChanged(); } public Cursor getReports(String date, String time, String type, String game, String place){ Cursor data=null; try { SQLiteDatabase db = this.getReadableDatabase(); String query = "SELECT * FROM reports WHERE date='"+date+"' AND time ='"+time+"' AND game='"+game+"' AND type='"+type+"' AND lugar='"+place+"'"; data = db.rawQuery(query,null); }catch (Exception e){ System.out.println(e); } return data; } </code></pre>
<android><nullpointerexception><android-sqlite>
2019-07-24 07:56:11
LQ_CLOSE
57,177,989
How to turn off NavigationLink overlay color in SwiftUI?
<p>I've designed a "CardView" using ZStack in which the background layer is a gradient and the foreground layer is a PNG(or PDF) image(the image is a yellow path(like a circle) drawn in Adobe Illustrator).</p> <p>When I put the ZStack inside a NavigationLink the gradient remains unchanged and fine, but the image get a bluish overlay color (like default color of a button) therefore there is no more yellow path(the path is bluish).</p> <p>How can get the original color of foreground PNG(or PDF) image?</p> <pre class="lang-swift prettyprint-override"><code> import SwiftUI struct MyCardView : View { let cRadius : CGFloat = 35 let cHeight : CGFloat = 220 var body: some View { NavigationView { NavigationLink(destination: Text("Hello")) { ZStack { RoundedRectangle(cornerRadius: cRadius) .foregroundColor(.white) .opacity(0) .background(LinearGradient(gradient: Gradient(colors: [Color(red: 109/255, green: 58/255, blue: 242/255),Color(red: 57/255, green: 23/255, blue: 189/255)]), startPoint: .leading, endPoint: .trailing), cornerRadius: 0) .cornerRadius(cRadius) .frame(height: cHeight) .padding() Image("someColoredPathPNGimage") } } } } } </code></pre>
<xcode><colors><navigation><swiftui>
2019-07-24 07:59:27
HQ
57,178,203
how to check input for use ngif?
i want check Comment if is not null open the div Uncaught Error: Template parse errors: Unexpected closing tag "div". It may happen when the tag has already been closed by another tag. For more info see <div class="form-group"> <label>توضیحات</label> <textarea [(ngModel)]="name" style="direction: rtl; color: rgb(3, 0, 0);" class="form-control" formControlName="Comment" aria-label="With textarea"></textarea> </div> <div *ngIf="{{name}} == ''"></div> <app-upload style="width: inherit; float: inline-start; width: 100px;" (onUploadFinished)="uploadFinished($event)"></app-upload> <img src="http://localhost:54277/{{this.response.dbPath}}" width="200px" height="200px"> </div>
<angular>
2019-07-24 08:10:22
LQ_EDIT
57,179,339
Anroid Studion 3.4.2 error when compiling
[I am getting errors on the lines compiling message_text][1] [1]: https://i.stack.imgur.com/zVP7j.png
<android><kotlin>
2019-07-24 09:15:26
LQ_EDIT
57,179,839
cell.delegate = self does't work in swift
I am trying to use https://github.com/MortimerGoro/MGSwipeTableCell this library to make custom swipe cell. However, cell.delegate = self keep giving me error saying that "Cannot assign value of type 'AlarmTableViewController' to type 'MGSwipeTableCellDelegate?'" but even if I insert ' as! MGSwipeTableCellDelegate' it makes fatal error: unexpectedly found nil while unwrapping an Optional value. ``` class AlarmTableViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { ``` ``` func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell{ let reuseIdentifier = "programmaticCell" var cell = tableView.dequeueReusableCell(withIdentifier: reuseIdentifier, for: indexPath) as! MGSwipeTableCell cell.textLabel!.text = "Title" cell.delegate = self as! MGSwipeTableCellDelegate //optional return cell } ``` In my storyboard I've set cell's custom class as MGSwipeTableCell and its Identifier as programmaticCell. Please help me. table view is driving me crazy.
<swift><delegates><tableview>
2019-07-24 09:39:32
LQ_EDIT
57,180,375
SQL that work on ORACLE and not work on DB2
<p>I have an SQL that put the comma before house address number. This SQL work great on ORACLE but if I paste it in DB2 (vers. 7.2) is not work. </p> <pre><code>SELECT C, REGEXP_REPLACE(C,'(\s+\S*\d+\s*$)',',\1') FROM TABLE( VALUES ('VIA MILANO 123 '), ('VIA MILANO A123 '), ('VIA 11 MILANO AA123') ) AS T(C) </code></pre> <p>Is there anybody that can tell me why ? or if I can convert it please ? </p> <p>Thanks a lot Denis</p>
<oracle><db2>
2019-07-24 10:07:14
LQ_CLOSE
57,181,011
How can I create new Tags in DICOM?
I want to add some specifics tags in my java program that are not in the DICOM library. How can I do it?
<java><dicom><dcm4che>
2019-07-24 10:41:39
LQ_EDIT
57,182,210
i have writen api in php and again i am consuming my api in php,but delete method is not working
i have writen api in php and consuming that api in php to make crud operations,but delete method is not working. } else if($_SERVER['REQUEST_METHOD'] == 'DELETE'){ $del_id = $_GET["issuse_id"]; $url = 'http://192.168.0.82/ITS/Controller/issues'. $del_id; $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response_json = curl_exec($ch); curl_close($ch); $data=json_decode($response_json, true); return $data;
<php><api>
2019-07-24 11:48:56
LQ_EDIT
57,182,899
private arguments not saving things help c++
main.cpp #include <iostream> #include <string> #include <vector> #include "Figuras.h" using namespace std; void error(){ cout<<"algo ha ido mal vuelve a empezar"<<endl; exit(0); } int main(){ Figuras fig; vec V; string tip; cout << "Triangle = Tr / Cuadrat = Cu / Rectangle = Re / Segment = Se / Cercle = Ce" << endl; cin >> tip; if(tip=="Tr"){ V = vector<pair<double,double>>(3); } else if(tip == "Cu" or tip == "Re"){ V = vector<pair<double,double>>(4); } else if (tip == "Se" or tip == "Ce"){ V = vector<pair<double,double>>(2); } else error(); for (int i = 0; i < V.size(); i++) { //fill vector with coords cout << "Introdueix coordenada numero: " << i<<" format (double,double): " <<endl; cout << "x: "; cin >> V[i].first; cout << "y: "; cin >> V[i].second; } fig.crea_figura(tip,V); fig.mostrar_fig(); } Figuras.cpp #include "Figuras.h" using namespace std; /*void Figuras::Figura(){ tipo = NULL; Coord = NULL; }*/ string Figuras::get_tipo (){ return tipo; }; vec Figuras::get_coords (){ return Coord; }; punto Figuras::get_inicio (){ return inicio; }; void Figuras::Set_tipo (string typ){ tipo = typ; }; void Figuras::Set_Coord (vec V){ punto p; int x= V.size(); Coord=vector<pair<double,double>>(x); for ( int i =0; i<x; i++){ Coord[i].first = p.first; Coord[i].second = p.second; } }; void Figuras::Set_inicio (punto ini){ inicio = ini; }; void Figuras::crea_figura (string tip, vec V){ Set_tipo(tip); Set_Coord(V); }; void Figuras::trasladar (punto P){ double difx,dify; difx=P.first - inicio.first; dify=P.second - inicio.second; vec V; Figuras::get_coords(); if (!Coord.empty()){ for(int i=0; i<Coord.size(); i++){ Coord[i].first += difx; Coord[i].second += dify; } } else cout<< "no hay coords"<<endl; }; void Figuras::mostrar_fig (){ vec V; V=get_coords(); punto ini; ini=get_inicio(); string tip; tip=get_tipo(); cout<<"tipo: "<<tip<<endl; for (int i =0; i<V.size(); i++){ cout<<"punto "<< i+1<<": "<<"("<<V[i].first<<","<<V[i].second<<")"<<endl; } cout<< "punto inicial: ("<<ini.first<<","<<ini.second<<")"<<endl; }; Figuras.h #ifndef FIGURAS_H #define FIGURAS_H #include <vector> #include <iostream> #include <string> using namespace std; typedef vector < pair < double, double >>vec; typedef pair < double, double >punto; class Figuras { private: string tipo; vec Coord; punto inicio={0.0,0.0}; public: string get_tipo (); vec get_coords (); punto get_inicio (); void Set_tipo (string typ); void Set_Coord (vec V); void Set_inicio (punto ini); void crea_figura (string tip, vec vec); void trasladar (punto P); void mostrar_fig (); }; #endif hi guys let me explain the problem when i do, `crea_figura(tip,V);` and then mostrar_fig() at main.cpp line 39,40 this happens: Triangle = Tr / Cuadrat = Cu / Rectangle = Re / Segment = Se / Cercle = Ce Tr Introdueix coordenada numero: 0 format (double,double): x: 1.1 y: 1.1 Introdueix coordenada numero: 1 format (double,double): x: 2.2 y: 2.2 Introdueix coordenada numero: 2 format (double,double): x: 3.1 y: 1.1 tipo: Tr punto 1: (0,0) punto 2: (0,0) punto 3: (0,0) punto inicial: (0,0) any help with that? if u hadn't noticed all points appear to be empty and i can not realize why is that for. Please help me and if you know any other way to initialize the class (another type of constructor), i will really appreciate that.
<c++>
2019-07-24 12:25:20
LQ_EDIT
57,184,364
I want to call three.js inside a div
I was trying to call three.js webgl particles waves inside a <div> with custom size (responsive). I got a codepen exapmle [https://codepen.io/deathfang/pen/WxNVoq][1] but this example not meeting my requirements. <div id="container"></div> I want this inside my custom div [1]: https://codepen.io/deathfang/pen/WxNVoq
<javascript><jquery><html><three.js>
2019-07-24 13:41:07
LQ_EDIT
57,184,671
Is it possible to add links to images in css?
<p>I can't change the html, so is it possible to do something like (a href="") in css?</p> <p>I saw that I can use jQuery to do it, but there aren't any specific classes for each slide, just a general class:</p> <pre class="lang-html prettyprint-override"><code>&lt;div class="slick-slider draggable"&gt; &lt;div class="slick-slider"&gt; &lt;figure class="slick-slide-inner"&gt;&lt;img class="slick-slide-image" alt="PLANOS"&gt;&lt;/figure&gt; &lt;/div&gt; &lt;div class="slick-slider"&gt;...&lt;/div&gt; &lt;div class="slick-slider"&gt;...&lt;/div&gt; &lt;div class="slick-slider"&gt;...&lt;/div&gt; &lt;div class="slick-slider"&gt;...&lt;/div&gt; &lt;div class="slick-slider"&gt;...&lt;/div&gt; &lt;div class="slick-slider"&gt;...&lt;/div&gt; &lt;/div&gt; </code></pre> <p>Is it possible to do something like this:</p> <pre class="lang-css prettyprint-override"><code>figure.slick-slide-inner[alt="PLANOS"]{ /*and command to add link*/ } </code></pre>
<javascript><jquery><html><css>
2019-07-24 13:56:56
LQ_CLOSE
57,185,072
Initialize Tree List View with Buttons
I have an TreeListView with three columns. The first displays the name of a file, and the other two must have buttons that allow to perform download and delete actions. However, to initialize this TreeListView, I first call a method that returns a list of strings with the file names. How do I get the names of these files to load in the first column of TreeListView, accompanied by the buttons in the other two columns? Thanks.
<c#><winforms><objectlistview>
2019-07-24 14:16:36
LQ_EDIT
57,186,568
I need help understanding the code for reversing an of string
I do need help understanding a code of reversing the array of string I have been looking through few codes, and just trying to understand it. it is function using pointer void ReverseString(char *pStr){ int length = 0; int i = 0; while(pStr[i]!='\0') { length++; i++; } for (int i = 0; i < length / 2; i++) { char temp = pStr[length - i - 1] ; pStr[length - i - 1] = pStr[i]; pStr[i] = temp; } } expecting to reverse a string, have a main function different
<c><arrays><string><reverse><swap>
2019-07-24 15:35:19
LQ_EDIT
57,187,322
Two versions of icu4c installed by Homebrew
<p>Whenever I attempted to run <code>npm --version</code> or <code>node --version</code> on my Mac, I was getting the following error:</p> <pre><code>$&gt; node --version dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.63.dylib Referenced from: /usr/local/bin/node Reason: image not found Abort trap: 6 </code></pre> <p>I found <a href="https://stackoverflow.com/questions/53828891/dyld-library-not-loaded-usr-local-opt-icu4c-lib-libicui18n-62-dylib-error-run">this helpful SO post</a> which suggested linking the appropriate version, and fixed my issue with:</p> <pre><code>$&gt; brew switch icu4c 63.1 Cleaning /usr/local/Cellar/icu4c/64.2 Cleaning /usr/local/Cellar/icu4c/63.1 Opt link created for /usr/local/Cellar/icu4c/63.1 </code></pre> <p>However after doing this, <strong>PHP</strong> stopped working:</p> <pre><code>$&gt; tail /usr/local/var/log/php-fpm.log Reason: image not found dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib Referenced from: /usr/local/opt/php/sbin/php-fpm Reason: image not found dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib Referenced from: /usr/local/opt/php/sbin/php-fpm Reason: image not found dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib Referenced from: /usr/local/opt/php/sbin/php-fpm Reason: image not found </code></pre> <p>I found <a href="https://stackoverflow.com/questions/53828891/dyld-library-not-loaded-usr-local-opt-icu4c-lib-libicui18n-62-dylib-error-run">this helpful SO post</a> which suggested linking the appropriate version, and fixed my issue with:</p> <pre><code>$&gt; brew switch icu4c 64.2 Cleaning /usr/local/Cellar/icu4c/64.2 Cleaning /usr/local/Cellar/icu4c/63.1 Opt link created for /usr/local/Cellar/icu4c/64.2 </code></pre> <p>But now NodeJS is broken again! How can I tell Homebrew to create <strong>both</strong> links, one for 63.1 and one for 64.2? Or is there a way to tell NodeJS to use the newer 64.2 instead?</p>
<php><node.js><macos><homebrew><icu4c>
2019-07-24 16:17:34
HQ
57,188,661
Detect is child container at the bottom of the parent - jQuery
I have HTML like this: <div class="cont"> <!-- some elements --> <div class="child fixed">Child</div> </div> `child` is with position `fixed` (class `fixed`). Inside `cont` there are another elements, which make it with higher height than `child`. I have scroll event on document: $(document).scroll(function(e) { ... } I want when some1 scroll and child is at the bottom of `cont` to remove `fixed` class. How can I detect on scroll (`document` scroll) that some element is at the bottom of some parent element ?
<javascript><jquery><css>
2019-07-24 17:52:02
LQ_EDIT
57,189,943
Java System Independent Root Directory Paths
<p>In a Windows system my path would be like this:</p> <pre><code>C:/example/ </code></pre> <p>And in a Linux system my path would be like this:</p> <pre><code>/example/ </code></pre> <p>Is there some utility function to have a single string work in both systems? </p>
<java>
2019-07-24 19:24:45
LQ_CLOSE
57,190,185
Multiple Values in sql
I have two tables, Table A & Table B Table A: G.R.N ITEM QUANTITY 1 ABC001 150 1 CBD001 150 1 SDB001 100 Table B: DELIVERY ITEM QUANTITY 34 ABC001 50 35 ABC001 40 36 ABC001 60 37 CBD001 50 38 CBD001 40 39 CBD001 10 Is it possible to get desired output like this: G.R.N ITEM QUANTITY DELIVERY ITEM QUANTITY DIFFERENCE 1 ABC001 150 34,35,36 ABC001 150 0 1 CBD001 150 37,38,39 CBD001 100 50 1 SDB001 100 100
<sql><sql-server>
2019-07-24 19:41:14
LQ_EDIT
57,190,886
Vuetify download previous version 1.5
<p>The Vuetify CDN updated to the latest 2.0 version. How do I access version 1.5 via CDN? Or download the min.js file? I can't find any links on the Vuetify site to get previous versions. </p> <p>Thanks, Donnie</p>
<vue.js><vuetify.js>
2019-07-24 20:38:29
LQ_CLOSE
57,191,013
SwiftUI can't tap in Spacer of HStack
<p>I've got a List view and each row of the list contains an HStack with some text view('s) and an image, like so:</p> <pre><code>HStack{ Text(group.name) Spacer() if (groupModel.required) { Text("Required").color(Color.gray) } Image("ic_collapse").renderingMode(.template).rotationEffect(Angle(degrees: 90)).foregroundColor(Color.gray) }.tapAction { self.groupSelected(self.group) } </code></pre> <p>This seems to work great, except when I tap in the empty section between my text and the image (where the <code>Spacer()</code> is) the tap action is not registered. The tap action will only occur when I tap on the text or on the image.</p> <p>Has anyone else faced this issue / knows a workaround?</p>
<ios><swift><swiftui>
2019-07-24 20:47:39
HQ
57,193,012
VBA How to paste data a certain number of times
I have 2 lines: L39 = DR L40 = CR And I want to copy those two lines down a certain number of times. I have already calculated that using variable Template_row. So if Template_row = 128, I would want those 128 rows to be filled down with DR & CR.
<excel><vba>
2019-07-25 01:09:53
LQ_EDIT
57,194,152
Is Python `list.extend(iterator)` guaranteed to be lazy?
<h1>Summary</h1> <p>Suppose I have an <code>iterator</code> that, as elements are consumed from it, performs some side effect, such as modifying a list. If I define a list <code>l</code> and call <code>l.extend(iterator)</code>, is it guaranteed that <code>extend</code> will push elements onto <code>l</code> one-by-one, <em>as elements from the iterator are consumed</em>, as opposed to kept in a buffer and then pushed on all at once?</p> <h1>My experiments</h1> <p>I did a quick test in Python 3.7 on my computer, and <code>list.extend</code> seems to be lazy based on that test. (See code below.) Is this guaranteed by the spec, and if so, where in the spec is that mentioned?</p> <p>(Also, feel free to criticize me and say "this is not Pythonic, you fool!"--though I would appreciate it if you also answer the question if you want to criticize me. Part of why I'm asking is for my own curiosity.)</p> <p>Say I define an iterator that pushes onto a list as it runs:</p> <pre class="lang-py prettyprint-override"><code>l = [] def iterator(k): for i in range(5): print([j in k for j in range(5)]) yield i l.extend(iterator(l)) </code></pre> <p>Here are examples of non-lazy (i.e. buffered) vs. lazy possible <code>extend</code> implementations:</p> <pre class="lang-py prettyprint-override"><code>def extend_nonlazy(l, iterator): l += list(iterator) def extend_lazy(l, iterator): for i in iterator: l.append(i) </code></pre> <h1>Results</h1> <p>Here's what happens when I run both <em>known</em> implementations of <code>extend</code>.</p> <hr> <p>Non-lazy:</p> <pre class="lang-py prettyprint-override"><code>l = [] extend_nonlazy(l, iterator(l)) </code></pre> <pre><code># output [False, False, False, False, False] [False, False, False, False, False] [False, False, False, False, False] [False, False, False, False, False] [False, False, False, False, False] # l = [0, 1, 2, 3, 4] </code></pre> <hr> <p>Lazy:</p> <pre class="lang-py prettyprint-override"><code>l = [] extend_lazy(l, iterator(l)) </code></pre> <pre><code>[False, False, False, False, False] [True, False, False, False, False] [True, True, False, False, False] [True, True, True, False, False] [True, True, True, True, False] </code></pre> <hr> <p>My own experimentation shows that native <code>list.extend</code> seems to work like the lazy version, but my question is: does the Python spec guarantee that?</p>
<python><list><data-structures><iterator><lazy-evaluation>
2019-07-25 04:04:04
HQ
57,195,361
T SQL syntax for creating table
I Need to make a table of student marks list. in one column the data need to be sum of the columns in the same row ex roll_no Maths1 maths2 physics total 12 48 50 60 158 how can i create a table for the above solution in sql
<sql-server><tsql>
2019-07-25 06:09:12
LQ_EDIT
57,196,679
How to count the numbers of records in a table
<p>What are 3 ways to get a count of the number of records in a table?</p>
<sql>
2019-07-25 07:38:23
LQ_CLOSE
57,202,043
Windows Defender might be impacting your build performance
<p>After I updated my Pycharm IDE to 19.2.0 from the 19.1.2. I am getting the following warning:</p> <pre><code>"Windows Defender might be impacting your build performance. PyCharm checked thefollowing directories: C:\Workspace\Projects\576_UniversityTwitter C:\Users\Burak\.PyCharmCE2019.2\system C:\Users\Burak\.gradle </code></pre> <p>Do you think that it is secure, necessary and really improve the performance?</p>
<jetbrains-ide>
2019-07-25 12:31:51
HQ
57,204,314
I need some vba code that copies the contents of the attachment (a word document) and inserts it into the body of the draft email
I have a program that generates a draft email with an attached letter for the user to send on to the client. Most clients don't want the letter as an attachment but want it in the body of the email. Is it possible to create a button that runs some vba that opens up the attachment of the draft email, copies the text and pastes it into the body of the email? I have tried to search for something similar but couldn't find anything and am not experienced enough in vba to code it myself.
<vba><outlook><ms-word>
2019-07-25 14:25:46
LQ_EDIT
57,204,516
On Button click i want to toggle the text of TextView in Android Studio
I want to toggle textview text with on a button click .I have set the flag as public variable and change it in onclick function but still the value of flag for some reason is initialized to its default value. i am beginner to android studio Thank you. I want text of Textview to toggle every time i click on the button but text of textview changes only once. bt1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { flag=true; if(flag=true){ flag=false; txt.setText("Steve"); } else { txt.setText("Shetty"); flag=true; } } });
<java><android>
2019-07-25 14:35:13
LQ_EDIT
57,204,724
Looking for advice with C arrays
Good afternoon, I want to improve my program with user-input of array length. Is that possible in C?
<c><arrays><user-input>
2019-07-25 14:45:49
LQ_EDIT
57,205,650
What are the problems with mixing .NET Framework and .NET CORE?
<p>I have a load of middle and back end components (repositories, services etc) that were written against the .NET Framework 4 but that are still relevant to a new project that I'm now working on. The front end of this new project will be written in ASP .NET CORE2.2. What should I do - recreate all components in .NET CORE or keep the back end running against .NET Framework while the front end runs against CORE? What are the considerations in terms of e.g. performance?</p>
<c#><asp.net><asp.net-core><.net-framework-version>
2019-07-25 15:33:31
LQ_CLOSE
57,205,711
java.lang.IllegalArgumentException: Plugin already initialized. How to fix?
<p>When I'm testing my new plugin an exception keeps getting thrown: java.lang.IllegalArgumentException: Plugin already initialized! Please help! Here's the code:</p> <pre><code>package me.plugin.example; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.event.Listener; import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; public class Main extends JavaPlugin implements Listener { @Override public void onEnable() { getServer().getPluginManager().registerEvents(new Main(), this); } @EventHandler public void onPlayerJoinEvent(PlayerJoinEvent event) { Player p = event.getPlayer(); event.setJoinMessage(ChatColor.AQUA + p.getPlayerListName() + " has joined the game."); p.sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "Welcome to the server!"); p.setGameMode(GameMode.ADVENTURE); } @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = (Player) sender; if (cmd.getName().equalsIgnoreCase("example")) { player.sendMessage(ChatColor.BOLD + ""+ ChatColor.ITALIC + "Hello! Hope you like to be set on fire. lol :P"); player.setFireTicks(20); } return true; } @Override public void onDisable() { } } </code></pre> <p>I know that you're only supposed to declare one JavaPlugin class per plugin, which I think I'm doing. But it keeps saying:</p> <pre><code>java.lang.IllegalArgumentException: Plugin already initialized! at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:122) ~[spigot.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.plugin.java.JavaPlugin.&lt;init&gt;(JavaPlugin.java:66) ~[spigot.jar:git-Spigot-db6de12-18fbb24] at me.plugin.example.Main.&lt;init&gt;(Main.java:19) ~[?:?] at me.plugin.example.Main.onEnable(Main.java:27) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[spigot.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [spigot.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:357) [spigot.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:317) [spigot.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:414) [spigot.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:378) [spigot.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:333) [spigot.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:263) [spigot.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot.jar:git-Spigot-db6de12-18fbb24] at java.lang.Thread.run(Unknown Source) [?:1.8.0_201] Caused by: java.lang.IllegalStateException: Initial initialization at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:125) ~[spigot.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.plugin.java.JavaPlugin.&lt;init&gt;(JavaPlugin.java:66) ~[spigot.jar:git-Spigot-db6de12-18fbb24] at me.plugin.example.Main.&lt;init&gt;(Main.java:19) ~[?:?] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_201] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_201] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_201] at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_201] at java.lang.Class.newInstance(Unknown Source) ~[?:1.8.0_201] at org.bukkit.plugin.java.PluginClassLoader.&lt;init&gt;(PluginClassLoader.java:76) ~[spigot.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[spigot.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) ~[spigot.jar:git-Spigot-db6de12-18fbb24] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) ~[spigot.jar:git-Spigot-db6de12-18fbb24] at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:198) ~[spigot.jar:git-Spigot-db6de12-18fbb24] ... 2 more </code></pre> <p>I really need to test this plugin to see if it works, and any help would be greatly appreciated! Thank you!</p>
<java><minecraft><bukkit>
2019-07-25 15:37:23
LQ_CLOSE
57,206,654
Pointer in c++for scanning an array
<p>How to scan an array in c++ using pointer?</p> <p>I have learned c programming .so i tried that way.</p> <pre><code>include&lt;iostream&gt; using namespace std; main() { int a[5],*p,i; p=&amp;a[5]; for(i=0;i&lt;5;i++) { cout&lt;&lt;"enter"&lt;&lt;i+1&lt;&lt;endl; cin&gt;&gt;(p+i); } for(i=0;i&lt;5;i++) { cout&lt;&lt;*(p+i)&lt;&lt;endl; } } </code></pre> <p>I am expecting to scan using pointer just like in c programming</p>
<c++>
2019-07-25 16:37:53
LQ_CLOSE