Can we show some Dynamics/CDF in PowerPoint or Keynote ? - wolfram-mathematica

I want to show some dynamic content in a presentation. However, I am not sure I have time by Thursday to make slides in the way I would like to within Mathematica.
Is it possible to have Dynamic objects built in Mathematica within A Powerpoint (Microsoft) or Keynote (Apple) presentation ?

What is wrong with making few Manipulates, export them each to separate CDF, and you got your presentation there.
You can make a web page, each page can be contain one CDF. Each page will be like your one slide.
You can click a link to go to the next web page.next slide, and in it you can run the next CDF.
To insert a CDF into a web page, is very simple, like this
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<BODY >
<p><script src="http://www.wolfram.com/cdf-player/plugin/v1.0/cdfplugin.js"
type="text/javascript"></script><script type="text/javascript">// <![CDATA[
var cdf = new cdf_plugin();
cdf.addCDFObject("source", "source.cdf",840,670);
// ]]></script>
<img id="source" src="screen_shot.png"
alt="screen_shot" />
</BODY>
</HTML>
Put your cdf files in the same folder.
If you know latex, you can write latex document, make them as sections of a document, insert the HTML code in latex, export the latex document to html using latex2html. (this is what I do with my web pages). Like this
\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{html}
\begin{document}
\begin{rawhtml}
<p><script src="http://www.wolfram.com/cdf-player/plugin/v1.0/cdfplugin.js"
type="text/javascript"></script><script type="text/javascript">// <![CDATA[
var cdf = new cdf_plugin();
cdf.addCDFObject("source", "source.cdf",840,670);
// ]]></script>
<img id="source" src="screen_shot.png"
alt="screen_shot" />
\end{rawhtml}
\end{document}
Then type latex2html foo.tex and that will generate the html for you. This way you can write real mathematics using Latex, and have the CDF in the same page we well, next to your equations.
All what you need for your presentation is a browser and the CDF plugin installed.
Or, you can simply keep everything in Mathematica itself, with a Manipulate in each section of a mathematica notebook, and just run the notebook inside Mathematica at the presentation.
Forget about power points and PDF's. That is so boring and old fashioned now :)
CDF is the way to go.

If your presentation laptop has Mathematica you could use MMA itself to give the presentation. It has a presentation mode.

Yes you can! I was wondering the exact same thing for a group presentation where other members were making PowerPoint slides. It's simply a matter of embedding the slide into an HTML file then embedding the HTML file in a PowerPoint slide. It's not perfect, but it works surprisingly well and you maintain full interactivity.

Export a video file, eg by
an = Table[
Plot[Cos[x/a],
{x, 0, 20*Pi},
PlotRange \[Rule] {-1, 1}
],
{a, 0.1, 10, .1}
];
Export["~/Desktop/an.avi", an]

I don't think it is possible to do what you want, since even if you can use the standard java script to link to the CDF, there is no properly integrated CDF plugin for powerpoint, keynote, a pdf viewer etc...
Either, as other people have suggested, learn how to use Mathematica/CDF to make presentations - see the discussion in belisarius's SO question. Or use a html-based presentation.
It is possible to export a keynote presentation to html. Here's a tutorial that shows how to tweak it to get a navigation toolbar and make movies work - and an example is here. You should be able to embed a CDF (see also Walking Randomly) using similar modifications of the outputted html.
Alternatively, create a HTML based presentation from the start. S5 is a good opensource html slideshow. It uses markdown, so it's just like writing in stackexchange sites! Instiki includes a S5 mode. You can include raw-html in the presentation, so you should be able to embed CDF's like above.

Related

Using Transcrypt with Leaflet Maps

I love Python, and have never much cared for JavaScript. So I was pretty excited to learn about Transcrypt. I recently started a web-based project that uses Django for the back-end and a Leaflet map (specifically Esri Leaflet) that plays a central role in the front-end. I'm trying to figure out if Transcrypt is a good fit for my project. However, the documentation and examples on Transcrypt's website are either too simple or delve into more advanced topics too quickly. As a result, I'm having a hard time deciding whether Transcrypt will add anything positive to my project or will simply bring more complexity and bugs. I'd rather not spend several hours trying to get Transcrypt working (time that could be productively spent simply writing JavaScript) only to find out Transcrypt isn't a good fit for my website. So I have a few questions.
I know Transcrypt is designed to work with any JavaScript library. Will it also work with map-based GIS libraries?
For example, if I can successfully encapsulate the whole of Esri Leaflet (but maybe I won't be able to?), Transcrypt would allow me to write the following in Python?
var map = L.map('map').setView([40.91, -96.63], 4);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(map);
var arcgisOnline = L.esri.Geocoding.arcgisOnlineProvider();
L.esri.Geocoding.geosearch({
providers: [
arcgisOnline,
L.esri.Geocoding.mapServiceProvider({
label: 'States and Counties',
url: 'https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer',
layers: [2, 3],
searchFields: ['NAME', 'STATE_NAME']
})
]
}).addTo(map);
By the way, that code was taken from here.
I didn't quite understand the explanations about integrating with JavaScript libraries found here, specifically where it says:
Another way is to encapsulate the JavaScript library as a whole in a Transcrypt module. In the distribution this is done for the fabric module, that encapsulates fabric.js and is imported in the Pong example. In this way the global namespace stays clean.
So I can't really tell if Transcrypt could handle all the GIS and map stuff.
The Leaflet map will be the main user interface for my site. So knowing that Transcrypt could encapsulate it is kind of important. There will also be a lot of event listeners connected to the map, and data going back and forth between the front and back-ends. I'm probably going to be using jQuery's Ajax for a lot of that. I saw a few simple jQuery examples on the Transcrypt website, but am not sure if Transcrypt is really up to the job yet.
I've noticed that the only person answering the Transcrypt questions is its creator, Jacques de Hooge. I guess my questions are really directed at him. Any advice you can offer me is much appreciated, Jacques!
You don't need to encapsulate the Leaflet library. You can use it just as is in Transcrypt.
Here an example. In a new folder create the HTML file mymap.html`:
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="leaflet.css"/>
<script src="leaflet.js"></script>
</head>
<body>
<div id="the-map" style="width: 1000px; height: 800px;"></div>
<script type="module">import * as main from './__target__/mymap.js';</script>
</body>
</html>
And create the Transcrypt file mymap.py:
def main(map_id):
watercolorTiles = {'linkTpl': 'http://c.tile.stamen.com/watercolor/{z}/{x}/{y}.jpg',
'attribution': '© Stamen Maps'}
australiaView = {'center': [-27.30,133.62],
'zoomSnap': 0.1,
'zoom': 4.5}
# Build the map
map = L.map(map_id, australiaView)
L.tileLayer(watercolorTiles['linkTpl'], {
'attribution': watercolorTiles['attribution'],
}).addTo(map);
main('the-map')
Note that teh Transcrypt code uses the global Lefa;et object L just as is. This factory object is already instantiated in leaflet.js and you can use it to build your map.
To view the map you need to do:
Download the Leaflet library and copy leaflet.css and leaflet.js into your folder.
On the Terminal command line (after cd'ing into your folder) transpile the .py file :
$ transcrypt mymap.py
Fire up a webserver serving your folder, e.g. with:
$ python3 -m http.server
Now go in your browser to http://localhost:8000/mymap.html and look at a beautiful (in this case watercolour) map of Australia.
Your geosearch code snippet could be written in a similarly fashion with Transcrypt - just make sure to write dictionary keys as Python strings (so instead of attribution write 'attribution')!

Custom sections Umbraco

Not even sure I labeled this correctly, I am in the process of converting a site to Umbraco, and there are sections of the site that needs to be edited using the CMS tools in the back end, basically it is a grid with pictures and description text
Here is a sample of the HTML
<div class="hi-icon-effect-1 hi-icon-effect-1a">
<a class="hi-icon">
<img class="img-responsive " id="ImgSales" src="../../Images/sales_icon_circle_grey.png" alt="">
</a>
<p style="padding-left:5px;" id="lblSales" class="">Sales</p>
</div>
What I would like to be able to do is go to the content section of the admin and edit the list of items and configure the image and text for each item.
http://www2.strikemedia.co.za/
If you view the above link and scroll down there will be a grid of items (services) and it is this list that I want to be able to generate.
I am comfortable with all the technologies used in Umbraco, I just do not know the system well enough to do these kinds of modifications, can someone please assist or point me to the resources that will help me build this.
Thanks
You should take a look at the Archetype package: https://our.umbraco.org/projects/backoffice-extensions/archetype/
As far as I understand your question you are looking for a way to add X amount of similar items to the contents of a page - for this, Archetype is probably perfect :-)
Once you have your list of items added inside Umbraco, look here: https://github.com/kgiszewski/ArchetypeManual/blob/master/03%20-%20Template%20Usage.md
Use case #1 in this example will allow you to iterate through items and output it with whatever "template" you want (aka the HTML sample you provided).

Arrange UI-Elements in HTML (with containers, layouts, etc.)

I'm working on a SAPUI5 application with XML-Views.
Now I want to arrange my buttons for example. They should be arranged so they form a numberpad like on a keyboard.
I only know the layout managers from Java or the layouts of a SAP Web Dynpro where I also used transparent containers.
So how can I arrange my elements in HTML? How can I use layout managers and is there such a thing as a transparent container?
Thanks for any hints! :)
Arranging HTML elements in SAPUI5 is how you would in normal HTML. SAP does emphasize that code in index.html is to be minimal, however, so do your best to keep your coding done inside of your views. Your elements are likely to be contained in <div>, </div> tags, which, like any other HTML tag, can be manipulated using CSS.
You'll need to create a CSS file and reference it in your index.html file like so:
<link rel="stylesheet" type="text/css" href="css/style.css" />.
Additionally, you should be aware of the native SAPUI5 layout controls and use them when you can as opposed to writing up your own solution.
You might find this post useful as well.

Insert clickable SVG image into Sphinx documentation

I have SVG image file with several nodes each is associated with URL. If I open this file directly in browser I can click on each node and it will open different URLs. However when I use this picture in my Sphinx documentation it doesn't work - picture rendered as a whole so I need to open it by View Image and only then I can click on nodes.
I'm using standard image directive:
.. image:: myfile.svg
Probably I need to use something else?
Sphinx generates <img> tags for images, which makes sense in most cases. However, to have the links inside the svg be clickable, you should use an <object> tag, i.e.:
.. raw:: html
<object data="myfile.svg" type="image/svg+xml"></object>
(Regarding the GitHub issue you linked to, I don't think there's a lot that Sphinx can do here—it's really quite complicated—short of introducing a new option to the .. image directive that lets the user specify whether to render as an img or object tag.)
One simple solution would be to add a link to the svg file in this .. image:: myfile.svg command:
.. image:: myfile.svg
:target: _images/myfile.svg
Take care of checking the relative directory where the images are copied when the html files are generated. By default, it should be _images/.
This way, you can click the SVG file, to see it in a plain page, and then click on it as usual (not a perfect solution but still..).
I am probably misunderstanding the OP's requirements, but why not just include the SVG into the sphinx documentation as html? This appears to work for me:
.. raw:: html
:file: images/image.svg
To include clickable svg links within sphinx I did the following:
.. raw:: html
:file: ../graphs/pymedphys_analysis.gamma.svg
See:
https://raw.githubusercontent.com/pymedphys/pymedphys/1915b9496e93782bdac7dcebff7e26e470e5ff57/docs/graphs/graphs.rst
This then freed me to write the following within an imported style sheet:
svg {
width: 100%;
}
https://github.com/pymedphys/pymedphys/blob/f4d404fa1cf3f551c4aa80ef27438f418c61a436/docs/_static/style.css
This made the svg fit the container as desired.
See:
https://pymedphys.com/developer/dependencies.html#pymedphys
I like this way
.. raw:: html
<a href="https://www.google.com/">
<img src="https://img.shields.io/static/v1?&style=plastic&logo=appveyor&label=Google&message=link2google&color=FF0000" alt="No message"/></a>
I'm still looking for a better solution myself, but I ran into the same problem and used this workaround.
You can use the download directive to give the user a link to the file.
:download:`svg <images/image.svg>`

Richer Coloring and Typesetting in DDoc Output

Can I make the generated HTML page from my DDoc-marked-up D program use richer coloring and type-setting? The default is black-and-white.
I'm currently calling DMD as
dmd -debug -gc -unittest -D -Dd$OUTPUT_DIR
Well, you should probably read through http://dlang.org/ddoc.html to get some of the details, but ultimately, what you need is a css file which tells it how to present the page. That can be set via the DDOC macro.
What I'd suggest doing is taking a look at https://github.com/D-Programming-Language/dlang.org, which contains the code for dlang.org - including the ddoc stuff. In particular, you want to grab std.ddoc along with the css, images, and js folders (as they are all referenced by std.ddoc). If you then give std.ddoc to dmd as part of your documentation build and have those folders in the parent directory of the documentation, the generated documentation should end up looking like the documentation on dlang.org. If you want to put the folders elsewhere, then just tweak the paths to them in std.ddoc.
If you want to change what the documentation looks like, just adjust std.ddoc and the css files accordingly. At that point, it's html and css stuff that you're dealing with, so you'll have to have some clue how those work to make the necessary changes to either the macros in std.ddoc or to the css files themselves. And of course, if you want to do anything with the js files, you'll need to know javascript. You can strip out all of the js and images if you want to. They're just what's used for dlang.org, but again, you'll have to have some clue how html and friends work to know what to do with that. I'm not particularly well versed in any of that, so when I've generated documentation, I've typically made only minimal changes to what dlang.org uses, but all I've typically been looking for is to get more legible colors than the default rather than anything specific.
Sorry that I can't be more specific or helpful than that, but the best that I've done with it is stumble through it enough to get pages looking like dlang.org, since I know next to nothing about web development. Hopefully this will point you in the right direction though.
Something else that you might want to look into is ddox, which uses ddoc comments to generate better looking documentation than dmd does. And it's likely that dlang.org will be switching to using ddox-generated documentation sometime in the relatively near future (some of the details still need to be sorted out, so I don't know when exactly, but that's the current plan). So, using ddox may ultimately end up becoming more common than using dmd to generate the documentation.
You can create your own .ddoc config file in which you override or create new ddoc macros to use class names and id's. Then you can style the page using CSS.
Sample .ddoc file containing custom CSS, Notice the theme.css file in the head HTML section:
DDOC = <!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link type="text/css" href="theme.css" rel="stylesheet" media="all" />
<title>$(TITLE)</title>
</head>
<body>
<h1>$(TITLE)</h1>
$(BODY)
</body>
</html>
H2 = <h2>$0</h2>
H3 = <h3>$0</h3>
STRONG = <strong>$0</strong>
EM = <em>$0</em>
DDOC_DECL = $(H2 $0)
DDOC_DECL_DD = <div class="declaration-description">$0</div>
DDOC_CLASS_MEMBERS = <div class="class-members">$0</div>
DDOC_SUMMARY = $(P $0)
DDOC_DESCRIPTION = $(P $0)
DDOC_MEMBERS = <div class="members">$0</div>
DDOC_ENUM_MEMBERS = <div class="enum-members">$0</div>
DDOC_MODULE_MEMBERS = <div class="module-members">$0</div>
DDOC_STRUCT_MEMBERS = <div class="struct-members">$0</div>
DDOC_TEMPLATE_MEMBERS = <div class="template-members">$0</div>
This file should be saved somewhere and added to the sc.ini file (in the case of Windows) or the dmd.conf file (in the case of Mac/Linux) like this:
DDOCFILE=myproject.ddoc
Then the next time you compile using -D, HTML is read from the custom ddoc macros instead of the built-in stuff and viola, you have style-able class names and id's to use with CSS.
Here's a preview of pretty documentation using a custom style-sheet and macros: http://htmlpreview.github.io/?https://github.com/kalekold/dunit/master/docs/dunit/toolkit.html
HTML files: https://github.com/nomad-software/dunit/tree/master/docs/dunit
Full ddoc macro listings can be found here: http://dlang.org/ddoc.html

Resources