Generating table of contents - wolfram-mathematica

I posted this one a couple of months ago on the Mathematica newsgroup, but got no usable response. I thought I'd give SO a try.
The question was: I don't seem to be able to find the method to generate the table of contents of a
Mathematica document I'm working on. Anyone knows this feauture's
hideout?
David Annetts pointed me in the direction of the AuthorTools, an old v5.1
utility package that's still hidden in Mathematica. However, it
doesn't work on my document (v7). Any clue?
Edit
The TOC should contain correct section numbers (if present in the stylesheet) and list page numbers (this requires taking page size settings into account).

Perhaps looking at the code of Yuri Kandrashkin's package, Sidebar, will be useful?

Related

Best approach for tracking clicks and selection based task in wix

I am looking for a low code solution for a Wix website I am creating. I have the website done except for the gamified task. I am looking to present the user with 3 or 4 pictures on the page, and they must make a selection of the available pictures. The selection is either correct or incorrect based on a pre-determined decision, and the click and selection need to be stored and saved in a database. Following correctly choosing the correct or incorrect answer, the user is presented with the next question. I was wondering if anyone had any key terms to look up that are no code/low code solutions to a task like this, or examples that anyone has seen of tasks that have been made in wix/corvid like this. Any help is greatly appreciated.
You will need some code to do this. It shouldn't be too difficult to do, but there's some work involved.
Some of the APIs you'll need to use are
$w.Image.onClick()
wix-data.insert() (or wix-dataset.save())

Importing book names from goodreads.com into Google Sheets with ImportXML gives "Import Internal Error" sometimes

I have a formula that fetches names of books from goodreads.com:
=IMPORTXML("https://www.goodreads.com/book/show/" & gr_id; "//*[#id='bookTitle']")
where gr_id is a column containing ids of the books. For example when gr_id=23848607, it fetches from URL https://www.goodreads.com/book/show/23848607 and the result is "Warheart".
The formula worked fine some time ago. I did not change anything and now I noticed it stopped working for some of the books (still working for others). Instead of the name of the book now it gives N/A with "Import Internal Error" hint. The ids that do not work are:
48332548
35906922
How to make it work for all books?
There were many questions posted about "Import Internal Error" problems. I tried some solutions including copying the formula to a fresh sheet, but it did not work.
Update: I tried the following different XPath formulas instead of "//*[#id='bookTitle']".
"//h1[#id='bookTitle']"
"//h1"
Those different XPath formulas worked the same as the original XPath formula. They worked correctly for the same ids that the original one did and produced N/As for the same ids that the original one did.
Update: I just re-checked and all my formulas worked correctly for all gr_ids (I had not changed anything since the time when they did not work.) May be someone knows how to prevent them from stopping working in the future.
Update: I re-checked once again. Of all gr_ids only this one was showing N\A now: 35906922. I created an example spreadsheet, because my working spreadsheet contains too many unrelated details, but the problem did not appear in the example spreadsheet. I went back to my working spreadsheet and reloaded it - and the problem disappeared in my working spreadsheet too. Then I added more test data in the example spreadsheet and the following new example gr_ids showed N\A:
48213012
48213092
I tried to make a copy of the example spreadsheet to see if it fixes the problem. The behavior in the copy example spreadsheet was identical to the original example spreadsheet - the problem only with two gr_ids specified above.
if you run full IMPORTXML on those two IDs you can see it won't return anything at all:
=IMPORTXML("https://www.goodreads.com/book/show/48213012-fathers-and-sons", "//*")
which means that Google Sheets can't reach the XML content for some reason (could be something similar to https://stackoverflow.com/a/24891676/5632629)
therefore we can try to read the source code directly with IMPORTDATA where we can find around 70 elements with the same information so we pick one, isolate it and remove HTML tags. then we just wrap the prior formula in IFERROR and force the formula to take a 2nd look if it fails first time. the result is like this:
=IFERROR(IMPORTXML("https://www.goodreads.com/book/show/"&A:A, "//*[#id='bookTitle']"),
REGEXEXTRACT(QUERY(ARRAY_CONSTRAIN(
IMPORTDATA("https://www.goodreads.com/book/show/"&A:A), 100, 1),
"select Col1 where Col1 contains '</title>'"), ">(.*) by"))
IMPORTXML() seems to be unreliable. I decided not to use it, because I did not find an acceptable solution to my problem. Instead of using IMPORTXML() I exported my books from goodreads.com to csv file (there is such a feature of goodreads.com) and then imported the csv file into my spreadsheet. This is not be an perfect solution, because I need to re-import every time I need to update the books, but at least it works.

Backpropogation Through Time with Snarli

This question stemmed from the following post with a recommendation to use Snarli for Backpropogation Through Time. I tried it out for regular Backpropogation and it works great. However, I'm not sure about backprop through time. With the limited documentation I can't quite tell how to do it. I used BpptUpdate, but I need to set some momentum term for a layer. I'm a little confused by this (which layer to set and how).
Anyway, just looking for a quick response and I understand it is probably a very limited audience who has used Snarli. My next step is to email the author if I don't hear anything and I figured I could post the answer.
So, maybe this goes without saying, but after emailing the author I came to find that examples are found in the CVS repository (not in the .jar file) or in the snarli-apps compressed files at http://sourceforge.net/projects/snarli/files/snarli/Beta0.21/.
An example for BPTT is found in the Caudill file, the Elman loop is found in elman, etc.

Is there a comprehensive MIME header format reference online somewhere?

I've looked at probably 100 sites, and haven't found anything. Some are just lists of mime type values, others references to the RFCs, or more or less direct quotes from them. The RFCs are impenetrable, and each only reveals one small part of the elephant.
Is there somewhere that gives us a comprehensive picture of the entire elephant (the MIME header), with all the parts attached in their appropriate locations?
I am going to list websites that have helped me on this topic enormously and hope they can help you two. I saved these to my bookmarks over time:
http://en.wikipedia.org/wiki/MIME
http://reference.sitepoint.com/html/mime-types-full
https://www.rfc-editor.org/rfc/rfc1521
http://www.hunnysoft.com/mime/
https://www.rfc-editor.org/rfc/rfc2045
https://www.rfc-editor.org/rfc/rfc2046
https://www.rfc-editor.org/rfc/rfc2047
https://www.rfc-editor.org/rfc/rfc2048
https://www.rfc-editor.org/rfc/rfc2049
http://www.iana.org/assignments/media-types/index.html
http://www.iana.org/assignments/media-types/video/index.html
http://www.iana.org/assignments/media-types/application/index.html
http://www.iana.org/assignments/media-types/audio/index.html
http://www.iana.org/assignments/media-types/examples/index.html
http://www.iana.org/assignments/media-types/image/index.html
http://www.iana.org/assignments/media-types/message/index.html
http://www.iana.org/assignments/media-types/model/index.html
http://www.iana.org/assignments/media-types/multipart/index.html
http://www.iana.org/assignments/media-types/text/index.html
All of these helped me in one way or another and I saved all of them because I will probably need them in the future, hope they help you as much as they did me.
http://www.iana.org/assignments/media-types/index.html
That is the ONLY link you should need!
EDIT: Answer in the Comments
http://ietf.org/rfc all the text is there, but not very useful because there is other stuff too. So then, go to the index: http://ietf.org/rfc/rfc-index and ctrl+f for MIME. This brings up 113 hits. Go through the title until you see what you are looking for, then reference the number and get the full text

Inline data representation

I would like to represent data that gives an overview but allows them to drill down in an inline fashion - so if you had a grouping of say 6 objects the user could expand the data and it would show the 6 objects immeadiately below it before any more high level data.
It would appear that MSHFlexgrid gives this ability but I can't find any information about actually using it, or what it's limitations are (can you have differing number of fields and/or can they have different spacing, what about column headers, indentation at for the start, etc).
I found this site, but the images are broken (in ie8 and ff3.5). Google searches show people just using the flat data representation but nothing using the hierarchical properties). Does anyone know any good tutorials or forums with a good discussion about pitfalls?
Due to lack of information about using it, I am thinking of coding my own version but if anyone has done work in this area I haven't found it - I would of thought it would be a natural wish for data representation. If someone has coded a version of this (any language) then I wouldn't mind reading about it - maybe my idea of how to do it wouldn't be the best way.
You might want to check out vbAccelerator. He has a Multi-Column Treeview control that sounds like what you may be looking for. He gives you the source and has some pretty decent samples.
The MSHFlexGrid reference pages and the "using the MSHFlexGrid" topic in the Visual Basic manual?
Sorry if you've already looked at these!

Resources