We’re rewarding the question askers & reputations are being recalculated! Read more.
33

In a post about automated image uploading Arnoud Buzing describes an undocumented and unsupported POST method. It looks like this: xml = Import[url, "XML", "RequestMethod" -> "POST", "RequestParameters" -> {"key" -> key, "image" -> image}]; Note: at the time of this answer I was using V8. Since the arrival of URLFetch in V9 I ...


30

I have made some time ago a Mathematica code to play with my Facebook graph. The code extracts your Facebook friends, photos, 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 use it, you to ...


28

Using the (deprecated but easy) API documented here, result = Import[ "https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=fuzzy%20monkey", "JSON"] Import["url" /. ("results" /. ("responseData" /. result))[[1]]] If you hit the service too many times, it'll lock you out for a while. Here's another example that gives the 24th-32nd results:...


26

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


24

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


22

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 = HTTPClient`...


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"]


19

Use URLFetch in Mathematica 9.0.1.


18

MoMA res= {1,2,3..} is the resolution.Use res = -1 for the max available resolution, but beware of a shipload of lawyers, middle managers, telephone sanitisers and hairdressers that may try to prosecute you if you use a value greater than 1, moma[catalogueNumber_, res_] := Module[{m = "http://www.moma.org", src, sj, rep, exp, a}, rep = {"]" -> "}", ...


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


16

Using the great example of Szabolcs from here, I implemented the following little function that solves my problem. You must give it a List of Rules, and it will send them to the hard-coded web-service endpoint inside. To test it, I implemented a little NodeJs server that reads the JSON body of a POST request, parses it, unparses it, and sends it back. So ...


15

There is a setting in Mathematica that controls whether it can access the internet. Go to Preferences -> Internet Connectivity and uncheck "Allow the Wolfram System to access the Internet". Disabling this will disable some features that depend on internet access, such as Wolfram|Alpha queries. This setting can also be controlled by the $AllowInternet ...


14

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


13

Van Gogh Museum Here is the same for the tiles structure of the Van Gogh Museum at @bills' request. Note that the structure is completely different. I preserved the same resolution convention: vanInTheSkyWithLucy[catalog_, res_] := Module[{i, df, zooms, c, maxXY, t}, i = Import["http://www.vangoghmuseum.nl/en/collection/" <> catalog, "XMLObject"]...


13

In my opinion, Mathematica's XML template feature makes this quite easy. You'd write your HTML code for each page using XML templates, and then populate the templates with data as necessary using TemplateApply. The collection of XML templates that make up the website would be what other systems call a "theme". This can be used either to build a static ...


13

You can use TravelDistance and related functions to find the distance by road. Example: TravelDistance[Entity["City", {"Tokyo", "Tokyo", "Japan"}], Entity["City", {"Osaka", "Osaka", "Japan"}]] (* Quantity[511.606, "Kilometers"] *) td = TravelDirections[{Entity["City", {"Tokyo", "Tokyo", "Japan"}], Entity["City", {"Osaka", "Osaka", "Japan"}]}]; ...


12

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


12

Two solutions: Use the listability of Interpreter to parallelize calls to WR servers: In[1]:= AbsoluteTiming[Interpreter["Time"][timeData]] // First Out[1]= 6.551647 Use Structured interpreters to avoid calling WR servers altogether: In[2]:= AbsoluteTiming[Interpreter["StructuredTime"][timeData]] // First Out[2]= 0.165715 In general you might want ...


12

This small note describes the method I use. I've been using this method for years. (all of my web site is written in Latex actually, and converted to HTML. First I used to use latex2html then switched to tex4ht few years ago as it is better supported and it comes with texlive). To use Mathematica to generate HTML, the idea is to mix Latex inside the ...


12

You can set $AllowInternet to False (or just turn off your WiFi or unplug the cable).


11

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


11

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


11

This is not an anwser to produce live/production code for websides. (yet) I guess it's not what you want because its not very sophisticated but one could use MMA to make a good html code emitter directly from Mathematica Expressions. We just write a function html which repeatedly calls itself on the subexpressions till it reaches "atomics" we can directly ...


11

You can use a program like Fiddler to compare the requests being generated by both: Your call to curl generates a request like this: POST https://postman-echo.com/post HTTP/1.1 Host: postman-echo.com User-Agent: curl/7.65.0 Accept: */* Connection: Keep-Alive Content-Length: 18 Content-Type: application/x-www-form-urlencoded Expected RESPONSE. Your WL ...


10

Mathematica now supports a native connection to GoogleCustomSearch API. To use image search you can do: gs = ServiceConnect["GoogleCustomSearch"] gs["Search",{"Query"-> "Jennifer Lawrence","SearchType"-> "Image"}] To use GoogleCustomSearch API you need an API Key and a Custom search engine ID. To get the API Key you first have to go to https://...


10

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 <> "'%20and%...


9

This is a hack, but it works. UploadFile[url_, filePath_, urlParams___] := With[ { bytes = Import[filePath, "Byte"], filename = StringJoin[FileBaseName[filePath], ".", FileExtension[filePath]] }, URLExecute[ url, urlParams, "Method" -> "POST", "MultipartElements" -> { {"file\"; filename=\"" <> filename, "...


9

If you are regularly sending email back and forth to a small number of people, then SendMail with the Google “less secure apps” setting is a very good solution. On the other hand, if you send or aspire to send, a large number of transactional or marketing emails every day, then an email delivery service may give a much better delivery success rate. For ...


9

Yep, as @Sjoerd mentions in the comments, 10.1 includes the WikipediaData functionality. You can use like this: links = WikipediaData["Mathematica", "BacklinksRules", "MaxLevelItems" -> 10, "MaxLevel" -> 2] Graph[links, VertexLabels -> Placed["Name", Tooltip], VertexStyle -> {"Mathematica" -> Red}]


9

I thought I'd just briefly lay out what I do so people don't have to go to the link to my blog post in the question. The packages for all this junk are here, here, and here. Look for the things with Pelican and Py starting their names and the WebSiteDeploy function. The autodoc pages are here, here and here Step 1: pelican I wrote a venv wrapper, installed ...


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