# Tag Info

## Hot answers tagged error-messages

8

FYI a more elegant way to get tweets1 is tweets1 = Rule @@@ tweets; Classify automatically separates words under the hood (via StringSplit), so you don't actually need to do that yourself. Classify has a built in sentiment classifier: Classify["Sentiment", "Windows 10 why is It called windows 10 when there was no Windows 9?"] (* "Negative" *)

5

How about using "RuntimeErrorHandler": f = Compile[{{x, _Real}, {y, _Real}}, Log[(x - y^2 - 2. x)^2]/(y x^2 - 2 (x + y) - y^2 + 3.), "RuntimeOptions" -> {"RuntimeErrorHandler" -> Function[Throw[$Failed]]} ]; Catch[Quiet@f[-196, 15]] // AbsoluteTiming (* {0.000019, 0.0000116843} *) Catch[Quiet@f[-196, 14]] // AbsoluteTiming (* {0.000051, ... 5 The problem is that the stdin stream for each process is being left open and needs to be closed. To demonstrate the issue, we create a single process:$process = StartProcess[$SystemShell]; WriteLine[$process, "echo example line"]; KillProcess[$process]; The call to WriteLine implicitly creates a stream object. Even though the process has been killed, ... 4 We had a bug like this on v. 10: it specifically stopped running new processes after you created 100 of them. This was fixed in version 10.0.1. I recommend testing it there, as version 10.0.1 has a number of improvements with respect to StartProcess. I can't test your example in MacOS right now, so please let me know if this isn't working on v. 10.0.1. ... 4 Since gh is a tensor, you need to say what rank it is, so replace {gh, _Real} with {gh, _Real, 2} to fix the error. costFxn = Compile[ {{P, _Real}, {Ns, _Integer}, {gh, _Real, 2}, {Kg, _Integer}, {G, _Integer}, {betaGN, _Integer}}, Sum[ -Exp[Kg/(P gh[[g, n]])] (Kg * betaGN)/ Log[2] ... 4 I use \$MessagePrePrint = StandardForm since without that the real number 1.5 is displayed in a message as 1.5. However, you might have $MessagePrePrint set to something else. Check is used to control what should happen when a built-in message occurs. Quiet prevents the built-in message from being displayed. I made a pure function (i.e. #1,#2,& ... 3 A simple way would be to assign the value of expr to a variable and then return that variable after printing the messages. For example: info::values = "n was  and d was "; Module[{n, d, v} , n = 100 ; d = 0 ; Check[v = n / d, Message[info::values, n, d]; v] ] 3 One can define a dynamic environment where Message will be overloaded. Here is one way: ClearAll[withMessageDetection]; SetAttributes[withMessageDetection, HoldAll]; withMessageDetection[code_] := InternalInheritedBlock[{Message}, Module[{inMessage, tag}, Unprotect[Message]; (call : Message[args___]) /; ! TrueQ[inMessage] := ... 1 As I see no clear pattern to the errors caused by TensorExpand, we can not pick out the special cases that case this error and just avoid them. So instead I choose to implement my own function TensorReduceContract to reduce tensor contractions. It is used like this: tp = TensorProduct;$Assumptions = {m ∈ Arrays[ {3, 3, 3, 3, 3, 3, 3, 3}, Reals], n ∈ ...

Only top voted, non community-wiki answers of a minimum length are eligible