Page 1 of 34

Cumulus RealTime Data Grabber - Tool

Posted: Sun 19 Feb 2012 4:27 pm
by Solorize
After I had my hard drive die on me 7 years ago. Loosing years of load of Visual Basic 6 code and
programs that I had written, I decided to stop my hobby of programming, and took up Photography
instead.

But now I have decided to start a fresh and try my hand at VB.NET to see if I can get myself back
into the groove.

So I downloaded a copy of Visual Basic 2010 Express on Friday night and have spent all Saturday
and most of today (Sunday) immersing myself in code, and finding my way around.

I wanted to create a program that would be of some use, to keep me motivated. ;) So I decided to
see if I could write a program that would grab a realtime.txt file and display it's contents at a
specific time interval. Which is what I have hopefully managed to achieve :)

Hopefully some of you may be interested in using it? and I could do with any feedback / comments
/ bug reports or suggestions, that I could update / add in future updates.

FYI.
I know about the rouge Label2 I have left on the "Setup interval screen" ;) I have already
shut down my other machine which I have VB on and need to give my eyes a rest :shock: so I
will have to remove it when I next go back into the code.

Download:
HTTP://www.wokinghamweather.co.uk/downl ... DGv101.zip

Screen Shot:
Image

Mark

Re: Cumulus RealTime Data Grabber - Tool

Posted: Sun 19 Feb 2012 4:56 pm
by nitrx
So far so good but the windrun has the good number but it's in km by me and not miles

Re: Cumulus RealTime Data Grabber - Tool

Posted: Sun 19 Feb 2012 4:58 pm
by water01
Works fine for me.

Re: Cumulus RealTime Data Grabber - Tool

Posted: Sun 19 Feb 2012 6:40 pm
by mcrossley
Mark, just a suggestion, but why not learn C# rather than VB.net? If you know VB it isn't too hard to convert, and C# is a much better language imho.

Re: Cumulus RealTime Data Grabber - Tool

Posted: Mon 20 Feb 2012 4:24 am
by cgwx1
My software does just exactly what yours does, but mine also does a forecast... Wish I would have found this before I started. Take a look at this thread https://cumulus.hosiene.co.uk/viewtopic.php?f=18&t=7017 I saw that you commented on it... Maybe you would like to work with me and help make it look/work better it is coded in VB.NET. I can send you a copy of the code, but beware I have not cleaned it up or commented on it yet, it can be confusing.

Re: Cumulus RealTime Data Grabber - Tool

Posted: Mon 20 Feb 2012 1:23 pm
by Solorize
cgwx1 wrote:My software does just exactly what yours does, but mine also does a forecast... Wish I would have found this before I started. Take a look at this thread https://cumulus.hosiene.co.uk/viewtopic.php?f=18&t=7017 I saw that you commented on it... Maybe you would like to work with me and help make it look/work better it is coded in VB.NET. I can send you a copy of the code, but beware I have not cleaned it up or commented on it yet, it can be confusing.
Hi, Thanks for the offer to collaborate with you on your project, at the moment I am still very rusty on my programming and really need to
get my head back into it before I would be comfortable in joining forces, as I would not want to mess up what you have done so
far, by me doing something wrong ;)

Hopefully if I carry on with a few more additions to my program, which I have not as yet decided upon, I will be able to learn
some more VB and when I am comfortable, we could then look at pooling all the features into one program :)

Re: Cumulus RealTime Data Grabber - Tool

Posted: Mon 20 Feb 2012 1:48 pm
by Solorize
I have just noticed that if you try to save the realtime.txt file, it will throw up an error:

Unhandled exception has occured in your application ...... ... ..
Access tio the path 'c:\CumulusRealTimeLocalCopy.txt' is denied.


Which after looking on the net, is because the program needs to be
"run as administrator" by right clicking on the program on launch and selected the
aforementioned option, which will then allow you to save the file to the disk.

Does anyone know how a way around this problem? i.e. that I can code into
my program to automatically allow it to run as administrator and allow the
file to be saved?

Re: Cumulus RealTime Data Grabber - Tool

Posted: Mon 20 Feb 2012 2:40 pm
by steve
It requires permission to save the file in your example because it's trying to save to the root of the C: drive. I suggest that you set the save location to somewhere else, rather than requiring your application to run as administrator.

Re: Cumulus RealTime Data Grabber - Tool

Posted: Mon 20 Feb 2012 5:09 pm
by geoffp
Working great for me Mark :clap:

Re: Cumulus RealTime Data Grabber - Tool

Posted: Mon 20 Feb 2012 8:41 pm
by Solorize
steve wrote:It requires permission to save the file in your example because it's trying to save to the root of the C: drive. I suggest that you set the save location to somewhere else, rather than requiring your application to run as administrator.
Hi Steve, Thanks for the info, I will try and set it to either save to the application folder or allow the
user to select where to save the file. Time to read up some more on the net to remind myself how to
do it. :)

Re: Cumulus RealTime Data Grabber - Tool

Posted: Mon 20 Feb 2012 8:54 pm
by Solorize
mcrossley wrote:Mark, just a suggestion, but why not learn C# rather than VB.net? If you know VB it isn't too hard to convert, and C# is a much better language imho.
Hi Mark,
I had thought about learning C++ years ago but stayed with VB as I had a copy of
VB 6 and was already learning that. I may at somepoint have a go at C# , but want
to get back into the swing of programming, and I feel that it would be better for me
to reserect my VB knowledge first before I try my hand at another language :)

Re: Cumulus RealTime Data Grabber - Tool

Posted: Mon 20 Feb 2012 10:30 pm
by Solorize
nitrx wrote:So far so good but the windrun has the good number but it's in km by me and not miles
Hi Ron,

I think I have managed to sort out the incorrect Wind Run units so it should now display the
correct unit discription based upon which wind units are being used.

i.e.

Wind unit: m/s = km
Wind unit: mph = miles
Wind unit: km/h = km
Wind unit: kts = nm

If you get time could you download my updated version: 1.0.2 below, and tell me if
it now correctly displays the Wind Run units for your data.

Download version 1.0.2 : http://www.wokinghamweather.co.uk/downl ... DGv102.zip

FYI.
These are the following bug fixes and additiona I have done in this latest release version 1.0.2

1.0.2 - bug fixes (20.02.2012)

1. Corrected wind run units.
2. Removed rouge label on set update interval screen.
3. Added force update button.
4. Save button now saves to the same folder as application is running from.

Mark

Re: Cumulus RealTime Data Grabber - Tool

Posted: Tue 21 Feb 2012 5:57 am
by cgwx1
Solorize wrote:I have just noticed that if you try to save the realtime.txt file, it will throw up an error:

Unhandled exception has occured in your application ...... ... ..
Access tio the path 'c:\CumulusRealTimeLocalCopy.txt' is denied.


Which after looking on the net, is because the program needs to be
"run as administrator" by right clicking on the program on launch and selected the
aforementioned option, which will then allow you to save the file to the disk.

Does anyone know how a way around this problem? i.e. that I can code into
my program to automatically allow it to run as administrator and allow the
file to be saved?
Here is how I do it in my program, there is really no reason to save the actual text file to the local disk, just use a web client...

Code: Select all

Dim txtRead As WebClient = New WebClient
stringValue = txtRead.DownloadString("URL TO REALTIME.TXT")
txtRead.Dispose()
You could also use a web request and process the stream, but that is much more difficult.
Hope this helps! :lol:

Re: Cumulus RealTime Data Grabber - Tool

Posted: Tue 21 Feb 2012 6:13 am
by cgwx1
Here is a bit of code I have used previously to start a process as an Administrator.

Code: Select all

Dim updstatrt As New Diagnostics.ProcessStartInfo()
                updstatrt.FileName = "Update.exe"
                If Environment.OSVersion.Version.Major >= 6 Then
                    updstatrt.Verb = "runas"
                End If
                updstatrt.UseShellExecute = True
                Process.Start(updstatrt)
I don't think it is possible to automatically start the program as an administrator. The only thing I can think of is something like this...

Code: Select all

private sub load() handles form1.onload
Try

'try to write to a place that needs admin rights

Catch

'if we cannot write to that place this will run.
'use the code above to execute the program as an administrator
Application.Exit 'close this non-administrative instance

End Try
End Sub
It is dirty, but will probably work, I would only use this if the program absolutely must run as an administrator. There is another way to do it in the manifest file that is much cleaner, but you are only distributing the ".exe" so that will not work for you.

Re: Cumulus RealTime Data Grabber - Tool

Posted: Tue 21 Feb 2012 10:01 am
by nitrx
Solorize wrote:
nitrx wrote:So far so good but the windrun has the good number but it's in km by me and not miles
Hi Ron,

I think I have managed to sort out the incorrect Wind Run units so it should now display the
correct unit discription based upon which wind units are being used.

i.e.

Wind unit: m/s = km
Wind unit: mph = miles
Wind unit: km/h = km
Wind unit: kts = nm

If you get time could you download my updated version: 1.0.2 below, and tell me if
it now correctly displays the Wind Run units for your data.

Download version 1.0.2 : http://www.wokinghamweather.co.uk/downl ... DGv102.zip

FYI.
These are the following bug fixes and additiona I have done in this latest release version 1.0.2

1.0.2 - bug fixes (20.02.2012)

1. Corrected wind run units.
2. Removed rouge label on set update interval screen.
3. Added force update button.
4. Save button now saves to the same folder as application is running from.

Mark
Windrun is now in the units as used in my cumulus and realtime saves local without errors.

Well done