DFA diagram to recognize arithmetic expressions
I need to draw a DFA diagram that can recognize arithmetic expressions, varialbes or brackets are not allowed. It can only contain numbers and four arithmetic operators.
And it has to accepts any number string with or without sign  e.g. 5, 7 , +15. And the numbers strings can be mixed with arithmetic operators  e.g. 3+5 , 1+7*3.
I don't know if my diagram actually performs this requirements.
See also questions close to this topic

JavaScript divide large number on string without using unprecise float
I write some methods to work with big numbers in JavaScritp. I try to work on strings since float gives me imprecise results. I've already wrote some operations, but I'm heavily stuck on divining numbers. Is it possible to write optimal divination on strings and how?

Matrix4 rotation won't work around x and y but works around z
I am trying to make a single cube to rotate properly around all axis. I can move the cube, the view is perspective, but when I try to rotate it, the rotation only works on Z axis.
It's like X and Y axis rotation have no effect, even though I'm taking them into account. My rotate method:
void Matrix4::rotate(float degrees, Vector3 axis) { float c = cos(Common::degreesToRadians(degrees)); float s = sin(Common::degreesToRadians(degrees)); values[0] = (axis.x * axis.x) * (1.0f  c) + c; values[1] = (axis.y * axis.x) * (1.0f  c) + (axis.z * s); values[2] = (axis.z * axis.x) * (1.0f  c)  (axis.y * s); values[4] = (axis.x * axis.y) * (1.0f  c)  (axis.z * s); values[5] = (axis.y * axis.y) * (1.0f  c) + c; values[6] = (axis.z * axis.y) * (1.0f  c) + (axis.x * s); values[8] = (axis.x * axis.z) * (1.0f  c) + (axis.y * s); values[9] = (axis.y * axis.z) * (1.0f  c)  (axis.x * s); values[10] = (axis.z * axis.z) * (1.0f  c) + c; }
My createTransformationMatrix function:
Matrix4 Matrix4::createTransformationMatrix(Vector3 position, Vector3 rotation, Vector3 scale) { Matrix4 result; result.translate(position); result.rotate(rotation.x, Vector3(1, 0, 0)); result.rotate(rotation.y, Vector3(0, 1, 0)); result.rotate(rotation.z, Vector3(0, 0, 1)); result.scale(scale); return result; }
I would appreciate any help, thank you.

Java get length between two points
I'm trying to get length between two point in order to compare them and get shortest length, so after I added points I used the Pythagorean theorem to get length between two point like:
if (circles.size() > 2) { // Determine shortest path double length ; for (int i = 0; i < circles.size()  1; i++) { length = Math.sqrt(((circles.get(i + 1).getX()  circles.get(i).getX()) * (circles.get(i + 1).getX()  circles.get(i).getX())) + ((circles.get(i + 1).getY()  circles.get(i).getY()) * (circles.get(i + 1).getY()  circles.get(i).getY()))); for (int j = 0; j < circles.size()  1; j++) { double newLength = Math.sqrt(((circles.get(j + 1).getX()  circles.get(j).getX()) * (circles.get(j + 1).getX()  circles.get(j).getX())) + ((circles.get(j + 1).getY()  circles.get(j).getY()) * (circles.get(j + 1).getY()  circles.get(j).getY()))); if (newLength < length) length = newLength; System.out.println(length); } } }
The question:
Is that the best practice to do that if I'm doing it right?

Increment operator's
Post and preIncrement Operators
int a=10, b;
b=++a+(++a);
Why is b value 24?
Explain me along with memory location of variable a.

Why javascript expression '[[][[]]+[]][+[]][++[+[]][+[]]]' result is 'n'?
I know first execute
+[]
, and convert it to0
so the expression become
[[][[]]+[]][0][++[0][0]]
then I think the
++
have high priority, but the++[0]
seem is illegalSo why the final result is
n
? 
Using And / Or over tree objects in python
I as going through some Python notes and I saw this example and its working find but i am trying to understand what is happening.
class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None T= TreeNode(5) T.left = TreeNode(2) T.right = TreeNode(7) ans = T and T.left #===> This returns T.left, < how? ans2 = T or T.left #===> This returns T . <? ans3 = T.left and T.right #====> T.right < mind blows away :(, how , how ??
How and/or operator works here? I tried looking up on google but it just showed me basic and/or stuff :(.
 UML Class Diagram  Modelling with Enumeration

For MacOS is there an OmniGraffle Replacement?
I am tired of OmniGrffle nickle and diming me at every corner for stencils, upgrades etc  are there other similar, without the nickle/diming, for macOS?

Invoice generation based on credit cards usage
Need a highlevel UML diagram, of a process like this, or a similar one:
 User logging in to a web application.
 Sets from_date and to_date
 clicks button "generate bill"
 Web app makes a REST call (HTTP POST) POST) with "from_date" and "to_date" as URL query parameters to a Backend server.
 REST call triggers the queries in MySQL DB and generates the bill.
 The bills, formatted as simple HTML tables, are being mailed to all the relevant customers in the DB for the mentioned period of time.

A guide to the right path on accomplishing the haskell commands
I am totally newbie on haskell. My java know how just isnt helping me alot.
i need any help or guide on finishing the code. I have tried most of the parts and also indicated comments on what i tend to achieve.
A DFA has been defined as follows (original image of DFA definition):
Q = {q1,q2,q3,q4,q5} qs = q1 F = {q4} delta = { <q1,0,q2>,<q1,1,q2>,<q1,.,q3>, <q2,0,q2>,<q2,1,q2>,<q2,.,q4>, <q3,0,q4>,<q3,1,q4>,<q3,.,q5>, <q4,0,q4>,<q4,1,q4>,<q4,.,q5>, <q5,0,q5>,<q5,1,q5>,<q5,.,q5> } Sigma = {0,1,.}
task:
Create a Haskell language program that can be used to execute any arbitrary Deterministic Finite Automaton corresponding to the FDA definition above. Represent the DFA as a fourtuple
a. represent each state with its name as a String
b. represents all states as a list of states
c. represent each transition as three tuple and the list of transitions as a list.
To assist you, implement the following functions in your solution:
a. stateFactory – returns a DFA definition (i.e. a four tuple)
b. allStates, firstState, finalStates, and allTransitions – take a DFA and return the corresponding component of the DFA. For example, in the above DFA instance, allStates would return the list of states, q₁, q₂, q₃, q₄, and q₅.
c. transFrom, transInput, and transTo – take a transition and return the corresponding component of the transition
d. findTransition – takes a state, a label, and a list of transitions and returns a list containing the single transition matching the given state and character (note the transitions emanating from a state are uniquely determined by each character label
e. findNextState – takes a DFA, a label, and a state and returns a state
f. dfaAccept – takes a DFA and an input String and returns True if the DFA accepts the input and False otherwise (i.e. decompose the string one character at a time, don’t match the entire string since your solution must work for any DFA). It is helpful to separate this into two functions each with different sets of parameters (one for an empty list and one for a nonempty list). One function takes a current state and one simply takes a DFA, whose state is assumed to be the initial state of the DFA.
this is my code has lots of errors but am trying to fix them
allStates = ["q1","q2","q3","q4","q5"]  iniitialize all states firstState = "q1" finalStates = "q4" define all transitions as a tuple t1 = ("q1",'0',"q2") t2 = ("q1",'1',"q2") t3 = ("q1",'.',"q3")  place all transitions in a list allTransitions = [t1,t2,t3] lst =[] stateFactory = (allStates, firstState, finalStates, allTransitions) findTransition state label listOfTransition = if (state , label , "q1") elem listOfTransition then lst ++ []  if the tuple matches the one in transition add to list else lst  no match dont add if (state , label , "q2") elem listOfTransition then lst ++ []  if the tuple matches the one in transition add to list else lst  no match dont add if (state , label , "q3") elem listOfTransition then lst ++ []  if the tuple matches the one in transition add to list else lst  no match dont add findNextState DFA label state = get the transition and extract the last element which is the state last findTransition state label allTransitions dfaAccept DFA inputString = if inputString == null then False
expected Output
Prelude> dfaAccept stateFactory “” False Prelude> dfaAccept stateFactory “1” False Prelude> dfaAccept stateFactory “1.0” True Prelude> dfaAccept stateFactory “11.11” True Prelude> dfaAccept stateFactory “10.10.10” False

2x Kleene stars adjacent to eachother
I have the following question to answer, but cannot seem to find the answer anywhere:
Let S = {a,b} and Let T = {a,b,bb}
Determine True or False:
 S+ = S*
 S* = S** > Here is my question: What do the two Kleene Stars adjacent to eachother mean??

How Can I Change This Deterministic Finite State Automaton(DFA) Program to Allow for Spaces to be Entered
I have a program which takes in a users phone number and tells the user if the number is valid. The phone number must be in the format of (085/6/7)7/8xxxxxx. If the user enter a number which is not in this format, the phone number will not be valid. I have a DFA class which reads in a text file, this text file shows the rules of each phase. If a user enters the numbers correctly the program will transition from the current state to the next state. But I was wondering how can I change this program to allow for a space? So instead of a user entering (087)711111 they can enter (087)711 1111. Here are all my classes associated with the program, including the dfaPhone.txt file.
DFA.java
import java.util.*; import java.io.*; class DFA { private Vector states; private Vector endStates; private String alphabet; private Vector transitions; public DFA(String filename) throws Exception { states = new Vector(); endStates = new Vector(); transitions = new Vector(); FileReader fr = new FileReader(filename); BufferedReader br = new BufferedReader(fr); //number of states String line1 = br.readLine(); int nStates = Integer.parseInt(line1); for (int i=0; i<nStates; i++){ State s = new State(i); states.addElement(s); } //end states String line2 = br.readLine(); String[] ends = line2.split("\\s"); for (int i=0; i<ends.length; i++){ String e = ends[i]; State s = getState(Integer.parseInt(e)); endStates.addElement(s); } //alphabet String line3 = br.readLine(); alphabet = line3; //transitions String line4 = br.readLine(); while (line4!=null){ //System.out.println(line4); String[] tr = line4.split("\\s"); State current = getState(Integer.parseInt(tr[0])); State next = getState(Integer.parseInt(tr[2])); char s = tr[1].charAt(0); Transition t = new Transition(current, s, next); transitions.addElement(t); line4 = br.readLine(); } } private State getState (int st){ for (Enumeration e = states.elements(); e.hasMoreElements(); ){ State s = (State) e.nextElement(); if (s.getState() == st) return s; } return null; } public Transition getTransition(State current, char symbol){ for (Enumeration e=transitions.elements(); e.hasMoreElements(); ){ Transition t = (Transition) e.nextElement(); if ((t.getCurrrentState()).equals (current) && t.getSymbol() == symbol) return t; } return null; } public State getNextState(State current, char symbol){ Transition t = getTransition(current, symbol); if (t==null) return null; else return t.getNextState(); } public boolean isEndState (State s){ for (Enumeration e = endStates.elements(); e.hasMoreElements(); ){ State state = (State) e.nextElement(); System.out.println("next: "+state.toString()); if (state.equals(s)) return true; } System.out.println("not end state"); return false; } public void printEndStates(){ for (Enumeration e = endStates.elements(); e.hasMoreElements(); ){ State state = (State) e.nextElement(); System.out.print(state+" "); } System.out.println(); } public boolean parseInput (String input){ State currentState = getState(0); String currentInput = input; State nextState = currentState; char symbol; while (!currentInput.equals("")){ symbol = currentInput.charAt(0); nextState = getNextState(currentState, symbol); System.out.println("Processing: " + currentState.toString()+ " " + symbol + " " +nextState.toString()); if (currentInput.length()==0) currentInput = ""; else currentInput = currentInput.substring(1); currentState = nextState; } System.out.println(currentState); return isEndState(currentState); } }
DFATest.java
import java.util.*; class DFATest { // // This program will ask the user to continually enter words and // check if the variation is considered a valid input // Entry ceases when the user enters zero. // public static void main (String [] args){ Scanner Keyboard = new Scanner(System.in); try { DFA dfa = new DFA("dfaPhone.txt"); String str; boolean b; do{ System.out.println("Enter your Mobile Phone Number in the form (087/6/5)7/8XXXXXX : "); System.out.println("Don't forget the hyphen: "); System.out.println("________________________ "); str = Keyboard.nextLine(); b = dfa.parseInput(str); //System.out.println("End states: "); //dfa.printEndStates(); if (b) System.out.println("Valid Phone Number!"); else System.out.println("INVALID Phone Number!!!"); }while (!str.equals("0")); } catch (Exception e){ e.printStackTrace(); } } }
Transition.java
class Transition { private State currentState; private State nextState; private char symbol; public Transition (State current, char s, State next){ currentState = current; nextState = next; symbol = s; } public State getCurrrentState(){ return currentState; } public State getNextState(){ return nextState; } public char getSymbol(){ return symbol; } }
State.java
class State { private int state; public State(int s){ state = s; } public int getState(){ return state; } public void setState(int s){ state = s; } public boolean equals (State s){ return (s.getState() == state); } public String toString(){ return ""+state; } }
dfaPhone.txt
14 13 ()0123456789 0 ( 1 1 0 2 2 8 3 3 7 4 3 6 4 3 5 4 4 ) 5 5  6 6 8 7 6 7 7 7 0 8 7 1 8 7 2 8 7 3 8 7 4 8 7 5 8 7 6 8 7 7 8 7 8 8 7 9 8 8 0 9 8 1 9 8 2 9 8 3 9 8 4 9 8 5 9 8 6 9 8 7 9 8 9 9 9 0 10 9 1 10 9 2 10 9 3 10 9 4 10 9 5 10 9 6 10 9 7 10 9 8 10 9 9 10 10 0 11 10 1 11 10 2 11 10 3 11 10 4 11 10 5 11 10 6 11 10 7 11 10 8 11 10 9 11 11 0 12 11 1 12 11 2 12 11 3 12 11 4 12 11 5 12 11 6 12 11 7 12 11 8 12 11 9 12 12 0 13 12 1 13 12 2 13 12 3 13 12 4 13 12 5 13 12 6 13 12 7 13 12 8 13 12 9 13