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 |
|---|---|---|---|---|---|
55,368,964 | My Date Formatter Isn't Showing Correct Day | I am trying to show today's date as March 26 but it is showing as "March 85" when I use this code. I am not sure why.
let formatter = DateFormatter()
formatter.dateFormat = "MMMM DD"
let defaultTimeZoneStr = formatter.string(from: NSDate() as Date) | <swift><date><time><formatter> | 2019-03-27 02:38:07 | LQ_EDIT |
55,369,645 | How to customize default auth login form in Django? | <p>How do you customize the default login form in Django?</p>
<pre><code># demo_project/urls.py
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('', include('pages.urls')),
path('users/', include('users.urls')), # new
path('users/', include('django.contrib.auth.urls')), # new
path('admin/', admin.site.urls),
]
<!-- templates/registration/login.html -->
<h2>Login</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Login</button>
</form>
</code></pre>
<p>Above code works but I need to customize that {{form.as_p}} Where is that form or can it be override? Thanks for the help.</p>
| <python><django><django-forms> | 2019-03-27 04:05:52 | HQ |
55,369,651 | How to convert JSON object to a different format | <p>I have a JSON object like this</p>
<pre><code>{
"name": "Test Name",
"age": 24
}
</code></pre>
<p>Is there a way I can convert this to a <strong>String</strong> in a format like</p>
<pre><code>{
name: "Test Name",
age: 24
}
</code></pre>
<p>The JSON will be of varying lengths with different properties.</p>
<p>Right now, I am doing this as shown below. This can get too long and messy for larger and more complex JSON objects. I need to know if there is an easier and cleaner solution for this.</p>
<pre><code>let cypherQueryObject = '{';
cypherQueryObject += ` name: "${user.name}";
if (user.age) { cypherQueryObject += `, age: "${user.age}"` };
cypherQueryObject = '}';
</code></pre>
| <javascript><json><ecmascript-6><neo4j> | 2019-03-27 04:06:44 | LQ_CLOSE |
55,370,195 | Write char pointer to a file, read file and check size? | <p>I'm trying to read a char pointer to a file, then check the size of that file. The file SHOULD be 256 bytes if I'm doing this correctly. I want to create a file that has the char* array fwrite into it, then check that file to see it's size and print out it's size in bytes. My code is down below.</p>
<p>ALSO, i should be writing chars into the peep, NOT INTEGERS, but I'm not sure how to do that.</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
double price;
char title[60];
} game;
void main(){
FILE* fp = fopen("file.txt","w+"); //file.txt will be blockchain text file.
char* peep = malloc(256);
for(int i = 0; i<256;i++){ // Populate array with 256 2's.
peep[i] = 2; //THIS SHOULD BE CHARACTERS, ONE CHARACTER PER INDEX
}
for (int i = 0; i < 256 ;i++){ //Print array to verify if has 256 2 char.
printf("%d %d\n",peep[i],i);
}
int j = sizeof(peep)/sizeof(peep[0]); //amount of elements in array.
fwrite(peep,sizeof(peep[0]),sizeof(peep)/sizeof(peep[0]),fp); //Writes 256 chars to the array, all of the peep.
long fsize = 0; //Size of the file after writing
if (fp != NULL){
fseek(fp,0,SEEK_END);
fsize = ftell(fp);
}
if (fsize != 256){
printf("\nPEEP NOT FULL,size is %ld",fsize);
}
// fseek(fp,0,SEEK_SET); //Go back to start of file, since we were at the end.
}
</code></pre>
| <c><file-io><malloc> | 2019-03-27 05:11:41 | LQ_CLOSE |
55,370,851 | How to fix Binding element 'children' implicitly has an 'any' type.ts(7031)? | <p>I'm missing something here with the validation how to add types validation? Having error "element 'children' implicitly has an 'any' type".</p>
<pre><code>import * as React from 'react';
import Button from './Styles';
const Button1 = ({ children, ...props }) => (
<Button {...props}>{children}</Button>
);
Button1.propTypes = {};
export default Button1;
</code></pre>
| <reactjs><typescript> | 2019-03-27 06:12:19 | HQ |
55,372,330 | What does "Limit of total fields [1000] in index [] has been exceeded" means in Elasticsearch | <p>I have Elasticsearch index created which has approx 350 fields (Including nested fields) , I have defined mapping only for few of them.
While calling _update API I am getting below exception with 400 Bad request.</p>
<p><strong>Limit of total fields [1000] in index [test_index] has been exceeded</strong><br>
I want to understand the exact reason for this exception since my number of fields and fields for which mapping is defined both are less than 1000.<br>
<strong>Note:</strong> I have nested fields and dynamic mapping enabled. </p>
<p>Regards,<br>
Sandeep</p>
| <elasticsearch> | 2019-03-27 08:02:59 | HQ |
55,372,675 | Type int? vs type int | <p>I've this comparison which equals <code>false</code> as expected</p>
<pre><code>bool eq = typeof(int?).Equals(typeof(int));
</code></pre>
<p>now I have this code</p>
<pre><code>List<object> items = new List<object>() { (int?)123 };
int result = items.OfType<int>().FirstOrDefault();
</code></pre>
<p>but this returns <code>123</code> - anyway that value is of type <code>int?</code></p>
<p>How can this be?</p>
| <c#><casting> | 2019-03-27 08:27:06 | HQ |
55,372,837 | Is there a way to make RecyclerView requiresFadingEdge unaffected by paddingTop and paddingBottom | <p>Currently, I need to use <code>paddingTop</code> and <code>paddingBottom</code> of <code>RecyclerView</code>, as I want to avoid complex space calculation, in my first <code>RecyclerView</code> item and last item.</p>
<p>However, I notice that, <code>requiresFadingEdge</code> effect will be affected as well.</p>
<p>This is my XML</p>
<pre><code><androidx.recyclerview.widget.RecyclerView
android:requiresFadingEdge="vertical"
android:paddingTop="0dp"
android:paddingBottom="0dp"
android:overScrollMode="always"
android:background="?attr/recyclerViewBackground"
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false" />
</code></pre>
<hr>
<h2>When paddingTop and paddingBottom is 40dp</h2>
<p><a href="https://i.stack.imgur.com/J8u20.png" rel="noreferrer"><img src="https://i.stack.imgur.com/J8u20.png" alt="enter image description here"></a></p>
<p>As you can see, the fading effect shift down by 40dp, which is not what I want.</p>
<hr>
<h2>When paddingTop and paddingBottom is 0dp</h2>
<p><a href="https://i.stack.imgur.com/LfDEv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/LfDEv.png" alt="enter image description here"></a></p>
<p>Fading effect looks fine. But, I need to have non-zero <code>paddingTop</code> and <code>paddingBottom</code>, for my <code>RecyclerView</code>.</p>
<hr>
<p>Is there a way to make <code>RecyclerView</code>'s <code>requiresFadingEdge</code> unaffected by <code>paddingTop</code> and <code>paddingBottom</code>?</p>
| <android><android-recyclerview> | 2019-03-27 08:37:25 | HQ |
55,373,301 | How to get number of days between two date in SQl Server? | I need to get number of days between 2 date from history booking room from one customer in SQLServer. in that data that have 3 status(in, stay and out)
#record :#
id | room | status | date<br/>
1 | A | In | 2018-01-10<br/>
2 | A | Stay | 2018-01-11<br/>
3 | A | out | 2018-01-12<br/>
4 | B | In | 2018-01-12<br/>
5 | B | Stay | 2018-01-13<br/>
6 | B | Out | 2018-01-14<br/>
7 | A | In | 2018-01-14<br/>
8 | A | Stay | 2018-01-15<br/>
9 | A | Stay | 2018-01-16<br/>
10 | A | Out | 2018-01-17<br/>
I expect the result for that customer, number of days in room A is 7 days and in room B is 3 days.
I already try to use min and max but the result is not valid because in the data that customer in the end is back to room A again | <sql><sql-server> | 2019-03-27 09:04:03 | LQ_EDIT |
55,375,528 | Why isn't std::set just called std::binary_tree? | <p>std::set in C++ is not a real set in terms of data structures. std::unordered_set is a real set, but std::set is a <strong>binary search tree</strong>, more specifically a red-black tree. Why, then, is it called std::set? Is there some specific functionality that sets a std::set apart from a binary tree? Thanks.</p>
| <c++><data-structures><set><binary-tree><binary-search-tree> | 2019-03-27 10:57:16 | LQ_CLOSE |
55,375,630 | How can I turn list of strings to list of lists? | <p>I am new in programming and in stackoverflow. Sorry is this seems too basic.
I am trying to turn this:</p>
<p>I am trying to train a AI for predicting destination a car based on historical data.
It is inside a column and I must iterate over all of them.
I a single list it is working, but in a column, it is not for some reason.</p>
<p>I am trying this on windows 10 in anaconda , jupyter notebook </p>
<p>I am trying to turn this:</p>
<pre><code>lst = ['55.7492,12.5405', '55.7492,12.5405', '55.7492,12.5406', '55.7492,12.5406']
</code></pre>
<p>into this </p>
<pre><code>lst = [[55.7492,12.5405], [55.7492,12.5405], [55.7492,12.5406], [55.7492,12.5406]]
</code></pre>
<p>I have a column with a lot of those in a csv file.</p>
<p>I tryed to turn them like this:</p>
<pre><code>
[[x] for x in lst]
[['55.7492,12.5405'],
['55.7492,12.5405'],
['55.7492,12.5406'],
['55.7492,12.5406']]
</code></pre>
<p>So its working find outside of the csv but when I try to do it for every box in the colomn:</p>
<pre><code>for stuff in data['column']:
[[x] for x in stuff]
for stuff in data_train['locations']:
[map(int,x.split()) for x in stuff]
</code></pre>
<p>Nothing changes in the column .</p>
| <python><pandas><list> | 2019-03-27 11:02:16 | LQ_CLOSE |
55,377,168 | I am trying a program that is a password generator and I'm having an error that shows: TypeError: can only concatenate list (not "str") to list | <p>I am creating a program that is a password generator and while executing it is showing following error: TypeError: can only concatenate list (not "str") to list
I'm new to python and need help regarding this.</p>
<pre><code>import random
import string
adjectives = ['fast', 'slow', 'fat', 'red', 'smelly', 'wet', 'green',
'orange', 'blue', 'white', 'brave', 'purple']
nouns = ['apple', 'dinosaur', 'ball', 'toaster', 'dragon', 'panda',
'team', 'hammer']
print 'Welcome to password picker'
adjective = random.choice(adjectives)
noun = random.choice(nouns)
number = random.randrange(0,100)
special_char = random.choice(string.punctuation)
password = adjectives + noun + str(number) + special_char
print 'Your New Password is : %s' % password
</code></pre>
<p>It should print randomly generated password like OrangeDinosaur32! etc</p>
| <python> | 2019-03-27 12:25:48 | LQ_CLOSE |
55,377,365 | What does "keyof typeof" mean in TypeScript? | <p>Example:</p>
<p>Explain to me what <code>keyof typeof</code> means in TypeScript</p>
<pre><code>enum ColorsEnum {
white = '#ffffff',
black = '#000000',
}
type Colors = keyof typeof ColorsEnum;
</code></pre>
<p>The last row is equivalent to:</p>
<pre><code>type Colors = "white" | "black"
</code></pre>
<p>But how does it work?</p>
<p>I would expect <code>typeof ColorsEnum</code> to return something like <code>"Object"</code> and then <code>keyof "Object"</code> to not do anything interesting. But I am obviously wrong.</p>
| <typescript> | 2019-03-27 12:36:37 | HQ |
55,378,639 | Strong password autofill appears in iOS simulator | <p>Our UI test suites are showing some unexpected behaviour where our Create Password screen intermittently auto-completes both the username and password - this results in the test being failed.</p>
<p>The process is something like:</p>
<ul>
<li>Tap in the first create password field</li>
<li>Enter a password</li>
<li>Tap in the confirm password field</li>
<li>Enter the same password</li>
</ul>
<p>This last step fails because the passwords in both fields have been auto-completed.</p>
<p><a href="https://i.stack.imgur.com/J8TQ8.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/J8TQ8.jpg" alt="enter image description here"></a></p>
<p>This happens for about one in every ten to twenty test executions. </p>
<p>Our understanding is that the password auto-fill should never be seen in any simulator, so it's very confusing to see this at all. Is there something that we can do to <em>extra</em> disable autofill, or otherwise prevent this from happening?</p>
| <ios><autofill><xcuitest><uitest> | 2019-03-27 13:39:24 | HQ |
55,379,909 | how to insert data in lookup wizard data type in ms access using pyodbc(python) | i have a mini project in which i have to use gui and database
i have chosen ms access
what is the query to insert data in lookup wizard datatype in ms access | <python><sql><ms-access><odbc><pyodbc> | 2019-03-27 14:39:03 | LQ_EDIT |
55,380,803 | python's chain assignment with no regard to order | <p>I started to learn python but find something annoying </p>
<pre><code>In [82]: a = b = 8
In [83]: id(b)
Out[83]: 94772909397088
In [84]: id(a)
Out[84]: 94772909397088
In [86]: id(8)
Out[86]: 94772909397088
</code></pre>
<p>The result is anti-intuitive</p>
<p>b pointing 8 and a pointing b, b hold 8's address, a hold b's address. but they return the same result.</p>
<p>What's more, If change b</p>
<pre><code>In [88]: b = 9
In [89]: a
Out[89]: 8
</code></pre>
<p>b changed to 9 but a does not change.</p>
<p>So it make no difference `a= b= c= 9' or 'c=b=a=9'</p>
<p>How could wrap brain on this intuitively?</p>
| <python> | 2019-03-27 15:22:28 | LQ_CLOSE |
55,381,659 | ionic 4 ios fails to build due to swift version 3 | <p>After upgrading to xcode 10.2 my ionic for ios project stopped building using below command</p>
<p>ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"</p>
<p>i tried to upgrade cordova-ios@5.0.0 and remove and readd ios platform but no luck.</p>
<pre><code>The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 4.0, 4.2, 5.0. This setting can be set in the build settings editor.
Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 12.2'
** ARCHIVE FAILED **
The following build commands failed:
Check dependencies
(1 failure)
xcodebuild: Command failed with exit code 65
[ERROR] An error occurred while running subprocess cordova.
cordova build ios --buildFlag=-UseModernBuildSystem=0 exited with exit code 65.
Re-running this command with the --verbose flag may provide more information.
</code></pre>
| <ios><ionic-framework><ionic4> | 2019-03-27 16:02:31 | HQ |
55,382,165 | How can i convert a dictionnary values to string in python | dict={(0, 0): 'S', (1, 1): 'T', (2, 2): 'A', (3, 3): 'C', (4, 4): 'K', (5, 5): 'O', (6, 6): 'V', (5, 7): 'E', (4, 8): 'R', (3, 9): 'F', (2, 10): 'L', (1, 11): 'O', (0, 12): 'W', (1, 13): 'T', (2, 14): 'E', (3, 15): 'S', (4, 16): 'T'}
if i want to convert the values of this dictionnary to an str
how can i do it ?
also if i want to show the string in special order like :
(0, 0), (0, 12),(1, 1),(1, 11) ....
Thank You
| <python><python-3.x> | 2019-03-27 16:29:27 | LQ_EDIT |
55,382,596 | How is WordPiece tokenization helpful to effectively deal with rare words problem in NLP? | <p>I have seen that NLP models such as <a href="https://github.com/google-research/bert" rel="noreferrer">BERT</a> utilize WordPiece for tokenization. In WordPiece, we split the tokens like <strong><code>playing</code></strong> to <strong><code>play</code></strong> and <strong><code>##ing</code></strong>. It is mentioned that it covers a wider spectrum of Out-Of-Vocabulary (OOV) words. Can someone please help me explain how WordPiece tokenization is actually done, and how it handles effectively helps to rare/OOV words? </p>
| <nlp><word-embedding> | 2019-03-27 16:52:34 | HQ |
55,382,954 | How can i stream audio from one device to another device over same wifi network? | I have music player and need to add sync play functionality with other mobile for example if 2 or more users are using my music player and want to play same song on all devices then they just connect through same network and can play music on all devices from one device with complete music player control of all devices on single device.
I am already having some research but not getting any useful information...
Reference app https://play.google.com/store/apps/details?id=com.kattwinkel.android.soundseeder.player
PLEASE HELP TO GET THIS AND TRY THE APP IF YOU NOT GETTING WHAT I WANT
Already try: https://stackoverflow.com/questions/14401340/live-stream-video-from-one-android-phone-to-another-over-wifi
and some other examples of StackOverflow | <android><audio><webrtc><android-mediaplayer><wifip2p> | 2019-03-27 17:11:07 | LQ_EDIT |
55,383,934 | How to multiple all digits of x number? | <p>I'm doing a counting program and i need to multiple all digits of x number by it self.</p>
<p>for example: number 123456789;</p>
<p>1*2*3*4*5*6*7*8*9=362,880</p>
| <c#> | 2019-03-27 18:10:33 | LQ_CLOSE |
55,384,425 | How can I create a maven plugin to test the source code of a project? | <p>We have a console program that checks all .java files in a project for some common mistakes. It Reads the source code as plain text. We'd like to transform it to a maven plugin that is run when pushed to gitlab in the CI pipeline </p>
| <java><maven><gitlab> | 2019-03-27 18:41:47 | LQ_CLOSE |
55,385,116 | How to create custom REST API endpoint correctly | <p>Suppose we have customers: /api/customers (/api/customers/{id})</p>
<p>With the following content:</p>
<pre><code>[{
name: "Mike",
age: 20,
amount: 300
},
{
name: "John",
age: 30,
amount: 600
}]
</code></pre>
<p>But there are different tasks when you have to perform various data manipulations.</p>
<p>Suppose we need to display the client who spent the most (in the "amount" field).</p>
<p>What the endpoint should look like for this request?</p>
<p>I have a few suggestions how to do this, please correct me:</p>
<pre><code>1. /api/customers/spent-more
2. /api/customers-spent-more
3. /api/customers?action=spent-more
</code></pre>
<p>How do you perform similar tasks, share experiences</p>
| <rest><api><endpoint> | 2019-03-27 19:29:37 | LQ_CLOSE |
55,386,108 | Is there a general function or way in Java to calculate an equation of the form (a+b+...+n)^2 with a,b,n >= 0? | <p>I need to find a way to implement an algorithm in Java that can calculate (a+b+...+n)^2 with a,b,n >= 0. The purpose is to use it afterwards in order to calculate Jain's Fairness index for my algorithm in networks. Is there any standard way to do that or any specific library for advanced math that i might have missed?</p>
| <java><math><equation> | 2019-03-27 20:42:32 | LQ_CLOSE |
55,386,164 | How to perform PyCUDA 3x3 matrix inversion with same accuracy than numpy linalg "inv" or "pinv" function | I am facing an issue of accuracy about my code which performs **a high number (128, 256, 512) of 3x3 matrix inversion**. When I use the original version, i.e the numpy classical function `np.linalg.inv` or `np.linakg.pinv`, everything works fine.
Unfortunately, with the CUDA code below, I get `nan` and `inf` values into inverted matrix.
For example, if I use classical numpy "`inv`", I get for the first iteration the inverted 3x3 matrix :
4.715266047722758306e-10 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00
0.000000000000000000e+00 2.811147187396482366e-28 -2.811147186834252285e-48 -5.622294374792964645e-38
0.000000000000000000e+00 -2.811147186834252285e-48 2.811147187396482366e-28 -5.622294374230735768e-48
0.000000000000000000e+00 -5.622294374792964645e-38 -5.622294374230735768e-48 5.622294374792964732e-28
To check the validity of this inverse matrix, I have multiplied it by original matrix and the result is the identity matrix.
But with CUDA GPU inversion, I get after this same iteration :
0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00
0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00
-inf -inf -9.373764907941219970e-01 -inf
inf nan -inf nan
So, I woul like to increase the precision into my CUDA kernel or python code to avoid these `nan`and `inf` values.
Here is the CUDA kernel code and calling part of my main code (I have commented the classical method with numpy `inv` function :
# Create arrayFullCross_vec array
arrayFullCross_vec = np.zeros((dimBlocks,dimBlocks,integ_prec,integ_prec))
# Create arrayFullCross_vec array
invCrossMatrix_gpu = np.zeros((dimBlocks*dimBlocks*integ_prec**2))
# Create arrayFullCross_vec array
invCrossMatrix = np.zeros((dimBlocks,dimBlocks,integ_prec,integ_prec))
# Build observables covariance matrix
#arrayFullCross_vec = buildObsCovarianceMatrix3_vec(k_ref, mu_ref, ir)
arrayFullCross_vec = buildObsCovarianceMatrix4_vec(k_ref, mu_ref, ir)
"""
# Compute integrand from covariance matrix
for r_p in range(integ_prec):
for s_p in range(integ_prec):
# original version (without GPU)
invCrossMatrix[:,:,r_p,s_p] = np.linalg.inv(arrayFullCross_vec[:,:,r_p,s_p])
"""
# GPU version
invCrossMatrix_gpu = gpuinv4x4(arrayFullCross_vec.flatten(),integ_prec**2)
invCrossMatrix = invCrossMatrix_gpu.reshape(dimBlocks,dimBlocks,integ_prec,integ_prec)
"""
and here the CUDA kernel code and `gpuinv4x4` function :
kernel = SourceModule("""
__device__ unsigned getoff(unsigned &off){
unsigned ret = off & 0x0F;
off = off >> 4;
return ret;
}
const int block_size = 256;
const unsigned tmsk = 0xFFFFFFFF;
// in-place is acceptable i.e. out == in)
// T = double or double only
typedef double T;
__global__ void inv4x4(const T * __restrict__ in, T * __restrict__ out, const size_t n, const unsigned * __restrict__ pat){
__shared__ T si[block_size];
size_t idx = threadIdx.x+blockDim.x*blockIdx.x;
if (idx < n*16){
si[threadIdx.x] = in[idx];
unsigned lane = threadIdx.x & 15;
unsigned sibase = threadIdx.x & 0x03F0;
__syncwarp();
unsigned off = pat[lane];
T a,b;
a = si[sibase + getoff(off)];
a *= si[sibase + getoff(off)];
a *= si[sibase + getoff(off)];
if (!getoff(off)) a = -a;
b = si[sibase + getoff(off)];
b *= si[sibase + getoff(off)];
b *= si[sibase + getoff(off)];
if (getoff(off)) a += b;
else a -=b;
off = pat[lane+16];
b = si[sibase + getoff(off)];
b *= si[sibase + getoff(off)];
b *= si[sibase + getoff(off)];
if (getoff(off)) a += b;
else a -=b;
b = si[sibase + getoff(off)];
b *= si[sibase + getoff(off)];
b *= si[sibase + getoff(off)];
if (getoff(off)) a += b;
else a -=b;
off = pat[lane+32];
b = si[sibase + getoff(off)];
b *= si[sibase + getoff(off)];
b *= si[sibase + getoff(off)];
if (getoff(off)) a += b;
else a -=b;
b = si[sibase + getoff(off)];
b *= si[sibase + getoff(off)];
b *= si[sibase + getoff(off)];
if (getoff(off)) a += b;
else a -=b;
T det = si[sibase + (lane>>2)]*a;
det += __shfl_down_sync(tmsk, det, 4, 16); // first add
det += __shfl_down_sync(tmsk, det, 8, 16); // second add
det = __shfl_sync(tmsk, det, 0, 16); // broadcast
out[idx] = a / det;
}
}
""")
# python function for inverting 4x4 matrices
# n should be an even number
def gpuinv4x4(inp, n):
# internal constants not to be modified
hpat = ( 0x0EB51FA5, 0x1EB10FA1, 0x0E711F61, 0x1A710B61, 0x1EB40FA4, 0x0EB01FA0, 0x1E700F60, 0x0A701B60, 0x0DB41F94, 0x1DB00F90, 0x0D701F50, 0x19700B50, 0x1DA40E94, 0x0DA01E90, 0x1D600E50, 0x09601A50, 0x1E790F69, 0x0E391F29, 0x1E350F25, 0x0A351B25, 0x0E781F68, 0x1E380F28, 0x0E341F24, 0x1A340B24, 0x1D780F58, 0x0D381F18, 0x1D340F14, 0x09341B14, 0x0D681E58, 0x1D280E18, 0x0D241E14, 0x19240A14, 0x0A7D1B6D, 0x1A3D0B2D, 0x063D172D, 0x16390729, 0x1A7C0B6C, 0x0A3C1B2C, 0x163C072C, 0x06381728, 0x097C1B5C, 0x193C0B1C, 0x053C171C, 0x15380718, 0x196C0A5C, 0x092C1A1C, 0x152C061C, 0x05281618)
# Convert parameters into numpy array
# float32
"""
inpd = np.array(inp, dtype=np.float32)
hpatd = np.array(hpat, dtype=np.uint32)
output = np.empty((n*16), dtype= np.float32)
"""
# float64
"""
inpd = np.array(inp, dtype=np.float64)
hpatd = np.array(hpat, dtype=np.uint32)
output = np.empty((n*16), dtype= np.float64)
"""
# float128
inpd = np.array(inp, dtype=np.float128)
hpatd = np.array(hpat, dtype=np.uint32)
output = np.empty((n*16), dtype= np.float128)
# Get kernel function
matinv4x4 = kernel.get_function("inv4x4")
# Define block, grid and compute
blockDim = (256,1,1) # do not change
gridDim = ((n/16)+1,1,1)
# Kernel function
matinv4x4 (
cuda.In(inpd), cuda.Out(output), np.uint64(n), cuda.In(hpatd),
block=blockDim, grid=gridDim)
return output
As you can see, I tried to increase accuracy of inverting operation by replacing `np.float32` by `np.float64` or `np.float128` but problem remains.
I have also replaced `typedef float T;` by `typedef double T;`but without success.
Anyone could help me to perform the right inversion of these matrices and mostly avoid the 'nan' and 'inf' values ? I think this is a real issue of precision but I can't find how to circumvent this problem.
Regards | <python><matrix><cuda><matrix-inverse><pycuda> | 2019-03-27 20:46:11 | LQ_EDIT |
55,386,244 | Count words with the letter 'w' in them but only the(almost done) | <p>So the goal is to count the number of words in the sentence with the letter 'w', and I have written the code to count the number of w's but I can't get it to count the words in total. </p>
<pre><code>items = ["whirring", "wow!", "calendar", "wry", "glass", "", "llama","tumultuous","owing"]
items = str(items)
acc_num = 0
for i in items:
if i in ['w']:
acc_num += 1
print(items)
</code></pre>
| <python> | 2019-03-27 20:51:14 | LQ_CLOSE |
55,386,489 | Gradle: Error: Program type already present: androidx.activity.R$attr | <p>When adding</p>
<pre><code> implementation
('com.google.android.ads.consent:consent-library:1.0.0') {
exclude module: 'androidx.activity'
}
</code></pre>
<p>to my app/build.gradle file i get this error:
Error: Program type already present: androidx.activity.R$attr</p>
<p>What i did do:
1. gradlew androidDependencies
But i cannot find any duplicates</p>
<ol start="2">
<li><p>Read: <a href="https://developer.android.com/studio/build/dependencies#duplicate_classes" rel="noreferrer">https://developer.android.com/studio/build/dependencies#duplicate_classes</a>.</p></li>
<li><p>Other stackoverflow answers suggesting excluding support library versions dont help me</p></li>
</ol>
<pre><code>repositories {
maven { url 'https://maven.fabric.io/public' }
}
configurations {
all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}
configurations.all {exclude group: 'com.android.support', module: 'support-v13'}
dependencies {
def nav_version = "1.0.0"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
implementation 'androidx.core:core-ktx:1.1.0-alpha05'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha02'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test:rules:1.1.1'
androidTestImplementation 'androidx.test:core-ktx:1.1.0'
implementation "com.vorlonsoft:androidrate:1.2.1"
implementation 'com.github.THEAccess:SuspendRx:1.0.10'
implementation 'com.github.THEAccess:privacydialog:0.1.0'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'com.yqritc:android-scalablevideoview:1.0.4'
implementation 'com.timqi.sectorprogressview:library:2.0.1'
implementation 'com.github.Angtrim:Android-Five-Stars-Library:v3.1'
implementation 'com.stepstone.apprating:app-rating:2.3.0'
implementation 'com.google.firebase:firebase-dynamic-links:16.1.8'
implementation 'com.google.firebase:firebase-ads:16.0.1'
api ('com.google.android.ads.consent:consent-library:1.0.0') {
exclude module: 'androidx.activity'
}
//Navigation
implementation "android.arch.navigation:navigation-fragment-ktx:$nav_version"
implementation "android.arch.navigation:navigation-ui-ktx:$nav_version"
implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0'
//Kodein
def kodein_version = "6.0.1"
implementation "org.kodein.di:kodein-di-generic-jvm:$kodein_version"
implementation "org.kodein.di:kodein-di-framework-android-x:$kodein_version"
implementation "org.kodein.di:kodein-di-conf-jvm:$kodein_version"
//Firebase
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-config:16.4.0'
implementation 'com.google.firebase:firebase-perf:16.2.4'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.google.firebase:firebase-inappmessaging-display:17.1.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') {
transitive = true;
}
implementation 'androidx.cardview:cardview:1.0.0'
}
</code></pre>
<p>Please help me understanding where the dependencies have duplicates</p>
| <android><gradle> | 2019-03-27 21:09:34 | HQ |
55,386,659 | Query string closures in php | <p>I'm attempting to setup a query through php to a MySQL database. Within the query string I have placed functions and thus have used the dot (.) operator with string closures as seen below. The issue is that my query is not going through and try as i might I can't seem to make out the error. Thanks for any help in advance. :) </p>
<pre><code>$query = "INSERT INTO `foo` (`ip`, `time`, `date`, `reason`) VALUES ('".strval(getUserIpAddr())."', '".$time."', '".$date."', '".$reason."')";
</code></pre>
| <php><mysqli> | 2019-03-27 21:22:56 | LQ_CLOSE |
55,386,996 | Error in Code Why does using float instead of int give me different results when all of my inputs are integers? | void main( )
{ int no=123;
while(no)
{ no/=10;
printf(“%d”, no%10);
}
}
1) 2 2) 210 3) 21 4) 213 | <c> | 2019-03-27 21:49:17 | LQ_EDIT |
55,387,065 | In the expression left() = right(), why is right() sequenced first? | <p>In C++, the expression <code>left() = right()</code> evaluates</p>
<ol>
<li><code>right()</code></li>
<li><code>left()</code></li>
</ol>
<p>in that sequence. The <code>right()</code> goes first, as has been discussed <a href="https://stackoverflow.com/q/52762511/1275653">here.</a></p>
<p>I cannot think of a reason for <code>right()</code> to go first. Can you? I presume that there exists a reason. Otherwise, the standard would hardly say what it says, but consider: <code>right()</code> will return some result. At the machine-code level, does the CPU not need to know where to put the result <code>right()</code> will return before asking <code>right()</code> to return it?</p>
<p>If you happen to know what the standard committee was thinking (because you were in the room or have read the memo), that's great: I'd like to read your answer. However, my actual question is more modest. All I want to know is whether there exists a plausible reason and what that reason might be.</p>
| <c++><c++17><assignment-operator> | 2019-03-27 21:54:05 | HQ |
55,387,755 | NameError: name 'c' is not defined | can anyone tell me, why c is not defined?
I expect an output in the end for c.
[enter image description here][1]
[1]: https://i.stack.imgur.com/bOTQh.png | <python><jupyter-notebook> | 2019-03-27 23:00:13 | LQ_EDIT |
55,387,838 | Enhanced For Loop not changing all elements of my array | <p>I am currently working on a program that will roll 5 dice and store a random number for each dice in an array.
My problem is my method is only changing the first element and leaving the rest of the elements as 0's. (Only rolling the first dice so to say)</p>
<p>I initialized an array with 5 values, then run this method which takes an array as a parameter, checks if an element is 0, if it is it assigns a random value between 1 and 6.</p>
<p>I've tried doing an enhanced for loop that looks at each element in the array, and theoretically if it is zero, it assigns a random integer between 1 to 6 to it.</p>
<pre><code>public static void rollDice(int[] dice) {
for (int element: dice) {
int roll = (int)(Math.random()*6) + 1;
if (element == 0) {
dice[element] = roll;
}
}
</code></pre>
<p>My results are currently: [Random Number, 0, 0, 0, 0]
My expected results are: [5 random integers]</p>
| <java><arrays><for-loop><poker> | 2019-03-27 23:08:00 | LQ_CLOSE |
55,388,455 | Get href attribute in pupeteer Node.js | <p>I know the common methods such as <code>evaluate</code> for capturing the elements in <code>puppeteer</code>, but I am curious why I cannot get the <code>href</code> attribute in a JavaScript-like approach as</p>
<pre><code>const page = await browser.newPage();
await page.goto('https://www.example.com');
let links = await page.$$('a');
for (let i = 0; i < links.length; i++) {
console.log(links[i].getAttribute('href'));
console.log(links[i].href);
}
</code></pre>
| <node.js><puppeteer> | 2019-03-28 00:28:39 | HQ |
55,388,481 | IF checkbox is checked ONLOAD, display textbox, IF NOT, do not show textbox | <p>Is there a way in javascript that i can already show a textbox if checkbox is checked Onload? then hide the textbox if it is not checked onload?</p>
| <javascript><html><css><typescript> | 2019-03-28 00:32:38 | LQ_CLOSE |
55,389,007 | Draws a Xmas tree on the screen of using size | I've been trying draw a Xmas tree by using size which is input from user and I also have been trying to find out the logic such as spaces would it take. Any hint for me would be fantastic. Also, this lab requires only one "for" loop and have to call the method write-pattern which I provide below. Thank you so much.
Sorry if the code was too long. It's just to make sure that you guys can understand it.
for (int i=0; i <=size; i++) {
writePattern (' ','*',' ', ' ',' ',size -i,i,0,0,0,size+2);
writePattern (' ','*','*',' ',' ',size -i,i,i,0,0,size+2);
}
This is the wrirePattern that I mentioned above.
private void writePattern(char ch1, char ch2, char ch3, char ch4, char ch5, int n1, int n2, int n3, int n4, int n5, int length)
{
while ((n1 > 0) && (length > 0)) {
System.out.print(ch1);
n1--;
length--;
}
while ((n2 > 0) && (length > 0)) {
System.out.print(ch2);
n2--;
length--;
}
while ((n3 > 0) && (length > 0)) {
System.out.print(ch3);
n3--;
length--;
}
while ((n4 > 0) && (length > 0)) {
System.out.print(ch4);
n4--;
length--;
}
while ((n5 > 0) && (length > 0)) {
System.out.print(ch5);
n5--;
length--;
}
System.out.println();
}
This is from another class which uses to give the output:
`drawer.drawXmasTree();
System.out.println("\n");`;
| <java> | 2019-03-28 01:48:09 | LQ_EDIT |
55,389,211 | String based data encoding: Base64 vs Base64url | <p>What is the difference between Base64 and Base64url that I see in things like JSON web tokens?</p>
| <url><base64><base64url> | 2019-03-28 02:14:57 | HQ |
55,389,458 | Change Checkout Form text "Billing Details" for specific product | How can I change the text "Billing Details" in the checkout page only for a specific product? | <php><wordpress><woocommerce><checkout><gettext> | 2019-03-28 02:48:36 | LQ_EDIT |
55,389,765 | why should case statement be within select statement? | why should CASE statement be within SELECT statement?
### Why does not the second code work? I mean, why should CASE statement be within SELECT statement?
### First
SELECT report_code,
year,
month,
day,
wind_speed,
CASE
WHEN wind_speed >= 40 THEN 'HIGH'
WHEN wind_speed >= 30 AND wind_speed < 40 THEN 'MODERATE'
ELSE 'LOW'
END AS wind_severity
FROM station_data;
### Second
SELECT report_code,
year,
month,
day,
wind_speed,
ROM station_data
CASE
WHEN wind_speed >= 40 THEN 'HIGH'
WHEN wind_speed >= 30 AND wind_speed < 40 THEN 'MODERATE'
ELSE 'LOW'
END AS wind_severity; | <sql> | 2019-03-28 03:32:47 | LQ_EDIT |
55,389,940 | Method can only be called again if 5 seconds is passed | <p>I have an aplication running and i kinda want to create a timeout, my method is called too many times in a small amount of time. i want to determine that the method can only be called again if 5 seconds is passed. How do i do that ?</p>
| <java> | 2019-03-28 03:58:36 | LQ_CLOSE |
55,390,393 | not allow special characters into input box | Am new on Angular.
Need to restrict special characters into input box with angularjs
HTML code:
input type="text" class="form-control" id="cntry" ng-model="address.countryCode"
Allow only apphabets or digits | <html><angularjs><typescript> | 2019-03-28 04:51:58 | LQ_EDIT |
55,391,413 | How to auto jump from div to div using javascript? | <p>I am developing a website for my university. My advisor requires features that will focus on selected divs on page load. That means when the full page will be loaded, there will be a pop up which will ask for a tour guide permission. If the permission is given, it will jump from one div to another till the end of the page. Can anyone help with any procedures? </p>
| <javascript><html><css> | 2019-03-28 06:30:24 | LQ_CLOSE |
55,391,415 | End of Public Updates for Oracle JDK 8, what is the meaning of that? | <p>According to <a href="https://www.oracle.com/technetwork/java/javase/overview/index.html" rel="nofollow noreferrer">this link</a>, Can we say that starting in January 2019, Java is no longer open source?</p>
| <java> | 2019-03-28 06:30:54 | LQ_CLOSE |
55,392,307 | i want to compute specific field in my db depends on ID_number | This is my model
```
public function total_late()
{
$query = "SELECT sum(late_deduction) as late_deduction FROM tbl_dtr";
$result = $this->db->query($query);
return $result->row()->late_deduction;
}
```
this the image of db
[enter image description here][1]
this is the image of my table
[enter image description here][2]
[1]: https://i.stack.imgur.com/ViMUi.png
[2]: https://i.stack.imgur.com/6zH1M.png
please help asap
thank you in advance | <php><codeigniter> | 2019-03-28 07:36:31 | LQ_EDIT |
55,392,435 | Linear gradient for background image -JS | i am getting error
var sectionStyle = {
paddingTop:"2%",
width: "100%",
height: "100%",
backgroundImage: "url(" + Background + ") , linearGradient(#eb01a5, #d13531)"
} | <javascript><css><background-image> | 2019-03-28 07:45:30 | LQ_EDIT |
55,392,925 | I want create this Sliding UIVies in xocde using swift, what sholud i used ? an collecntionView or TableView ? how to use it? | i want to create an exact screen in my ios application im not able to create it , what shall i used? an collectionView? or ScroolView?
import UIKit
class ViewController: UIViewController,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout{
@IBOutlet weak var newCollectionView: UICollectionView!
override func viewDidLoad() {
super.viewDidLoad()
newCollectionView.delegate = self
newCollectionView.dataSource = self
// Do any additional setup after loading the view, typically from a nib.
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 4
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
{
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath)
return cell
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: view.frame.width, height: view.frame.height)
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 0
}
}[enter image description here][1]
[1]: https://i.stack.imgur.com/mHhxv.gif | <ios><swift><xcode><tableview><collectionview> | 2019-03-28 08:18:37 | LQ_EDIT |
55,393,074 | how to split ruby code like c or c++ code | I'd like to split the long ruby code into another ruby source files, in c source file , I can put the code like this:
```
a.c
if (xxx)
#include "my_file.c"
my_file.c
printf("yes we are in xxx conditions");
```
now in ruby code I can't do that like:
```
a.rb
case condition
when "a"
puts "a"
load (or include "b.rb")
end
b.rb
when "b"
puts "we are in b.rb"
```
so how to solve the ruby code just like in c source file. thanks | <ruby> | 2019-03-28 08:29:55 | LQ_EDIT |
55,393,525 | date in format of 20190328 rather than 2019-03-28 in python | The files I need to move,have a pattern of date as 20190328.My datetime module gives me the date as 2019-03-28.how can I get the date in form 20190328? | <python><python-datetime> | 2019-03-28 08:56:25 | LQ_EDIT |
55,393,662 | Is it possible to covert an entire application developed using php,javascript,html to angular 7? | <p>I have developed an application using javascript,php,html with a lot of ajax calls . I was planning to convert this entire application to angular 7. Is it possible to do this without re-doing the entire application from scratch in angular ?
If this is possible,could you please tell me how to get started with this?
Thank you</p>
| <javascript><php><html><angular> | 2019-03-28 09:04:05 | LQ_CLOSE |
55,393,833 | make image clickable and on click open corresponding text file in new window | <p>when date is clicked on Image it should open new tab and load that date txt file in new tab
for example when 28/03/2019 is clicked in new tab 28/03/2019.txt should open<code>image dates should be clickable and on click specific text file should get open</code>`</p>
| <php><jquery><html><css><ajax> | 2019-03-28 09:12:17 | LQ_CLOSE |
55,393,895 | How to mysql database connection with react js | <p>I'm beginner for React JS. Therefore, I want to learning how can used together React JS, Node JS and MySQL. So, Please give me some advises and example. I try do solve this problem. please help me guys.</p>
| <mysql><node.js><reactjs> | 2019-03-28 09:15:26 | LQ_CLOSE |
55,395,152 | Which design pattern is suitable illustrated problem below? | <p>I am developing a project in spring boot. There are common <strong>required steps</strong> will be used by all classes in development phase. For example to make connectivity through jdbc from java program to database the <strong>first step</strong> is load the jdbc driver, <strong>second step</strong> is create connection object and so on.
The problem is design pattern of my project should restrict the new developer of my project to write new classes in such a way that <strong>no requires steps would skip</strong> in such condition which design pattern should i use??</p>
| <java><design-patterns><spring-boot-actuator> | 2019-03-28 10:20:33 | LQ_CLOSE |
55,395,302 | Different design for mobile and desktop | <p>I have two different design for mobile and desktop. When I tried to restore the chrome then the mobile version looks good but when I check on the phone it didn't show me at all. The desktop version is all clear. </p>
<p>I have tried display function none and block in css. </p>
<p>HTML</p>
<pre><code><body>
<div class="row" >
<div class="column">
<img src="logo.png" style="position: absolute; padding-top: 15%;">
</div>
<div class="column1">
<img src="new.png" style="position: fixed;z-index: -1">
<div class="links">
<h1><a href="http://okdateme.com" target="_blank">FIND A PARTNER</a></h1>
<h1><a href="https://stayaunty.com" target="_blank">BOOK A ROOM</a></h1>
<h1><a href="https://www.thatspersonal.com/" target="_blank">EXPLORE YOUR FANTASIES</a></h1>
</div>
</div>
</div>
<div class="mobile">
<img src="logo.png" style="width: 100%;">
<div>
<img src="new.png" style="width: 100%; position: absolute; z-index: -1; margin-top: -25px;">
<h2><a href="http://okdateme.com">FIND A PARTNER</a></h2>
<h2><a href="https://stayaunty.com">BOOK A ROOM</a></h2>
<h2><a href="https://www.thatspersonal.com/">EXPLORE YOUR FANTASIES</a></h2>
</div>
</div>
</code></pre>
<p>CSS</p>
<pre><code>body
{
width: 100%;
height: 100%;
margin: 0;
background-color: #000;
}
.row:after{
clear:both;
background-color: #000;
}
.column {
width: 33.33%;
float: left;
}
.column1 {
width: 66.66%;
float: right;
position: relative;
}
.links{
font-family: Comic Sans MS;
margin-top: 30%;
}
a{
text-decoration: none;
color: #cc3366;
z-index: 9999;
position: relative;
background-color: #000;
}
@media(min-width: 768px){
.mobile{
display: none;
}
}
@media(max-width: 767px) {
.row:after, .column, .row{
display: none;
}
}
@media (max-width: 767px) {
div.row, .column, .column1{
display: none;
}
.mobile{
display: all;
}
a{
color: #fff;
background-color: #999900;
font-family: Comic Sans MS;
}
}
</code></pre>
<p>My desktop version is looking good but the desktop version is also coming to mobile. But I have tried a different mobile design and hide the desktop on the mobile.</p>
| <html><css><responsive> | 2019-03-28 10:27:19 | LQ_CLOSE |
55,397,432 | How to preload a CSS @font-face font that is bundled by webpack4+babel? | <p>I have a webpack4+babel bundler setup for a react web app. In a LESS file, I reference a local font. This font gets copied over to the <code>dist</code> folder on build and its filename is hashed. I want to be able to preload this font.</p>
<p>Here is my LESS file:</p>
<pre><code>@font-face {
font-family: 'Test';
src: url('../fonts/test.ttf') format('truetype');
font-weight: 400;
}
</code></pre>
<p>I have tried the following approaches but so far with no success:</p>
<ol>
<li>Add custom import to my app's main JS file.</li>
</ol>
<pre><code>import(/* webpackPreload: true */ "../fonts/test.ttf");
</code></pre>
<p>Here is my <code>.babelrc</code> file:</p>
<pre><code>{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-syntax-dynamic-import"
]
}
</code></pre>
<p>Running <code>webpack</code> does not produce preload directions anywhere as far as I can see in the outputted html - I have searched through the <code>dist</code> folder contents and found nothing.</p>
<ol start="2">
<li>preload-webpack-plugin</li>
</ol>
<p>I add this to my <code>webpack.config.js</code> file:</p>
<pre><code>plugins: [
new HtmlWebpackPlugin(),
new PreloadWebpackPlugin({
rel: 'preload',
as(entry) {
if (/\.css$/.test(entry)) return 'style';
if (/\.woff$/.test(entry)) return 'font';
if (/\.png$/.test(entry)) return 'image';
return 'script';
}
})
]
</code></pre>
<p>This creates preloads for the JS script file bundles but not for the CSS and fonts.</p>
<p>Any ideas on how to get this to work?</p>
| <reactjs><babeljs><webpack-4><preload> | 2019-03-28 12:17:10 | HQ |
55,397,627 | Run Laravel project on local setup | <p>I have a project which was completed earlier by previous developer team using laravel framework and it is hosted on live. </p>
<p>I have downloaded the source code using FTP 'Filezilla' from the live server and have the full project folder or the hard drive.</p>
<p>Now In order to make changes and understand I want to set it locally.</p>
<p>I want to set it up in local environment where I use WAMP server.</p>
<p>Please suggest me how can I proceed and in which All files I have to make changes.</p>
<p>So please tell me how can I install the same . It will be helpful if step-by step instruction can be provided.</p>
<p>I am new to laravel and wanting to learn the framework. Please help</p>
<p>Thanks in Advance.</p>
| <laravel><laravel-5.3> | 2019-03-28 12:27:21 | LQ_CLOSE |
55,398,027 | Is it possible to print on both sides, like printing ID card or driving license, in c#? This is not a simple double sided printing | I have two images front.jpg and back.jpg. I want to print them front and back on a same page to make one 'card'. I came across 'duplex' property but not sure how it can help me in this regard.
I tried using Duplex | <c#><webforms> | 2019-03-28 12:46:42 | LQ_EDIT |
55,398,280 | Split String into Array of subarrays | <p>This question is related to my <a href="https://stackoverflow.com/questions/55396179/split-string-into-array-of-arrays">Previous question</a></p>
<p>I am writing an iOS App in Swift 4.2</p>
<p>Response from server is a string with values separated by pipe character "". It contains many rows of values separated by "$". I want to split it into array of subarrays.</p>
<p>Rows are separated by "<strong>$</strong>" and elements are separated by "<strong>|</strong>"</p>
<p>Response:</p>
<p>Example: <strong>"001|apple|red$002|banana|yellow$003|grapes|purple$"</strong></p>
<p><strong>Expected Output:</strong></p>
<p>[[001, "apple", "red"], [002, "banana", "yellow"], [003, "grapes", "purple"]]</p>
| <ios><swift> | 2019-03-28 12:59:09 | LQ_CLOSE |
55,399,209 | Update flutter dependencies in /.pub-cache | <p>I erased in my folder <code>.pub-cache/hosted/pub.dartlang.org/this_plugin</code></p>
<p><strong>What is the command to update the dependencies inside <code>pubsec.yaml</code>?</strong> I believe it is</p>
<blockquote>
<p>flutter packages get</p>
</blockquote>
<p>The folder under <code>.pub-cache</code> is still not up to date.</p>
<p>Note: there was a <code>pubspec.lock</code> that I deleted</p>
| <flutter><flutter-dependencies><flutter-plugin> | 2019-03-28 13:46:37 | HQ |
55,400,995 | android studio firebase search find my value in under verious childs | hi gys i am trying to retrive my data in firebase but problem is my value is under the 3 childs normally iam able to to search value under the 1 child but can't search under the 2nd and 3rd one
here is example plz help thank you
i am try this one but not get result
`enter code here` FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference mUserDatabase = database.getReference();
enter code here//and query
Query
firebaseSearchQuery=mUserDatabase.orderByChild("Time").startAt(searchText).endAt(searchText + "\uf8ff");
| <java><android><firebase><firebase-realtime-database> | 2019-03-28 15:10:09 | LQ_EDIT |
55,401,987 | Javascript - Merge multiple different array values of same length with a delimeter in a final single array? | I have 3 different array with same length
var title = ['title 1','title 2','title 3'];
var description = ['description 1','description 2','description 3'];
var link = ['link 1','link 2','link 3'];
How can i get or merge all array values in single array with PIPE delimeter "**|**" ?
Result:
final_arr = ['title 1|description 1|link 1','title 2|description 2|link 2','title 3|description 3|link '] | <javascript><jquery><arrays> | 2019-03-28 15:57:07 | LQ_EDIT |
55,402,375 | Select more values on clause IF in the Stored Procedure | I have a problem of sintaxe in my Stored Procedure when a select more values in my IF, on code snippet 37 OR 35.
IF 37 OR 35 NOT IN (SELECT CodPerfilSistema FROM [BRSAODB09].[ADMIN].[dbo].[PERFIL_USUARIO] where CodUsuario = @pCodUsuario)
BEGIN
SET @CondicaoEmpresa = ' AND [Lote].CodEmpresa = ' + CONVERT(varchar(10), @pCodEmpresa);
SET @CondicaoProjeto = ' AND [AUD_Projeto].CodProjeto = ' + CONVERT(varchar(10), @pCodProjeto);
END
Im tried the code above.
And below is how the code is running
IF 37 NOT IN (SELECT CodPerfilSistema FROM [BRSAODB09].[ADMIN].[dbo].[PERFIL_USUARIO] where CodUsuario = @pCodUsuario)
BEGIN
SET @CondicaoEmpresa = ' AND [Lote].CodEmpresa = ' + CONVERT(varchar(10), @pCodEmpresa);
SET @CondicaoProjeto = ' AND [AUD_Projeto].CodProjeto = ' + CONVERT(varchar(10), @pCodProjeto);
END
I need the permission for Id 37 and 35.
Thanks. | <sql><sql-server><tsql><stored-procedures> | 2019-03-28 16:16:20 | LQ_EDIT |
55,402,751 | Angular app has to clear cache after new deployment | <p>We have an Angular 6 application. It’s served on Nginx. And SSL is on.</p>
<p>When we deploy new codes, most of new features work fine but not for some changes. For example, if the front-end developers update the service connection and deploy it, users have to open incognito window or clear cache to see the new feature.</p>
<p>What type of changes are not updated automatically? Why are they different from others?</p>
<p>What’s the common solution to avoid the issue?</p>
| <javascript><angular><nginx><deployment> | 2019-03-28 16:37:07 | HQ |
55,404,233 | Powershell, compare data table object to date time variable | I am trying to compare the current date/time to a date time located in the first row of a data table filled from an sql query.
$datatable | out-host
Shows this...
LastRunDate
————————-
3/28/2019 1:22:01 PM
I need to compare that one cell to the current date and time to see when the last time the data source was updated. I just can’t fogure out how to extract that cell and convert it to a date time variable . Any suggestions? Thanks!
Jon
| <powershell> | 2019-03-28 18:07:02 | LQ_EDIT |
55,405,918 | Optimal design for database scenario | <p>I am building a system that keeps track of the visits of members to some clubs.</p>
<p>As I see it, I have 2 options to keep track of the visits, just insert one row into the visits table for each visit and when I need the total, I can just select count, when I need to display i can just do a simple select.</p>
<p>The problem, this is going to grow fast and I am sure I will have eventually like millions of rows just in this table.</p>
<p>Can mysql handle this with ease? Or better implement the second option, one row for each member, and store in one of the row cells the total amount of visits and in another cell the last 60 visits (not really more needed).</p>
<p>I guess the answer as to what's better is obvious but I am curious about how much mysql can handle because the previous system implemented 1 row for each visit.</p>
| <mysql><database-design> | 2019-03-28 19:56:57 | LQ_CLOSE |
55,406,699 | Windows Ethernet showing "Network cable unplugged" when connected to Linux machine | <p>I currently have a Windows 10 machine connected to a Red Hat Enterprise Linux Workstation 6.10 machine by Cat 5 Ethernet cable. </p>
<p>I plug an Ethernet cable from <code>eth2</code> port on the Linux machine to <code>Ethernet</code> on Windows machine.</p>
<p>I run <code>ifconfig eth2 down</code> on the Linux machine to take down the network connection. The Network Connections window on the Windows Machine show that <code>Ethernet</code> is connected to an Unidentified network. I cannot ping the static ip address for <code>eth2</code> however. </p>
<p>If I run <code>ifconfig eth2 up</code> on the Linux machine to bring up the network connection Windows shows <code>Ethernet</code> as "Network cable unplugged'. When running <code>ifconfig</code> on the Linux machine the following shows:</p>
<pre><code>eth2 Link encap:Ethernet HWaddr __:__:__:__:__:__
inet addr: 192.168.1.11 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 frame:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:17
</code></pre>
<p>If I ping <code>192.168.1.11</code> on the Windows machine I get the message <code>Destination Host Unreachable</code>. </p>
<p>What might be causing this?</p>
| <linux><windows><redhat><ethernet><ifconfig> | 2019-03-28 20:54:12 | LQ_CLOSE |
55,407,256 | Getting an error on decoding JSON Expected to decode Array<Any> but found a dictionary instead | Getting an error on decoding JSON in swift 4.2, if you like to help me out.
Expected to decode Array<Any> but found a dictionary instead. Tried Various search and code change but useless.
Failed to decode. TypeMismatch <br>
Many Thanks!!!
Model:
public struct NewsSource: Equatable, Decodable {
public let id: String?
public let name: String?
public let sourceDescription: String?
public let url: URL?
enum CodingKeys: String, CodingKey {
case id
case name
case sourceDescription = "description"
case url
}
public init(id: String,
name: String,
sourceDescription: String,
url: URL,
category: NewsCategory,
language: NewsLanguage,
country: NewsCountry) {
self.id = id
self.name = name
self.sourceDescription = sourceDescription
self.url = url
} }
Function:
func fetchJSON() {
let urlString = "https://newsapi.org/v2/sources?apiKey=176a4fe177c4461ba3b8fbd1774dbdea"
guard let url = URL(string: urlString) else { return }
URLSession.shared.dataTask(with: url) { (data, _, err) in
DispatchQueue.main.async {
if let err = err {
print("Failed to get data from url:", err)
return
}
guard let data = data else { return }
print(data)
do {
// link in description for video on JSONDecoder
let decoder = JSONDecoder()
// Swift 4.1
decoder.keyDecodingStrategy = .convertFromSnakeCase
self.Sources = try decoder.decode([NewsSource].self, from: data)
self.tableView.reloadData()
} catch let jsonErr {
print("Failed to decode:", jsonErr)
}
}
}.resume()
}
| <ios><json><swift><swift4.2><jsondecoder> | 2019-03-28 21:40:42 | LQ_EDIT |
55,408,199 | How to write a program that check validity of the password | <p>''' How to write a Python program to check the validity of password input by users.
Allow a user 3 attempts, on the 4th one exit the program(Google is your friend :)).</p>
<pre><code>Validation :
•At least 1 letter between [a-z] and ta least one letter between [A-Z].
•At least 1 number between [0-9].
•At least 1 character from [$#@].
•Minimum length 6 characters.
•Maximum length 16 characters.
</code></pre>
<p>'''</p>
| <python> | 2019-03-28 23:09:47 | LQ_CLOSE |
55,409,304 | File.exists giving a null reference exception instead of returning false. c# | <pre><code>if(File.Exists(Application.persistentDataPath + "/users/" + Input.GetComponent<Text>().text + ".dat"))
</code></pre>
<p>This line always causes a null reference exception instead of returning false when it cannot find the file.</p>
| <c#><nullreferenceexception><system.io.file> | 2019-03-29 01:35:13 | LQ_CLOSE |
55,409,574 | Converting to manipulatable datetime format | <p>I have a date value <code>20130312</code> and I would like to convert it into a format like <code>2013-03-12</code> or a similar format</p>
<p>I've tried looking into the <code>datetime</code> library but could not find a solution.</p>
<p>Thanks in advance</p>
| <python><python-3.x> | 2019-03-29 02:13:38 | LQ_CLOSE |
55,409,966 | Hi,Do you encounter some problems about linux version and jdk version is not compatible | the same code ,when I use maven to package codes on the linux Linux 6.0.10,the final jar can not run successful,but I do this on Linux 8 ,it works well
The jdk version is 1.8
Exception as following:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.event.internalEventListenerProcessor': Instantiation of bean failed; nested exception is java.lang.IllegalStateException: No bean class specified on bean definition
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1287) ~[spring-beans-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1181) ~[spring-beans-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204) ~[spring-beans-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:179) ~[spring-context-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705) ~[spring-context-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) ~[spring-context-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.3.RELEASE.jar!/:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.3.RELEASE.jar!/:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.3.RELEASE.jar!/:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.3.RELEASE.jar!/:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.3.RELEASE.jar!/:2.1.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.3.RELEASE.jar!/:2.1.3.RELEASE]
at cn.j.lithium.LithiumApplication.main(LithiumApplication.java:16) [classes!/:0.0.1-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [lithium-0.0.1-test.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [lithium-0.0.1-test.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [lithium-0.0.1-test.jar:0.0.1-SNAPSHOT]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [lithium-0.0.1-test.jar:0.0.1-SNAPSHOT]
Caused by: java.lang.IllegalStateException: No bean class specified on bean definition
at org.springframework.beans.factory.support.AbstractBeanDefinition.getBeanClass(AbstractBeanDefinition.java:407) ~[spring-beans-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:68) ~[spring-beans-5.1.5.RELEASE.jar!/:5.1.5.RELEASE | <java><spring-boot> | 2019-03-29 03:11:55 | LQ_EDIT |
55,410,834 | How to animate list changes in Flutter | <p>If I have a list (of ListTiles for example) that can be added to, removed from, and swapped, what would be the best way to animate these changes? I am using a <a href="https://pub.dartlang.org/packages/flutter_reorderable_list" rel="noreferrer">reorderable list</a> if that makes a difference. Right now my list has no animations, I just call setState when data is changed.</p>
| <dart><flutter> | 2019-03-29 05:08:36 | HQ |
55,413,215 | VS Code quick fix always give "no code actions available" | <p>VS Code with Go, the quick fix always give "no code actions available".
No matter what's the error or warning, no fix is given.</p>
<p><a href="https://i.stack.imgur.com/UXNZQ.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/UXNZQ.gif" alt="enter image description here"></a></p>
<p>Is this my config/environment problem or is it a vscode bug/expected?
Any help will be highly appreciated!</p>
| <visual-studio-code> | 2019-03-29 08:26:08 | HQ |
55,414,344 | Chrome Network Request does not show Cookies tab, some request headers, Copy as cURL is broken | <p>Since I upgraded to Chrome 72 the "Cookies" tab in Developer Tools -> Network -> A network request no longer shows the "Cookies" tab, and the request headers no longer include Cookies.</p>
<p>Furthermore, right clicking on a network request and selecting Copy -> Copy as cURL gives a <code>curl</code> command without the proper request headers / cookies.</p>
<p>See screenshots comparing Chrome with Cookies tab / request headers, and Chrome without them.</p>
<h1>It looks like this:</h1>
<p><a href="https://i.stack.imgur.com/WJuMD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/WJuMD.png" alt="Chrome without cookies tab"></a></p>
| <google-chrome> | 2019-03-29 09:34:04 | HQ |
55,414,470 | What are all the types of '✔️' characters available on Android ? (for a TextView) | <p>I wonder what are all the types of '✔️' characters available on Android (for a TextView)</p>
<p>Nota : I need to be able to change their color (I just saw that it is impossible to change the color for some of them)</p>
<p>Thanks !</p>
| <java><android><unicode><character-encoding><character> | 2019-03-29 09:40:29 | LQ_CLOSE |
55,416,494 | C Program to get the version of jar file | <p>A c program code to get the file version of jar file and we need to compare with some versions and show to the user , we know that it is easy in java but we wanted in c language only</p>
| <c> | 2019-03-29 11:29:30 | LQ_CLOSE |
55,417,186 | Is this a valid way of checking if a variadic macro argument list is empty? | <p>I've been looking for a way to check if a variadic macro argument list is empty. All solutions I find seem to be either quite complex or using non-standard extensions. </p>
<p>I think I've found an easy solution that is both compact and standard:</p>
<pre><code>#define is_empty(...) ( sizeof( (char[]){#__VA_ARGS__} ) == 1 )
</code></pre>
<p>Q: Are there any circumstances where my solution will fail or invoke poorly-defined behavior?</p>
<p>Based on C17 6.10.3.2/2 (the # operator): <em>"The character string literal corresponding to an empty argument is <code>""</code>"</em>, I believe that <code>#__VA_ARGS__</code> is always well-defined. </p>
<p>Explanation of the macro:</p>
<ul>
<li>This creates a compound literal char array and initializes it by using a string literal.</li>
<li>No matter what is passed to the macro, all arguments will be translated to one long string literal. </li>
<li>In case the macro list is empty, the string literal will become <code>""</code>, which consists only of a null terminator and therefore has size 1. </li>
<li>In all other cases, it will have a size greater than 1.</li>
</ul>
| <c><c-preprocessor><c11><variadic-macros> | 2019-03-29 12:10:41 | HQ |
55,419,178 | Is this type aliasing syntax n Go? | <p>I did not get the below syntax in <code>../go/src/net/http/server.go</code>:</p>
<pre><code>var defaultServeMux ServeMux
</code></pre>
<p>where</p>
<p><code>ServeMux</code> is a struct</p>
<pre><code>type ServeMux struct {
mu sync.RWMutex
m map[string]muxEntry
es []muxEntry
hosts bool
}
</code></pre>
<hr>
<p>In GO, type aliasing looks like <code>type T1 = T2</code>. </p>
<p>Is the above syntax(used for <code>defaultServeMux</code>) anything to do with type aliasing?</p>
| <go> | 2019-03-29 14:04:55 | LQ_CLOSE |
55,420,376 | Encode string for URL (angular) | <p>I'm trying to encode a string that's pretty complex, so that I can include it in a mailto:</p>
<p>Component:</p>
<pre><code><a href="mailto:test@example.com?subject='Hello'&{{body}}">
</code></pre>
<p>TS: </p>
<pre><code>import { HttpParameterCodec } from "@angular/common/http";
let body = encodeValue('This is the example body\nIt has line breaks and bullets\n\u2022bullet one\n\u2022bullet two\n\u2022bullet three')
</code></pre>
<p>When I try to use encodeValue, I get "cannot find name encodeValue.</p>
<p>How would be best to url-encode body?</p>
| <angular><url><encode> | 2019-03-29 15:08:40 | HQ |
55,421,620 | 8086 Assembly - get UNIX timestamp(seconds) | How can I get the current UNIX time on 8086 asm? I couldn't find any information on the internet. I know it's 32bit so it would have to fill 2 registers. | <assembly><dos><unix-timestamp><x86-16> | 2019-03-29 16:19:53 | LQ_EDIT |
55,421,837 | SQL-Statement to calculate time between to days | I have some data's in my mySQL Database.
I try to get all informationen between to timestamps. Everytime the status change, i got a new timestamp and new number of Status.
Someting like this: Status_List
Status Time_Start Time_End
2 14:00:12 14:13:33
5 14:13:33 15:33:41
9 15:33:41 16:02:11
When i search:
select * from Status_List where Time_Start between (15:00:00 and 16:00:00)
Output: 9 15:33:41 16:02:11
But i need:
Output: 5 15:00:00 15:33:41
9 15:33:41 16:00:00
Is this possible? | <mysql><sql> | 2019-03-29 16:35:01 | LQ_EDIT |
55,424,306 | SQL Join on Table with Duplicates, add condition to get unique values | <p>I need to join Table B to Table A using SQL in order to get Table B's column called "Reservoir". They both have a unique ID to join on called "Well_ID" but the issue is that Table B has duplicate ids. Table B has a column called "Qualifier" and another called "CreatedDate". Qualifier "Dallas" has precedence over qualifier "Houston" and the latest CreatedDate is needed to find the unique Reservoir value.</p>
<p><a href="https://i.stack.imgur.com/biKhn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/biKhn.png" alt="enter image description here"></a></p>
<p>Since I'm unsure how to do the condition, all I have is the join statement so far: </p>
<pre><code>SELECT a.*
,b.[Reservoir]
,b.[CreatedDateTime]
,b.[Qualifier]
FROM TableA a
INNER JOIN TableB b on a.Well_ID = b.Well_ID
</code></pre>
| <sql><sql-server> | 2019-03-29 19:23:55 | LQ_CLOSE |
55,427,776 | Using inputs and functions as a values in a dictionary | First, is there anyway to use input() as a value in a dictionary?
I have tried:
dictionary = {'1': input('Choose: [1]Red [2]Blue'), '2':input('Choose: [1]Green [2]Yellow)}
but this returns the first input:
'Choose: [1]Red [2]Blue'
Second, I know you can use functions in dictionaries but how would you give the argument for the function. For example:
dictionary = {'1': func1(), '2': func2()}
action = input('[1] or [2]')
dictionary[action]
Would I have to define a key for every argument possible for func1 or func2? | <python-3.x><dictionary> | 2019-03-30 03:07:17 | LQ_EDIT |
55,427,936 | Number of files in directory | <p>I am on Windows 10. I currently doing a group assignment that deals with a lot of images. I want to know when I click on an image if there is a way for the file explorer to tell me that this is "X" (for example 10th) item in this directory. I only see the total number of items on the bottom left corner of the file explorer screen. I know it sounds very nooby haha.</p>
| <windows><windows-10> | 2019-03-30 03:44:32 | LQ_CLOSE |
55,428,305 | is there is function for image view that when we press the image button it should show and if we realise button the previous image should show? | <p>i am developing one walkie talkie app in that i am using walkie talkie image button. when i click on that image it should show the different image and when realise that button it should show the previous image . bellow code walk1 first image and walk2 is second image which should see when image button is clicked </p>
<p>,,,</p>
<pre><code>walk1=findViewById(R.id.walky)
walk2=findViewById(R.id.walky1)
walk1?.setOnLongClickListener {
walk2?.visibility=View.VISIBLE
true // Don't consume event, if return false. Consume event if true.
}
walk2?.setOnClickListener {
walk2?.visibility=View.GONE
}
</code></pre>
<p>,,,
in this code its showing second image but when i realised button its not showing first image when i click again that time its showing </p>
| <android><kotlin> | 2019-03-30 04:55:22 | LQ_CLOSE |
55,428,615 | How can i get the ip address of the local system in angular 6 | In an angular project, I want to capture the IP address of the local system | <javascript><angular> | 2019-03-30 05:52:54 | LQ_EDIT |
55,430,289 | android button design for fan and dilmmer contol | [enter image description here][1]How to design button which works like fan regulator pot
[1]: https://i.stack.imgur.com/Eezr7.png | <android><android-layout><button> | 2019-03-30 10:01:48 | LQ_EDIT |
55,430,384 | How can I get access_token from auth-module, Nuxt.js | <p>I try to build Facebook login with auth-module the link below with Nuxt.js.</p>
<p><a href="https://github.com/nuxt-community/auth-module" rel="noreferrer">https://github.com/nuxt-community/auth-module</a></p>
<p>I can not get "access_token". the code is follows.</p>
<pre><code>// pages/login.vue
export default {
methods: {
this.$auth.loginWith('facebook')
}
}
</code></pre>
<p>the call back URI is like this.</p>
<pre><code>https://localhost:3000/facebook/oauth_callback/?#access_token=***&data_access_expiration_time=1561715202&expires_in=4398&reauthorize_required_in=7776000&state=MC4xOTU3MDM2ODIxMzIzOTA5OA
</code></pre>
<pre><code>// pages/facebook/oauth_callback/index.vue
<template>
<section>
<p>{{ this.$auth.$state }}</p>
<p>{{ this.$route.query }}</p
</section>
</template>
</code></pre>
<p>this.$auth.$state don't include "access_token". How can I get "access_token"?
I don't also understand why the URI include "#" in get parameter field. because of it, I can't get access_token from "this.$route.query".</p>
| <javascript><facebook><nuxt.js> | 2019-03-30 10:14:02 | HQ |
55,431,119 | VS Code: Analyzing in the background | <p>When I start a python project in vs code (with the microsoft python extension) it starts "Analyzing in the background" and python keep crashing. It also uses a ton of memory.<a href="https://i.stack.imgur.com/b1YP6.png" rel="noreferrer"><img src="https://i.stack.imgur.com/b1YP6.png" alt="enter image description here"></a></p>
<p>Anyone knows how to fix this? Or is it supposed to do this?</p>
| <python><visual-studio-code> | 2019-03-30 11:46:54 | HQ |
55,433,298 | How to emulate Android's showAsAction="ifRoom" in Flutter? | <p>In my Flutter app I have a screen that is a MaterialApp with a Scaffold widget as it's home.</p>
<p>The appBar property of this Scaffold is an AppBar widget with the actions property filled with some actions and a popup menu to house the rest of the options.</p>
<p>The thing is, as I understand a child of AppBar <code>actions</code> list can either be a generic widget (it will be added as an action) or an instance of <code>PopupMenuButton</code>, in which case it will add the platform specific icon that when triggered opens the AppBar popup menu.</p>
<p>On native Android that's not how it works. I just need to inflate a menu filled with menu items and each item either can be forced to be an action, forced to NOT be an action or have the special value "ifRoom" that means "be an action if there is space, otherwise be an item inside de popup menu".</p>
<p>Is there a way in Flutter to have this behavior without having to write a complex logic to populate the "actions" property of the AppBar?</p>
<p>I've looked into both AppBar and PopupMenuButton documentations and so far nothing explains how to do such a thing. I could simulate the behavior but then I would have to actually write a routine to calculate the available space and build the "actions" list accordingly.</p>
<p>Here's a typical Android menu that mixes actions and popup menu entries. Notice the "load_game" entry can be an action if there is room and will become a menu entry if not.</p>
<pre class="lang-xml prettyprint-override"><code><?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/new_game"
android:icon="@drawable/ic_new_game"
android:title="@string/new_game"
android:showAsAction="always"/>
<item android:id="@+id/load_game"
android:icon="@drawable/ic_load_game"
android:title="@string/load_game"
android:showAsAction="ifRoom"/>
<item android:id="@+id/help"
android:icon="@drawable/ic_help"
android:title="@string/help"
android:showAsAction="never" />
</menu>
</code></pre>
<p>On the other hand in Flutter I have to decide ahead of time if the options will be an action or a menu entry.</p>
<pre class="lang-dart prettyprint-override"><code>AppBar(
title: Text("My Incredible Game"),
primary: true,
actions: <Widget>[
IconButton(
icon: Icon(Icons.add),
tooltip: "New Game",
onPressed: null,
),
IconButton(
icon: Icon(Icons.cloud_upload),
tooltip: "Load Game",
onPressed: null,
),
PopupMenuButton(
itemBuilder: (BuildContext context) {
return <PopupMenuEntry>[
PopupMenuItem(
child: Text("Help"),
),
];
},
)
],
)
</code></pre>
<p>What I hoped would work is that the AppBar actually had just a single "action" property instead of "actions". That property would be just a widget allowing me to have anything so if I wanted just a list of actions then a Row filled with IconButton's would suffice.</p>
<p>Along with that each PopupMenuItem inside the PopupMenuButton would have a "showAsAction" property. If one or more PopupMenuItem inside the PopupMenuButton was checked to be an action or "ifRoom" and there is room, then the PopupMenuButton would expand horizontally and place these items as actions.</p>
| <android><dart><menu><flutter><menuitem> | 2019-03-30 16:06:45 | HQ |
55,433,546 | Calling a function in another form | My question is about dealing with multiple forms in c# windows form application. I am developing a code for playing a movie and moving it frame by frame with buttons. I already have the code for moving the movie frame by frame with ctlcontrols in windows media player. The thing that I'm having an issue with is that I want to have a main form and a movie form, and when i click the button in the main form, i want to send a number to the other form and if the number was 2, i want the movie to go frame by frame in the movie form. And I want to do it without opening a new form every time I click the button. I have made a function in my second form and I called it in the button in the main form. It is expected to work but it doesn't. Any help ASAP would be appreciated.
The code for the button in the main form is:
private void button1_Click(object sender, EventArgs e)
{
value = txtSendNum.Text; //get the value from the textox and assign it to string variable
MovieForm movieform = new MovieForm(); //create an object for MovieForm
movieform.ConnectForms(value);
}
The code for the function(ConnectForms function) in the second form is:
public void ConnectForms(string value)
{
val = Convert.ToInt32(value);
if (val == 2)
{
axWindowsMediaPlayer1.Ctlcontrols.play();
axWindowsMediaPlayer1.Ctlcontrols.currentPosition += 0.5;
axWindowsMediaPlayer1.Ctlcontrols.stop();
}
} | <c#><visual-studio> | 2019-03-30 16:36:53 | LQ_EDIT |
55,434,226 | i have this error but i don't even know why ?! please help me | i have this error at line 3 (sup_id) however i don't know why?
it should be correct right ??
this SQL language (DATABASE) ,i tried changing the name and the type everything nothing worked
this part of my work for college project i will be thankfull for the help
create table supplier
(
sup_id number (12),
contact number (12),
Name varchar2 (30) NOT NULL,
constraint id_pk primary key (sup_id));
at line 3 it says error | <mysql><sql><database><relational-database> | 2019-03-30 17:59:17 | LQ_EDIT |
55,435,226 | How to correctly use Scanner to print output stream | <p>I am using Scanner to take in input and print output but ln.nextLine() jumps to next line to scan.</p>
<pre><code> Scanner in = new Scanner(System.in);
System.out.println("ENTER ID: ");
String line = null;
while (in.hasNext()) {
line = in.nextLine();
if (line.toLowerCase().equals("exit")) {
break;
} else {
System.out.println("number entered
"+Integer.parseInt(line));
}
System.out.println("ENTER ID: ");
}
</code></pre>
<p><strong>This produces a output like:</strong><br>
ENTER ID:<br>
78<br>
number entered 78<br>
ENTER ID:<br>
89<br>
number entered 89</p>
<p><strong>Desired output is:</strong><br>
ENTER ID: 78<br>
number entered 78<br>
ENTER ID: 89<br>
number entered 89 </p>
<p>what part of println sequence should I change to achieve this?</p>
| <java><java.util.scanner> | 2019-03-30 20:02:48 | LQ_CLOSE |
55,435,628 | Adding more li elements with 2variables | <p>Hey i want to do something like to-do list. But with counter.</p>
<p>So when user input a title and date then there will be new element with time counter and title.</p>
<p>For now i got something like this: </p>
<pre><code>`https://jsfiddle.net/678z5pgy/1/`
</code></pre>
<p>But it only changes the "add-new" item h2 and p. I want to append new child for container as li element.</p>
<p>But when i make it as appendchild it will add me new element every second.</p>
<p>(Please don't make it for me just tell me what can i do and where i can look for answer, maybe for loop?)</p>
<p><a href="https://codepen.io/ludzik/pen/YMzKKP" rel="nofollow noreferrer">https://codepen.io/ludzik/pen/YMzKKP</a></p>
| <javascript><html> | 2019-03-30 21:00:42 | LQ_CLOSE |
55,435,943 | Swift class extensions and categories on Swift classes are not allowed to have +load methods | <p>I have updated Xcode Version 10.2 (10E125) and testing on devices (not only simulator) </p>
<p>I get this message when I execute the app:</p>
<p>objc[3297]: Swift class extensions and categories on Swift classes are not allowed to have +load methods</p>
<ul>
<li>It's just not working on devices with iOS 12.2. I would like to know if there was any update that was affecting the swift classes. So far no answer about this in other forums just saw that apple has some issues with other apps in production as well.</li>
</ul>
<p>-I'm using extensions of swift classes but I don't think that is the problem</p>
<ul>
<li><p>Using Cocoapods and Firebase dependencies.</p></li>
<li><p>I searched in my project any functions that could contain "load" functions, none found.</p></li>
</ul>
<p>Please some help</p>
| <swift><ios12><xcode10.2> | 2019-03-30 21:49:17 | HQ |
55,436,221 | Wil a C/C++ compiler inline a for-loop with a small number of terms? | Suppose I have a class `5x5matrix` (with suitably overloaded index operators) and I write a method `trace` for calculating the sum of its diagonal elements:
double 5x5matrix::trace(void){
double t(0.0);
for(int i(0); i <= 4; ++i){
t += (*this)[i][i];
}
return t;
}
Of course, if I instead wrote:
return (*this)[0][0]+(*this)[1][1]+(*this)[2][2]+(*this)[3][3]+(*this)[4][4];
then I would be sure to avoid the overhead of declaring and incrementing my `i` variable. But it feels quite stupid to write out all those terms!
Since my loop has a "constexpr" number of terms that happens to be quite small, would a compiler inline it for me? | <c++><compiler-optimization><loop-unrolling> | 2019-03-30 22:29:35 | LQ_EDIT |
55,436,363 | adding two charss intoa short wrong answer c | Hi I have a function that is aimed at getting the value of two chars added together into a short. it seams that the value is getting cut off or mangled.
here is my code:
void add(char a, char b){
unsigned short x = a + b;
printf("init:%hu %hu = %hu\n", (unsigned char)a, (unsigned char)b, (unsigned short)x);
...
unsigned char x = add((unsigned char)230, (unsigned char)100);
unsigned char y = add((unsigned char )200, (unsigned char)200);
unsigned char z = add((unsigned char) 230, (unsigned char)120);
and the results are
init:230 100 = 74
init:200 200 = 65424
init:230 120 = 94
| <c><casting> | 2019-03-30 22:50:36 | LQ_EDIT |
55,437,006 | How to view file properties in visual studio 2017 | I am following along to a video on msdn's channel 9 page.
[Bob Tabor teaches C#][1]
Around the 12:37 time mark, the narrator tells how to view the file properties in visual studio. But that is for an older edition. The problem is I added a .txt file to the C# project but it was not included in the \bin\Debug folder. How do I view the file properties window?
[1]: https://channel9.msdn.com/series/C-Fundamentals-for-Absolute-Beginners/12 | <c#><visual-studio-2017><file-properties> | 2019-03-31 01:07:57 | LQ_EDIT |
55,438,297 | why do I get an ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0? | <p>I keep an error "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0" even though i've referenced this array bounds in the method.</p>
<pre><code>`public class USCrimeLibrary
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
USCrimeObject crimeObject = new USCrimeObject(args[0]); `
</code></pre>
<p>and the reference object:</p>
<pre><code>`public class USCrimeObject {
private Crime[] crimes;
String fileName = "/Users/jpl/Developer/Java/CMIS141/WK8/Crime.csv";
public USCrimeObject(String fileName) {
this.crimes = new Crime[20];
readFile(fileName);
}`
</code></pre>
| <java><arrays><indexoutofboundsexception> | 2019-03-31 05:56:39 | LQ_CLOSE |
55,439,599 | SSLHandshakeException with jlink created runtime | <p>I've got a dropwizard app, which runs fine with the standard JRE.</p>
<p>I've tried creating a runtime using jlink which is considerably smaller:</p>
<pre><code>/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home/bin/jlink --no-header-files --no-man-pages --compress=2 --strip-debug --add-modules java.base,java.compiler,java.desktop,java.instrument,java.logging,java.management,java.naming,java.scripting,java.security.jgss,java.sql,java.xml,jdk.attach,jdk.jdi,jdk.management,jdk.unsupported --output jre
</code></pre>
<p>If I run it with the jlink created runtime it throws this error connecting to redis (which has stunnel in front of it).</p>
<pre><code>ERROR [2019-03-31 09:12:20,080] com.company.project.core.WorkerThread: Failed to process message.
! javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
! at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
! at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
! at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
! at java.base/sun.security.ssl.Alert$AlertConsumer.consume(Unknown Source)
! at java.base/sun.security.ssl.TransportContext.dispatch(Unknown Source)
! at java.base/sun.security.ssl.SSLTransport.decode(Unknown Source)
! at java.base/sun.security.ssl.SSLSocketImpl.decode(Unknown Source)
! at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(Unknown Source)
! at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
! at java.base/sun.security.ssl.SSLSocketImpl.ensureNegotiated(Unknown Source)
! at java.base/sun.security.ssl.SSLSocketImpl$AppOutputStream.write(Unknown Source)
! at redis.clients.jedis.util.RedisOutputStream.flushBuffer(RedisOutputStream.java:52)
! at redis.clients.jedis.util.RedisOutputStream.flush(RedisOutputStream.java:133)
! at redis.clients.jedis.Connection.flush(Connection.java:300)
! ... 9 common frames omitted
! Causing: redis.clients.jedis.exceptions.JedisConnectionException: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
! at redis.clients.jedis.Connection.flush(Connection.java:303)
! at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:235)
! at redis.clients.jedis.BinaryJedis.auth(BinaryJedis.java:2225)
! at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:119)
! at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:888)
! at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:432)
! at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:361)
! at redis.clients.jedis.util.Pool.getResource(Pool.java:50)
! ... 2 common frames omitted
! Causing: redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
! at redis.clients.jedis.util.Pool.getResource(Pool.java:59)
! at redis.clients.jedis.JedisPool.getResource(JedisPool.java:234)
</code></pre>
<p>The stunnel server logs show:</p>
<pre><code>redis_1 | 09:12:20 stunnel.1 | 2019.03.31 09:12:20 LOG7[23]: TLS alert (write): fatal: handshake failure
redis_1 | 09:12:20 stunnel.1 | 2019.03.31 09:12:20 LOG3[23]: SSL_accept: 141F7065: error:141F7065:SSL routines:final_key_share:no suitable key share
redis_1 | 09:12:20 stunnel.1 | 2019.03.31 09:12:20 LOG5[23]: Connection reset: 0 byte(s) sent to TLS, 0 byte(s) sent to socket
</code></pre>
<p>Are there some crypt algorithms being left out by jlink?</p>
| <java><java-11><jlink> | 2019-03-31 09:37:21 | HQ |
55,439,866 | How to use regexp to extract the digit within { customer:490 } bought a car { car:6441 } | <p>I have a json object with value in this pattern:
{ customer:1501 } bought a car { car:6333 }
How to use regexp to extract the digit of customer and car.
I am very new to regex, I can only extract the string between the curly braces. I am not sure should I do it separately, i.e. extract the string between the curly braces than extract the digits after "customer:" or "car:". Please help</p>
| <regex> | 2019-03-31 10:13:52 | LQ_CLOSE |
55,440,912 | npm outdated error Cannot read property 'length' of undefined | <p>I try running 'npm outdated' from the console in my node project. But I get this error:</p>
<pre><code>npm ERR! Cannot read property 'length' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Roaming\npm-cache\_logs\2019-03-31T12_26_30_745Z-debug.log
</code></pre>
<p>This is the error in the log:</p>
<pre><code>199 verbose stack TypeError: Cannot read property 'length' of undefined
199 verbose stack at dotindex (C:\Users\amita\AppData\Roaming\npm\node_modules\npm\node_modules\text-table\index.js:59:32)
199 verbose stack at C:\Users\amita\AppData\Roaming\npm\node_modules\npm\node_modules\text-table\index.js:11:21
199 verbose stack at Array.forEach (<anonymous>)
199 verbose stack at forEach (C:\Users\amita\AppData\Roaming\npm\node_modules\npm\node_modules\text-table\index.js:73:31)
199 verbose stack at C:\Users\amita\AppData\Roaming\npm\node_modules\npm\node_modules\text-table\index.js:10:9
199 verbose stack at Array.reduce (<anonymous>)
199 verbose stack at reduce (C:\Users\amita\AppData\Roaming\npm\node_modules\npm\node_modules\text-table\index.js:63:30)
199 verbose stack at module.exports (C:\Users\amita\AppData\Roaming\npm\node_modules\npm\node_modules\text-table\index.js:9:20)
199 verbose stack at C:\Users\amita\AppData\Roaming\npm\node_modules\npm\lib\outdated.js:130:16
199 verbose stack at cb (C:\Users\amita\AppData\Roaming\npm\node_modules\npm\node_modules\slide\lib\async-map.js:47:24)
199 verbose stack at outdated_ (C:\Users\amita\AppData\Roaming\npm\node_modules\npm\lib\outdated.js:221:12)
199 verbose stack at skip (C:\Users\amita\AppData\Roaming\npm\node_modules\npm\lib\outdated.js:343:5)
199 verbose stack at updateDeps (C:\Users\amita\AppData\Roaming\npm\node_modules\npm\lib\outdated.js:446:7)
199 verbose stack at tryCatcher (C:\Users\amita\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
199 verbose stack at Promise.successAdapter [as _fulfillmentHandler0] (C:\Users\amita\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\nodeify.js:23:30)
199 verbose stack at Promise._settlePromise (C:\Users\amita\AppData\Roaming\npm\node_modules\npm\node_modules\bluebird\js\release\promise.js:566:21)
200 verbose cwd C:\Users\amita\Ionic\toratlechima
201 verbose Windows_NT 10.0.17134
202 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\amita\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "outdated"
203 verbose node v10.11.0
204 verbose npm v6.9.0
205 error Cannot read property 'length' of undefined
206 verbose exit [ 1, true ]
</code></pre>
<p>This also happens when I try to run it globally.
Anyone encounter this?</p>
| <node.js><npm> | 2019-03-31 12:29:51 | HQ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.