Sandaysoft

Support forum for Cumulus weather station software
It is currently Fri May 24, 2013 1:42 pm
Please click here before posting. Help me to help you!
Useful Links: Cumulus FAQ • Enhancement requests • Wiki (documentation)
Please put your approximate location into your profile
Add your web site to the Cumulus user map
Vantage Pro2 users with firmware 3.00 should upgrade to fw 3.12 and Cumulus 1.9.4

All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: Help with Java
PostPosted: Thu Mar 29, 2012 6:40 am 
Offline
User avatar

Joined: Sat Jun 11, 2011 7:52 am
Posts: 25
Location: Te Puke
Weather Station: Digitech
Operating System: Windows 7 Ultimate
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

_________________
www.tepukeweather.co.nz live and up to date weather information. Website design and hosted with FrameIT - www.frameit2010.co.nz


Top
 Profile  
 
 Post subject: Re: Help with Java
PostPosted: Thu Mar 29, 2012 7:28 am 
Offline
Site Admin
User avatar

Joined: Mon Jun 02, 2008 6:49 pm
Posts: 17600
Location: Sanday, Orkney
Weather Station: Davis VP2
Operating System: Windows Home Server 2011
I think the answer is that Javascript does not allow cross-domain access, because it's a security risk.

_________________
Steve
Sanday Weather
----------------------------------------------------------------------------------------------------------------------------------
Like Cumulus and want to support it? Please donate! Image


Top
 Profile  
 
 Post subject: Re: Help with Java
PostPosted: Thu Mar 29, 2012 7:32 am 
Offline
User avatar

Joined: Sat Jun 11, 2011 7:52 am
Posts: 25
Location: Te Puke
Weather Station: Digitech
Operating System: Windows 7 Ultimate
Bugger....

_________________
www.tepukeweather.co.nz live and up to date weather information. Website design and hosted with FrameIT - www.frameit2010.co.nz


Top
 Profile  
 
 Post subject: Re: Help with Java
PostPosted: Thu Mar 29, 2012 10:39 am 
Offline

Joined: Mon Aug 10, 2009 10:16 pm
Posts: 1772
Location: World...
Weather Station: No weather station
Operating System: No operating system
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:


Top
 Profile  
 
 Post subject: Re: Help with Java
PostPosted: Thu Mar 29, 2012 12:09 pm 
Offline
User avatar

Joined: Thu Jan 07, 2010 9:44 pm
Posts: 2521
Location: Wilmslow, Cheshire, UK
Weather Station: Davis VP2
Operating System: XP SP3, Win 7
My PHP is even more limited, but cURL springs to mind?

_________________
Mark
Wilmslow Astro Weather


Top
 Profile  
 
 Post subject: Re: Help with Java
PostPosted: Thu Mar 29, 2012 12:26 pm 
Offline
User avatar

Joined: Wed Oct 21, 2009 11:19 am
Posts: 280
Location: Bayswater, Australia
Weather Station: La Crosse WS-2355
Operating System: Windoze 7
Brendan,
You might find something here: http://au.php.net/manual/en/function.http-get.php


Cheers.

_________________
Graeme.
http://weather.gktnet.com/cumulus/index.htm
Image


Top
 Profile  
 
 Post subject: Re: Help with Java
PostPosted: Thu Mar 29, 2012 12:43 pm 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 1851
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
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 !


Top
 Profile  
 
 Post subject: Re: Help with Java
PostPosted: Thu Mar 29, 2012 8:14 pm 
Offline
User avatar

Joined: Sat Jun 11, 2011 7:52 am
Posts: 25
Location: Te Puke
Weather Station: Digitech
Operating System: Windows 7 Ultimate
Yes its my data (to start with) and one other from my mates station.

I do have PHP,

_________________
www.tepukeweather.co.nz live and up to date weather information. Website design and hosted with FrameIT - www.frameit2010.co.nz


Top
 Profile  
 
 Post subject: Re: Help with Java
PostPosted: Thu Mar 29, 2012 10:29 pm 
Offline

Joined: Mon Aug 10, 2009 10:16 pm
Posts: 1772
Location: World...
Weather Station: No weather station
Operating System: No operating system
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).


Top
 Profile  
 
 Post subject: Re: Help with Java
PostPosted: Thu Mar 29, 2012 11:14 pm 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 1851
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
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.

_________________
Image
......................Imagine, what you will KNOW tomorrow !


Last edited by beteljuice on Mon Apr 02, 2012 11:47 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Help with Java
PostPosted: Mon Apr 02, 2012 11:10 am 
Offline
User avatar

Joined: Sat Jun 11, 2011 7:52 am
Posts: 25
Location: Te Puke
Weather Station: Digitech
Operating System: Windows 7 Ultimate
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

_________________
www.tepukeweather.co.nz live and up to date weather information. Website design and hosted with FrameIT - www.frameit2010.co.nz


Top
 Profile  
 
 Post subject: Re: Help with Java
PostPosted: Mon Apr 02, 2012 12:43 pm 
Offline
User avatar

Joined: Wed Oct 21, 2009 11:19 am
Posts: 280
Location: Bayswater, Australia
Weather Station: La Crosse WS-2355
Operating System: Windoze 7
Brendan,
A good place to start is http://www.w3schools.com
It has tutorials covering php, javascript, html and just about everything in between.

_________________
Graeme.
http://weather.gktnet.com/cumulus/index.htm
Image


Top
 Profile  
 
 Post subject: Re: Help with Java
PostPosted: Mon Apr 02, 2012 11:14 pm 
Offline

Joined: Mon Aug 10, 2009 10:16 pm
Posts: 1772
Location: World...
Weather Station: No weather station
Operating System: No operating system
BrendanPratt wrote:
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
Brendan, it should and will be fun, believe me, I have been learning for the past 6-7 years and I am still learning something new almost on a daily basis... :mrgreen:

As Graeme pointed out, there is a lot of information on the W3Schools web site - but I have found that having a good book beside me is even better as most technical books I have around not only provide the information but as well as some examples.

I have found the best way to learn PHP was to installed a server software package (as well as PHP) on one's computer - thus eliminating the need to upload to an online server whenever a modification is made to the code. On my 'development' (personal/working) computer, I have two server packages installed (although not running consecutively), the Abyss Web Server package and the XAMPP for Windows package.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group