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
 How to plan path from point 1 to point 2 so that it remains in the specified region?

Drawing a perpendicular line with a midpoint that meets in the middle
I have coordinates (x0,y0) and (x1,y1) that define a line of length L. I want to draw a line of length L that is perpendicular to this line such that the midpoint of the new line touches (x0,y0)  so that it forms a T. I need to obtain the coordinates (x3,y3) and (x4,y4) of this line.
I know that the slope of the original line is (y1y0) / (x1x0) and that the the slope of the new line will be 1 * the inverse of that.
This question is broadly similar (and probably quite simple) to this question:
Drawing line perpendicular to a given line
If I knew x3,y3 then I'd obviously be able to calculate x4,y4 easily, but I'm stumped at how to obtain the coordinates x3,y3.

calculate mod of fraction using pow in python
I would like to calculate the value of the Fraction 2/7**1000000 %13 in python with the built in method pow but pow only accepts numeric types.
My guess is that I need to calculate the inverse of 2/7 with extended euclid and then use that number in pow. Am I right?

How to prevent javascript if statement to evaluate 0 as an empty string?
I have js object that has data which contains numbers. Some of them can be
0
. In that case if statement will evaluate those values as an empty strings. Here is example:var dataObj = { "one": 13, "two": 0, "three": 3 } $.each(dataObj, function (j, k) { if(k){ console.log('Column: '+k); }else{ console.log('Empty'); } });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
I'm wondering how this can be prevented? Is there a way to check if value is empty but at the same time not consider
0
as an empty value? 
How to store a specific operator in Java?
I have the following Java code:
int i = 6; int j = 2; String[] operators = {"+", "", "*", "\\"}; for(String operator : operators) { System.out.print(Integer.valueOf(i + operator + j)); }
But I get:
Exception in thread "main" java.lang.NumberFormatException: For input string: "6+2"
How to solve this? The result should be:
8 4 12 3
Thanks!

C++  complex operator[] ambiguity
I am having issues in overloading the operator[] in a complex situation.
This is the context of the code :
template<typename T> class V : public T<std::p<size_t, T>> { class Proxy; public: // access operator const T& operator[](std::ptrdiff_t i) const { return T::s(i); } // mutate operator P operator[](std::ptrdiff_t i) { return P(i, this); } }; template<typename T> class V<T>::P{ std::size_t _i; V* _sp; public: P(std::size_t i, V<T>* sp) : _i(i), _sp(sp) {}; P& operator=(const T& item){ _sp>T::insert(P<std::size_t, T>(_i, item)); return *this; } };
I am trying to achieve the following:
V<char> x; ... V[3]; // calls access operator V[3] = 'a'; //calls mutate operator, internally does T::i(p(3,'a'));
For mutation, I tried to defined a Proxy type and overload the operator= for it, which works. The problem is that the access operator is never called and the mutate one now is called for both
v[3]
andv[3]='a'
.Your help is appreciated .

Er diagram: What is the Relationship between customer invoice and customer vendor
What is the relationship between Customer vendor and customer invoice?

What is the differance between a "class hierarchy diagram" and a "Class diagram"?
So for my coursework we need to make a simple ordering system application, nothing hard and the code is all finished and works,
But it also requires me to make a " UML use case diagram, UML class hierarchy diagram, one class and one instance diagrams."
So for the use case diagram, easy. For the class hierarchy diagram, done for the instance diagram, although short, it's done,
But for the "Class diagram" i can't seem to do, what is the difference between that and the class hierarchy diagram ?
i've looked it up and the the same can someone tell me the difference ?
Many thanks

Angular 7: ngxgraph cuts off diagram, even though container height is much higher
I use a grid layout for my application. In the top left grid I want to use ngxgraph.
Problem: Even though, I set the css height to 100%, the container still gets cut off in the same spot.
The css is not the problem. I saw in the Google Chrome Developer tool, that the container height is all over the grid, but the diagram still gets cut off.
HTML:
<ngxgraph class="chartcontainer" [links]="hierarchialGraph.links" [nodes]="hierarchialGraph.nodes" [legend]="true" [curve]="curve" [draggingEnabled]="true" xmlns:svg="http://www.w3.org/1999/XSL/Transform"> <ngtemplate #nodeTemplate letnode> <svg:g class="node" ngxtooltip [tooltipPlacement]="'top'" [tooltipType]="'tooltip'" [tooltipTitle]="node.label"> <svg:rect [attr.width]="node.width" [attr.height]="node.height" [attr.fill]="node.options.color" /> <svg:text alignmentbaseline="central" [attr.x]="10" [attr.y]="node.height / 2">{{node.label}}</svg:text> </svg:g> </ngtemplate> <ngtemplate #linkTemplate letlink> <svg:g class="edge"> <svg:path class="line" strokewidth="2"> </svg:path> <svg:text class="edgelabel" textanchor="middle"> <textPath style="fill: #666;" [attr.href]="'#' + link.id" startOffset="60%"> {{link.label}} </textPath> </svg:text> </svg:g> </ngtemplate> </ngxgraph>
CSS:
.chartcontainer { justifycontent: center; height: 100%; position: absolute; top: 50%; left: 50%; transform: translate(50%, 50%); }
The typescript code is not important. It just has the information of nodes and edges.
Here you can see it: At the bottom of the diagram a part of the diagram gets cut off.

Showing that the intersection of two language accepted by NFA is undecidable
I am having problem with this problem.
Let A = {〈N1, N2〉  N1 and N2 are NFAs and L(N1) ∩ L(N2) =∅}. Show that A is decidable.
Any help is appreciated.

State Elimination DFA to Regular Expression
I have a few questions regarding state elimination and the terminology.
In the example above is a DFA with a accepting state where you must start with symbol 0 and end with 1.
If I were to convert it to regular expression, the upper would be
Here is my problem, I have no idea how to add the top part and the bottom part into on single expression. I am also not totally sure how to eliminate q2 symbol 1 further.
Would it be 0(0*(0+1))1* ?
Thank you to anyone who could help!

Language Defined by DFA to Regular Expression
I know there are a lot of examples online and I've taken a look at them (particularly those using the state elimination method) but I'm still not completely sure of how to do these conversions. Is there an easier/more clear way to go about solving these types of problems than the state elimination method?
For the first DFA, I got (110) * 10 (100) *. For the second DFA, I got (b * ab(bab) *) * for the regular expression. I'm unsure about the first one because 100110 would be accepted by the automaton but it doesn't work with my regular expression.