Jupyter link to section - jupyter-notebook

I tried to create an internal link to a heading in a jupyter notebook, using the following. The various answers on SO, such as here don't seem to be working as expected in my notebook. The code below creates a link, but nothing happens when trying to access the link.
[Link to section](#section)
... Some text ...
## Section
An alternative method suggested here does work as expected.
<a href='#section'>Link to section</a>
... Some Text ....
<a id='section'></a>
## Section
Is there a mistake in the first section of code?
Update
After researching the suggestions by Waylan, I came across this example for ipython. Just adding dashes, without using lowercase seems to work.
[Link to section](#section)
becomes
[Link to section](#Section)

There are a couple different factors which could be at play here.
Non-Standard Markdown
The Markdown rules do not specify that the outplay should include an id attribute. However, many implementations create one for you. Some do so out-of-the-box and others only if a specific extension is enabled. You will need to check the documentation for the implementation you are using to see if such a feature is supported and what you need to do to enable it. If such a feature is not available, then the only option is to manually define the ids using raw HTML.
Slug creation method
As there is no standard rule, each implementation which adds the feature does so using their own non-standard method for creating the slug (value of the id attribute). For example, some handle capitalization and/or whitespace differently. You will need to check the documentation for the implementation you are using to find the method used. Alternatively, you could run a draft of the document through the Markdown parser and check for an id attribute and simply use the value. This ensures it will match without needing to know the method used. You may need to use your browser's "view source" feature to determine what id, if any, was assigned to the header.

Related

Can I filter error messages from certain sources in the Chrome Dev console?

In the Chrome DevTools console, I keep getting error messages from certain places that do not actually affect my application's performance. Is there a way to filter out errors from those sources? (e.g., a YouTube iframe with errors, certain Chrome Extensions, etc.)
Yes, you can. You are able to filter messages from any file source by right-clicking on the file's name and line (something like main.js:15) and selecting Hide messages from *filename*. This will block all messages coming from that file (as is probably self-explanatory given what the button says).
Warning: This will also block messages using console.log() that might harm your debugging process, as well as errors that might come up in the future and be important (which you will now not know about). Use with caution on your own files. It should be harmless with files that aren't yours (again, things like iframes and extensions).
You can reverse the block by going up to the Filter dialog box near the top of the console (to the right of the eye icon) and deleting it. (This will also delete all other filters, so you could just remove one if you needed.) You can also more specifically filter messages using Filter, but for the purposes of the question (blocking messages from a certain file), it does the job the fastest and the best.
For more information, see: https://developers.google.com/web/tools/chrome-devtools/console/reference#filter. This also includes information on the other ways to more specifically filter console messages.
At the top of your console is a filter box. Here you can do
plain text search
regular expression search such as /\d+\s\d+/
attribute, such as url:pagead
negate any of the above with prefix -.
combine (AND) any of the above with space
For example -url:pagead will filter out all messages that have pagead in the url. There are two other attributes context: and source:, but I don't know what they do.
For example, def anon will show only messages that contain both def and anon (not necessarily together).
I have not found any way to OR two expressions (UNION).
see documentation

Frama-C's extensible printer and projects

I am trying to make changes to the behavior of a function and print the results to a file. The ViewCfg plug-in described in the Plug-in Development Guide does something similar, but I am trying to avoid having to use Ast.get, which ViewCfg uses. I am thinking of extending Printer.extensible_printer which, according to the Frama-C API Documentation, is something I can do if I want to obtain a custom pretty-printer.
However, if I extend the pretty-printer as described in the API docs, unless I'm doing something wrong, I notice that the changes I make take place regardless of which project is set as the current project. I'm using File.create_project_from_visitor to create a new project and Project.set_current to set the new project as the current project before I use the custom pretty-printer.
Is it true that any change made by a class that extends Printer.extensible_printer applies to all projects? I happen to be using frama-c-Aluminium-20160502, which I know is not the latest version.
EDIT: Sorry, I should have made this clearer in the beginning, but I'm not actually making changes to the behavior of a function. I'm reading in the behavior of a function, then based on that, I'm trying to generate as output valid C code that's meant to be read as input by another program.
Regarding AST.get, the only reason I was avoiding it was that it sounds like it gets the entire AST, while I'm only interested in part of it, i.e. behaviors. But if I'm just making things harder for myself by avoiding it, then I'll go ahead and use it.

Auto-Incrementing (Unique) ID in Alfresco

i am trying to extend alfresco's document management by running a script. So far, i have managed to create a Custom Model with a Custom Type and Property as seen below:
the said Custom Type is under this Custom Model (never mind the Custom Aspect for now)
the custom type is working so far, i managed to apply it to a certain document as you can see below (Notice the Control Code Field)
now what i want to do is to add an auto incrementing function that will be set as the value of the Control Code Property (ie: [FILE0012])
i tried utilizing the scripts rule from alfresco but it seems like the commands are limited to that of alfresco's functionalities. not even alert() or console.log functions work. i thought that if i can make a script that could call an ajax to my php server, i can extract the document's property, and insert it to my database and get the rowid then attach it to a word "FILE" so it becomes the Control Code Property (ie: a document was inserted to my database at row 1996, then the Control code is [FILE1996], this is because i joined '[FILE' and 1996 and ']'
but like i said, what happened was, the javascript commands are limited to that of alfresco's needs.
i tried to make my research but i've only bumped on 2 outdated (and i mean outdated) threads dating back to 2006-2010. which does not help me quite well with Alfresco's current build structure.
i hope someone can help me with here. connecting to the database is not mandatory, but if i can make it do as such then it'll give me quite a rather amazing results.
Take a look at the "cm:countable" aspect. You do not have uniqueness guaranteed OOTB, so take that into account.
Example:
http://www.avantec.se/howto-create-an-auto-increment-field-on-an-object-in-alfresco/

Passing istanbul flags to grunt-jasmine-node-coverage

I am working on a project that is using the multiline node package. This allows us to create multi-line strings inside of multi-line comment tags.
The problem I am encountering is related to the grunt-jasmine-node-coverage node package.
Normally running istanbul, you can pass in the flag --preserve-comments and it won't strip out comments while processing the coverage information, otherwise it will default to false.
So far I have not been able to find a workaround for passing in this flag in the grunt-jasmine-node-coverage configuration. Is what I am trying to accomplish currently possible?

Different "clickable" log items in Chorome Dev Tools console

When I console.log a javascript object or array in Chrome Dev Tools I get a nice and clickable "drilldown" tree representation where I can inspect the various values, their keys and values with all the syntax highlighting, (i) icon, .length shown etc.
Is there some extension API for doing/changing this behaviour so it is different for some other classes/instances? My idea was to format Clojure data structures so one can inspect them the same way.
EDIT: I know I can do a simple formatting in console.log via %c etc., but that is only a tiny fraction of what I want to do.
So far I wasn't successful with googling. If you know where is the correct Chrome extension API written, can you please point me to the right direction?
There are no current extension APIs for customizing console output. https://code.google.com/p/chromium/issues/detail?id=142783 tracks that item. The team is open to a patch for this, if you'd like to look into tackling the implementation.
What you can do is to override console.log and, when object you are interested in is being printed out, use own function for printing it. To achieve something similar to the default object output you should probably use console.group and console text formatting (shown bellow).
See the official docs for more tips on using the Console.

Resources