PRACTICE cmm script how to v.v a new variable in an old window - jtag

This opens a window of variable a:
v.v a
View variable b in the same window. How to do tihs?
v.v b
I know this can put them in the same window, but I want to view b at a later time
v.v a b

I figured it myself.
Var.AddWatch var
will do the job.

Related

Disable peek in Visual Studio Code

Is there a way to disable the ctrl-click 'peek' feature in Visual Studio Code? Ideally I'd like ctrl-click to just open the file containing the definition in a new tab.
Edit: I submitted an issue to at least make it less confusing. Apparently my terminology is slightly wrong.
To clarify, there are two actions:
Right-click -> Peek Definition
Right-click -> Go to Definition (bound to ctrl-click)
Their behaviour is as follows:
PD, Single Definition
Opens inline interface showing definition.
PD, Multiple Definitions
Opens inline interface showing definitions.
GtD, Single Definition
Open the file containing the definition.
GtD, Multiple Definitions
Pick one of the definitions at random, open that file, and an inline interface showing all the definitions.
All of those are fine except the last. Doing both things results in a really redundant and confusing UI like this:
There should be a way to have one of these behaviours:
Pick one of the definitions at random, open that file.
Or:
Open inline interface showing all the definitions (in the current file)
I've made a pull request to fix this https://github.com/Microsoft/vscode/pull/68023, but until then here's a temp fix that patches the VSCode installation files. You'll need to re-apply every update.
EDIT: The fix was merged into vscode. It should be in later versions.
With this fix Ctrl+Click will:
Use peek if there are multiple definitions
When using peek, will not navigate to the best match in the editor and cause you to lose your spot
If there is only one definition, it will navigate to the best match and NOT open peek.
Figure out what the function that needs to be patched looks like. The method is DefinitionAction.prototype._onResult(editorService, editor, model)
https://github.com/Microsoft/vscode/blob/e82d8bb6e6c8fd07ca16eacd16663ebd221187cb/src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts#L128
Go to the VSCode installation directory. %LocalAppData%\Programs\Microsoft VS Code and right click and open the directory in VSCode so that we can use VSCode's search feature to search for text in every file.
Search for _onResult and evaluate every result, checking to see if the signature and body matches what we are expecting from the function we saw in step 1.
We know from step 1, the function _openReference is nearby. Use that to narrow the search.
I found it in workbench.main.js line 2454. Use bracket matching to find the end or know that it ends immediately before t.prototype._openReference
The function when formatted is the following (async func is compiled down to statemachine, that's why it looks nothing like the source typescript):
t.prototype._onResult = function (e, t, r) {
return i(this, void 0, void 0, function () {
var i, s, a;
return n(this, function (n) {
switch (n.label) {
case 0:
return i = r.getAriaMessage(), o.alert(i), this._configuration.openInPeek ? (this._openInPeek(e, t, r), [3, 3]) : [3, 1];
case 1:
return s = r.nearestReference(t.getModel().uri, t.getPosition()), [4, this._openReference(t, e, s, this._configuration.openToSide)];
case 2:
(a = n.sent()) && r.references.length > 1 ? this._openInPeek(e, a, r) : r.dispose(), n.label = 3;
case 3:
return [2]
}
})
})
}
Replace the function with the following (if using same version) or format and edit the function you found to be similar to this example. Note the o variable is the global\window object and subject to change.
t.prototype._onResult = function (e, t, r) {
return i(this, void 0, void 0, function () {
return n(this, function (n) {
switch (n.label) {
case 0:
return r.getAriaMessage(), o.alert(r.getAriaMessage()), this._configuration.openInPeek || r.references.length > 1 ? (this._openInPeek(e, t, r), [3, 3]) : [3, 1];
case 1:
return [4, this._openReference(t, e, r.nearestReference(t.getModel().uri, t.getPosition()), this._configuration.openToSide)];
case 2:
r.dispose(), n.label = 3;
case 3:
return [2]
}
})
})
}
Launch VSCode. You will get a Your Code installation appears to be corrupt. Please reinstall. Just hit the gear icon and click Don't Show Again.
I tried to find a workaround changing the behavior of CMD + Click to go to implementation but it appears there is no solution yet?
The VSCode documentation shows its set by default to go to definition without a way to modify it:
https://code.visualstudio.com/docs/editor/editingevolved
On my machine (Mac) if I press CMD + Click or F12 on a method it will direct me to the Peek view on the definition, however CMD+F12 will direct me to the implementation without the peek appearing.
This seems to have been fixed in a newer version. If I now hover over FOO in foo.cpp, I see the normal tooltip #define FOO 2. If I press Ctrl, the message expands to add the text "Click to show 2 definitions" and if I click while still holding Ctrl, I get the peek window, as requested.

Creating an instance of a class

Trying to create my first class in MATLAB but obviously am missing something.
So here is my class below.
classdef MyBank
properties
Balance;
CustName;
end
methods
function BA = MyBank()
BA.Balance = 0;
BA.CustName = 'Mr Blogs'
end
end
end
In the same path I have a m file. In this file I try to create an object from my class like so,
bank = MyBank;
I get the error message 'undefined function or variabel 'MyBank'? Not sure what I'm missing as the examples I have seen appear to do the same thing?
Also when typing BA in my constructor should there be any intellisense? Find it quite painful coding in Matlab.
Matlab doesn't understand ".
You shuold use BA.CustName = 'Mr Blogs'
Are you using Matlab or Octave? Octave understands ", but last time I checked classdef is not working.
To find the constructor with "intellisense", you should type "My" and then press tab. At least for me this works.
If this doesn't work for you, check that your file is named MyBank.m and double check if it is in your current working folder. Open the file in your edior window and execute it by pressing F5. Then a dialog should pop up, if your in another working directory.

Lua Scripting Push Class Function PN.click()

I'm incorporating Lua scripting in my iPhone game implementation and it's working great!
For purely cosmetic reasons, I'd like for my functions in Lua to be in the format of PN.function(). Currently they are in the format of function().
I've tried registering the function as such:
lua_register(lua, "PN.Color", Color);
But it won't let me call it in the Lua script.
Anyone have any suggestions?
Thanks!
Answered my own question!:
lua_newtable(lua);
int pn = lua_gettop(lua);
lua_pushstring(lua, "Click");
lua_pushcfunction(lua, Click);
lua_settable(lua, pn);
lua_pushstring(lua, "Release");
lua_pushcfunction(lua, Release);
lua_settable(lua, pn);
lua_setglobal(lua, "PN");
You cannot use . as a function name in Lua. If you're trying to put all of your Lua functions in a global table called PN, then you have to actually do that.
Remember: lua_register is just a macro:
#define lua_register(L,n,f) \
(lua_pushcfunction(L, f), lua_setglobal(L, n))
There's nothing that say you couldn't do it yourself more specifically.
If you have a global table PN that you want to register Lua functions into, you do the following:
Push the PN table onto the stack, using lua_getfield(L, LUA_GLOBALSINDEX, "PN").
Push the function you want to register onto the stack, with lua_pushcfunction(L, Color).
Put the function into the proper location in the table, with lua_setfield(L, -2, "Color").
Pop the table from the stack with lua_pop(L, 1).

Problem importing ZEXP files programmatically

I'm developing a Plone Product that needs to import objects programmatically previously exported to ZEXP files. It's working perfectly, except the navigation bar. When one object is imported, it does so correctly, but the navication bar is not updated. The object can be accessed through it's URL and it's parent container contents tab.
Bellow is the code I used to import the objects. It's based on zope's ObjectManager._importObjectFromFile implementation.
def importDocument( app, fileName, container ):
app._p_jar.sync()
owner = 1
connection = container._p_jar
ob = connection.importFile( config.REMOTE_DIR + fileName, customImporters={ magic: importXML, } )
id = ob.id
if hasattr(id, 'im_func'): id = id()
try:
container._setObject( id, ob, set_owner = owner, suppress_events=False )
except AttributeError:
print "AttributeError"
# Try to make ownership implicit if possible in the context
# that the object was imported into
ob = container._getOb( id )
ob.manage_changeOwnershipType( explicit = 0 )
transaction.commit()
return True
I've noticed that the _setObject implementation fires an ObjectAddedEvent event in it's code, and it's after that event that the menu gets updated when I use the ZMI interface to import an object, so I figure something is listening to this event and handling the menu, but oddly, it doesn't happen when using my code.
Generally speaking, importing zexp objects is not supported (in part due to cases like this where unexpected or unintended results may occur). If it works, great. If it doesn't, you are "on your own" and probably better off copying the Data.fs file to a new software stack.
That said, I'm not sure I understand why clear and rebuild the catalog (ZMI -> portal_catalog -> tab 'advance' -> 'clear & rebuild') is not the answer here. According to its description its job is to "walk the entire portal looking for content objects which should be indexed in the catalog and index them".
Unless I misunderstand, you've just described a situation where newly imported content "should be indexed" because it hasn't been indexed yet.
If you are worried about the length of time required to clear and rebuild, try running it from the command line with something like this:
http://svn.plone.org/svn/plone/plone.org/Products.PloneOrg/trunk/scripts/catalog_rebuild.py
If you are worried about crawling the whole site, then call indexObject() on each object (http://dev.plone.org/plone/browser/plone.org/Products.PloneOrg/trunk/scripts/catalog_rebuild.py#L109)
Maybe try manually rebuilding the whole catalog after the import is complete? It might give you more hints to what is wrong ...
ZMI -> portal_catalog -> tab 'advance' -> 'clear & rebuild'.
You may need to "publish" the object after import to make it visible.
Use the manage_importObject method instead.

problem for cross plateform rhodes

i have made setup for the rhodes (cross platform) very well and i got the success in setup itself.with the "$rake run:iphone" command i can get the successful execution of demo project.Now i want to handle some issues like i want to do arithmatic calculations in one screen and i want to show the answer in next screen.
How would i get that? give the suggestions please?
I know that it is some time since you posted this, but I hope it helps or that others may find it helpfull.
Assuming that you know how to make the calculations on the first page, lets call it the index-page (as it is properly named in rhodes), you can do it as follows:
Before you begin make sure that you store the result of your calculations in a variable, for these instructions lets call it $result.
1) Create a new .erb file which you want to represent the result page (if you created a model, you already have a .erb file called "show" and could just as easily modify and use that). In this example - lets call the page "result".
2) Create a new def in your controller - lets call it "calculate". This could look something like this:
def calculate
[do any calulations you should desire]
$result = [result of calculations]
render :action => :result, :back => url_for(:action => :index)
end
This line:
render :action => :result, :back => url_for(:action => :index)
will send you to your result page and define the action for the smartphone's backbutton to navigate back to your index-page.
3) Make sure that your "get-result-button" on your index-page invokes your new def. For a simple link this could for example look something like this:
get result
4) Display the result in the result page.
Your variable from your index-page is still available in the result-page, so you can show the result by adding the following line to your result-page (result.erb):
<%= $result.to_s %> (this will insert your result as a string).