Tag Info

Hot answers tagged

26

I have made some time ago Mathematica code to play with my Facebook graph inside it. The code extracts your Facebook friends, photos and relationships, and constructs a PDF file that you can click in your friend's picture to open their Facebook and see they relations. The result is like this: And the zoom in PDF is great, see: The notebook is here. To ...


20

webShot[URI_String] := Import["http://www.sciweavers.org/iWeb2Shot?url=" <> URI] webShot["google.com"] Another one: webShot["http://mathematica.stackexchange.com/questions/20486/import-the-thumbnail-of-an-internet"]


18

Certainly. There have indeed been some changes to certain tags in the 2.1 API and also to the method to sort out how many pages to import. And, since we are now a full site under StackExchange, the server has changed and a site parameter was necessary. I did a bit of clean-up, hardened the code a little to accommodate connection failures, made the basic ...


15

With this function a random integer is inserted in the e-mail address (gmailuser@gmail.com becomes gmailuser+randominteger@gmail.com) and then the hash value is computed. The hash value is used to get the corresponding identicon from the Gravatar website. This approach can address also some privacy concerns. generatePic[email_] := Module[{emailparts, ...


13

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


12

Seeing as how someone has been nice enough to write the C-code for you, you could just use that. Assuming you have a C compiler on your machine, here's how you use it within Mathematica. Note that code is defined below. (* Be sure to define code first! *) Needs["CCompilerDriver`"]; url = "http://www.stackexchange.com/"; checksum = CreateExecutable[code, ...


11

I am not sure what exactly that rank mean. But here's direct rough porting of code: ConvertStrToInt[url_String, init_, factor_] := Fold[FromDigits[IntegerDigits[#1*factor + #2, 16, 8], 16] &, init, ToCharacterCode[url]]; HashURL[url_String]:= Block[{c1, c2,t1, t2}, c1=ConvertStrToInt[url, 5381,33]; c2=ConvertStrToInt[url, 0,65599]; ...


10

I now have part of the picture. There is an undocumented function called HTTPClient`OAuthAuthentication[] which takes only options as arguments. These options settings override defaults that are visible in HTTPClient`OAuth.m. Here is an example of how to make get an OAuth 1.0a style access token, in this case for the Withings API: token = ...


9

I found some free gis data of indian roads. I extracted the india-latest.shp.zip and then imported the roads.shp file. Here is a quick example to extract relevant roads: (* Make sure to fix the path *) indiaRoadData = Import["india-latest.shp/roads.shp", "Data"]; (* This just happens to be where the Lines are located in the data, see below for some ...


8

I implemented this function using YQL: acquireOptions[stock_String, expiration_, type_] := Module[{options, list, data}, options = Cases[Import[ "http://query.yahooapis.com/v1/public/yql?q=SELECT%20*%20FROM%20yahoo.finance.option_chain%20WHERE%20symbol%3D'" <> stock <> "'%20AND%20expiration%3D'" <> expiration <> ...


6

Thanks to @halirutan and @Szabolcs, I found a working solution by myself. Apparently it won't work with localhost on Windows7 but with 127.0.0.1. To sum up, I present the ssh-commands, so other users might gain something from this (use your own network names or IPs here): First connect through the firewall via ssh.server: ssh -L 16286:127.0.0.1:16286 ...


5

It might make sense to try to import the data from WolframAlpha, seeing as how they've gone to the trouble to set it up. Unfortunately, the support for doing so is a bit disappointing, as it can't be accessed directly through Mathematica. I imagine that a future version will support this but, for the time being, this is available only via WolframAlpha ...


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

If you're downloading a website it may not be entirely static. So you need to download the file and check the headers at the same time, you cannot do it separately. Therefore URLSave is easier to use, even though URLFetch can also to be used. Like Joel Klein says there isn't a checksum by default for every page. However, we could use the header ...


4

You question does basically not fit here, but I'm sure it is still one of the best places to ask. I think we shouldn't be too pedantic with the rules. Let me give you some advice, which will unfortunately only help you, if you can cooperate with your admin of the server: You have to ensure, that you can reach the license server over an IP, because this is ...


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

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


3

using Mathematica 9 the easiest way is URLSave URLSave["http://www.nytimes.com" , "C:\\temp\\test9.html"] you get the output "C:\temp\test9.html" and then directly from within Mathematica open your html default browser SystemOpen[%] with earlier versions try the following source = Import["http://www.nytimes.com", "Source"]; ...


2

URLFetch does return only when it finishes processing the request. Knowing whether the request was successful is a different matter, it depends on where along the chain things break. In general, you can verify the download by obtaining a checksum or hash value and then comparing it with the value you get on the downloaded data. But that's up to you and ...


2

As I wrote in my earlier comment, I got the same error messages in the two-PC client/server Tunnelier system I set up specifically for this question. Apparently Mathematica's handling of proxies is not really up to the task, as I have had many problems with them before (in particular proxies in an NTLM environment). I did have some success by adding the ...



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