How to quickly view a function's documentation when using jupyter-notebook - jupyter-notebook

It seems that using '?' command is the only way.But this is too much trouble, need to run the function? in another cell.
I've tried shift+tab, but it does not work for me.

Shift + TAB displays popup with signature, docstring and type.
One can also keep open Inspector where documentation will be displayed while typing.

Related

How do I dismiss an autocomplete suggestion in Atom?

When I'm writing Docstrings in Python3, I'm ending all of my sentences with periods and I see an autocomplete suggestion like this:
In this case it wants to replace the string "wager." with "wagerself."
If I press Enter or Tab the string replaces. I've messed around with all the logical buttons (Including adding an extra space which doesn't work), and nothing will allow me on my merry way to a newline.
This problem occurs both with and without the autocomplete-python package installed.
I do want to use auto-complete when I type a dot after an object, just not in the comments.
Is there a way to either:
Dismiss the autocomplete suggestion as they come up.
-- or --
Change the autocomplete to be aware of the context, i.e. not autocomplete dots when I'm in a string/comment.
From experimenting with different key combos, ctrl + enter will ignore the suggestion and allow you to go to the next line without altering what you've typed.
I haven't found any documentation around this, so I'm not sure if there's a similar key combo for tab or not. I couldn't find anything myself beyond alt + tabing to lose focus, which causes the suggestion to go away, then alt + tabing back to hit tab, which obviously isn't ideal.
I'm using Atom 1.44.0 on Windows and have found that shift + enter works to dismiss an autocomplete suggestion. No luck with tab on this platform though.
I use atom extensively, and have found that a quick left-right cursor move will leave the typed text in place and will NOT reactivate the suggestion list, unless more characters are typed. You can then type and move on to the next line.
I was actually searching myself for a way to exclude "then" from the autocomplete action, because I have text in other locations that has it as a commented "Then". I was hoping to find a way to exclude that word completely, but thought to share my work-around for that little bit, instead.
I am having the same problem where my text is getting replaced with cached words where if I wanted to type “manage” but if I have used “management “ before, I will get the text what I don’t want if I press enter. I went into preferences and followed the same steps mentioned in the below article and once the preferences are changed, I don’t see the word suggestions anymore. I felt so relieved.
https://elearning.wsldp.com/pcmagazine/disable-code-hints-atom-editor/

Ctrl+P and Ctrl+N for navigation in jupyter notebooks

I'm used to Emacs navigation, in particular Ctrl+P, N, F, and B, but I'm also used to Jupyter notebooks by now. The general question is: how to enable those shortcuts in a notebook?
What tickles me is the fact that on Mac those keybindings are already in place in a standard Anaconda IPython. But it's perfectly understandable since most system and browser shortcuts are bound to Cmd instead of Ctrl.
Since I spend a lot of time in Ubuntu, I wanted to reproduce the same behaviour here. It soon became apparent that most browsers hold some of the keybindings very dearly, such as Ctrl+P for print or Ctrl+N for New window. Turning these off is a huge matter in itself, so I decided to use another browser solely for the Jupyter Notebook, and Vivaldi seems like a nice choice since all shortcuts are easily customizable there.
I believed that with browser shortcuts being turned off, the IPython syntax would kick in, but none such thing has happened. Next I tried one of many manuals on the Jupyter notebook shortcuts customization (such as this one http://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/Custom%20Keyboard%20Shortcuts.html) to bind the 4 shortcuts I need. It works only up to some extent and only in the Jupyter inline magic:
%%javascript
Jupyter.keyboard_manager.command_shortcuts.add_shortcut('ctrl-p', 'jupyter-notebook:move-cursor-up')
What it does is that occasionally now the cursor in command mode does indeed move up when I press ctrl-p, but this behaviour is unstable. Moreover, after it moves, it immediately enters the edit mode in the cell above, which isn't happening if I simply press 'Up' arrow. As for the same trick for the edit mode:
%%javascript
Jupyter.keyboard_manager.edit_shortcuts.add_shortcut('ctrl-p', 'jupyter-notebook:move-cursor-up')
alas, it doesn't work at all.
Forgive me for the prolonged intro. The questions I have now are:
What is wrong with the key bindings I use in inline mode? Is it a silly mistake I made or a Jupyter glitch?
When I try to use these byndings through my custom.js file, they do not work. However, the file itself is recognized, e.g. the alert() commands work perfectly fine.
I've stumbled a few times on a emacs-bindings for the CodeMirror, however, as far as I understood, they are mostly used for copy-paste related matters rather than navigation, is it true? Would it help to use this set of bindings instead of pursuing the path with custom.js?
Thank you.
UPD
Installing emacs.js from CodeMirror and adding this code actually solved my problem. Just had to make sure that all conflicting browser keybindings were turned off.
require(["codemirror/keymap/emacs", "notebook/js/cell", "base/js/namespace"],
function(emacs_keymap, cell, IPython) {
cell.Cell.options_default.cm_config.keyMap = 'emacs';
var cells = IPython.notebook.get_cells();
for(var c=0; c< cells.length ; c++){
cells[c].code_mirror.setOption('keyMap', 'emacs');
}
}
);

Using atom text editor with the vim-mode package, how do I view commands in command mode?

I just started using atom and I want to be able to see the commands I'm typing (i.e. ':' some command, but unlike in vim where you see them at the bottom of the window I don't see them in atom. Anyone know where/if they appear?
The "Key Binding Resolver" should show you what you want. You can get there by hitting Cmd+.
As per my experience it does not show the command, but does work in some instances like search (:?) or (/). This is shown under the text editor main window.

The type or namespace name 'FaceBookClient' could not be found

None of the other questions regarding this question were able to answer this. I am new to programming, and I am just trying to add a FacebookLogin option to the website.
I built all the Javascript they wanted, and there is no error there(I don't think). In the interest of saving time, and that I am working on multiple computers. I am going to post pictures of all the code. I have added excess using statements to try and get the reference.
http://imgur.com/a/2wCyf
If you need anymore information let me know. And I will edit this page.
it looks like you just have some simple issues to fix in your IDE/project. The below instructions are for Visual Studio, but can be slightly altered for other IDEs.
First, make sure you have a reference to the Facebook SDK for .NET (I'm assuming you're using Outercurve's library from the looks of it):
In Visual Studio, check in the Solution Explorer window, then expand the "References", and make sure you see it there.
If it's not there, right-click "References", then "Manage Nuget Packages". When the Packages screen pops up, ensure in the left-pane that you have "Online -> nuget.org" selected. In the top right of the Packages window, in the "Search Online" textbox, enter:
facebook sdk and press "enter". On my screen, it's the second search result. To ensure you have the correct one, ensure that the "Created by" field says "Outercurve Foundation" before you accept it. Once you know you have the right package, hit the "Install" button, and it will be added to your project.
Once you have verified you have the correct reference, if you are still having the issue, make sure you have a "using" statement in your class file, to ensure library types you are using are recognized. In this example, I believe that would be:
using Facebook;
From the images of code you provided, I didn't see that statement in there, so that may be the problem, if this is fact the library you are referencing.
I am new to this type of application but what I found that is:
Use Facebook.FacebookClient instead of FacebookClient.

Adobe Extendscript Photoshop Guides Visibility

Is there a way via extendscript (jsx) to get the visibility status of Photoshop' guides?
The code to show and hide the guides is the same code as it 'toggles' the guides on or off so it must know the status when this code is executed, but how do I get at it?
I appreciate this could be done via a preference switch but that seems an awkward hack for something this simple, especially as something somewhere must be accessing this 'property' during execution of the 'toggle' code.
What would be great is to have activeDocument.guides.visible property, returning either true or false. Is there anything like that?
EDIT:
OK. Further investigation reveals that creating a guide using guides.add does not automatically toggle guides ON, however, using the code generated via the scriptListener does.
I would rather use guides.add as its only one line of code compared to fourteen so in order to toggle the guides to ON I thought I could run a function that created and then deleted a guide using the scriptListener code during the onLoad of the HTML.
This works great, except getting this function to run only when a document is opened is now the new problem.
documentAfterActivate is supposed to be the code to do this except it doesn't work unless a flash panel such as kuler is opened first.
So the question now is really what part of the flash code is allowing documentAfterActivate to work properly and how can I use it in my code instead of opening a flash panel I don't need?
It doesn't look like you've got a direct toggle option. You'd need to record the position of the guides somewhere and use script listener code to clear them when you wanted to toggle them off and use the add method on the Guides object to re-add them.
Keep in mind that even getting to the guide position via the photoshop DOM wasn't avail before CS4 I think? maybe CS5.
And i realised I just mis-read your question quite a bit. Anyway, this way you'd also know if the guides were visible based on whether or not they are there :) But yes, it isn't as nice as it could be.
The solution:
As stated, the workaround is to create and delete a guide with the fourteen lines of code from the scriptListener.
This toggles the guide visibility to ON regardless of its current state.
I can then save this status as a preference using putCustomOptions.
A function to do this is fired during the onLoad of the HTML but only when a document is opened otherwise guide creation fails.
documentAfterActivate does not work as expected unless a further flash panel (such as Kuler) is also opened beforehand.
An alternative to documentAfterActivate is to register the open event using CSevent instead.
The code can be found HERE.

Resources