I have last version of jupyterlab Version 3.0.14
in debugging mode many variables not needed exists in the right box
what are they?
I want to delete them except i, j and result.
You can adjust the variableFilters setting of the debugger to hide variable that you are not interested in; see this answer for more details.
The debugger simply shows all variables that are available at runtime in the kernel; the Python kernels (IPython and Xeus Python) come with a feature of remembering your input and output for each executed cell; it is immensely useful if you execute a cell with compute-intensive task but forget to assign the result onto a variable, for example instead of:
result = do_long_calculation()
you do:
do_long_calculation()
in the latter case you can use the IPython underscore _ variable which caches the last execution result to recover the output:
result = _
If you already overwritten the most recent output, it the previous one goes to __ and so on. Learn more about this in the output caching system documentation.
Similarly _i, _ii, etc. variables cache most recent input of cells so you can check what has been executed. See more in input caching system documentation. There are also In and Out variables which store entire execution history for your reference.
Fur the future convenience I raised the idea of allowing regular expressions to hide all variables matching a pattern here.
I'm trying to figure out how to execute (for example /say hi) when there's Yellow Terracotta in a certain radius or field, however I can't figure out how to do it.
Anyone knows?
Using Minecraft 1.16,
"Execute" command has several syntax options. You can use the form "execute if block run "
Using the proper block name, we can get:
execute if block 1015 63 989 minecraft:yellow_glazed_terracotta run say hi
This targets a specific position.
I am a little less clear on how to achieve specifically what you are asking, but here are my thoughts:
The syntax provides for another form "execute if blocks..." This form allows you to select a range by corners, but it must be compared against a third selection of the exact same size (only the corner can be specified). I think the regions must be exactly the same, and may not allow for random placement of the block anywhere within the region.
Another way might be using different execute if commands instead to select an entity, and test where the entity is standing.
If you put a button on a command block and set it to:
execute at #p if block ~ ~-1 ~ minecraft:yellow_glazed_terracotta run say hi
When the player hits the button on the command block (obviously they must be within range of the button to press it) it shall check if the block -1 under the #p is "yellow_glazed_terracotta", and it will run say hi.
#p can be modified with [distance=..3] which means the player targeted by the command block must be within 3 blocks of the command block:
execute at #p[distance=..3] if block ~ ~-1 ~ minecraft:yellow_glazed_terracotta run say hi
So, this is sort of creating that range that you were looking for.
Some sources use "execute as #a at #s..." as a way to target any player when they step on a certain block anywhere at anytime. It may be possible to modify this into a distance as well, but it seems that the player will need to stand at a specific relative position to the terracotta.
If I find a better way to achieve this, I'll follow up.
The subreddit r/MinecraftCommands has a decent community that messes with Minecraft commands and command blocks. They may have further insight.
If I find a better way to achieve this, I'll follow up.
Edit- The only other thing I can think at this point is to take the first command I suggested and repeat it for every single coordinate in an area. If a terracotta block is any of those spaces, it will run the say hi command.
If you place all of these command lines into a function file you can call for the function when the command block is activated.
Example: I write the following string in my old project and a new, clear one:
UIInterfaceOrientation k = [UIApplication sharedApplication].statusBarOrientation;
Console input/output for a clear project:
(lldb) po k
UIInterfaceOrientationLandscapeLeft
And something awful in my old project if I write "po k" - a list of useless integers.
Additionally, I can't print most of the objects in the new project.
I don't know what is going on in your case, but just so folks are clear on the difference between po & p:
The p command (a.k.a. expr --) takes the arguments it is given, compiles them as though they were a source code expression written in the context of the current frame, executes the result - either by running an interpreter on the result of the compilation if that is possible, or by JITing the result of the compilation, inserting it into the target program, and running it there. Then it prints the result of the evaluation.
The po command (a.k.a. expr --O --) does everything that p does, but instead of printing the result, if the result is a pointer to an ObjC object, it calls that object's "description" method, and prints the string returned by that method(*). Similarly, if the result is a CF object, it will call CFShow and print the result of that. If both these attempts fail, it will go ahead and print the result as p would have.
So po is mostly like p. But you can get some weird results if you use po on things that it aren't actually objects. For instance, ObjC has a optimization (tagged pointers) that represent the contents of some objects (e.g. NSNumbers) in the object pointer. There isn't a "real" object, just a cooked pointer. So if you try to po an integer that just happens to look like a tagged pointer, you'll get the description of some probably unrelated ObjC object, not the value of the integer.
And of course, po is doing a lot more work, so unless you really want some object's description of itself, p is more efficient.
Actually, it calls debugDescription, if that exists, and falls back to description if it doesn't...
p = print
po = print object
p prints value of primitive variable or value of a reference
po try to call -description for that object and print returned string
Use po, p, & v to print variables
po ends up compiling & executing twice, once to evaluate your expression and again to get the object description.
v doesn’t compile at all: can’t evaluate any expression but does allow property accessing and does recursive dynamic type resolution so each property is treated as the actual runtime type.
For people who are interested in learning more : https://developer.apple.com/videos/play/wwdc2019/429/
Add this as an answer for visibility, Also explains the functionality of each debugging commmand
po tries to treat what you want to print, as an object. In many cases it is similar to p, but there are cases where the difference emerges.
The simplest way to see the difference: compare the output of p 0 and po 0.
(lldb) p 0
(int) $26 = 0
(lldb) po 0
<nil>
UIInterfaceOrientation is no (Objective-C) object, but an integer (enum:NSInteger). You should not use po (print object) at all.
It seems the difference is lldb/gdb debugger. The only way for iOS project to make debugger more workable is expr #import UIKit. But it may not work for older xcode versions and... you need to input this string in the console after each relaunch. The only way to automate it is an extra breakpoint with this expression.
p prints value of primitive variable or value of a reference
po try to call -description for that object and print returned string
There is also **v command** in lldb. Explaining using example.
protocol Activity {}
struct Trip: Activity {
var name: String
var destinations: [String]
}
let cruise: Activity = Trip(...)
Using v command
(lldb) v cruise.name
(string) cruise.name = "print name"
//As it uses dynamic resolution
Using p command
(lldb) p cruise.name
//execution interrupted
Strip debug symbols during copy
In most answers they advice to set optimization to "none" but forget that this option should be set to NO (at least for debug configuration).
This is in reference to what Jim Ingham said. Type "p " instead of "po ". When I do that Xcode displays the correct information. Try that.
I have a file variable in d3 pick basic and I am trying to figure out what file it corresponds to.
I tried the obvious thing which was to say:
print f *suppose the file variable's name is f in this case
but that didn't work, because:
SELECTION: 58[B34] in program "FILEPRINTER", Line 7: File variable used
where string expression expected.
I also tried things like:
list f *didn't compile
execute list dict f *same error
execute list f *same error
but those also did not work.
In case any one is wondering, the reason I am trying to do this in the first place is that there is a global variable that is passed up and down in the code base I am working with, but I can't find where the global variable gets its value from.
That file pointer variable is called a "file descriptor". You can't get any information from it.
You can use the file-of-files to log Write events, and after a Write is performed by the code, check to see what file was updated. The details for doing this would be a bit cumbersome. You really should rely on the Value-Add Reseller or contract with competent assistance for this.
If this is not a live end-user system, you can also modify an item getting written with some very unique text like "WHAT!FILE!IS!THIS?". Then you can do a Search-System command to search the entire account (or system) to find that text. See docs for proper use of that command.
This is probably the best option... Inject the following:
IF #USER = "CRISZ" THEN ; * substitute your user ID
READU FOO FROM F,"BLAH" ELSE
DEBUG
RELEASE F,"BLAH"
END
END
That code will stop only for one person - for everyone else it will flow as normal. When it does stop, use the LIST-LOCKS command to see which file has a read lock for item "BLAH". That's your file! Don't forget to remove and recompile the code. Note that recompiling code while users are actively using it results in aborts. It's best to do this kind of thing after hours or on a test system.
If you can't modify the code like that, diagnostics like this can be difficult. If the above suggestions don't help, I think this challenge might be beyond your personal level of experience yet and recommend you get some help.
If suggestion here Does help, please flag this as the answer. :)
I'm not sure if there is a name for this technique, but I remember doing something like this a long time ago in C++. I would like to breakpoint and observe a specific object of which there are hundreds in my program. It would be nice if you can tell the compiler to use a reserved space of memory so that I can run once, pull out a memory address, then run again with the guaruntee of having the objects allocated to the same address in memory so that I can see what happens to this specific object the next time around.
At the moment I am just assigning a 'debug id' which gets incremented with each allocation but thought there might be a cleaner way of doing it. I'm sure I've done this before with Vis Studio / C++...
You can set a conditional breakpoint in Xcode so that it will only break into the debugger if a certain condition is satisfied.
To do this, set the breakpoint normally and then right-click on it and select Edit Breakpoint.
Locate the breakpoint in the Breakpoints window and double click the "Condition" column. You can then enter an expression, something like:
(BOOL)[[yourObject name] isEqualToString:#"foo"]
This will break only when the name property of yourObject is foo.
Note that you need to cast the result of the expression to a boolean, otherwise gdb doesn't know how to deal with the result of the expression. You also can't use dot notation syntax, you must use the full square bracket syntax.