Hot answers tagged html
31
All we need to create an interactive Google Map in the notebook is access to the individual tiles - and there is a relatively simple naming scheme for those tiles. I actually typed up a description of this naming scheme a few years ago and posted it here:
http://facstaff.unca.edu/mcmcclur/GoogleMaps/Projections/GoogleCoords.html
The examples on that page ...
16
It seems networkx uses the D3 library and the example is based on this. We can adapt that code to work with Mathematica and generate JSON output from Mathematica.
Save the HTML from the linked page to index.html. Change miserables.json in the source code to graph.json.
Generate JSON with Mathematica:
g = RandomGraph[BarabasiAlbertGraphDistribution[100, ...
14
You can always do Import["http://wsj.com","XMLObject"]. That has the side effect of producing some irregular XML whenever the underlying HTML doesn't quite map cleanly to XML, but it mostly produces an XMLObject[] expression tree that you can match over and extract data from, and I've never seen a web page for which it won't return something.
12
Comment
This was originally answered on Oct 2, 2012 using V8. The performance can be dramatically improved using V9's URLFetchAsynchronous, as now shown below.
Fortunately, we needn't download all the tiles at once. We can use Dynamic to set up a little pan-and-zoom explorer. The first load takes a bit and zooming out takes a bit. Panning and zooming ...
11
You do not really need a tool to depoly your CDF to HTML. It is very simple to do by hand. Here is what I do
open your text editor and create a file called index.htm
<HTML>
<BODY >
This is my CDF
<p>
<script src="http://www.wolfram.com/cdf-player/plugin/v1.0/cdfplugin.js"
type="text/javascript"></script><script ...
11
I agree wholeheartedly with the comment of celtschk to the OP. Both journals have RSS feeds (with pointers at the bottom of their main pages) that are designed exactly for the purpose that you describe. I doubt that either journal wants you to "scrape" their content; scraping is specifically forbidden by the WSJ Terms of Use.
I don't know how much easier ...
9
I've got my own package that I've used for a few years to generate LaTeX from Mathematica. All the labs on my Mathematica course page were produced with this package. Here's a handout on probability theory for Calc II students that was produced by the package. Unfortunately, it's not at all polished and really not usable by anyone but me. I can present ...
5
There's no easy way, it's a custom script that assembles the image out of individual slices, and it's written by someone who clearly didn't intend anyone to read it again (including himself).
Reverse engineering. The script responsible is http://imgs.xkcd.com/clickdrag/1110.js, the image to be displayed is assembled in line 86 ($image=...). Scanning the ...
4
You can download all the original tiles using the following functions. 404 and file not founds are handled gracefully. I'm avoiding displaying to the FE so as to lower the chances of crashing.
url[n1_Integer, d1_String, n2_Integer, d2_String] :=
"http://imgs.xkcd.com/clickdrag/" <> ToString@n1 <> d1 <> ToString@n2 <> d2 <> ...
4
For the two strings in your first example, this seems to work
ImportString[string, "HTML"]
For the baseurl as in the original post, Import[baseUrl, "Data"] gives something like
data = Import[baseUrl, "Data"]
data[[2, ;; 4]]
{{"Item", "View Options"}, {
1., "1841-1869 (Province of Canada), number 195, 21 June 1845, page \
15", "GIF | PDF"}, {
2., ...
3
As you already have the selection set to the cell and NotebookFind returns that selection, you could just use CurrentValue on it as here:
PaletteNotebook[
Button[Style["Blog it", 12, FontFamily -> "Times"],
Module[{
nb = InputNotebook[],
out = NotebookCreate[],
retval
},
SelectionMove[nb, Before, Notebook];
retval = ...
3
Using JLink and Apache Commons Email and Java Mail it is not that hard to get MIME controlling working. I just modified some code I wrote some time ago (mostly for being able to send Email from within webMathematica) and added the ability to send HTML emails. It is a whole package with the jar files in subfolder and a Notebook with an example, so I hope it ...
3
Perhaps this is caused by an interaction between the embedding JavaScript and the Page Zoom feature in Safari. If you reset the page zoom to "Actual Size" by pressing Command-0 (or from the View menu), it hopefully will allow you to interact with the controls again.
After that, it may even be possible to return to a larger zoom setting and still have the ...
3
As the result of the RSS is just a notebook expression, you can perform any transformation of that expression before you show the notebook. Here I replace the buttonbox as which the hyperlink is represented with a graphics cell that shows the image:
blognb = Import[
"http://gregmankiw.blogspot.com/feeds/posts/default?alt=rss",
"RSS"];
blognb /. {
...
2
I'm still not clear what you're looking for, but, with a slightly modified version of the code (from your web page):
list = DictionaryLookup[x__ /; x == StringReverse[x]];
SeedRandom[1];
col = Column@Riffle[
Framed[#,
Background -> RGBColor[RandomReal[{0,1}, 3]],
FrameMargins->2] & /@ list,
Framed[
TableForm[#, ...
2
Seems to work fine for me. I placed a simple RTF file (created by TextEdit on my Mac) on my webspace so you can try it.
NotebookPut[
Import["http://facstaff.unca.edu/mcmcclur/temp.rtf"] /.
Cell[td_TextData, "Input", opts___] ->
Cell[td, "Text", opts], WindowTitle -> "ImportedRTF.nb"];
The one problem I did have was that the resulting ...
1
This stupid piece of code doesn't work very well:
Export["test.xhtml", EvaluationNotebook[], "MathOutput" → "DisplayForm"]
and crashes Mathematica 8 reliably too, but the files it creates contain selectable text - here selecting something in the browser...
1
Have you any indication that CurrentValue[{sel,Cell}] should work? I didn't find any such statement in the documentation so I think in this case you need to use NotebookRead instead of CurrentValue. Note that even CurrentValue[nb,"SelectionData"] won't get you the selected cell but rather seems to be addressing dynamic selection with the mouse. Another thing ...
1
Some time ago I wanted to have good tooltips for images composed by polygons. Mathematica generated square areas only, and the polygons had many shapes. Then I did my own export function for polygons with tooltips. I basicaly rescaled all the polygon points to the image size and wrote the image maps. I never found how to get the right area from Mathematica. ...
Only top voted, non community-wiki answers of a minimum length are eligible

