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 |
|---|---|---|---|---|---|
54,723,651 | How to check whether any woocommerce order contains a product-ID? | I'm coding a plugin which should check whether an order contains an product-ID.
How can I check all orders if any contains the product-ID and then mark this order as finished?
I know how to check an order on thankyou-page, but the order-ID there is already given:
Thank you all and @johnnyd23 for the code below.
foreach ( $order_summary as $order ) {
$order = wc_get_order( $order->order_id );
$order_id = $order->get_id();
$order_items = get_products_for_order( $order_id );
if ( $order->get_status() == 'processing' ) {
foreach( $order_items as $item ) {
if ( $item->is_featured() ) {
echo 'Something';
} else {
echo 'Something else';
}
}
}
}
| <php><wordpress><woocommerce> | 2019-02-16 13:39:38 | LQ_EDIT |
54,725,728 | R : function lapply error : subscript out of bounds | I have to make a 4*4 Kohonen map for a project.
However, I get the error
> Error in win_index[1, ] : subscript out of bounds
> In addition: There were 16 warnings (use warnings() to see them)
After testing my code, I guess it's the lapply function (line 77) that doesn't
is not executed correctly because the matrix thus created contains only NA.
And so since this matrix is used later on, the result is not correct because
NA is present throughout the program.
######################################
## Initialize random matrix phi/psi ##
######################################
##Pour mac
setwd("/Users/amandinelecerfdefer/Desktop/Kohonen_MAP")
data_phipsi<-read.csv("/Users/amandinelecerfdefer/Desktop/Kohonen_MAP/pbA.txt.new.2.rep30.phipsi",h=F)
colnames(data_phipsi)<-c("phi1","psi2","phy2","psi3","phy3","psi4","phy4","psi5")
random_list<-list()
borne<-16
for(n in 1:borne){
random_list[[n]]<-floor(runif(8,min=-180,max=180))
}
# ##############Print random matrix#####
# for(n in 1:16){
# print(random_list[[n]])
# }
#creation of a matrix 4*4 representing the Kohonen map containing the vectors of the angles phi/psi
Kohonen_matrix<-matrix(random_list,ncol=sqrt(borne),nrow=sqrt(borne))
rownames(Kohonen_matrix)<-c('1','2','3','4')
colnames(Kohonen_matrix)<-c('1','2','3','4')
#############################################
##Function for distance calculation (RMSDA)##
#############################################
RMSDA<-function(data_phipsi,Kohonen_matrix)
{
difference<-data_phipsi-Kohonen_matrix
for(j in 1:length(difference)){
if (difference[j]< -180) {difference[j]=difference[j]+360}
if (difference[j]> +180) {difference[j]=difference[j]-360}
}
distance=mean(sqrt(difference^2))
return(distance)
}
#######################
##LEARNING FUNCTION ##
#######################
learning<-function(initial_rate,iteration,data_phipsi){
return(initial_rate/(1+(iteration/nrow(data_phipsi))))
}
##############################
## Program for Kohonen MAp ###
##############################
initial_rate=0.75 # Decrease with training time
initial_radius=2 # Decrease with training time
iteration=3
for(step in 1:iteration)
{
data_phipsi<-data_phipsi[sample(nrow(data_phipsi)),] # Sample vectors of training (samples of lines of the dataframe)
print(step) #Visualize where we are in loops
for(k_row in 1:nrow(data_phipsi))
{
#Update learn_rate and radius at each row of each iteration
learn_rate<-learning(initial_rate,((step-1)*nrow(data_phipsi))+k_row,data_phipsi)
learn_radius<-learning(initial_rate,((step-1)*nrow(data_phipsi))+k_row,data_phipsi)
#Find distance between each vectors of angles of Kohonen Map and the training vector
phipsi_RMSDA<-lapply(random_list, RMSDA, data_phipsi=data_phipsi[k_row,])
#Unlist and create a matrix of distances
vector_RMSDA<-unlist(phipsi_RMSDA)
matrix_RMSDA<-matrix(vector_RMSDA,sqrt(borne),sqrt(borne))
#Take the index of the winning neuron, it's the neuron that are more similar than the training vector
win_index<-which(matrix_RMSDA==min(matrix_RMSDA), arr.ind=TRUE)
current_index<-list(c(1,1),c(2,1),c(3,1), c(4,1), c(1,2),c(2,2),c(3,2), c(4,2),c(1,3),c(2,3),c(3,3), c(4,3), c(1,4),c(2,4),c(3,4), c(4,4), c(1,4),c(2,4),c(3,4), c(4,4))
#Update of angles of Kohonen Map vectors with the equation (be careful at number of parenthesis)
for (mlist in 1:borne)
{
distance<-as.numeric(dist(rbind(win_index[1,], current_index[[mlist]])))
random_list[[mlist]]<-(random_list[[mlist]]+ ( prot_phipsi[i_row,]-random_list[[mlist]])* (learn_rate*( exp (- ((distance)^2/(2*((learn_radius)^2)) )) ) ))
}
Kohonen_matrix<-matrix(random_list,sqrt(borne),sqrt(borne))
}
}
How is it possible to fix this lapply error?
Thank you. Thank you.
| <r> | 2019-02-16 17:24:03 | LQ_EDIT |
54,725,826 | I'm tring to increase the stack size in Visual Studio 2017 | I keep getting a stack Overflow! Probably my code could be written a lot better, I know.
But I just need to increase the stack size for just one routine (a recursion with a very big array :-( )
I was told to solve it like that:
In my Project ->
Properties -> Configuration Properties -> Linker -> System -> Stack Reserve Size :
But I can't get to that screen.
I can go to Project -> Properties and that's where it ends.
[enter image description here][1]
I used all of the above items, but I never saw an option to increase the stack size...
Using Visual Studio 2017 Community with c#
Thank you
[1]: https://i.stack.imgur.com/mw03d.jpg | <c#><.net><visual-studio><recursion><visual-studio-2017> | 2019-02-16 17:33:33 | LQ_EDIT |
54,726,381 | Flutter sliver container | <p>I'm new to flutter and I'm not able to achieve the layout I want.</p>
<p>I have one sliverAppBar with 3 tabs. The content of one of the tabs has to be a ScrollView compound by one container with fixed size(with an image as background) and a ListView.</p>
<p>I've tried to do this with a CustomScrollView but I don't know how to create the container as it is not a sliver.</p>
<p>Can you point me in the right direction?</p>
<p>Regards, Diego. </p>
| <flutter><scrollview><flutter-sliver> | 2019-02-16 18:37:46 | HQ |
54,726,773 | Plot solutions of bivariate polynomial equation | <p>How can I plot the solutions of this equation in R?</p>
<blockquote>
<p>(x²+y²-1)³=x²y³</p>
</blockquote>
| <r><plot><equation> | 2019-02-16 19:19:32 | LQ_CLOSE |
54,728,709 | HOW TO PRINT "THAT'S IT!" IN PHP? WITH DOUBLE AND SINGLE QUOTATIONS? | <p>I want to print "that's it!" Exactly as same with double and single quotations in php? Can anyone have solution?</p>
| <php> | 2019-02-16 23:32:34 | LQ_CLOSE |
54,728,755 | Image Taking Full Width Of Container | <p>really basic question, but I do marketing for a client so don't know too much besides basics HTML, CSS. </p>
<p>I've got an image slider in the URL below, what should I do so the image occupies the full space of the container (as there are bars on either side of the image). Do I just remove the padding or is there something more efficient to put in the stylesheet. Thanks heaps for your help</p>
<p><a href="https://www.vibrantrealestate.com.au/property/outstanding-warehouse-space-style-on-the-citys-edge/" rel="nofollow noreferrer">https://www.vibrantrealestate.com.au/property/outstanding-warehouse-space-style-on-the-citys-edge/</a></p>
<p><a href="https://i.stack.imgur.com/cn2qy.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cn2qy.jpg" alt="enter image description here"></a></p>
| <html><css> | 2019-02-16 23:41:15 | LQ_CLOSE |
54,728,824 | How to add tinted mask with text over images on hover | <p><img src="https://i.ibb.co/ck1BZYk/Screen-Shot-2019-02-16-at-6-43-04-PM.png" alt="my image"></p>
<p>Looking to achieve the effect in the image above. I have a bunch of svg icons. When the user hovers over each image, the image tints and white text is revealed unique to each icon. </p>
<p>What's the best practice for this effect? Make the icons the background image? Right now they are inline svg.</p>
| <javascript><html><css><svg><hover> | 2019-02-16 23:54:18 | LQ_CLOSE |
54,729,052 | How to check if time in millis is yesterday | How can i check if time in millis is yesterday? For example my time in millis is 23:59 so actually is yesterday but 00:00 is now today. Sorry for my eng. | <java> | 2019-02-17 00:37:21 | LQ_EDIT |
54,729,445 | Why does my JS function not return any results in Chrome Dev Console? | <p>My function compPlay() does not return any results in console. I have the function written to what I believe is correct as far as syntax goes and proper use of "Math random" and "Math" floor. Please help me.</p>
<pre><code> <!doctype html>
<html lang="en-us">
<head>
<meta charset="UTF-8">
<title>Rock Paper Scissor Game</title>
<!-- CSS, STYLESHEET -->
<link rel="stylesheet" type="text/css" href="assets/css/style2.css">
<!-- BOOTSTRAP -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<!-- JQUERY, 3.2.1 -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js">
function compPlay {
const choices = ["rock", "paper", "scissors"]
return choices([Math.floor(Math.random() * choice.length)];
}
</code></pre>
<p><a href="https://i.stack.imgur.com/ymmrQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ymmrQ.jpg" alt="enter image description here"></a></p>
| <javascript><html><function> | 2019-02-17 01:56:00 | LQ_CLOSE |
54,729,647 | Xcode Application Loader stuck at "Signing in to App Store Connect" | <p><em>Note: this is NOT the same as being stuck at "Authenticating with the iTunes store" while uploading an app, which is well-documented on SO and elsewhere.</em></p>
<p>When I first launch Application Loader, I'm prompted for a username and password. I enter my credentials and click Sign In. A message pops up saying "Signing in to App Store Connect" with a little spinner to the left. Then a few seconds later, the spinner goes away, and I'm never brought to the page where I can upload an .ipa. And I'm left questioning my life choices.</p>
<p><a href="https://i.stack.imgur.com/MYzQv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/MYzQv.png" alt="Application Loader Sign In"></a></p>
<p>I have a coworker who experienced the exact same issue. We each have email addresses associated to 2 Apple Developer accounts, we'll call them <code>nodice.com</code> and <code>allgood.com</code>. We can both sign in to our <code>allgood.com</code> accounts fine. But both of us experience this issue when signing in to our <code>nodice.com</code> accounts.</p>
<p>However, we can both sign in to both accounts at <a href="https://developer.apple.com/" rel="noreferrer">https://developer.apple.com/</a> and <a href="https://appstoreconnect.apple.com/" rel="noreferrer">https://appstoreconnect.apple.com/</a>.</p>
<p>The curious difference between the two, is that both of our <code>nodice.com</code> email addresses also belong to other organizations. The <code>allgood.com</code> accounts have only been invited to one organization. In other words, on the websites above, while logged in to the <code>nodice.com</code> account, I can switch between these organizations. On the <code>allgood.com</code> account, I have only one organization to choose from.</p>
<p><a href="https://i.stack.imgur.com/TDoTw.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TDoTw.png" alt="App Store Connect menu"></a></p>
<p>Even curiouser is this, which I found by accident: if I close the stuck login screen, I see the "Template Chooser" screen! But the selected team is the one I don't want, and when I click the button, the menu is borked.</p>
<p><a href="https://i.stack.imgur.com/2Li6J.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2Li6J.png" alt="Template Chooser"></a> </p>
<p>Recently Apple made a change -- we all got the email -- that "Teams and roles have been unified" between the Apple Developer website and App Store Connect. This could be related.</p>
<p>We are using Xcode Version 10.1 (10B61) and Application Loader Version 3.7.2 (1138), which as far as I know are the most recent versions. </p>
<p>I have tried modifying the <code>net.properties</code> file as documented <a href="https://stackoverflow.com/questions/18971710/application-loader-stuck-at-the-stage-of-authenticating-with-the-itunes-store">here</a>.</p>
<p>I have also tried updating the <code>iTMSTransporter</code> using the instructions found <a href="https://forums.developer.apple.com/thread/76803" rel="noreferrer">here</a>.</p>
<p>I may just have to file a bug report with Apple, but I'm curious if anyone else has had this issue and has maybe found a workaround.</p>
| <ios><xcode> | 2019-02-17 02:39:43 | HQ |
54,730,365 | Amazon API Implementation in Android Studio product base | recently tried Google Books API and got beautiful result.
I want to create a small android window which can show me products from amazon.
it will be great help if you can help me even a littile bit of it. | <android><api><amazon><amazon-product-api> | 2019-02-17 05:20:28 | LQ_EDIT |
54,731,015 | Finding the average from user given list in python | <p>I need to get the user to input the grades of both "boys" and "girls" until they want to stop adding the grades. Than find the average of the boys grades and the average of the girls and print them both separately.</p>
<p>My issue is I don't understand how i'm supposed to make it so the user can add as many grades as they want for both the boys and the girls, and then get both of the averages.</p>
<p>I'm still very new to python and am not sure what the best method for this would be, like would I use <code>while</code> or <code>if</code> in some way that I haven't learned yet?</p>
| <python> | 2019-02-17 07:15:56 | LQ_CLOSE |
54,731,811 | bubble sorting problem function not working code running but function not working | function is not working....i mean that array is not sorted it just prints the way i insert integers!
#include <iostream>
using namespace std;
main()
{
int n;
cout << "Enter size of array"<<endl;
cin >> n;
int A[n];
for(int i = 0; i < n; i++)
{
cout << "enter integer"<<endl;
cin >> A[i];
}
for (int i = 0; i < n; i++)
{
cout<<"Sorted Array: ";
cout<<A[i]<<" ";
}
void bubblesort(int A[],int n);
}
void bubbleSort(int A[] , int n)
{
for(int i = 0; i < n; i++)
{
for (int j = 0; j < n -i-1; j++)
{
if(A[j] > A[j+1])
{
int swap = A[j];
A[j] = A[j+1];
A[j+1] = swap;
}
}
}
}
this is my code......the array is not able to be sorted i think my function is not working correctly so please can someone help?!
i often visit
www.geekforgeeks.com
| <c++><arrays> | 2019-02-17 09:27:59 | LQ_EDIT |
54,733,838 | returning a value from a column if row number equals to a given value | <p>I have a dataframe with two columns, let's call them "value" and "diff". The column diff contains random row numbers.
I would like to create a vector by selecting values from the column "value" satisfying one condition, namely finding the value where the number given in diff column equals to the rownumber of the dataframe.
Shall I try it with a for loop, or is there an easier solution?</p>
| <r> | 2019-02-17 13:40:14 | LQ_CLOSE |
54,734,003 | HOW CAN I SEND A USSD CODE FROM PHP TO ANY NETWORK PROVIDER? | How can i send USSD code like *556# from php to any network provider like MTN,GLO or Airtel.
For instance ,say i have two inputs where user can enter USSD code and Phone number. On getting to the server(PHP),the received code will be dialed on the received phone number and send to the network provider. please is this possible? thanks
| <php><ussd> | 2019-02-17 14:00:48 | LQ_EDIT |
54,737,387 | How to add new value to database column without deleting old data | <p>I want to add data to mysql table without removing old data of that column</p>
<p>stock = 50
now i want to add 5 more
so i want to get result in table as: stock = 50+5 or stock=60
how i can do this in SQL</p>
| <php><mysql><sql> | 2019-02-17 20:26:50 | LQ_CLOSE |
54,737,405 | Integer 0 is found in vector calling for the -1 index? | When I initialize a vector:
std::vector <int> someVec;
and I call:
std::cout << someVec[-1];
with an arbitrary number of elements, 0 is always returned. Is there someway to get around this? This fault in cpp is messing up my "sort" function. Is there anyway to initialize said vector differently in order to return the last element in the vector, rather than 0 which seems to be the default. It seems that any index called outside the range of the vector will result in 0. It isn't wrapped which is baffling me. Thanks for the help, kind stranger!
| <c++><vector><indexing> | 2019-02-17 20:29:18 | LQ_EDIT |
54,737,884 | Changing the size of a modal view controller | <p>Once, the user taps a button, I want my modalViewController to appear as a small square in the middle of the screen (where you can still see the original view controller in the background).</p>
<p>Almost every answer on stackoverflow I find uses the storyboard to create a modal view controller, but I've gotten this far with everything I've found.</p>
<p>When you tap the button that is supposed to bring up the modal view, this function is called: </p>
<pre><code>func didTapButton() {
let modalViewController = ModalViewController()
modalViewController.definesPresentationContext = true
modalViewController.modalPresentationStyle = .overCurrentContext
navigationController?.present(modalViewController, animated: true, completion: nil)
}
</code></pre>
<p>And the modalViewController contains:</p>
<pre><code>import UIKit
class ModalViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .blue
view.isOpaque = false
self.preferredContentSize = CGSize(width: 100, height: 100)
}
}
</code></pre>
<p>Based on the answers I found, I was under the impression that if I set <code>preferredContentSize = CGSize(width: 100, height: 100)</code>, then it would make the modal view controller 100px x 100px.</p>
<p>However, the view controller takes up the entire screen (except for the tab bar because I set <code>modalViewController.modalPresentationStyle = .overCurrentContext</code></p>
<p>I'm obviously missing a step here, but I want to do everything programmatically as I'm not using the Storyboard at all in my project (except for setting the opening controller)</p>
<p>Thanks in advance for you help!!</p>
| <ios><swift><uiviewcontroller><modalviewcontroller> | 2019-02-17 21:31:41 | HQ |
54,738,273 | Profiling and std::vector part of Hot Path? | <p>I'm trying to find the source of performance issues with my application. Using Visual Studio 2017 profiling tools I got this result:</p>
<p><a href="https://i.stack.imgur.com/z3HPr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z3HPr.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/PRlsg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PRlsg.png" alt="enter image description here"></a></p>
<p>I'm relatively new to C++ so I'm not sure what this <code>std::vector<bool,std::allocator<bool> >::operator[]</code> stuff is or if this is really the bottleneck in my program or not. Any help is appreciated.</p>
<p>Here is my code:
<a href="https://github.com/k-vekos/GameOfLife/tree/multithread" rel="nofollow noreferrer">https://github.com/k-vekos/GameOfLife/tree/multithread</a></p>
| <c++><vector><std><sfml> | 2019-02-17 22:30:32 | LQ_CLOSE |
54,738,681 | How to change Context value while using React Hook of useContext | <p>Using the <code>useContext</code> hook with React 16.8+ works well. You can create a component, use the hook, and utilize the context values without any issues.</p>
<p>What I'm not certain about is how to apply changes to the Context Provider values.</p>
<p>1) Is the useContext hook strictly a means of consuming the context values?</p>
<p>2) Is there a recommended way, using React hooks, to update values from the child component, which will then trigger component re-rendering for any components using the <code>useContext</code> hook with this context?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const ThemeContext = React.createContext({
style: 'light',
visible: true
});
function Content() {
const { style, visible } = React.useContext(ThemeContext);
const handleClick = () => {
// change the context values to
// style: 'dark'
// visible: false
}
return (
<div>
<p>
The theme is <em>{style}</em> and state of visibility is
<em> {visible.toString()}</em>
</p>
<button onClick={handleClick}>Change Theme</button>
</div>
)
};
function App() {
return <Content />
};
const rootElement = document.getElementById('root');
ReactDOM.render(<App />, rootElement);</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><div id="root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.8.2/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.2/umd/react-dom.production.min.js"></script></code></pre>
</div>
</div>
</p>
| <javascript><reactjs><react-hooks><react-context> | 2019-02-17 23:31:21 | HQ |
54,738,696 | Ruby Array Merge Method | How can I merge two `arrays` like a `set` with no duplicates? I'm looking for a method. The `pipe` method ('|') is what I want, and it's described in documentation as `Array.union(another_array)` in version `2.5.1`, but it throws an error.
a = [1,2,3]
b = [3,4,5]
p a|b # => [1, 2, 3, 4, 5] what I want
puts
p a & b # => [3] intersection
puts
p a + b # => [1, 2, 3, 3, 4, 5] this is a push
puts
p a.union(b) # => undefined method `union' for [1, 2, 3]:Array (NoMethodError)
Is there such a written method for a `union`? | <arrays><ruby> | 2019-02-17 23:32:56 | LQ_EDIT |
54,739,854 | nice way to loop all 3 numbers of python list | let say I have a list A = [1,2,3,4]<br/>
I want to show the list [1,2,3] , [2,3,4] <br/> then here is my solution<br/>
A= [5, 3, 3]
def solution(A):
A.sort()
#print(A)
for i in range(0,len(A)-2):
if i+3 <= len(A):
part = A[i:i+3]
if part[0] + part[1] > part[2]:
print(part)
return 1
I used if i+3 <= len(A):
condition to check length overflow. but I do not like <br/>
is there other nicer way to represent? | <python><list> | 2019-02-18 02:52:41 | LQ_EDIT |
54,740,898 | Registration form will no longer appear after register in android studio | How create a registration that after you register it wil no longer appear in the next open of the application?
Pls help , i need it in our next class , thank you so much for your responding | <android> | 2019-02-18 05:21:39 | LQ_EDIT |
54,740,947 | Node JS addons - NAN vs N-API? | <p>I am looking to working on a project using node js addons with C++. I came across two abstract library NAN and N-API that I can use. However I am unable to decide which one I should use. I was not able to find proper comparison between these two libraries.</p>
<p>What are the pros, cons and differences of both? How to choose between them?</p>
<p>So far I have found that NAN has more online tutorials/articles regarding async calls. But N-API is officially supported by Node (and was created after NAN as a better alternative, although not sure.)</p>
| <node.js><node.js-addon> | 2019-02-18 05:28:37 | HQ |
54,743,477 | Java scripts do not work in HTML email templates | I need to send an email using php, which could be easily done using SMTP, but the challenge is to embed a web service in the html mail, which is why I used java scripts in the body of the message to access the Web service when a button click is triggered. | <javascript><php><gmail> | 2019-02-18 08:53:24 | LQ_EDIT |
54,744,439 | Timeout expired after calling stocked procedure | I keep getting this error after the calling the stored procedure on mysql database :
"MySql.Data.MySqlClient.MySqlException (0x80004005): Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.TimeoutException: Timeout in IO operation"
I know that the problem is related to the query it takes to long to execute so my question is this query it is good ? is there another way to improve this stocked procedure :
CREATE DEFINER=`mysql`@`%` PROCEDURE `UpadtePriceToCalibre`(IN Dos int(6), IN Var varchar(50), IN PRIX double(10,4) , IN Cal int(6))
BEGIN
insert into xxpch
select `NuméroDossier`,`NuméroLot`,`Variété`,`Client`,`NF`,`Calibre`,`PrixKg`,PRIX,`NetFacture`,(PRIX * PoidNet),NOW()
from detaildossier
where NuméroDossier = Dos AND Variété LIKE CONCAT('%',Var,'%') AND Calibre= Cal;
update detaildossier
SET PrixKg = PRIX
, NetFacture = (PRIX * PoidNet)
, PrixColis = (( PoidNet / NombreColis) * PRIX)
WHERE NuméroDossier = Dos AND Variété LIKE CONCAT('%',Var,'%') AND Calibre= Cal;
update aff_e ,cpv_d
set aff_e.netcpv =(select sum(cpv_d.prxtot) from cpv_d where cpv_d.numdos = Dos AND cpv_d.numlot = aff_e.numlot)
,aff_e.mntvnt =(select sum(cpv_d.prxtot) from cpv_d where cpv_d.numdos = Dos AND cpv_d.numlot = aff_e.numlot)
where aff_e.numdos = Dos AND cpv_d.numlot = aff_e.numlot;
END
| <c#><mysql> | 2019-02-18 09:50:18 | LQ_EDIT |
54,744,707 | SQL between-statement | <p>In SQL I want to call all prices between 3 and 4. I entered the next code that doesn't work. What do I need to do to make it work?</p>
<p>code </p>
<pre><code>SELECT * FROM `album` WHERE `prijs` BETWEEN 3 en AND 4
</code></pre>
| <sql> | 2019-02-18 10:04:50 | LQ_CLOSE |
54,745,085 | Java Optional: map to string from boolean | I'd like to re-write this code using `Optional`-like code:
private Order buildOrder(String field) {
if (field.startsWith("-")) {
return Order.desc(field.substring(1));
}
else {
return Order.asc(field);
}
}
Up to now, I've been able to code that:
private Order buildOrder(String field) {
return Optional.of(field.startsWith("-"))
.filter(Boolean::booleanValue)
.map(() -> field.substring(1)) <<<<1>>>>
.orElse(field)
.map(Order.desc(field.substring(1)))
.orElse(Order.asc(field));
}
But I'm getting this compilation error on `<<<<1>>>>`:
> Lambda expression's signature does not match the signature of the functional interface method `apply(? super Boolean)`
> Type mismatch: cannot convert from `String` to `? extends U` | <java><java-8><optional> | 2019-02-18 10:25:33 | LQ_EDIT |
54,745,183 | How to Hide and show RelativeLayout header on scroll webview in android? | Actually, I have webView with custom relative layout header, and when we scroll up webView header should be hidden and when i scroll down header should be visible. plz suggest me if anyone have idea about it. | <android> | 2019-02-18 10:29:59 | LQ_EDIT |
54,748,977 | Asyncronous texture object allocation in multi-GPU code | I have some code for texture object allocation and Host to Device copy. It is just a modification of the answer [here](https://stackoverflow.com/questions/53524944/array-of-cudaarray-for-multi-gpu-texture-code). I do not explicitly use streams, just `cudaSetDevice()`
This code works fine, however, when I run the Visual Profiler, I can see that the memory copies from Host to Array are not asynchronous. They are allocated each to their own device stream, but the second one does not start until the first one finishes (running on 2 GPUs). I have tried it with large images, so I make certain that its not overhead from CPU.
My guess is that there is something in the code that requires to be synchronous thus halts the CPU, but I don't know what. What can I do to make this loop asynchronous?
void CreateTexture(int num_devices,const float* imagedata, int nVoxelX, int nVoxelY, int nVoxelZ ,cudaArray** d_cuArrTex, cudaTextureObject_t *texImage)
{
//size_t size_image=nVoxelX*nVoxelY*nVoxelZ;
for (unsigned int i = 0; i < num_devices; i++){
cudaSetDevice(i);
//cudaArray Descriptor
const cudaExtent extent = make_cudaExtent(nVoxelX, nVoxelY, nVoxelZ);
cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc<float>();
//cuda Array
cudaMalloc3DArray(&d_cuArrTex[i], &channelDesc, extent);
cudaCheckErrors("Texture memory allocation fail");
cudaMemcpy3DParms copyParams = {0};
//Array creation
copyParams.srcPtr = make_cudaPitchedPtr((void *)imagedata, extent.width*sizeof(float), extent.width, extent.height);
copyParams.dstArray = d_cuArrTex[i];
copyParams.extent = extent;
copyParams.kind = cudaMemcpyHostToDevice;
cudaMemcpy3DAsync(©Params);
cudaCheckErrors("Texture memory data copy fail");
//Array creation End
cudaResourceDesc texRes;
memset(&texRes, 0, sizeof(cudaResourceDesc));
texRes.resType = cudaResourceTypeArray;
texRes.res.array.array = d_cuArrTex[i];
cudaTextureDesc texDescr;
memset(&texDescr, 0, sizeof(cudaTextureDesc));
texDescr.normalizedCoords = false;
texDescr.filterMode = cudaFilterModePoint;
texDescr.addressMode[0] = cudaAddressModeBorder;
texDescr.addressMode[1] = cudaAddressModeBorder;
texDescr.addressMode[2] = cudaAddressModeBorder;
texDescr.readMode = cudaReadModeElementType;
cudaCreateTextureObject(&texImage[i], &texRes, &texDescr, NULL);
cudaCheckErrors("Texture object creation fail");
}
}
| <cuda> | 2019-02-18 14:01:34 | LQ_EDIT |
54,749,286 | what is the role of bins to plot an histogram? | I want to an histogram. When I plot it with `bins=80` or `auto`. My code works correctly. But when I try to plot it with `bins=100`. It does not work with giving me this error:
"{!r} is not a valid estimator for `bins`".format(bin_name))
ValueError: '100' is not a valid estimator for `bins`
This is my code:
import matplotlib.pyplot as plt
x= [81.70900202536467, 81.69066539803865, 81.9634647036723, 81.6886583191991, 81.70063595809025, 81.71279936786232, 81.6846428541525]
plt.hist(x,bins='100')
plt.hist(x)
plt.show()
What is the role of bins with histogram? how to choose the suitable bins value for my data? | <python><matplotlib><histogram> | 2019-02-18 14:20:19 | LQ_EDIT |
54,749,588 | Continue inside multi thread throws error | I am threading a time consuming for-loop and executing them inside N number of threads. A continue statement is throwing error
Getting the error "Continue cannot be used outside of a loop"
for (final Message m : messagelistholder.getMessage()) {
Callable<Void> tasksToExecute=new Callable<Void>() {
public Void call() {
if (guidanceonly1 == true && !QuoteUtil.isECPQuote(list.get(0))) {
String msg = "Message From " + m.getSource() + " when retrieving Guidance values: "
+ m.getDescription();
String lcladdStatusMessages = CommonUtil.getLoclizedMsg(
"PRCE_LNE_ITM_MSG_FRM_WHN_RETRVNG_GUIDNCE_VAL",
new String[] { m.getSource(), m.getDescription() }, msg);
list.get(0).addStatusMessages("Info", lcladdStatusMessages);
}
else if ("Error".equalsIgnoreCase(m.getSeverity())) {
if (m.getCode().indexOf("_NF") > 0) {
continue; // price not found due to private sku
}
if ("Eclipse".equalsIgnoreCase(m.getSource())) {
String msg1 = "Please check Sold To customer data. ";
String lcladdStatusMessages1 = CommonUtil
.getLoclizedMsg("PRCE_LNE_ITM_PLS_CHK_SLDTO_CUST_DTA", null, msg1);
String msg2 = "Discount information may not be returned from Optimus due to "
+ m.getSeverity() + " From " + m.getSource() + " " + m.getDescription();
String lcladdStatusMessages2 = CommonUtil.getLoclizedMsg(
"PRCE_LNE_ITM_DSCNT_INFO_MNT_RTRND_FRM_OPTMS_DUETO_FRM",
new String[] { m.getSeverity(), m.getSource(), m.getDescription() }, msg2);
list.get(0).addStatusMessages(m.getSeverity(),
(m.getDescription().contains("MDCP") ? lcladdStatusMessages1 : "")
+ lcladdStatusMessages2);
} else {
if (response1.getItems() == null) {
String lcladdStatusMessages = CommonUtil.getLoclizedMsg("PRCE_LNE_ITM_OPTMS_ERR",
new String[] { m.getSource(), m.getDescription() }, m.getDescription());
list.get(0).addStatusMessages("Error", lcladdStatusMessages);
list.get(0).setOptimusError(true);
} else {
if(!QuoteUtil.isECPQuote(list.get(0))){
String lcladdStatusMessages = CommonUtil.getLoclizedMsg(
"PRCE_LNE_ITM_MSG_FRM_WHN_RETRVNG_GUIDNCE_VAL",
new String[] { m.getSource(), m.getDescription() },
"Message From " + m.getSource() + " " + m.getDescription());
list.get(0).addStatusMessages("Info", lcladdStatusMessages);
list.get(0).setOptimusError(true);
}
}
}
}
if (list.get(0).getFlags().get(QtFlagType.ESCALATIONFORPARTNER) != null) {
list.get(0).getFlags().get(QtFlagType.ESCALATIONFORPARTNER).setFlgVl(null);
}
if (m.getCode() != null) {
String pricingServiceMsgCode = m.getCode();
String pricingServiceSeverity = m.getSeverity();
Map<Integer, AutoEscalationScenario> categoryMap;
if (StringUtils.equals("ERROR", pricingServiceSeverity)) {
categoryMap = getScenario("SEVERITY", globalAccount1, null, true, null);
if (categoryMap.size() != 0) {
finalCategorylist.get(0).putAll(categoryMap);
}
}
if(partnerExclusivityAutoEscalation1){
categoryMap = getScenario(pricingServiceMsgCode, globalAccount1, null, true, null);
if (categoryMap != null && categoryMap.size() != 0) {
finalCategorylist.get(0).putAll(categoryMap);
}
}
}
return null;
}
};
runnableTasks.add(tasksToExecute);
}
Can someone help me to skip the particular loop for the speicified condition but without using continue statement since it throws error. | <java><continue> | 2019-02-18 14:36:54 | LQ_EDIT |
54,751,785 | How can i get the values of id2 using vba excel? | <?xml version="1.0" encoding="utf-16"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<id xmlns="id.services/">
<ids1>
<response xmlns="">`enter code here`
<ids xmlns="ids">
<Id-info id0="123" id1="0" id2="2345" xmlns=""></Id-info>
<Id-info id0="456" id1="1" id2="6789" xmlns=""></Id-info>
</ids>
</response>
</ids1>
</id>
</s:Body>
</s:Envelope>
I tried:--
Dim xmlDoc As DOMDocument30
Set xmlDoc = New DOMDocument30
xmlDoc.Load ("C:test.xml")
Dim id As String
id = xmlDoc.SelectSingleNode("//ids/Id-info").Attributes.getNamedItem("id2").Text | <excel><vba><xml-parsing> | 2019-02-18 16:42:40 | LQ_EDIT |
54,751,798 | Session variables in PHP not appearing | <p>I have read all the questions concerning this but I'm still at a loss.
Using a test script like this</p>
<pre><code>// PAGE 1
<?php session_start();
echo var_dump($_SESSION) . "<br>";
$_SESSION[‘session_var’] = "stuff";
$PHPSESSID = session_id();
echo session_id() . "<br>";
?>
<html>
<head><title>Testing Sessions page 1</title></head> <body>
<p>This is a test of the sessions feature.
<form action="sessionTest2.php" method="POST">
<input type= "text" name= "form_var" value= "testing">
<input type= "submit" value= "Go to Next Page"> </form>
</body>
</html>
//PAGE 2
<?PHP session_start();
echo var_dump($_SESSION);
$session_var = $_SESSION['session_var'];
$form_var = $_POST['form_var'];
echo "session_var =" . $session_var. "</br>";
echo "form_var =" . $form_var. "<br>";
$PHPSESSID = session_id();
echo session_id();
?>
</code></pre>
<p>the results I get in page 2 are</p>
<pre><code>array(1) { ["‘session_var’"]=> string(5) "stuff" } session_var =
form_var =testing
al89u6vu02lstp99cs4damdn04
</code></pre>
<p>As you can see the variable session_var can be seen in the array but is not being output to the screen where expected, and yes session_start() is at the very top of both pages.</p>
<p>Any ideas what may be wrong</p>
| <php><session> | 2019-02-18 16:43:32 | LQ_CLOSE |
54,752,056 | code not finished but whenever I try to run the code all I see is a black screen I dont see any of the lines or the x drawings that I made? | I'm creating a tic tac toe game in open gl Im not finished yet but whenever I run my code all I see is a black screen I do not see the lines that I have drawn or the X?
#include<stdlib.h>
#include<math.h>
#include<time.h>
#include<string.h>
#include <GLut/glut.h>
using namespace std;
int matrix [3][3]; // board for the gameplay of tic tac toe we are using a 3x3 matrix board
int turn; // indicates whose turn it is going to be
bool gameover; // is the game over would you like to end the game
int result;// the ending result of the game
void begin()
{
turn=1;
for(int i=0;i<3;i++) // setting up the board and clearing the matrix we start at 1, basically clearing our matrix
{
for(int j=0;j<3;j++)
matrix[i][j]=0;
}
}
void drawxo() // setting up our X and O if it is 1 then we want to use x and if it is 2 then 0
{
for(int i = 0; i <= 2; i++)
{
for(int j = 0; j <= 2; j++)
{
if(matrix[i][j] == 1) //if it is 1 then draw x
{
glBegin(GL_LINES);
glVertex2f(50 + j * 100 - 25, 100 + i * 100 - 25);
glVertex2f(50 + j * 100 + 25, 100 + i * 100 + 25);
glVertex2f(50 + j * 100 - 25, 100 + i * 100 + 25);
glVertex2f(50 + j * 100 + 25, 100 + i * 100 - 25);
glEnd();
}
else if(matrix[i][j] == 2) //if it is 2 then draw o
{
glBegin(GL_LINE_LOOP);
glVertex2f(50 + j * 100 - 25, 100 + i * 100 - 25);
glVertex2f(50 + j * 100 - 25, 100 + i * 100 + 25);
glVertex2f(50 + j * 100 + 25, 100 + i * 100 + 25);
glVertex2f(50 + j * 100 + 25, 100 + i * 100 - 25);
glEnd();
}
}
}
}
void DrawString(void *font,const char s[],float x,float y)
{
unsigned int i;
glRasterPos2f(x,y);
for(i=0;i<strlen(s);i++)
{
glutBitmapCharacter(font,s[i]);
}
}
void drawLines()
{
glBegin(GL_LINES);
glColor3f(0, 0, 0);
//2 vertical lines
glVertex2f(100, 50);
glVertex2f(100, 340);
glVertex2f(200, 340);
glVertex2f(200, 50);
//2 horizontal lines
glVertex2f(0, 150);
glVertex2f(300, 150);
glVertex2f(0, 250);
glVertex2f(300, 250);
glEnd();
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(1, 1, 1, 1);
glColor3f(0, 0, 0);
if(turn == 1)
DrawString(GLUT_BITMAP_HELVETICA_18, "Player1's turn", 100, 30);
drawxo();
drawLines();
glutSwapBuffers();
}
void KeyPress(unsigned char key, int x, int y)
{
switch (key)
{
case 27: // the escape key to exit the program
exit (0);
break;
case 'y':
if (gameover = true) {
gameover = false;
begin();
}
break;
case 'n' :
if (gameover = true) {
exit(0);
}
break;
}
}
int main(int argc, char **argv)
{
begin();
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGB|GLUT_DOUBLE);
glutInitWindowPosition(550,200);
glutInitWindowSize(300,350);
glutCreateWindow("Tic tac toe");
glutDisplayFunc(display);
glutKeyboardFunc(KeyPress);
glutIdleFunc(display);
glutMainLoop();
}
| <c++><opengl><glut> | 2019-02-18 16:57:37 | LQ_EDIT |
54,752,540 | How to print i and i+1 in for-loop in android? | I have an array full of names. Im using a for-loop to print my names but the problem is that i want to print 2 names: i(the name) and i+1(the next name). you may not get what i said, look at my code:
My code:
=======
"text" is my textview and "people" is the array:
for (int i=0; i< people.size(); i = i+2) {
text.append(people.get(i) + " with " + people.get(i+1));
}
## the problem is it prints this: ##
(these are the names in the array : "Kim","John","Sam","Edison")
Kim with Kim Sam with Sam
### instead of this : ###
Kim with John Sam with Edison
| <android><for-loop> | 2019-02-18 17:32:54 | LQ_EDIT |
54,754,003 | splitting a list of integers into sublists given 0 as separator - python | I have this list of integer
l = [6, 6, 0, 5, 4, 5, 0, 0, 4, 6]
and I would have to generate this list
res = [[6, 6], [5, 4, 5] , [4, 6]]
Thank you in advance! | <python><list> | 2019-02-18 19:21:34 | LQ_EDIT |
54,755,202 | Average of first and last variable | <p><a href="https://i.stack.imgur.com/TEkoN.png" rel="nofollow noreferrer">Sample Data</a></p>
<p>The highlighted color is the first and the last of each customer ID how do I use R code to do this and below is the answer expected</p>
<p><a href="https://i.stack.imgur.com/quZLQ.png" rel="nofollow noreferrer">Answer expected</a></p>
| <r> | 2019-02-18 20:54:04 | LQ_CLOSE |
54,755,893 | I have an ArrayIndexOutOfBoundsExeption error can someone help me fix it please | <p>This error keeps occurring Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 131071</p>
<p>I'm trying to create an array of 131071 integers with no duplicates.</p>
<pre><code>public class array {
public static void main(String[] args) {
populateArray();
}
public static void populateArray(){
int [] numbers = new int [131071];
int k = 0;
Random r = new Random();
for (int i = 0; i < 131070 ; i++) {
int random=r.nextInt(13071)+1;
for (int h = 0; h <= i; h++) {
if (random != numbers[h]) {
numbers [k] = random;
k=k+1;
}
}
}
for (int j = 0; j < 131071; j++) {
Arrays.sort(numbers);
System.out.println(numbers[j]);
}
}
}
</code></pre>
| <java><arrays> | 2019-02-18 21:50:09 | LQ_CLOSE |
54,756,500 | Is there an x86/x86_64 instruction which zeros all bits below the Most Significant Bit? | So for the following sequence:
0001000111000
The desired result would be:
0001000000000
I am fully aware that this is achievable by finding the MSB's index with assembly BSRL (or similar bit-twiddling hack) then >> bitshifting the number by (index - 1), then << shifting back by (index - 1),
but I want to know whether there is, specifically, an assembly instruction, Not a Bit-twiddle, that can do this.
Thanks | <c++><performance><assembly><x86><bit-manipulation> | 2019-02-18 22:48:12 | LQ_EDIT |
54,757,465 | how to convert keys values map to slice of int | <p>i'm trying to convert key-value map to slice of 2 value, for example :</p>
<pre><code>slices := make(map[int64]int64)
slices[int64(521)] = int64(4)
slices[int64(528)] = int64(8)
// how do i convert that to become
// [[521, 4], [528, 8]]
</code></pre>
<p>i'm thinking about each all those key-value then create slice for that, but is there any simple code to do that ?</p>
| <go><slice> | 2019-02-19 00:58:58 | LQ_CLOSE |
54,759,052 | I'm calculating the avrage of scores in a dictionary, but returns error and I don't know exactly what's the error, help please | [I'm calculating the average of scores in a dictionary, but returns an error and I don't know exactly what's the error, help please ][1]
[1]: https://i.stack.imgur.com/jXUZ2.png | <python> | 2019-02-19 04:52:27 | LQ_EDIT |
54,760,785 | How to get user input and output it onto the web page | <p>I am trying to create a program where I ask the user for two numeric inputs and then output to the web page the value of those two numbers when added together (show something like 1 + 2 = 3) and then display those two numbers multiplied together (1 * 2 = 2). Sample output should look something like the following but based on the input received from the website user:</p>
<p>1 + 2 = 3</p>
<p>1 * 2 = 2 </p>
| <javascript><input><output> | 2019-02-19 07:26:13 | LQ_CLOSE |
54,760,888 | error: non-static variable average cannot be referenced from a static context | <p>Write a program to input marks of three subjects for a student and calculate the average marks.
In your class.
a) Include a constructor to initialize the three marks to 0
b) Include a method to calculate and store the average
c) Include a method to display the student ID,name and the average marks of the student</p>
<pre><code>import java.util.Scanner;
public class Main{
int mark1;
int mark2;
int mark3;
float total;
float average;
public Main(){
int mark1=50;
int mark2=60;
int mark3=70;
float total=0;
float average=0;
}
public static void main(String args[]){
Main myb = new Main();
Scanner my = new Scanner(System.in);
System.out.println("Enter marks for First subject");
int marks1 = my.nextInt();
System.out.println("Enter marks for Second subject");
int marks2 = my.nextInt();
System.out.println("Enter marks for Third subject");
int marks3 = my.nextInt();
total = marks1+marks2+marks3;
average = total/3;
System.out.println("Total is "+myb.total);
System.out.println("Total is "+myb.average);
/*Student stud1=new Student("IT9087567","Kamal",50,60,70);
stud1.showDetail();*/
}
}
</code></pre>
| <java><constructor> | 2019-02-19 07:33:03 | LQ_CLOSE |
54,761,464 | How to use if-else condition on gitlabci | <p>How to use if else condition inside the gitlab-CI.</p>
<p>I have below code:</p>
<pre><code>deploy-dev:
image: testimage
environment: dev
tags:
- kubectl
script:
- kubectl apply -f demo1 --record=true
- kubectl apply -f demo2 --record=true
</code></pre>
<p>Now I want to add a condition something like this</p>
<pre><code>script:
- (if [ "$flag" == "true" ]; then kubectl apply -f demo1 --record=true; else kubectl apply -f demo2 --record=true);
</code></pre>
<p>Could someone provide the correct syntax for the same? Is there any documentation for the conditions (if-else, for loop) in gitlabci?</p>
| <if-statement><gitlab-ci> | 2019-02-19 08:11:06 | HQ |
54,763,387 | Android Configuration with name 'kapt' not found | <p>I'm trying to use <code>Realm</code> database on my project i add</p>
<pre><code>classpath "io.realm:realm-gradle-plugin:5.9.0"
</code></pre>
<p>to <code>build.gradle</code></p>
<p>and </p>
<pre><code>apply plugin: 'realm-android'
</code></pre>
<p>to module <code>build.gradle</code>, after click on sync i get this error:</p>
<pre><code>Configuration with name 'kapt' not found.
</code></pre>
<p><code>build.gradle</code> content:</p>
<pre><code>buildscript {
ext.kotlin_version = '1.3.21'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
classpath 'com.novoda:bintray-release:0.9'
classpath "io.realm:realm-gradle-plugin:5.9.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
</code></pre>
<p><code>build.gradle</code> module content:</p>
<pre><code>apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.jakewharton.hugo'
apply plugin: 'com.novoda.bintray-release'
apply plugin: 'realm-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 28
defaultConfig {
applicationId "xx.xxxxx.xxxxxxxx"
minSdkVersion 21
versionCode 1
versionName "1"
vectorDrawables.useSupportLibrary = true
multiDexEnabled = true
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath false
}
}
}
dataBinding {
enabled = true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/rxjava.properties'
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
/* IMPORTANT :
* Be careful when update dependencies, different version library may caused error */
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:support-v13:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
// google maps library ------------------------------------------------------------------------
implementation 'com.google.android.gms:play-services:12.0.1'
// google gson --------------------------------------------------------------------------------
implementation 'com.google.code.gson:gson:2.8.4'
// third party dependencies
implementation 'com.github.smart-fun:TabStacker:1.0.4'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'org.jetbrains:annotations-java5:15.0' // add this line
implementation 'com.fatboyindustrial.gson-jodatime-serialisers:gson-jodatime-serialisers:1.2.0'
implementation 'com.github.armcha:AutoLinkTextView:0.3.0'
implementation "com.github.bumptech.glide:glide:4.8.0"
annotationProcessor "com.github.bumptech.glide:compiler:4.8.0"
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.4'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.2.0'
implementation 'com.google.dagger:dagger:2.15'
annotationProcessor 'com.google.dagger:dagger-compiler:2.10'
implementation 'com.google.dagger:dagger-android:2.15'
implementation 'com.google.dagger:dagger-android-support:2.10'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.10'
implementation 'com.google.code.gson:gson:2.8.4'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation('io.socket:socket.io-client:1.0.0') {
exclude group: 'org.json', module: 'json'
}
implementation 'com.birbit:android-priority-jobqueue:2.0.1'
implementation 'com.github.onehilltech.concurrent:concurrent-android:0.8.1'
implementation 'com.balysv.materialmenu:material-menu:2.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
implementation 'com.blankj:utilcode:1.22.10'
implementation 'com.ncapdevi:frag-nav:3.0.0'
implementation 'com.daimajia.easing:library:1.0.0@aar'
implementation 'com.daimajia.androidanimations:library:1.1.2@aar'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'org.parceler:parceler-api:1.1.8'
annotationProcessor 'org.parceler:parceler:1.1.8'
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.3.0'
implementation 'com.pnikosis:materialish-progress:1.7'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation project(path: ':bottomsheet-commons')
implementation 'org.jsoup:jsoup:1.9.2'
kapt "io.realm:realm-annotations-processor:5.9.0"
}
kapt {
correctErrorTypes = true
}
repositories {
mavenCentral()
}
configurations {
cleanedAnnotations
compile.exclude group: 'org.jetbrains', module: 'annotations'
}
</code></pre>
| <android> | 2019-02-19 09:57:12 | HQ |
54,764,081 | Google dataflow streaming pipeline is not distributing workload over several workers after windowing | <p>I'm trying to set up a dataflow streaming pipeline in python. I have quite some experience with batch pipelines. Our basic architecture looks like this:
<a href="https://i.stack.imgur.com/OXB4O.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OXB4O.png" alt="enter image description here"></a></p>
<p>The first step is doing some basic processing and takes about 2 seconds per message to get to the windowing. We are using sliding windows of 3 seconds and 3 second interval (might change later so we have overlapping windows). As last step we have the SOG prediction that takes about 15ish seconds to process and which is clearly our bottleneck transform.</p>
<p>So, The issue we seem to face is that the workload is perfectly distributed over our workers before the windowing, but the most important transform is not distributed at all. All the windows are processed one at a time seemingly on 1 worker, while we have 50 available.</p>
<p>The logs show us that the sog prediction step has an output once every 15ish seconds which should not be the case if the windows would be processed over more workers, so this builds up huge latency over time which we don't want. With 1 minute of messages, we have a latency of 5 minutes for the last window. When distribution would work, this should only be around 15sec (the SOG prediction time). So at this point we are clueless..</p>
<p><a href="https://i.stack.imgur.com/5AEmD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5AEmD.png" alt="enter image description here"></a></p>
<p>Does anyone see if there is something wrong with our code or how to prevent/circumvent this?
It seems like this is something happening in the internals of google cloud dataflow. Does this also occur in java streaming pipelines?</p>
<p>In batch mode, Everything works fine. There, one could try to do a reshuffle to make sure no fusion etc occurs. But that is not possible after windowing in streaming.</p>
<pre><code>args = parse_arguments(sys.argv if argv is None else argv)
pipeline_options = get_pipeline_options(project=args.project_id,
job_name='XX',
num_workers=args.workers,
max_num_workers=MAX_NUM_WORKERS,
disk_size_gb=DISK_SIZE_GB,
local=args.local,
streaming=args.streaming)
pipeline = beam.Pipeline(options=pipeline_options)
# Build pipeline
# pylint: disable=C0330
if args.streaming:
frames = (pipeline | 'ReadFromPubsub' >> beam.io.ReadFromPubSub(
subscription=SUBSCRIPTION_PATH,
with_attributes=True,
timestamp_attribute='timestamp'
))
frame_tpl = frames | 'CreateFrameTuples' >> beam.Map(
create_frame_tuples_fn)
crops = frame_tpl | 'MakeCrops' >> beam.Map(make_crops_fn, NR_CROPS)
bboxs = crops | 'bounding boxes tfserv' >> beam.Map(
pred_bbox_tfserv_fn, SERVER_URL)
sliding_windows = bboxs | 'Window' >> beam.WindowInto(
beam.window.SlidingWindows(
FEATURE_WINDOWS['goal']['window_size'],
FEATURE_WINDOWS['goal']['window_interval']),
trigger=AfterCount(30),
accumulation_mode=AccumulationMode.DISCARDING)
# GROUPBYKEY (per match)
group_per_match = sliding_windows | 'Group' >> beam.GroupByKey()
_ = group_per_match | 'LogPerMatch' >> beam.Map(lambda x: logging.info(
"window per match per timewindow: # %s, %s", str(len(x[1])), x[1][0][
'timestamp']))
sog = sliding_windows | 'Predict SOG' >> beam.Map(predict_sog_fn,
SERVER_URL_INCEPTION,
SERVER_URL_SOG )
pipeline.run().wait_until_finish()
</code></pre>
| <google-cloud-dataflow><apache-beam> | 2019-02-19 10:31:25 | HQ |
54,764,385 | what dose @param notation in javaScript | <pre><code>/**
* Create mulit signature wallet function
* @param account {String} account name
* @returns {String} Return multisig wallet address
*/
const createMultiSigWallet = async(account) => {
if (!account) throw new Error('Account name is required.');
let keys = [];
await keys.push(await creat`enter code here`eWallet());
await keys.push(await createWallet());
//keys.toString();`enter code here`
//console.log(client.execute('addmultisigaddress', [2, keys, account]));
return client.execute('addmultisigaddress', [2, keys, account]);
};
</code></pre>
<p>it is function of node.js what does mean @param in javascript </p>
| <javascript> | 2019-02-19 10:46:13 | LQ_CLOSE |
54,766,454 | Use Derived/Temporary column in Where Clause | <p>Here Is my query. The Issue is that I am trying to apply the derived 'LineNo' field as the where clause. The query below does not work. Simply put, if the Value of a LineHrs column is > 0 it will set this derived column to a given value (eg If Line5Hrs = 1.4 then 'LineNo' for the row = 'Line 5'). I want to use this value to search for all jobs on a specific line.</p>
<pre><code>SELECT tblA.PROJECT_ID,
tblB.Line1Hrs,
tblB.Line2Hrs,
tblB.Line3Hrs,
tblB.Line4Hrs,
tblB.Line5Hrs,
tblB.Line6Hrs,
tblB.Line7Hrs,
"LineNo" =
CASE
WHen tblB.Line1Hrs > 0 Then 'Line1'
WHen tblB.Line2Hrs > 0 Then 'Line2'
WHen tblB.Line3Hrs > 0 Then 'Line3'
WHen tblB.Line4Hrs > 0 Then 'Line4'
WHen tblB.Line5Hrs > 0 Then 'Line5'
WHen tblB.Line6Hrs > 0 Then 'Line6'
WHen tblB.Line7Hrs > 0 Then 'Line7'
End
FROM tblA INNER JOIN tblB
ON tblA.blah = tblB.blah AND
tblA.blab = tblB.blab
WHERE LineNo = 'Line5'
</code></pre>
| <sql><sql-server><tsql><derived-column> | 2019-02-19 12:32:46 | LQ_CLOSE |
54,766,725 | Android Firebase Remote Config: Application name is not set. Call Builder#setApplicationName | <p>Whenever I call <code>FirebaseRemoteConfig.getInstance()</code>, I get this warning:</p>
<p><code>W/zze: Application name is not set. Call Builder#setApplicationName.</code></p>
<p>I've updated the json config file from Firebase, but it remains the same. It does not affect any functionality, but I can't help but think something is missing. Any configurations I might be missing somewhere?</p>
| <android><firebase><firebase-remote-config> | 2019-02-19 12:46:56 | HQ |
54,770,007 | Cannot convert decimal(4,2) to decimal(10,2) | <p>I have <a href="https://i.stack.imgur.com/YI0a5.png" rel="nofollow noreferrer">this field in my table.</a>
I need to make it decimal(10,2), but when I tried to do it, <a href="https://i.stack.imgur.com/8y8iv.png" rel="nofollow noreferrer">I receive an error</a>.</p>
| <mysql><sql> | 2019-02-19 15:41:31 | LQ_CLOSE |
54,770,830 | Unable to find testhost.dll. Please publish your test project and retry | <p>I have a simple dotnet core class library with a single XUnit test method:</p>
<pre><code>TestLib.csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.SDK" Version="15.9.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.console" Version="2.4.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="xunit.runners" Version="2.0.0" />
</ItemGroup>
</Project>
BasicTest.cs:
using Xunit;
namespace TestLib
{
public class BasicTest
{
[Fact(DisplayName = "Basic unit test")]
[Trait("Category", "unit")]
public void TestStringHelper()
{
var sut = "sut";
var verify = "sut";
Assert.Equal(sut, verify);
}
}
}
</code></pre>
<p>If I enter the project on the CLI and type <code>dotnet build</code> the project builds. If I type <code>dotnet test</code> I get this:</p>
<pre><code>C:\git\Testing\TestLib> dotnet test
C:\git\Testing\TestLib\TestLib.csproj : warning NU1701: Package 'xunit.runner.visualstudio 2.4.1' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
Build started, please wait...
C:\git\Testing\TestLib\TestLib.csproj : warning NU1701: Package 'xunit.runner.visualstudio 2.4.1' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
Build completed.
Test run for C:\git\Testing\TestLib\bin\Debug\netstandard2.0\TestLib.dll(.NETStandard,Version=v2.0)
Microsoft (R) Test Execution Command Line Tool Version 16.0.0-preview-20181205-02
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
Unable to find C:\git\Testing\TestLib\bin\Debug\netstandard2.0\testhost.dll. Please publish your test project and retry.
Test Run Aborted.
</code></pre>
<p>What do I need to change to get the test to run?</p>
<p>If it helps, VS Code is not displaying the tests in its test explorer, either.</p>
| <c#><unit-testing><.net-core><xunit.net> | 2019-02-19 16:26:20 | HQ |
54,770,983 | Most efficient Rails query method | <p>I've been looking into a few ways of writing efficient ActiveRecord queries and I thought I might put it out to gather a consensus on who thinks what might be best.</p>
<pre><code>@page = @current_shop.pages.where(state: "home").first
</code></pre>
<p>At the moment, I've surmised that find_by_sql might be the best route?</p>
| <mysql><ruby-on-rails><activerecord> | 2019-02-19 16:35:59 | LQ_CLOSE |
54,774,789 | Add a function to a button made with userscript | <p>I know how to create a button with userscript, but I don't know how to attach a function to the button with userscript. How do I attach a function to the button with userscript? I would also like to add an "id" to the button with userscript. How do I do that? Thanks. </p>
<pre><code>var button = document.createElement("BUTTON"); // Create a <button> element
var text = document.createTextNode("CLICK ME"); // Create a text node
button.appendChild(text); // Append the text to <button>
document.body.appendChild(button);
function clickMe() {
alert("Hi");
} //end of function clickMe()
</code></pre>
| <javascript><function><button><userscripts> | 2019-02-19 20:56:45 | LQ_CLOSE |
54,775,097 | Formatting a Duration like HH:mm:ss | <p>Is there a good way to format a Duration in something like hh:mm:ss, without having to deal with time zones?</p>
<p>I tried this:</p>
<pre><code>DateTime durationDate = DateTime.fromMillisecondsSinceEpoch(0);
String duration = DateFormat('hh:mm:ss').format(durationDate);
</code></pre>
<p>But I always get 1 hour to much, in this case it would say <code>01:00:00</code></p>
<p>And When I do this:</p>
<pre><code>Duration(milliseconds: 0).toString();
</code></pre>
<p>I get this: <code>0:00:00.000000</code></p>
| <dart><flutter> | 2019-02-19 21:21:21 | HQ |
54,776,499 | Drawing route direction between two locations using Google Map Swift 4.0 | <p>I am having trouble rendering the JSON response onto the map.
I am trying to make an app that you can enter in the a destination and google maps will make a route based on your current location.</p>
<p>I successfully can print out the JSON response in the console</p>
<p>But I am unsure as to how I can make a route using a polyline.</p>
<p>Everything I look at online is out of date </p>
<p>any help would be great thanks.</p>
<p>If you could point me to a tutorial it would be great!</p>
<p>thanks :)</p>
| <swift><xcode><api><google-maps><gmsmapview> | 2019-02-19 23:27:45 | LQ_CLOSE |
54,776,588 | how to change value of a var in reverse geocoding function | <p>I am trying to get address info for my project. I can see the address by alert() method if i write it inside the geocode function. but if i outside of the function, it returns <strong>undefined</strong>. </p>
<p>tried to write the variable name like <strong>window.adres</strong> but didnt work. i think because of an another function with is parent of this.</p>
<p>how to make that variable global and change the value? </p>
<pre><code>var geocoder = new google.maps.Geocoder;
var adres;
var latlng = {lat: parseFloat(lat), lng: parseFloat(lon)};
geocoder.geocode({'location': latlng}, function(results, status) {
if (status === 'OK') {
if (results[0]) {
adres = results[0].formatted_address;
//window.adres = ... is not working. i think because of an another function which is parent of these lines.
alert(adres); //returns address
}
} else {
window.alert('Geocoder failed due to: ' + status);
}
alert(adres); //returns undefined
</code></pre>
<p>also i tried that</p>
<pre><code>var geocoder = new google.maps.Geocoder;
var latlng = {lat: parseFloat(lat), lng: parseFloat(lon)};
var adres = geocoder.geocode({'location': latlng}, function(results, status) {
if (status === 'OK') {
if (results[0]) {
return results[0].formatted_address;
}
} else {
window.alert('Geocoder failed due to: ' + status);
}
alert(adres); //returns undefined too
</code></pre>
| <javascript><google-maps><reverse-geocoding> | 2019-02-19 23:38:24 | LQ_CLOSE |
54,776,603 | C priting number 2^31-1 or -2^31+1 | I have to submit this code , the intention is to count the digits of a number and print it(range can be 2^31-1 or -2^31+1) and the result ust be present as a single number (ex number 234 is printed 3)
#include <stdio.h>
#include <stdlib.h>
int main()
{
long int num_ins;
int contador = 0;
printf("Inserir numero desejado a avaliar?\n"); // asking the number
scanf("%lu", &num_ins);
if (num_ins == 0){
printf("%d", 1);
}
else{
while(num_ins!=0){
num_ins = num_ins/10;
contador++;
}
printf("%d", contador); //contador is count
}
}
But the submission keep giving me an error, that there are some number who isn't right, and i can't figure it
| <c> | 2019-02-19 23:40:23 | LQ_EDIT |
54,777,218 | Axios/Vue - Prevent axios.all() to keep executing | <p>In my application wile authenticating the user I call the fetchData function. If the user token become invalid, the application will run <code>axios.all()</code> and my interceptor will return a lot of errors.</p>
<p>How to prevent <code>axios.all()</code> of keep runing after the first error? And show only one notification to the user?</p>
<p>interceptors.js</p>
<pre><code>export default (http, store, router) => {
http.interceptors.response.use(response => response, (error) => {
const {response} = error;
let message = 'Ops. Algo de errado aconteceu...';
if([401].indexOf(response.status) > -1){
localforage.removeItem('token');
router.push({
name: 'login'
});
Vue.notify({
group: 'panel',
type: 'error',
duration: 5000,
text: response.data.message ? response.data.message : message
});
}
return Promise.reject(error);
})
}
</code></pre>
<p>auth.js</p>
<pre><code>const actions = {
fetchData({commit, dispatch}) {
function getChannels() {
return http.get('channels')
}
function getContacts() {
return http.get('conversations')
}
function getEventActions() {
return http.get('events/actions')
}
// 20 more functions calls
axios.all([
getChannels(),
getContacts(),
getEventActions()
]).then(axios.spread(function (channels, contacts, eventActions) {
dispatch('channels/setChannels', channels.data, {root: true})
dispatch('contacts/setContacts', contacts.data, {root: true})
dispatch('events/setActions', eventActions.data, {root: true})
}))
}
}
</code></pre>
| <javascript><vue.js><axios><vue-cli> | 2019-02-20 00:53:31 | HQ |
54,778,251 | VB getting the last 3 digit number in textbox | <p>i have 16textbox and one command button for my userform and the textbox 1 are the one that i use to search for the data and display it from other textbox.</p>
<p>my question is.</p>
<p>it is possible for textbox1 to search only the last 3 digit number instead of 8 digit? wish can some answer my question.</p>
<p>thank you</p>
| <excel><vba> | 2019-02-20 03:14:31 | LQ_CLOSE |
54,779,166 | Given a string of letters, how can I count the occurrences of every letter? | <p>Given a string of letters, I'm looking to create an object containing key value pairs with the letter as the key and the number of occurrences within the string as the value. </p>
<p>So given "aabccc", the function should return:
{ a: 2, b: 1, c: 3 }</p>
<p>What would be a good way to count the letters? Ideally adhering to functional programming paradigm and utilizing ES6 functionality if it's applicable. Until now I've only worked with C++ and OO so I'm working through exercises using tools and techniques outside of my comfort zone. I'm very new to all the new features of ES6 and functional programming so I'm hoping to develop the correct mindset for them. </p>
<p>Any insights would be greatly appreciated. Thank you.</p>
| <javascript><ecmascript-6><functional-programming> | 2019-02-20 05:02:40 | LQ_CLOSE |
54,779,204 | Python list not appending | <p>I've been following a tutorial exactly but my list isn't appending--I get the error, "AttributeError: 'list' object attribute 'append' is read-only."</p>
<p>My code is:</p>
<pre><code>mylist = [1,2,3]
mylist.append = (4)
</code></pre>
<p>Thank you in advance.</p>
| <python> | 2019-02-20 05:07:05 | LQ_CLOSE |
54,780,574 | Scale/Radius ratio issue | <p>I have a scale variable and a radius variable. When scale is a specific number, ratio needs to be a specific number. So far I know this..</p>
<pre><code>Scale = 0.25 and Radius = 3.00
Scale = 0.50 and Radius = 1.50
Scale = 0.75 and Radius = 1.00
Scale = 1.00 and Radius = 0.75
</code></pre>
<p>I need to find out what number the radius should be for 0.10, 0.15, 0.20, etc all the way to 1.0 and I can't figure out how. Does anyone have any ideas?</p>
| <math> | 2019-02-20 06:59:56 | LQ_CLOSE |
54,781,243 | Hide legend from seaborn pairplot | <p>I would like to hide the Seaborn pairplot legend. The official docs don't mention a keyword legend. Everything I tried using <code>plt.legend</code> didn't work. Please suggest the best way forward. Thanks!</p>
<pre><code>import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
test = pd.DataFrame({
'id': ['1','2','1','2','2','6','7','7','6','6'],
'x': [123,22,356,412,54,634,72,812,129,110],
'y':[120,12,35,41,45,63,17,91,112,151]})
sns.pairplot(x_vars='x', y_vars="y",
data=test,
hue = 'id',
height = 3)
</code></pre>
| <python-3.x><matplotlib><seaborn> | 2019-02-20 07:47:30 | HQ |
54,781,809 | How to delete particular elements in a array of objects | <p><a href="https://i.stack.imgur.com/IktIJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IktIJ.png" alt="enter image description here"></a></p>
<blockquote>
<p>I have an array with multiple objects.How can i delete an element in a
object.</p>
<p>For example i have attached a image in that i need to delete
organization element.</p>
<p>Please help me out to fix.</p>
</blockquote>
| <javascript><angular> | 2019-02-20 08:26:32 | LQ_CLOSE |
54,781,833 | Picking unique records in SQL | <p>Say I have a table with multiple records of peoples name, I draw out a prize winner every month. What is a query in SQL that I can use so that I pick up a unique record every month and the person does not get picked on the next month. I do not want to delete the record of that person.</p>
| <sql> | 2019-02-20 08:28:16 | LQ_CLOSE |
54,781,856 | Xcode 10.1 textField secureTextEntry | <p>StoryBoard textField checked secureTextEntry, other textField all textFields are asking faceRecognition in iphone X, other lower version of iphones are working fine. Is that iphone x, bug or xcode bug ? </p>
| <swift><xcode> | 2019-02-20 08:29:21 | LQ_CLOSE |
54,786,560 | Removing character from a list of words | <p>I have a list of strings like below.</p>
<pre><code>arr = ['U.S.A','Ph.D','Mr.']
</code></pre>
<p>I would like to clean this array of the period so that the output would be like</p>
<pre><code>arr = ['USA','PhD','Mr']
</code></pre>
<p>Is there a clean regex way to do this?</p>
| <python><regex><special-characters> | 2019-02-20 12:37:06 | LQ_CLOSE |
54,788,400 | I have sentence . how can group this based on character length? |
public class sortingtext {
public static void main(String[] args) throws IOException {
String readline="i have a sentence with words";
String[] words=readline.split(" ");
Arrays.sort(words, (a, b)->Integer.compare(b.length(), a.length()));
for (int i=0;i<words.length;i++)
{
int len = words[i].length();
int t=0;
System.out.println(len +"-"+words[i]);
}
}
input: i have a sentence with words
when i tried i got it like
8- sentence
5- words
4- have
4-with
1-I
1-a
Expected output:
8- sentence
5- words
4- have ,with
1-I a | <java> | 2019-02-20 14:13:50 | LQ_EDIT |
54,788,650 | PHP/MySQL: Count number of available tables | <p>I have a database $db_name that contains a slew of tables. Many of them contain the name 'puzzle' (for example: 'puzzle1', 'puzzle2', 'puzzle3', etc.). What command do I need to perform to count all of those tables and return an integer?</p>
| <php><mysql><database> | 2019-02-20 14:27:38 | LQ_CLOSE |
54,789,406 | Convert array to object keys | <p>What's the best way to convert an array, to an object with those array values as keys, empty strings serve as the values of the new object.</p>
<pre><code>['a','b','c']
</code></pre>
<p>to:</p>
<pre><code>{
a: '',
b: '',
c: ''
}
</code></pre>
| <javascript> | 2019-02-20 15:06:12 | HQ |
54,790,460 | ASP.NET Core Singleton instance vs Transient instance performance | <p>In ASP.NET Core Dependency Injection, I just wonder if registering <code>Singleton</code> instances will improve performance better than registering <code>Transient</code> instances or not?</p>
<p>In my thinking, for <code>Singleton</code> instance, it just cost once time for creating new object and dependent objects. For <code>Transient</code> instance, this cost will be repeat for each service request. So <code>Singleton</code> seems to be better. But how much performance gaining we have when using <code>Singleton</code> over <code>Transient</code>? Thank you in advanced!</p>
| <c#><asp.net><asp.net-core><dependency-injection><.net-core> | 2019-02-20 15:58:24 | HQ |
54,790,679 | Print required output in Java | <p>I have requirement as below on array:</p>
<p>Input [1,2,5,7] Output [1,5,7]</p>
<p>Input [4,5,6,8] Output [4,8]</p>
<p>Input [1,2,3,9,10] Output [1,9]</p>
<p>Means if the next number is in sequence the take the first value in output, otherwise take all the values in output.</p>
<p>Thanks.</p>
| <java> | 2019-02-20 16:08:53 | LQ_CLOSE |
54,791,520 | sql server testing for 1 value in multiple columns | I have a table that has columns and I want to find out if all the columns contain that value. if they do not all contain that value I want to return the columns that do not contain it. can ANY or the IN clause be used for this?
| <sql-server> | 2019-02-20 16:51:38 | LQ_EDIT |
54,792,119 | Why do I get zero length for a string filled element by element? | <p>this is my issue. I am compiling with g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0</p>
<p>I would like to check every element of the string, and copy it only if it is a consonant.</p>
<p>This is how I try to do that:
This is just a function to select vowels:</p>
<pre><code>bool _is_vowel(char a){
if (a=='a' || a=='A' || a=='e' || a=='E' ||a=='i' || a=='I' || a=='o' || a=='O' || a=='u' || a=='U' || a=='y' || a=='Y')
return true;
else return false;
}
</code></pre>
<p>This is the bit of code that does not work. Specifically, inside the <code>ss.length()</code> appears to be 0, and the string ss contains no character, but they are correctly printed inside the while loop.</p>
<pre><code> main(){
int i=0, c=0;
string ss, name;
cout << "insert name\n";
getline(cin, name);
while (i<int(name.length())){
if (!_is_vowel(name[i])){
cout << name[i]<< "\t";
ss[c]=name[i];
cout << ss[c]<< "\n";
c++;
}
i++;
}
cout << int(ss.length())<<endl;
cout << ss;
}
</code></pre>
<p>Could anyone explain to me where I am wrong or give me some reference?
Thank you in advance</p>
| <c++><string><string-length> | 2019-02-20 17:26:16 | LQ_CLOSE |
54,793,041 | How to randomly print a word in an iOS app - swift | I have been trying to create an app that randomly prints a new word after a certain amount of time, i.e five seconds.
@IBOutlet weak var InspireLabel: UILabel!
func randomText() -> String {
if theValue > 5 {
let words = ["Place", "Cat", "House"]
return words[Int(arc4random_uniform(UInt32(words.count)))]
}
}
this is all the code I have right now. InspireLabel is the label which needs to change to the word. 'theValue' is the time passed. I keep getting a 'Missing return in a function expected to return 'String' error which stops me from running the code. | <ios><swift> | 2019-02-20 18:30:47 | LQ_EDIT |
54,793,402 | Is re-exporting modules harmful for tree-shaking? | <p>I've come into an argument with my co-workers for which we can't seem to find an answer from any official source (MDN, webpack documentation, ...). My research <a href="https://stackoverflow.com/questions/38077164/es6-export-from-import">hasn't yielded much</a> either. There seems to be doubt <a href="https://stackoverflow.com/questions/42051588/wildcard-or-asterisk-vs-named-or-selective-import-es6-javascript">even when it comes to importing</a> as well.</p>
<p>Our setup is Webpack, Babel, and a typical React / Redux app. Take this example:</p>
<pre class="lang-js prettyprint-override"><code>export * from './actions';
export * from './selectors';
export * from './reducer';
export { default } from './reducer';
</code></pre>
<p>This allows me to separate a Redux module into logical sections, making the code easier to read and maintain.</p>
<p>However, it is believed by some of my co-workers that <code>export * from</code> may, in fact, harm <code>webpack</code>'s tree-shaking capabilities, by tricking it into believing an export is used when it is in fact just being re-exported.</p>
<p>So my question is, are there any facts proving or disproving this?</p>
| <javascript><webpack><ecmascript-6><es6-modules><tree-shaking> | 2019-02-20 18:55:24 | HQ |
54,793,805 | Strange MYSQL behavior on TABLE CREATE | <p>The command: </p>
<pre><code>CREATE TABLE IRdata (ego int, altr VARCHAR(20), species VARCHAR(20), sex CHAR(1), birth DATE, death DATE);
</code></pre>
<p>works, but </p>
<pre><code>CREATE TABLE IRdata (ego int, alter VARCHAR(20), species VARCHAR(20), sex CHAR(1), birth DATE, death DATE);
</code></pre>
<p>does not. The only difference is the "e" in "alter" for the second column.</p>
<p>I have the latest MySQL install on the Ubuntu repos, running Ubuntu 18.04. </p>
<p>Any help is appreciated. </p>
<p>Thanks!</p>
| <mysql> | 2019-02-20 19:21:27 | LQ_CLOSE |
54,794,217 | Opening port 80 on Oracle Cloud Infrastructure Compute node | <p>This is an elementary question however one I cannot seem to resolve by perusing the Oracle documentation. I've created an Ubuntu-based compute node, and it's attached to a subnet. In that subnet I've created a stateful rule with source 0.0.0.0/0, IP protocol: TCP, Source Port Range: All, Destination Port Range: 80.</p>
<p>There is no firewall configured on the server.</p>
<p>Despite this configuration I can't access the compute node's public IP. Any ideas?</p>
| <oracle-cloud-infrastructure> | 2019-02-20 19:50:10 | HQ |
54,795,653 | UITable view error when converting to swift 4 | Updating an old app from swift 2.2 to swift 4. I have to use swift 3 as a stepping stone. I converted to 3 but come across the following error:
`Binary operator '==' cannot be applied to operands of type 'IndexPath' and 'Int`
The code is:
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if (indexPath as NSIndexPath).row == 0 || indexPath == 1 {
self.performSegue(withIdentifier: "NFL", sender: self)
}
if (indexPath as NSIndexPath).row == 1 {
self.performSegue(withIdentifier: "AFL", sender: self)
}
if (indexPath as NSIndexPath).row == 2 {
self.performSegue(withIdentifier: "FAI", sender: self)
}
if (indexPath as NSIndexPath).row == 3 {
self.performSegue(withIdentifier: "IPA", sender: self)
}
}
Why do I get this error in swift 3 and not 2.2? I tried to force it into an "int" but don't think I was going about it the right way. Any help would be great.
Thanks.
| <swift><uitableview><swift3><swift2> | 2019-02-20 21:40:28 | LQ_EDIT |
54,795,950 | Simplify the codes for some repeated actions by creating loops | <p>Here below are my codes performing data resetting for a series of ports of integer type. </p>
<pre><code> //note function: void resetData(int pin);
resetData(p00);
resetData(p01);
resetData(p02);
resetData(p03);
resetData(p04);
resetData(p05);
resetData(p06);
resetData(p07);
resetData(p10);
resetData(p11);
resetData(p12);
resetData(p13);
resetData(p14);
resetData(p15);
resetData(p16);
resetData(p17);
resetData(p50);
resetData(p51);
resetData(p80);
resetData(p81);
resetData(p82);
resetData(p83);
resetData(p84);
resetData(p85);
resetData(p86);
resetData(p87);
resetData(p110);
resetData(p111);
resetData(p112);
resetData(p113);
resetData(p114);
resetData(p115);
resetData(p116);
resetData(p117);
</code></pre>
<p>In the above codes, there are different types of ports (as grouped together), and they are processed by <code>resetData</code>. Is there way to simplify these long list of code by creating some loops, without changing the definition of <code>resetData</code>? Thanks!</p>
| <c++> | 2019-02-20 22:04:34 | LQ_CLOSE |
54,796,398 | Webpage scrolls when keyboard pops up | <p>I've noticed that when I am on my ipad or iphone and I open up the chatbox on my site and start to type, the webpage behind the chatbox will scroll back to the top of the site and not stay where I scrolled down. My website is www.leormanelis.com. Does not seem to happen on android devices. Does anyone know a fix? </p>
<p>Video - <a href="https://screencast.com/t/uiWdL39Qg6" rel="nofollow noreferrer">https://screencast.com/t/uiWdL39Qg6</a></p>
| <javascript><ios><css><chat> | 2019-02-20 22:40:41 | LQ_CLOSE |
54,796,664 | what is the regular expression to check if a string has no more than 2 repetitive character? | <p>Hi i have a requirement to check on passwords . the password should not contain no more than 2 repetitive character.</p>
<p>my password must contain atleast upper case, lower case, number and special characters #?!@$%^&*-</p>
<p>so if i have a password like for example</p>
<p>Password123$ it is valid
Passsword123$ it is invalid
Passssword123$ it is invalid
PPaassword123$$ valid
PPaassword123$$$ it is invalid</p>
<p>please help me
thank you </p>
| <regex> | 2019-02-20 23:05:07 | LQ_CLOSE |
54,796,702 | Find max number in array | <p>I am doing this JAVA homework for school and I have this task, but I can't find a beginner explanation on the web. </p>
<p>So I have to print out the biggest number in this array, please help...</p>
<pre><code>int[] mas = {12, 2135, -354, 4353, -1312, 4636, 1312, 3, 51};
</code></pre>
| <java> | 2019-02-20 23:09:15 | LQ_CLOSE |
54,796,766 | still getting CORS error spring boot and angular | I'm using Spring Boot 2.0.2 , I have spring-starter-web and spring-data-jpa in my project, Im' not using Spring Security for the moment.
I created RestControllers and added @CrossOrigin annotation to them, and tried this code to enable CORS for my angular app
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")..allowedOrigins("*").allowedMethods("GET","POST","DELETE","PATCH","OPTIONS");
}
}
};
}
But still getting CORS Error from my angular app | <java><angular><spring-boot><spring-mvc><cors> | 2019-02-20 23:15:48 | LQ_EDIT |
54,796,869 | resizing image that generated by paintcode app | I have imported a vector image to paincode app and then export its swift to code. I want to use this vector image in a small View (30x30) but since I want it to work on different devices, I need it to be size-independent.
The original size of the vector image is 512x512. When I add its class to a UIView, only a very small part of the vector image can be seen.
[screenshot of the UIView the image inside it][1]
[1]: https://i.stack.imgur.com/L1XIY.png
I need to somehow resize the image that can be fit in any size of a frame. I read somewhere, that I have to draw a frame in paintcode app around the image, I did it but nothing changed.
could you help me on this?
thank you so much | <swift><paintcode> | 2019-02-20 23:27:46 | LQ_EDIT |
54,797,528 | need help Action script 3 keyboard input | <p>I want to make a game, and I just found a tutorial on making a rhythm game on this website <a href="http://www.flashgametuts.com/tutorials/as3/how-to-make-a-rhythm-game-in-as3-part-7/" rel="nofollow noreferrer">http://www.flashgametuts.com/tutorials/as3/how-to-make-a-rhythm-game-in-as3-part-7/</a>, and i need help for change this arrow input to a keyboard input, Lik "W" "A" "S" etc, Thank you</p>
| <javascript><actionscript-3><action> | 2019-02-21 00:47:06 | LQ_CLOSE |
54,797,911 | Flutter: Where to add listeners in StatelessWidget? | <p>If I were using a StatefulWidget, then I would be listening to a Stream for example inside the initState method. Where would I do the equivalent in a StatelessWidget (like to use Bloc with streams for state management)? I could do it in the build method but since these are repetitively I wondered if there is a more efficient way than checking for existent listeners like below. I know that this is a redundant and useless example but it's just to show the problem.</p>
<pre class="lang-dart prettyprint-override"><code> import "package:rxdart/rxdart.dart";
import 'package:flutter/material.dart';
final counter = BehaviorSubject<int>();
final notifier = ValueNotifier<int>(0);
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (!counter.hasListener)
counter.listen((value) => notifier.value += value);
return MaterialApp(
home: Scaffold(
body: Center(
child:FlatButton(
onPressed: () => counter.add(1),
child: ValueListenableBuilder(
valueListenable: notifier,
builder: (context, value, child) => Text(
value.toString()
),
),
)
),
)
);
}
}
</code></pre>
| <dart><flutter><listener><statelesswidget> | 2019-02-21 01:36:29 | HQ |
54,798,072 | need help in writing sql server query | My data is look like below (usually more than 2 records)
OBLIGOR OBN_NUM XPTYPE NET_UNUSED BANK_ASSET
1 000100000 0101 100 0
1 000100001 5151 100 0
1 000100002 5151 50 0
when i use the below sql, i am able to sum as 100 only ( but i want to get 250).
SELECT SUM(NET_UNUSED)+SUM(BANK_ASSET) AS BANK_ASSET, OBLIGOR AS OBLIGOR,
SUBSTRING (OBN_NUM,1,4) AS OBN_NUM FROM RB_CRM_DEV.[IN].STG_SF_I_DC
WHERE SUBSTRING (OBN_NUM,1,4) = SUBSTRING (OBN_NUM,1,4)
AND SUBSTRING( XPTYPE,1,1) IN (0,1)
GROUP BY OBLIGOR, SUBSTRING (OBN_NUM,1,4)
ORDER by OBLIGOR,SUBSTRING(OBN_NUM,1,4)
how do i make sure my set of record should have xptype as 0,1 for atleast record to check in this query ( since SUBSTRING( XPTYPE,1,1) IN (0,1) condition drops the other two records)
| <sql><sql-server> | 2019-02-21 01:59:19 | LQ_EDIT |
54,799,888 | Make "Selected Context Only" persist in Chrome DevTools console settings | <p>I get a ton of misc errors from misc Chrome Extensions in my console. If I go to settings and check "Selected Context Only" then they go away and everything is good.</p>
<p>If I ever close that tab, or open a fresh Chrome window, "Selected Context Only" is unchecked again.</p>
<p>Is it possible to get this setting persisted forever and ever?</p>
| <google-chrome><google-chrome-devtools><devtools> | 2019-02-21 05:32:03 | HQ |
54,801,709 | Revese loop for a date in PHP | <p>Having 2 dates (from, to) such as 10/1/2019 and 21/2/2019 how would it be possible to write a loop to print each and every date from the 21st Feb back to the 10th of Jan in reverse order?</p>
<p>Sorry for the dumb question but cannot figure it out!</p>
| <php><date> | 2019-02-21 07:42:31 | LQ_CLOSE |
54,801,758 | How can an assignment call a function? | <p>My activity:</p>
<pre><code>class PlayerDetails : AppCompatActivity() {
private lateinit var binding: ActivityPlayerDetailsBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = DataBindingUtil.setContentView(this, R.layout.activity_player_details)
}
</code></pre>
<p>How can an assignment (<code>binding = DataBindingUtil.setContentView(this, R.layout.activity_player_details</code>) call a function? (<code>setContentView()</code>)?</p>
| <java><android><kotlin> | 2019-02-21 07:45:32 | LQ_CLOSE |
54,802,330 | Missing write access in mac to /usr/local/lib/node_modules | <p>I am trying to install angular cli but it's show me Missing write access to /usr/local/lib/node_modules
so, how can I fix it in my mac i try it may time but, not getting exact answer </p>
<pre><code> npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
</code></pre>
| <node.js><angular><angular-cli><node-modules> | 2019-02-21 08:22:19 | HQ |
54,803,060 | Decompile war file in eclipce | Hi i have WAR file with code java i need to decompile my war to project Eclipse
To do that i install Eclipse Jee 2018-12 and i have clic in `File->import` and i selected warFile, and i put my file war
but i have this when i go to src to see code java i have just pakage
[![enter image description here][1]][1]
When i clic in `open type hiererchy` i have this
[![enter image description here][2]][2]
How i can get code java please
[1]: https://i.stack.imgur.com/x7A4I.jpg
[2]: https://i.stack.imgur.com/vhZlS.jpg | <eclipse> | 2019-02-21 09:04:42 | LQ_EDIT |
54,803,901 | How to scroll to next div using Javascript? | <p>So I'm making a website with a lot of Divs that take 100% height.
And I want to make a button so when it's clicked to smoothly scroll to next div.
I've coded something so when its clicked, it scrolls to specific div.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>$(".next").click(function() {
$('html,body').animate({
scrollTop: $(".p2").offset().top},
'slow');
});</code></pre>
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{
margin: 0;
height: 100%;
}
.p1{
height: 100vh;
width: 70%;
background-color: #2196F3;
}
.p2{
height: 100vh;
width: 70%;
background-color: #E91E63;
}
.p3{
height: 100vh;
width: 70%;
background-color: #01579B;
}
.admin{
background-color: #B71C1C;
height: 100vh;
position: fixed;
right: 0%;
top: 0%;
width: 30%;
float: left;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="p1">
</div>
<div class="p2">
</div>
<div class="p3">
</div>
<div class="admin">
<button class="next">NEXT</button>
</div></code></pre>
</div>
</div>
</p>
| <javascript><jquery><html><css> | 2019-02-21 09:44:15 | HQ |
54,804,385 | How to get array into set of pairs using for loop and javascript map reduce functoins | <p>[1,2,3,4,5,6] should be changed to set containing {1,2},{2,3},{3,4},{4,5},{5,6} using normal for loop and using javascript map and reduce functions convert array to set of pairs using different techniques Thanks in Advance</p>
| <javascript><arrays> | 2019-02-21 10:08:04 | LQ_CLOSE |
54,804,580 | Tracing the history of an email chain | <p>I don't know if this is possible or not, so before i get too far down the rabbit hole I wanted to ask the community.</p>
<p>I have an email that was sent by person "a", to person "b", "c" and "d".
This email was then forwarded from either b,c or d to a person "e"
Finally person e has replied to that email to person a, but has deleted the text in the email that shows who sent the email to person e.</p>
<p>I can see in the message header from person e, the "in-reply-to" message ID isnt the message ID of the original email from person a, and has an extra reference in the header which will be the email from the mystery recipient that forwarded this to person e.</p>
<p>The question is, is there any way or recovering or tracing who this unknown individual was?</p>
| <email><email-headers> | 2019-02-21 10:16:59 | LQ_CLOSE |
54,805,322 | background image responsive but menu no | when page is resizing menu and content is decreases faster than image and when page have larger width than picture picture is alighed on left side
on normal resizing on pc site is normal image no but when it is on mobile or mobile mode on pc is it broken
i tried
background-size: 100% auto;
background-size: cover;
and nothing works so help me plz i need it thx
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-css -->
/* font-family: 'Montserrat', sans-serif; */
body {
background: #000;
font-family: 'Lato', sans-serif;
}
header {
width: 100%;
background: #fff;
}
nav > * {
list-style: none;
}
nav {
max-width: 960px;
margin: 0 auto;
display: flex;
flex-direction: row;
justify-content: space-between;
padding: 10px;
}
ul {
padding: 0;
}
nav > ul {
display: flex;
flex-direction: row;
}
.logo {
background: url('../img/01.png') no-repeat;
width: 150px;
height: 50px;
}
.menu {
display: flex;
text-decoration: none;
margin: 0 10px 0 10px;
color: #3a3b3b;
}
.menu:hover {
color: #d96e5d;
transition: all 0.5s ease;
}
strong.menu {
font-weight: normal;
color: #d96e5d;
}
.top-bg {
background: url('../img/topbg.jpg') no-repeat;
background-size: cover;
}
.top-img > h1 {
font-family: 'Montserrat', sans-serif;
text-transform: uppercase;
color: white;
}
.content {
position: absolute;
top: 800px;
color: white;
font-size: 80px;
}
@media ( max-width:500px ) {
nav > ul {
flex-direction: column;
align-items: center;
}
nav {
flex-direction: column;
align-items: center;
}
.item{
padding: 10px;
width: 90vw;
background: #d3d0d0;
margin: 2px 0 2px 0;
}
.menu {
justify-content: center;
}
}
<!-- language: lang-html -->
<header>
<nav>
<a class="logo" href="#"></a>
<ul>
<li class="item"><a href="aktivity.php" class="menu">Aktivity</a></li><li class="item"><strong class="menu">Index</strong></li><li class="item"><a href="kontakt.php" class="menu">Kontakt</a></li><li class="item"><a href="onas.php" class="menu">Onas</a></li>
</ul>
</nav>
</header>
<main>
<section class="topimg">
<h1>Coupe Invest</h1>
<img src="assets/img/topbg.jpg" alt="background">
</section>
<section class="content">
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Dolorem a et laboriosam illum recusandae nesciunt veniam architecto saepe ratione! Eaque quas provident voluptates facere consectetur repellendus amet nulla ea nisi! Lorem ipsum dolor, sit amet consectetur adipisicing elit. Consectetur odio, quos suscipit laudantium quo doloribus nulla sit ut cupiditate mollitia nihil maiores. Vitae ipsum excepturi quibusdam nam molestias ullam! Enim. Lorem ipsum dolor, sit amet consectetur adipisicing elit. Cumque, ut amet laboriosam quaerat, expedita nam neque placeat molestias non hic sit voluptate quam quia beatae nulla rem est eius fugiat. Lorem ipsum dolor sit amet consectetur adipisicing elit. Excepturi fugiat, cumque distinctio consequuntur asperiores quia veniam suscipit tenetur, nobis adipisci ad voluptate quisquam ducimus nesciunt id, voluptatem odio neque molestias. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus aliquid eum adipisci quaerat ducimus pariatur natus velit voluptates! Odit amet tempora quisquam mollitia fugit aliquam neque vitae molestiae debitis aperiam?</p>
</section>
</main>
<!-- end snippet -->
| <html><css><responsive-design> | 2019-02-21 10:51:50 | LQ_EDIT |
54,806,144 | Predicate where condition is not working in IQueryable but working after converted IQuaryable to ToList() | This is not working
**IQueryable<Items> items = Repository.GetItems(orderNo).Where(predicate);**
This is working
**IQueryable<Items> items = Repository.GetItems(orderNo).ToList().Where(predicate).AsQueryable();**
But i don't want to convert the results to list while these are in IQueryable
Please note : I am using **Convert.ToDateTime()** method in **predicate (dynamic) where** condition
| <c#><entity-framework><linq><filter><iqueryable> | 2019-02-21 11:34:12 | LQ_EDIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.