Tag Info

40

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 ...

25

As much as I would like to see a solution to this problem written in Mathematica, this is very unlikely given the scope of the problem. I would like to share a way to solve this using JLink, in the hope that it may help someone. JLink, for those who don't know, is a package that comes with Mathematica. It allows you to execute Java code from within ...

18

Animations as interactive visualizations The simplest form of interactive graphics is an animation in which the play head can be moved by the user. That doesn't sound very interactive, but in terms of functionality the play head is nothing but a type of Slider. With this simple interpretation of interactivity, any movie format supported by Export would be ...

17

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, ...

16

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 ...

15

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.

13

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 ...

10

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 ...

10

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 ...

10

This will download the titles of all articles that transclude the Persondata template, if that's what you're trying to do. Flatten@NestWhileList[ Import["http://en.wikipedia.org/w/api.php?action=query&list=\ embeddedin&eititle=Template:Persondata&format=json&eilimit=500" <> If[Length@# > 1, "&eicontinue=" <> ...

10

This is an issue with XOWA. The HTTP Server was rewritten in v2.7.2 to handle POSTs and other features. However, it looks like it crashes on your request. I'll look at fixing this for v2.8.2. I'll comment again here when I have a resolution, but feel free to contact me directly for more info. Hope this helps! [Edit: This was fixed for v2.8.2. XOWA now ...

9

The deploy functionality was introduced in Mathematica 8.0.4. To my knowledge, it is not available in 8.0.1.0, see the changelog.

8

The different HTML entities are stored in SystemConvertMLStringDataDump$HTMLEntities on version 9 and from here, it's a simple StringReplace: StringReplace["<select></select>", SystemConvertMLStringDataDump$HTMLEntities] (* "&lt;select&gt;&lt;/select&gt;" *)

6

Something like: ExportString[Cell[TextData["<select></select>"],"Text"],"HTML","FullDocument" -> False] produces: <p class="Text"> &lt;select&gt;&lt;/select&gt; </p> which might also be a good start.

5

The short answer is no, there is no straightforward (built-in) way to convert Mathematica's dynamic objects to non-proprietary HTML+SVG/JS. To see why, consider how you might try ti represent the following very simple example in HMTL/SVG? Manipulate[With[{pts = {#, Sin[a*#]} & /@ (x /. Quiet[Solve[Sin[a*x] == b*AiryAi[-x] && 0 < x < 10, ...

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 ...

5

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 <> ...

5

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 ...

5

I don't know how robust this is, but this function seems to do what you want: ImportString[ ExportString[Delete[ImportString[#, "Table"], {{2}, {-2}}], "Table"], "HTML" ] &

5

Just import the source of the page instead of its rendered content: Import["http://nyt.com", "Source"]

5

I figure it's good to avoid trying to parse the String manually when we can have Mathematica turn it into an XMLObject for us with ImportString[string, {"HTML","XMLObject"}] which lends itself to more reliable parsing. It's not really simpler but should give less headaches down the line. Here is a quick demonstration, modifyXMLAttributes takes an XMLElement ...

5

Your code works fine—the site is just very stringent on the data supplied. I used Chrome's Inspect Element to see the values of all the input elements (including the hidden fields, as you'd noticed)—and I found that sometimes codigoColegio was left blank: It didn't work when I filled out codigoColegio to match nivel as you seemed to have done, but it did ...

5

Updated Using ToBoxes@Column[{Row[{"test", "1"}]}] we get TagBox[GridBox[{{TemplateBox[{"\"test\"", "\"1\""}, "RowDefault"]}}, <<omitted output>> That TemplateBox is strange because Row should have translated into RowBox. Let us force it: kubaExport[x_] := ExportString[ ToBoxes@x /. TemplateBox[a_, "RowDefault"] :> RowBox[a] // ...

5

I don't know what causes the issue (which looks like a bug to me), but I generally find the best way to deal with exerting control over Import not doing quit the right thing with HTML is to use the "XMLObject" element and use ordinary Mathematica functions on it, like so: In[1]:= ImportString@ ExportString[ ...

4

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...

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., ...

4

I can understand, if Mathematica does not provide such functionality. It is running on top of an operating system, which delivers all the functionality to do these things, like socket I/O etc. I don't see the point to do this inside of Mathematica. What you can do is this: a) unix plattform Run["/path/to/wget", "http://www.nytimes.com"]; This is just ...

4

The answer in general is no, and I've also wished there was a simple way to do it. The only exception I know of is when you export a notebook with a ContoutPlot or ListContourPlot to HTML, as in this question. The exported GIF image actually contains a reference to an image map which is a very old-fashioned way of providing tooltip information in images ...

4

The benefit of using a symbolic tree representation with inert heads as in Leonid's parser is that you can then decide how to represent the data. And that is indeed what you should do, instead of extracting the elements using Cases. Here's an example using your parsed output above: Block[{ulContainer, liContainer}, ulContainer[_, l__] := {l}; ...

4

This thing could be done by the option "MathOutput"->"InputForm", However I'm not sure whether this can entirely solve the question(need more tests). Export["test.html", nb = EvaluationNotebook[], "HTML", "ConversionRules" -> {"Input" -> {"<pre><code>", "</code></pre>"}}, CharacterEncoding -> "CP936", ...

Only top voted, non community-wiki answers of a minimum length are eligible