Why are defined variables not turning black in Mathematica v10? - wolfram-mathematica

I just upgraded Mathematica from version 8 to 10, and I am having a problem with the syntax colouring. Before, when I assigned a value to a variable, it would turn from blue to black to indicate that it was defined. But now, even when I define variables, sometimes they stay blue! However, they still work as expected, meaning that there really is a value assigned to them, and I can call upon it. But why are they coloured incorrectly? It is very confusing to work with as I am not sure if a variable has been defined or not! Some variables still turn black, while others stay blue. I have no idea why this happens for some and not for all.

I just had the same problem with Mathematica 11 in Windows 10.
I went with the old "Have you tried turning it off and back on again".
I had to go to the task manager to stop the Mathematica Kernal, but once it reloaded, the variables seemed to start coloring correctly again.

Related

What actually causes the spinning blue circle in windows?

I thought it was supposed to be when the system is busy, but that's not what I'm seeing.
I have an application which (*almost) always shows the blue spinning wheel when the cursor is over the GUI. But everything seems to function correctly (the GUI is responsive, and other threads seem to be progressing just fine) and looking at CPU use, nothing seems obviously stalled.
So what is the actually state of affairs that triggers the displau of the spinning blue circle?
And does anybody have any suggestions as to how I can find out where the problem is in my code?
the "almost" is because confusingly, just now when I was looking to see if visual studio's cpu profiling could give me any clues and changing settings I ran it and didn't get the blue circle... but then ran it again with no changes and the blue circle was back.
The spinning circle is the busy cursor. Applications can set or unset it for whatever reason they want. In fact, the busy cursor indicates simply that some work is in progress, it doesn't necessarily mean that the application has frozen (although frozen apps do show a busy cursor, too).
This is how you set it:
SetCursor(hHourglass);
DoBusyThing();
SetCursor(hRegular);
See this answer for more information:
https://stackoverflow.com/a/3178525/492336
By the way, the spinning circle in Win7 is actually the hourglass cursor from WinXP and older versions. It's exactly the same cursor, they just changed how it looks.

X11: XRaiseWindow and XLowerWindow do the opposite of what is expected. Why?

While trying to implement click-to-focus in my custom window manager, I noticed that windows were lowering when I clicked on them, instead of raising. The lines in question looked like this:
XSetInputFocus(this->display, this->event.xbutton.subwindow, RevertToParent, CurrentTime);
XRaiseWindow(this->display, this->event.xbutton.subwindow);
I changed that to
XSetInputFocus(this->display, this->event.xbutton.subwindow, RevertToParent, CurrentTime);
XLowerWindow(this->display, this->event.xbutton.subwindow);
and now windows are being raised when I click on them, as is proper.
Per the man page: "The XRaiseWindow function raises the specified window to the top of the stack so that no sibling window obscures it." Vice versa for XLowerWindow. The behavior I'm observing is precisely the opposite of what is described; XRaiseWindow pushes windows to the background instead, and XLowerWindow moves them to the foreground.
What is going on here?
(This is with Ubuntu 14.04.2 LTS, for what it's worth.)
The problem turned out to be trivial, and entirely my fault: the lines above were in a switch() statement, the break; statement below was missing. The next condition called XCirculateWindowsUp(). So focusing and raising the window would fall through to lowering it again.
Whoops.

why am i getting CXX0030 (" Error: expression cannot be evaluated") and CXX0017 on almost everything?

it's a weird issue... cause i'm pretty much sure it worked with no problems up until a few days ago. i'm using VS2010 SP1.
when checking my Auto or Local variables debug window, i cannot seem to be able to evaluate them. even if it's a plain boolean, string or even a number variable
when hovering with the mouse on the variable during run time, after hitting a breakpoint, nothing shows up.
string show up in the watches panel as "0x0000000000000000" and when expanded shows CXX0030 under both "capacity" and "size" fields and no data.
a boolean variable is evaluated to a CXX0017 ("Error: symbol "variablename" not found")
when displayed to the screen or console everything is ok, with all the correct data in place! debugging is a nightmare at the moment...
i can put my finger on the cause to all of this. why is this happening?

How can I track a variable value in realtime in the Xcode 4 Debugger?

I know how to use the Xcode debugger, and I've used po to display values for variables.
The problem I'm having is that I want to see the variable values, and track how multiple variables change (when stepping through the code) and have these values displayed in the debugger window, without having to write "po ..." every time!
Is there a way to do that? I mean, how do xCoders simultaneously see 10-15 variables change as a consequence of stepping over a function?
And thanks for all your answers, this thing has been driving me crazy for quite a while!
First read the documentation (Section Debug Area Help).
In the variables view (in debug area) you can track when the values change. The changed variables are marked in blue. In addition you can watch the variables.

MATLAB: Prevent figures from being made active

I have a rather large routine which will can run for a couple of hours. Here and there it creates a figure, plots something to it and saves that Figure.
As I have only one PC, I would like to continue to work with that machine. The problem is that whenever a new figure is made, MATLAB becomes the active application again.
Is there any way to tell MATLAB or Windows that MATLAB should not be allowed to set itself to active?
I saw that one possibility is to run a MATLAB script totally in the background (like that). But that is a little bit too unsupervised, as I would like to be able to switch to the MATLAB window and check the output to the command window.
Any ideas? If there is a general solution for Windows that prevents that other Applications to become active would also be cool!
You can overload the figure function as following in order to prevent figure poping up:
a = figure('visible','off');
I hate to state the obvious, but you could always store the data you want to plot until the end.
Now, you're going to tell me that some of that data is subroutines and doesn't get passed back to the main routine. OK. So, the solution to that would be to write a "Store_Plot_Data" class with a method that would write into memory the data, the #plot_function_name (for 3D, scatter, etc.), the axis label strings, etc. Then you would create one instance of this class in your main routine and to ensure visibility of this one instance to all subroutines you could do any of the following:
use a global variable as your single instance ... OK, not so elegant,
implement the Singleton pattern, or
pass all subroutines the handle to that one instance of the "Store_Plot_Data" class.
If there is a general solution for Windows that prevents that other
Applications to become active would also be cool!
In Windows 7, this worked for me:
http://pcsupport.about.com/od/windowsxp/ht/stealingfocus02.htm
Set "HKEY_CURRENT_USER\Control Panel\Desktop\ForegroundLockTimeout" to 30d40 (hex).
If you want all figures to not show.
set(0,'defaultFigureVisible','off');
In the beginning of your script do:
set(0, 'DefaultFigureVisible', 'off');
set(0, 'DefaultFigureWindowStyle', 'docked');
Dock the Matlab figure window and maximize any other application (Excel, Word etc.) you are working with in front of Matlab.
Then you can continue to work without being interrupted by figures blinking on your face.

Resources