Questions tagged [logic]

Logic refers to the ultimate flow of your code and how you arrive your desired solution. Questions should relate to finding a coding solution (or improving existing coding logic) to a given problem. Please use with an appropriate language tag, a thorough description of your logic, and the relevant code you're working on. General logic questions are off-topic. If you simply need a code review, consider https://codereview.stackexchange.com

logic
Filter by
Sorted by
Tagged with
0 votes
1 answer
114 views

Bump out current user when same user login again in Laravel 5.4

I am new to Laravel, so I don't know if this question is answered before or not. I have a requirement in my project which is explained below: User1 login to the system User1 login again from another ...
Hariprasad S H's user avatar
0 votes
2 answers
5k views

Country->State->City Dependent dropdown showing 'object [Object]

I'm building a dependent dropdown for country, state and city. It's not going very well. I've done extensive research on the subject on Stackoverflow and other sites on the web for the past few days ...
brohjoe's user avatar
  • 894
0 votes
1 answer
435 views

long pulling bot telegram fail with making a test

So, guys, I'm doing a telegram long polling bot, via Java, via telegram bots API. I made an integer for a test to do +1 after good answer and nothing with integer, while answer is wrong. public void ...
Dygy's user avatar
  • 57
0 votes
1 answer
67 views

Iteration of HashMap<> included in List<> to get addition of array variables included in map as values in java

I have BankDetails as pojo object with following variables and its getters and setters. private String bankName; private Map<String,Long[]> monthMap= newHashMap<String,Long[]>(); ...
Student's user avatar
  • 41
2 votes
0 answers
566 views

Renaming a json as *.environment.json and not able to import the same in postman

I have the below json file. 1) I renamed it as mytest.environment.json and I am trying to import the same in postman client app. I am getting an error - format not recognized. (all values are null ...
stackoverflowfan's user avatar
1 vote
2 answers
35 views

pass string value inside a javascript function

Can you guys help me? Inside some php code i have a string variable $html as: $html.='<img class="page_img current_thumb" src="'.site_url().'assets/admin/'.$data['edp_image'].'" alt="" title="" ...
gomesh munda's user avatar
1 vote
2 answers
3k views

How to render FlatList with two array?

I want to render a FlatList with two arrays that are name and photo. I hope my FlatList each of item include name and photo. But i don't know how to merge them into my FlatList data. console.log ...
Morton's user avatar
  • 5,600
0 votes
3 answers
311 views

Concat php input fields that are populated by a mysql dropdown

I'm trying to concat city, state and zip input fields that are automatically populated when the user makes a selection from a customer dropdown list and causes the address line to also change (auto ...
Nu2This's user avatar
  • 21
0 votes
2 answers
132 views

How do you print a specific line of text from a text file using math.random in Java?

Hi, I'm a newbie to java. I need to code a program where a genie tells someone their fortune. For this program, I take in input from a program based on a random number (from math.random) and return ...
user avatar
0 votes
1 answer
990 views

Forcing video to take up entire width of SImpleExoPlayerView

I'm having trouble forcing a video to be the entire width of a SimpleExoPlayerView. I've read through a couple stack overflow posts and have not been successful. The layout: <FrameLayout android:...
Joel Robinson-Johnson's user avatar
-1 votes
2 answers
267 views

Component Won't Render on Map Function

I'm using this component progress to draw a progress line. It works when I hardcode the values, but when I use it inside a map function it does not pick up the values. Can someone explain why this ...
webjunkie's user avatar
  • 1,184
1 vote
0 answers
187 views

Modal doesn't render on incorrect file upload

I have a file Upload component, that checks for a specific file type(video/*), if any other file is uploaded it needs to show a modal with some message. At the moment I am trying to get the modal to ...
RRP's user avatar
  • 2,723
1 vote
0 answers
255 views

VHDL - Index out range even If I made concurrent checking using when-else

I'm implementing a register file where I wanna read asynchronously and write on the rising edge. I made concurrent checks on the addresses and the writing occurs inside a process. However, it always ...
May Abd Eldayem's user avatar
3 votes
4 answers
170 views

Looping won't stop when reading user input

This code cannot stop looping even when I enter n or N. What is causing this? char next = ""; printf("Do u want continue\n"); scanf("%c", &next); getchar(); do { ...
Wang Liangwei's user avatar
-1 votes
2 answers
195 views

SQL Logic - logic involving Update statement with Group By clause

Trying SQL after a long time. Need you help to solve this task. I have created a Procedure for updating a column's values from row 1 to N based on other Column combinations. Currently, other columns ...
Pulkit thukral's user avatar
-1 votes
1 answer
60 views

Shell Scripting to extract date

Need a logic in shell scripting where I give the start and end date, say startDate=20140101 & endDate=20160130 I should be able to extract startDate_new=20140122 and endDate_new=20140221 in ...
Nick's user avatar
  • 69
2 votes
3 answers
4k views

How to get the calendar week difference between two moments?

I want to get the calendar week difference between two dates in javascript. Example: a='09-May-2018' b='14-May-2018' Calendar week difference between these two is 2. I started by converting date ...
Ashish Bisht's user avatar
0 votes
2 answers
404 views

Algorithm to reduce text based on word frequency

How to reduce a text based on word frequency in PHP? For example, if I have this text: house house house house book book book it should be reduced to something like this (or any similar form): ...
zeeks's user avatar
  • 794
1 vote
1 answer
329 views

Unable to read last record of CSV file in VB.net

I have a CSV File in the following format : "FIELD1";"FIELD2";"FIELD3";"FIELD4";"FIELD5";"FIELD6"; "BABY";"333333";"0100-0100";"1";"3/2/2018";"88888"; "BABY";"333333";"0100-0200";"2";"3/3/2018";"...
Maklas's user avatar
  • 122
0 votes
2 answers
112 views

Determine if task is earlier while only knowing if date is earlier and if time is earlier

A class called Time contains a method isEarlier(Time): boolean, which returns true if the Time is earlier than the Time object passed as the argument, otherwise it returns false. A second class ...
nanoai's user avatar
  • 25
0 votes
1 answer
658 views

Exposing a method on a React Component

This is my code import React, { Component } from "react"; import { render } from "react-dom"; class CView extends Component { someFunc() { alert(1); } render() { return <div>...
Arun's user avatar
  • 3,055
0 votes
1 answer
319 views

How to Rotate Left the elements of an array [duplicate]

I want to Rotate these elements to left. Please Help me out ... public class RotateLeft { public static void main(String args[]) { int array[] ={1,2,3}; int myarray[]= ...
Haseeb Ansari's user avatar
0 votes
4 answers
1k views

.hasNext() and .next() cause infinite while loop

I'm in a beginner level coding class and this is my assignment: Write a void method called palindromeCheck that takes NO argument. The method should have functionality to check whether or not the ...
user avatar
0 votes
1 answer
65 views

how do i implement a parent for c# method

This method is making all moves for current board, then making all opponent moves, then making the future move for player 1 and evaluating the best move. how do i get the root or parent of this best ...
DR4QU3's user avatar
  • 13
0 votes
2 answers
63 views

Having trouble solving logic of random number game

I am relatively new to java programming. I am currently working on building a mini guessing game, as a project to learn more Java. I am having some issues with the following: Here are the 4 main ...
Jose Valladares's user avatar
2 votes
3 answers
2k views

How to tell if an image was not loaded in Angular?

Currently I have this in my component <img *ngIf="(showImage$ | async)" [alt]="image.alt [title]="image.title" [src]="image.src" (load)="imageHasBeenLoaded($event)" /> and the I do some ...
Mackelito's user avatar
  • 4,353
0 votes
1 answer
762 views

Implementation of word counting on non-text-based file as wc in Linux in C++

I am recently working on implementing word counting as wc in Linux in C++. I've read a lot of posts about how to implement this function, but I've still got a problem. When I use text-based file as ...
John's user avatar
  • 3
1 vote
1 answer
163 views

PHP array with n level deep

Assuming I have an array and recursively want to do some task. I have spent one day for this unable to solve this. May be my logic is not good. Any help on how to do such thing in an efficient way ...
Katty's user avatar
  • 489
0 votes
0 answers
38 views

Python Pandas DataFrame Manipulation [duplicate]

I am working with a medical data set in python where each row of data represents a patient visit. Each visit is part of a parent case labeled with a unique Case ID#. What I need to do is create a new ...
Andy's user avatar
  • 708
1 vote
8 answers
144 views

Show content based on radio option click with Javascript

I have 2 radio buttons. I would like to show the div when the radio is selected. As default, the default must be selected and the content is shown. <div class="m-form__group form-group row"> ...
SNaRe's user avatar
  • 2,037
5 votes
1 answer
3k views

How to use Google Script Send email with group account

I want to send an email with Google Script, but I need to use the public (group) mailbox, I didn't find an example of sending email from the group account on the Google API, and I couldn't find the ...
Arthur Huang's user avatar
0 votes
1 answer
34 views

Don't know why label is not updating using tkinter

I am a beginner to python and trying to make a simple log in system for a school program together with it's GUI. I did a good job since I am a beginner in python (and coding in general) and I am ...
Antonio Bento Pereira's user avatar
1 vote
1 answer
310 views

Calculating time difference between two dates in java with consideration to business hours, work suspensions and weekends [duplicate]

I need to get the MinutesRendered on a specific job on my program. I have the startdate and enddate of that particular job. I need to count the difference between these 2 dates while skipping the ...
Audrick's user avatar
  • 23
0 votes
1 answer
76 views

Implementation of SQL's three-valued logic

Is there a module in any SQL implementation that checks satisfiability/validity of a formula in 3-valued logic? If so, is there an open-source one? My purpose is to evaluate the performance of such a ...
Yoni Zohar's user avatar
0 votes
3 answers
444 views

Fire component method from another component on ReactJs

I have this components: class DashTopNav extends React.Component { constructor(props) { super(props); } render(){ return(<button></button>); } } class FltBox extends React....
Phoxer's user avatar
  • 424
0 votes
1 answer
44 views

How to query the result of rand in a php loop?

I am beginning to learn PHP. Here I am trying to create a loop that checks whether a randomly generated number is 50. If the number is 50, I want to print "it's 50!", if not, I want to echo the result,...
Chris L's user avatar
  • 109
0 votes
1 answer
44 views

How do I best control activity flow?

I am tasked with building an app that does not have a fixed screen order. When started the app will contact a server an get a list of actions to perform. So one launch could be screen 1 - screen 5 - ...
Allan's user avatar
  • 23
5 votes
2 answers
496 views

Integer division using only addition, multiplication, subtraction and maximum

Suppose we have a programming language ℤ which has the following syntax: ℤ := 0 | 1 | (+ ℤ ℤ) | (* ℤ ℤ) | (- ℤ ℤ) | (max ℤ ℤ) For convenience, we can define new binding forms in our language ...
Aadit M Shah's user avatar
  • 73.6k
0 votes
1 answer
48 views

Unexpected return values in my own take on Array.reduce() with Array.from(string)

I wanted to try my hand at writing my own reduce function, however the result t I'm getting when I pass a string is very strange. const _ = {}; _.reduce = (collection, callback, accumulator) => { ...
Eddy Vinck's user avatar
0 votes
1 answer
161 views

Multiply a base number and increase

I have a small problem, and I need some help. What I want to do is the following. I want the base price multiplied each time the counter is greater than 3. An example: if the base is 10 and the ...
Juan David's user avatar
0 votes
0 answers
188 views

Trying to understand Prolog error: existence_error

I am trying to understand what is going on with a couple Prolog queries. I have the following rules: similar(a,aa). similar(aa,aaa). similar(X,X). similar(X,Y) :- similar(Y,X). similar(X,Y) :-...
basil's user avatar
  • 710
2 votes
3 answers
797 views

Can you prove Excluded Middle is wrong in Coq if I do not import classical logic

I know excluded middle is impossible in the logic of construction. However, I am stuck when I try to show it in Coq. Theorem em: forall P : Prop, ~P \/ P -> False. My approach is: intros P H. ...
kengkeng's user avatar
0 votes
1 answer
44 views

Why does this equal True and thus render a div in React?

I'm a little confused why this will render when errors.email is not a falsey value. Does the JSX get ignored and it only looks at errors.email on the right-hand side so basically the expression is if (...
good_afternoon's user avatar
0 votes
1 answer
35 views

why the outputs are different in the while loop

while($car_result1 = mysqli_fetch_object($car_connect1)){ <div class="portfolio all" data-cat="all"> <? echo $car_result1->car_gear; ?> // output is stick <img alt="Ay <?php ...
Mamas Plodos's user avatar
-4 votes
4 answers
76 views

How to select a class of an id in jquery

I have two div with different id but same class how do I select a class of a given id ? $(function() { $('#1').find('.select').click(function() { alert("1 clicked "); })...
Saurabh Kumar Singh's user avatar
-4 votes
3 answers
144 views

Unknown behaviour of OR operator in C++ [duplicate]

I have this code running by chance and when i put anything as the answer it is showing me correct. I know we have to put ans before YES and yay, but this code was compiled too, as i mentioned if i put ...
Shahryar's user avatar
  • 324
2 votes
3 answers
135 views

Variables Not Updating

I have made this point of sale program with three items hard-coded in and the variables a_book, a_bat, and a_hat are not updating when I enter the quantities. Why? #include <iostream> #include &...
metanom's user avatar
  • 21
-3 votes
3 answers
71 views

C++ program if statements in function not executing. Seems Logically errored

I am making a program in C++, that takes the user entered time in U.S. standard time and converts it to military time. The body of the main code is executing fine, but the problem comes in the body of ...
Zachary Mueller's user avatar
1 vote
0 answers
56 views

Accessing objects within switch statements

I currently am stuck as to what the most efficient way is to fix this issue. My current goal is to code for a button click on a page. If the user meets a certain number of requirements, a message ...
M. Winnicki's user avatar
0 votes
1 answer
43 views

Working with nested formula in Excel

I'm new to formulas and I need a good one that checks multiple criteria from different columns to return a result. For example, if column B contains 4540 or 2750 or 4848 and column I contains either ...
Kerry's user avatar
  • 1

1
67 68
69
70 71
189