Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Viewing weather forecast of each location from a listbox control

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Viewing weather forecast of each location from a listbox control

    Is there a straightforward way to view the weather forecast for a location after selecting it from a list in a UX control?

    I have an account at www.myweather2.com which provides a request URL to obtain the weather forecast for any location. The last few characters of the url is the location/postcode, so changing this accordingly will display the forecast for potentially any location.

    Can I have a list box of locations which will have a column of postcode/zip code (appended to the request url) and after selecting from this list, scroll to another UX panel card displaying the weather forecast for that particular location? Perhaps in a text box/iframe, etc?

    Will this involve a lot of jquery/xbasic, etc, or has Alpha any easier way to accomplish this? I've had a look at the twitter API example using JSON to get twitter feeds - do I need to do something similar?

    Thanks

    #2
    Re: Viewing weather forecast of each location from a listbox control

    I use a similar API with WUnderground.com. You should be able to get most or even all of this done as an AJAX Callback, so Xbasic is your ticket. Here's a snippet from one of my functions:

    Code:
    x = "http://api.wunderground.com/api/27a73e6682e85732/geolookup/conditions/forecast/q/" + vlat + "," + vlon + ".json"
    y = http_get(x)
    z = y.body
    <<%a%
    	......snippet of returned text:
    	"weather":"Clear",
    	"temperature_string":"86 F (30.0 C)",
    	"relative_humidity":"70%",
    	"wind_string":"From the ESE at 5 MPH Gusting to 12.0 MPH",
    	"pressure_mb":"1017",
    	"dewpoint_string":"75 F (24 C)",
    	"heat_index_string":"95 F (35 C)",
    	......
    %a%
    From there, you just parse the text into a string you want, then do whatever fits your needs to put the string into, say, a div.

    Hope this helps a bit.
    -Steve
    sigpic

    Comment


      #3
      Re: Viewing weather forecast of each location from a listbox control

      You can start to do this all client side now, with the current pre-release of Alpha.

      Using the Ajax Callback - Cross Domain, Client-side HTML Templates, and a weather service that supports JSONP, you can make a call directly to the weather service from the Client side and get data back directly.

      myweather2 doesn't support this type of call... they use a RESTful call which must come from a server... so... as Steve says... XBasic is the way to go.

      http://openweathermap.org/ does support JSONP and this is what I'm using for this demo.

      forecast.io is another service that will work with the Ajax Callback - Cross Domain call. I think there are a bunch of others, as well. They all seems to have a free service with APIs.

      http://www.youtube.com/watch?v=OW5I0OaK1Mg

      Very interesting stuff.

      Comment


        #4
        Re: Viewing weather forecast of each location from a listbox control

        I did not know the client could not make a RESTful service request on another domain. I connect to several RESTful services including wunderground.com using the server-side http_get() method just because it was very easy to implement. I had planned on moving some of these requests to the client-side in order to save an unnecessary trip to the server. I'm glad I came across this thread.

        Comment


          #5
          Re: Viewing weather forecast of each location from a listbox control

          You can do it... but it depends on the service... and it's a little tougher.

          For Wunderground you can move the call to the client side... and I'm not positive about this... but I don't think you can use the Cross-domain callback.

          You have to go a more direct root and use jQuery and process the results (which you'd have to do anyway).

          So... for Wunderground... making sure you're jQuery libraries are loaded, noconflict, etc. here is a Javascript function you'd put into a UX component...

          Code:
          function showWeather(){
          
            jQuery.ajax({
            url : "http://api.wunderground.com/api/yourkey/geolookup/conditions/q/IA/Cedar_Rapids.json",
            dataType : "jsonp",
            success : function(parsed_json) {
            var location = parsed_json['location']['city'];
            var temp_f = parsed_json['current_observation']['temp_f'];
            alert("Current temperature in " + location + " is: " + temp_f);
            }
            });
          
          }

          Comment


            #6
            Re: Viewing weather forecast of each location from a listbox control

            Got to amend this. Yes... Wunderground does work with the new Alpha Ajax Callback Cross-Domain action.

            Wunderground does things a little different than I've seen at other sites.

            Here's an example of a working URL for the Cross-Domain action.

            javascript:'http://api.wunderground.com/api/yourkey/conditions/q/CA/San_Francisco.json?callback=getWeatherCallback'

            Comment


              #7
              Re: Viewing weather forecast of each location from a listbox control

              David nice video - but I can't see the video clearly is that a youtube limitation? Regardless - thanks again for sharing. I wish it was a little bit easier to grasp all of this API stuff. I have a whole list of API's I want to use, etc but at this point I have a better chance of finding a black cat, in a dark room, that is not there.
              NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

              Comment


                #8
                Re: Viewing weather forecast of each location from a listbox control

                I know what you mean. It's almost easy stuff to grasp once you see it... but then you run into another site's api where the docs stink and you've no idea if it's not working because of the call, because of cross-domain, because the site hasn't set up something or because it simply doesn't work. Wunderground buried it's "callback" info... and it doesn't seem to use request variables in a normal way.

                Sometimes the videos "sharpen"... sometimes they don't. Maybe I'll find a different delivery method.

                Comment

                Working...
                X