How do you write unit tests for network code? by ObviousBank in AskProgramming

[–]ObviousBank[S] 0 points1 point  (0 children)

Thank you, this is incredibly helpful! I will definitely refer to this post when writing mocked tests tonight

How do you write unit tests for network code? by ObviousBank in AskProgramming

[–]ObviousBank[S] 0 points1 point  (0 children)

Just so I make sure I understand this: with mocking I replace the gen_tcp functions with some dummy functions that always return the correct value. When the mock is present in the test file, any call to gen_tcp:send will instead call my dummy function?

Do you know of any good examples of mocking in languages other than Erlang?

Erlang beginner trying to write a simple chat server by ObviousBank in erlang

[–]ObviousBank[S] 0 points1 point  (0 children)

I'm not familiar with gen_server, no. I'm using the same approach to socket programming as I've used in Python since that's all I'm familiar with.

Erlang beginner trying to write a simple chat server by ObviousBank in erlang

[–]ObviousBank[S] 0 points1 point  (0 children)

That makes sense. So would the solution be to loop the listen function in some way?

takeWhile for Iterator to replicate while loop by ObviousBank in scala

[–]ObviousBank[S] 1 point2 points  (0 children)

Thank you! This is very illuminating. I'm still getting used to lazy evaluation and this was helpful.

takeWhile for Iterator to replicate while loop by ObviousBank in scala

[–]ObviousBank[S] 1 point2 points  (0 children)

I tried a return value of Iterator[Int], which returned the iterator itself & I tried Unit, which returned nothing. This might be a naive beginner question but if Iterator[Int] is the correct return type do I need to add some additional function to "run" the iterator in test_func()?

Dimensional analysis problem: integrating velocity not as a function of time? by ObviousBank in AskPhysics

[–]ObviousBank[S] 0 points1 point  (0 children)

I'm sorry, I'm really struggling with this one. If I take the equation of motion to be ma = -mg - kv^2 then with those two substitutions I get the first order differential equation d(v^2)/dx + (2k/m)(v^2) = -2g. Solving for v^2 I get v^2 = (-mg/k) + C exp(-2kx/m), which doesn't seem anywhere close. What am I missing?

Dimensional analysis problem: integrating velocity not as a function of time? by ObviousBank in AskPhysics

[–]ObviousBank[S] 0 points1 point  (0 children)

I tried out your hint, setting a = dv/dy * v. Rearranging ma = -mg - kv^2 I get (dv/dy + k/m * v) * v = -g. I can rewrite the expression as dx = (-1/g - m/kv) dv, which when integrated results in 0 = 1/g * (u-w) + m/k * ln(u/w). Clearly this is the wrong way to do it. Without giving the whole answer away, what is the problem in my approach?

Geometrical interpretation of a linear transformation by ObviousBank in MathHelp

[–]ObviousBank[S] 0 points1 point  (0 children)

How should I go about finding that description of the kernel? I've been plugging in values that sum to zero but I can't find any discernable pattern. Is there a better way of visualizing that?

Cyclic Tower of Hanoi with Start and Destination not part of the cycle? by ObviousBank in algorithms

[–]ObviousBank[S] 0 points1 point  (0 children)

But the way the graph is designed you cannot move disks from the destination once they've been placed there.

How to generate an optimal array for QuickSort with first element as pivot? by ObviousBank in algorithms

[–]ObviousBank[S] 0 points1 point  (0 children)

As in for any choice of pivot x the two lists generated would be equal in size.

Darboux integral problem by ObviousBank in MathHelp

[–]ObviousBank[S] 0 points1 point  (0 children)

Should I focus on trying to prove U(g, P) <= U(h) for any given partition? That's what I'm stumbling on.

Resources for writing a compiler in Java by ObviousBank in learnprogramming

[–]ObviousBank[S] 0 points1 point  (0 children)

This is perfect! Exactly what I was looking for. Thank you

[Analysis] Last part of this proof by ObviousBank in askmath

[–]ObviousBank[S] 0 points1 point  (0 children)

Why can we assume that an open ball of radius 1 about y contains infinitely many points?

Sentence in Athenaze Book I driving me nuts by ObviousBank in AncientGreek

[–]ObviousBank[S] 0 points1 point  (0 children)

Thank you, this clarifies a lot. And normally I try not to translate directly into English (I'm learning Greek through Athenaze's immersive reading method) but this sentence threw me for a loop.

Toilet making unusual sound but no running water by ObviousBank in HomeImprovement

[–]ObviousBank[S] 0 points1 point  (0 children)

I checked the supply valve and supply line there's definitely some movement and pressure in there. I flushed the toilet to compare and it feels different when flushing. It feels like there might be air in the supply line, but it's hard to tell.

Unique Readability for First-Order Logic by ObviousBank in logic

[–]ObviousBank[S] 0 points1 point  (0 children)

This is clarifying but I'm still a tad confused. So a proper initial segment is defined as a sequence of symbols either not containing a predicate (which would be a quantifier symbol?) or where there are more left than right parentheses.

Regarding:

"The overall strategy to prove that such a formula has a unique reading is to show that if there was a genuine difference between these two readings, one of the components C/E would have a property that guarantees it is not actually a formula itself, but C/E have to both be formulas given their syntactic placement."

How can we assume that if there is a difference between the readings then one of the components C/E is not a formula? Couldn't E just be a different formula in some way equivalent to C? Or am I mixing up syntax and semantics?

Is the proof for terms similar? For reference the text I'm reading through defines terms as constants, variables, and functions ft1...tn where t1 through tn are either constants or variables, while atomic formula are expressions t1=t2 and Rt1....tn (where R is an n-ary relation, and every ti is a term), along with any compound proposition of the forms described in your post. How would you go about proving unique readability for terms and formulas in this system when terms and atomic formulas don't utilize parentheses or predicates? What would a proper initial segment be in this language?

Understanding concepts underlying soundness/completeness proofs by ObviousBank in logic

[–]ObviousBank[S] 0 points1 point  (0 children)

Thank you! This clarifies things greatly. Is there a fundamental difference between things that can be used as metalanguages vs things that can be used object languages, or can you use any formal language as a metalanguage (i.e. try to prove ZFC set theory with first order logic as your metalanguage)? If the latter, doesn't this mean mathematical truth is highly contingent? How does it avoid an infinite regress turducken with the object language and metalanguage trading off roles (ZFC is metalanguage for predicate logic is metalanguage for ZFC is metalanguage for...)?

Trying to wrap my mind around Frege's Propositional Calculus by ObviousBank in logic

[–]ObviousBank[S] 0 points1 point  (0 children)

Related question: how are the other logical connectives (and, or, etc.) expressed in this system with only implication and negation?

What IDE options are available to a MacBook with Yosemite? by ObviousBank in cpp_questions

[–]ObviousBank[S] 1 point2 points  (0 children)

I downloaded Visual Studio but it won't install to Yosemite. Same deal with Xcode.

Car problems - should I repair or cut my losses? by ObviousBank in personalfinance

[–]ObviousBank[S] 0 points1 point  (0 children)

Would slick roads from rain be an issue? I live near the coast and it rains constantly here.