Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Help with Java

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

Post Reply
User avatar
BrendanPratt
Posts: 28
Joined: Sat 11 Jun 2011 7:52 am
Weather Station: Aercus
Operating System: Windows 8
Location: Te Puke
Contact:

Help with Java

Post by BrendanPratt »

Hi all

Well I am stuck on a issue, I want to call a realtime.txt from another host, but when I enter the path it dose not work.

This is the code if the Javascript was in the same file as the cumulus realtime.txt file on the host.

var realtime_location="realtime.txt";

But I can't get it call another realtime.txt file from another cumulus install on another host.

what would be the command?

Thanks all.

Brendan
http://www.tepukeweather.co.nz live and up to date weather information. Website design FrameIT - http://www.frame-it.co.nz
User avatar
steve
Cumulus Author
Posts: 26702
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Help with Java

Post by steve »

I think the answer is that Javascript does not allow cross-domain access, because it's a security risk.
Steve
User avatar
BrendanPratt
Posts: 28
Joined: Sat 11 Jun 2011 7:52 am
Weather Station: Aercus
Operating System: Windows 8
Location: Te Puke
Contact:

Re: Help with Java

Post by BrendanPratt »

Bugger....
http://www.tepukeweather.co.nz live and up to date weather information. Website design FrameIT - http://www.frame-it.co.nz
gemini06720
Posts: 1700
Joined: Mon 10 Aug 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: Help with Java

Post by gemini06720 »

Brendan, you would have better chances of accomplishing that task if you were to use PHP as PHP is a server-side language whereas JavaScript is a user-side language.

Although I have been 'playing' with PHP for the past 6-7 years, unfortunately, my knowledge on how such a task can be accomplished is very very limited... :oops:
User avatar
mcrossley
Posts: 12695
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Help with Java

Post by mcrossley »

My PHP is even more limited, but cURL springs to mind?
User avatar
GraemeT
Posts: 312
Joined: Wed 21 Oct 2009 11:19 am
Weather Station: La Crosse WS-2355 & WS-2306
Operating System: Windoze 7, 10, 11
Location: Bayswater, Australia
Contact:

Re: Help with Java

Post by GraemeT »

Brendan,
You might find something here: http://au.php.net/manual/en/function.http-get.php


Cheers.
Cheers,
Graeme.
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Help with Java

Post by beteljuice »

Do you have PHP ?

Do you want to process the file with JavaScript or PHP ?

IS IT YOUR DATA !
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
BrendanPratt
Posts: 28
Joined: Sat 11 Jun 2011 7:52 am
Weather Station: Aercus
Operating System: Windows 8
Location: Te Puke
Contact:

Re: Help with Java

Post by BrendanPratt »

Yes its my data (to start with) and one other from my mates station.

I do have PHP,
http://www.tepukeweather.co.nz live and up to date weather information. Website design FrameIT - http://www.frame-it.co.nz
gemini06720
Posts: 1700
Joined: Mon 10 Aug 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: Help with Java

Post by gemini06720 »

Brendan, if you are interested in learning something new, you might want to download and look at the code within Ken True's PHP/AJAX Website Template Sets (I would suggest the world templates) - I know, this might not be the 'easy-way-out' most people are expecting, but it would be a rewarding learning experience. ;)

Ken uses a function called 'fetchUrlWithoutHanging' (that function name is found in the 'check-fetch-times.php' template, but the same/similar function or under a slightly different name is also found in many other templates - a search for the word 'WithoutHanging' should provide many results) - the function is used to get contents from one URL and to return it as a string. Depending on how much protection and processing is needed, the function can be a few lines of code or many lines of code (that is why I am not posting any of the code).
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Help with Java

Post by beteljuice »

That's as good an education as you can get if you can get your head around it :)

Learning the 'routines' for grab and parsing will give you lots of new ideas :clap:

You don't say if you want to cyclically get the realtime.txt or do it as 'one-shot', that will make a difference to the solution you use, but the basics will be the same.
Last edited by beteljuice on Mon 02 Apr 2012 11:47 am, edited 1 time in total.
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
BrendanPratt
Posts: 28
Joined: Sat 11 Jun 2011 7:52 am
Weather Station: Aercus
Operating System: Windows 8
Location: Te Puke
Contact:

Re: Help with Java

Post by BrendanPratt »

Hmm I have been looking at PHP... seems to be the way to go.. so I will have to site down and learn the code.... O fun

Thanks you for all your help :D
http://www.tepukeweather.co.nz live and up to date weather information. Website design FrameIT - http://www.frame-it.co.nz
User avatar
GraemeT
Posts: 312
Joined: Wed 21 Oct 2009 11:19 am
Weather Station: La Crosse WS-2355 & WS-2306
Operating System: Windoze 7, 10, 11
Location: Bayswater, Australia
Contact:

Re: Help with Java

Post by GraemeT »

Brendan,
A good place to start is http://www.w3schools.com
It has tutorials covering php, javascript, html and just about everything in between.
Cheers,
Graeme.
Post Reply