MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Copying input from the Wolfram blog

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78231] Re: Copying input from the Wolfram blog
  • From: "Hans Michel" <hmichel at cox.net>
  • Date: Tue, 26 Jun 2007 04:35:22 -0400 (EDT)
  • References: <f5o7d0$4rd$1@smc.vnet.net>

Steve:

I am not certain what level of drilling down you can stand but this is where 
the FireFox DOM inspector works nicely.

If you have FireFox with the DOM Inspector option installed, then use the 
DOM Inspector. For each element that you want the title or alt text to --  
toggle the "Select Element by Click" and click on the image in the Browser 
View. In the Object View the "DOM Node" the object selected and its 
attributes should be available for copy/paste.

Or maybe the folks at Wolfram can add the same "Click for copyable input" 
javascript functionality to the blog pages.

Or you can modify the following rough Mathematica code

x = 
Cases[Import["http://blog.wolfram.com/2007/06/mathematicas_true_colors.html#more";, 
{"XMLObject"}],
 XMLElement["img", {___, "alt" -> x_ /; StringMatchQ[x, "*=*"], ___}, {}] :> 
x , Infinity]

it should return a list
{"In[1]:= ColorSetter[] | Out[1]: (interactive color setter box)", \
"In[2]:= {ColorSetter[Dynamic[c]],  Graphics[{Dynamic[c], \
EdgeForm[Black], Disk[]}]} | Out[2]= (ColorSetter with dynamically \
colored Disk)", "In[3]:= {ColorSlider[Dynamic[c]],   \
Graphics[{Dynamic[c], EdgeForm[Black], Disk[]}]} | Out[3]= \
(ColorSlider with dynamically colored disk", "In[5]:= \
Graphics[Polygon[{{-1, 0}, {1, 0}, {0, Sqrt[3]}}, \
VertextColors->{Red, Green, Blue}]] | Out[5]=  (Triangle with red, \
green, and blue vertex colors)", "In[6]:= pic = \
Reverse[ExampleData[{TestImage, Lena}, Data]][[5 ;; -5 ;; 5, 5 ;; -5 ;; \
5]];  |  In[7]:= ListPlot3D[Table[x + Sin[x y], {x, -5, 5, .1}, {y, \
-5, 5, .1}], Mesh -> None, VertexColors -> {pic/255.}, Lighting -> \
Neutral]  |  Out[7]= (Textured plot with image)", "In[8]:= \
Graphics[{ColorData[HTML][DeepSkyBlue], Rectangle[]}]  |  Out[8]= \
(DeepSkyBlue rectangle)", "In[10]:= ContourPlot[x + Sin[x^2 + y^2], \
{x, -4, 4}, {y, -4, 4},   ColorFunction ->Pastel]", "In[11]:= \
GraphicsGrid[Partition[ColorData[#, Image] & /@ ColorData[Gradients], \
3], ImageSize -> 300]"}

I leave it to others to write a function where you give it the URL and input 
number
GetInput[URI, n_Integer] := ....

String manipulate to get items to the left ot the "|" pipe and remove 
"In[number]:=".

Note you can use either the alt or title attributes which ever has the least 
character length restrictions in HTML.

Hans

"Steve Luttrell" <steve at _removemefirst_luttrell.org.uk> wrote in message 
news:f5o7d0$4rd$1 at smc.vnet.net...
>I find the Wolfram blog at http://blog.wolfram.com very interesting, but I
> am frustrated that I can't find a way of copying the input cells (which 
> are
> actually images of input cells) to Mathematica in order to evaluate them.
> There is "ALT" text visible when you hover over the image of each input
> cell, which looks as if it is what I need but I can't find a (quick) way 
> of
> accessing this text. Drilling down into the source HTML isn't really a 
> very
> convenient solution.
>
> So, the question is, is there a quick way of extracting input cells from 
> web
> pages generated by Mathematica?
>
> Steve Luttrell
> West Malvern, UK
>
>
> 



  • Prev by Date: Re: problem with Pick
  • Next by Date: Re: Why use Java in Mathematica?
  • Previous by thread: Re: Copying input from the Wolfram blog
  • Next by thread: Re: Copying input from the Wolfram blog