Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

16
LINES

< > BotCompany Repo | #1013965 // Test OpenWeatherMap Forecast

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (5918L/40K).

!7

p {
  S url = "http://api.openweathermap.org/data/2.5/forecast";
  S xml = /*postPage*/loadPageWithParams(url, APPID := openWeatherMapAPIKey(), q := "Hamburg", mode := "xml");
  print(xml);
  new TreeMap<S, Double> maxPerDay;
  for (L<S> tTime : findContainerOrEmptyTag(xml, "time")) {
    S from = tagParam(tTime, "from");
    S day = takeFirst(from, lastIndexOf(from, "T"));
    L<S> tTemperature = first(findContainerOrEmptyTag(tTime, "temperature"));
    double maxTemp = kelvinToCelsius(parseDouble(tagParam(tTemperature, "max")));
    maxPerDay.put(day, max(maxTemp, toDouble(maxPerDay.get(day))));
  }
  pnlStruct(maxPerDay);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xfbsdwenvhih

No comments. add comment

Snippet ID: #1013965
Snippet name: Test OpenWeatherMap Forecast
Eternal ID of this version: #1013965/9
Text MD5: f0a2a4a54e8e3349df9f9b2537c5d6e5
Transpilation MD5: 1c4e87e9e100c2fd5952054cfcb51b60
Author: stefan
Category: javax / networking
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-03-18 19:23:20
Source code size: 653 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 362 / 900
Version history: 8 change(s)
Referenced in: [show references]