Detailed Wolfram Programming Cloud

  • Tutorial


On June 23, 2014, less than a week ago, after a long development, a new product from Wolfram Research, called the Wolfram Programming Cloud (Wolfram Programming Cloud), was released. Stephen Wolfram wrote about his blog and his post was translated into Habrahabr.

Wolfram Programming Cloud allows you to program in Wolfram language in any browser and from any device, as well as create ready-made applications (web input forms and soon mobile applications), work with direct APIs, create automatically generated reports, deferred tasks, web pages, CDF and more. At the same time, everyone has the opportunity to try and use the Wolfram Programming Cloud for free .

I would like to share with you the first detailed video review in Russian of this product, as well as its implementation for a regular desktop - Wolfram Desktop.



From the review you will learn how to work with the Wolfram Programming Cloud, create input forms and APIs, use Wolfram Desktop, etc.

The video describes specific examples of working in the Cloud with geographic data, the VK API, sending messages to e-mail from the Cloud, processing and uploading images (both from user devices and from the Internet), the use of built-in functions of Wolfram Language, etc.

The main Wolfram codes used in the video review:

Terrain Graph
CloudDeploy@FormFunction[
{"city" -> "ComputedCity"},
Module[{data},
data = GeoElevationData[GeoBoundingBox[GeoDisk[#city, Quantity[10, "Kilometers"]]]];
Grid[{{#city},
{ListPlot3D[data, MeshFunctions -> {#3 &}, Mesh -> {{1, 0}}, MeshStyle -> Thick,
ColorFunction -> ColorData["HypsometricTints"], ColorFunctionScaling -> False,ImageSize -> 600]}},
Alignment -> {Center,Center}]]&,
"HTML"]

Image processing application
im1=Import["путь к файлу или веб-ссылка"];
im2=Import["путь к файлу или веб-ссылка"];
images =RemoveAlphaChannel[ColorConvert[#, "RGB"] ,White]&/@{im1, im2};
webString[str_]:=StringReplace[ExportString[Cell[str], "HTML", "FullDocument" -> False],""|"" -> ""]
CloudDeploy[
FormFunction[
{{"im1","Первая картинка"} -> "Image",
{"im2",webString@"Вторая картинка"} -> "Image"},
Module[{images,imDims,minX,minY,image,head},
images = RemoveAlphaChannel[ColorConvert[#, "RGB"] ,White]&/@{#im1, #im2};
imDims = ImageDimensions /@ images;
minX = Min[imDims[[;; , 1]]];
images = ImageResize[#, minX] & /@ images;
imDims = ImageDimensions /@ images;
minY = Min[imDims[[;; , 2]]];
Table[image[i] = ImageData[ImageCrop[images[[i]], {minX, minY}]], {i, 1, Length[images]}];
head = 1;
Image@Table[head = Replace[head, {1 -> 2, 2 -> 1}];image[head][[i, j]], {i, 1, minY}, {j, 1, minX}]]&,
"PNG",
AppearanceRules -> <|"Title" -> webString@"СМЕШИВАТЕЛЬ ИЗОБРАЖЕНИЙ",
"Description" -> webString@ "Выберите два изображения, смесь которых вы хотите получить.",
"SubmitLabel" -> webString@"Готово"|>]]

Work with the VK API
$VkAPIAccessToken ="ваш accesstoken";
VkAPIMethod[method_, {options___}] := Module[{response},
"response" /.ImportString[URLFetch["https://api.vk.com/method/" <> method, "Parameters" -> {"access_token" -> $VkAPIAccessToken, options}], "JSON"]];
message :=
Module[{fromId, date, text, Body, Subject,password}, 
{currentId, fromId, date,text} = {"id", "from_id", "date", "text"} /.VkAPIMethod["wall.get", {"owner_id" -> "-1172233", "offset" -> "0","count" -> "1"}][[2]];
Body = ToString[TableForm@{Row[{"От пользователя: ","http://vk.com/id" <> ToString@fromId}],
DateString[AbsoluteTime[{1970, 1, 1, 0, 0, 0}] + date, {"Hour", ":","Minute", ":", "Second", " ", "Day", ".", "Month", ".","Year"}], text}];
Subject ="Новое сообщение в группе Русскоязычной поддержки Wolfram Mathematica ВКонтакте";
password = CloudSymbol["pass"];
If[currentId === lastId, Null,
SendMail["To" -> "r.a.osipov@gmail.com", "Subject" -> Subject,"Body" -> Body, "Password" -> password];
lastId = currentId]]
message;


I hope that this video review will interest you and allow you to get started with Wolfram Programming Cloud faster!

Also popular now: