How to access GPS location from the web browser - ruby

I am developing a mobile based web-application, in which I need to integrate Google maps. I need to fill latLng info from Google maps. Is it possible to get the GPS location and use it in my application?

The browser is able to share the location with you thanks to Geolocation API, but you have to be aware of that, user when asked if he permits accessing the geo-data, might not agree. There is no way of forcing the locations to be shared with you.
Because it is part of Web browser API - there are JavaScript methods to be used.
The core of it is in very descriptive names of methods:
geolocation.getCurrentPosition(function(position) {
console.log(position);
});
Check this great tutorial of how to implement the solution on your own. It's really good, well explained and covers edge cases.
It covers much more code, so there is no point of copy-paste all of it here.
Hope that helps!

Related

Website creation query

I need to create a website which stores the list of all games the player has played and it shows right on your profile. As the player goes on completing a game, he adds the game into his list.
So i would need a basic lo-gin configuration and then by using AJAX, I will populate the list of games which he wants to add to his list. So that he can track the list with games that he has played.
So now I need suggestion on how to go on with it?
How to start building?
Which language do I need to pickup?
I am well versed with Java and j2ee.
Is this enough?
Also I am a freelancer so I can't afford to pay for a website. So any free website hosting service which will help me to build the website which I have in mind??
Also if I use any free website hosting service, will they provide me with a database and AJAX capabilities?
Here's the basic setup:
You need a domain first. Try to pick something unique, as it will be cheaper. You can find one on namecheap: https://www.namecheap.com
You need hosting. Again, go with namecheap.
To start building, you need to learn some HTML and CSS. HTML is markup of the web, and CSS is the stylesheet of the web. They aren't hard languages to start off in. You can start for free at Khan Academy: https://www.khanacademy.org/computing/computer-programming/html-css
I believe namecheap offers database support as well. Ajax isn't provided by a hosting service. It's more of a group of languages (HTML, CSS, JavaScript).
This should get you going. I can't really give you more detailed information than this because your question is really broad. If you Google your questions, you'll get good answers and guides.
Best of luck.

Using the Searchservice from Bing Maps in WP7

I used this to locate an address on Bing Maps on WP7 using the emulator. The site mentions searchservice, which is something I want to try out and implement. However, the method seems to be different, in the sense that the query parameters are different and so is the way to query it. Can anyone help me find resources that give me a (if possible) step-by-step list of how to achieve or implement the searchservice. I have been through the official MSDN pages and they're quite useless. For my needs, at least! Please help. Thank you!
I would highly recommend to use the Bing Maps REST services, you can find the information about how to use it on the MSDN:
http://msdn.microsoft.com/en-us/library/ff701713.aspx
Also, take a look at the official blog where you will be able to find the best practices and good tips to use the REST services using a .Net wrapper:
http://www.bing.com/community/site_blogs/b/maps/archive/2013/02/14/bing-maps-rest-service-tips-amp-tricks.aspx
Let us know if you have other difficulties to implement the search service in your Windows Phone application.

How to build web applications that have a look&feel like Google+?

For ages, our company uses Dojo as the interface library of choice. The applications created have a very desktop-like look & feel and are very suitable for business areas and banking.
However, I see a trend towards user interfaces that are more like Google+:
page-based instead of internal scrolling
not many modal popup windows but rather edit-in-place and drop-out things
loading additional list items via scrolling to the bottom of the page
all that kind of user interaction. Basically, a light and more web-centric usability approach.
Unfortunatelly, I don't know of an library that really helps in building such interfaces - I know jQuery UI, Sencha, Cappucino, Sproutcore and the like, but they do not quite fit.
Does anybody know of some new ui component library for sites like Google+?
A lot of the interface patterns used in Google+ are in Google Closure Library.
You can use the following book about Google closure : Closure: The Definitive Guide for reference.

Writing a web app using Dropbox API

I would like to write a web app that uses Dropbox for cloud storage.
If I understand correctly, I should use the Restful API to achieve that.
This documentation exists and is quite good but being a newcomer to Restful API I would love to see and play with a simple example that works with this API.
My questions are:
Am I right to assume that Rest API is the way to go?
Is there a quick and easy example (Maybe a live example) to get me going?
Thanks!
as you tagged your question with "ajax", i presume you want to do this entirely client-side (except for some proxy-code to be able to make requests accross domains)? I haven't tried it out myself, but there's dropbox-js on google code which will at least give you some ideas (and if the Dropbox API didn't change too much since June 2010 it might even work out of the box)?
Update: there's no "download", but you can browse the source code of trunk here.
Here's a lengthy article on the matter
Some love for Javascript Applications with code samples, a demo etc.

Dynamically updated graphs on a web page - howto?

I need to understand a good way to design a web page with dynamically updated graphs. It should be something close to what stock market graphs look like (e.g. Google Finance), although with a bit more complicated functionality, which is not the point. Naturally I am thinking of writing an ajaxy-style flash control, which would communicate with the server through, okay, something like XMLHttpRequest, but from within flash code, and draw things basing on data received. Is this doable with flash? Does security model allow such kind of client-server interaction? If yes, could you think of any references for me to get started (similar opensource projects, articles, whatever)? Or should I forget about flash and use a Java applet right away?
An important thing to note: I don't think I can use Google charting API, because I need also to have user interaction. In the link above to Google Finance the user can drag the graph to and forth with the mouse, that's close to what I need (I will also need to implement some actions from the dropdown menu).
Thanks for your answers and opinions!
Try this: JQuery Flot
Flot is a JQuery plugin to plot graphs. You keep replotting in-place with the latest data at the desired frequency to generate a dynamically updated graph. It is based on the <canvas> tag. We use it successfully to generate pretty complex dynamically updated graphs in our applications. The updates are fetched via periodic AJAX calls.
Another alternative is YUI Charts
We did not explore this a lot but this uses Flash and AJAX like you wanted to do.
/RS
I have used the Google Charts API to do this sort of thing. For a simple example, see my Sunrise and Sunset page. This page calculates sunrise and sunset times for a given latitude and longitude, all in Javascript, then uses the Google Chart API to replace the graph on the page with the requested data.
Update: The Stack Overflow reputation graph (see your user page) isn't Flash and yet allows interactive dragging. (Click and drag on the left to update the posts on the right that reflect the highlighted reputation region.) Perhaps you could look at how that is implemented.
You have described Flex...
This is very possible in flash.
You can use the URLLoader class to obtain data from a server at run time and the draw your graph using a custom control. In actionscript3 you'd subclass the Shape class and write a little drawing code to draw your graphs. Flash has support for drawing and filling so it would probably be very good at this.
The flash client can poll the server for updates. Or if you want a "live" connection you can establish a socket connection to the server and let the server push updated data live. Flash is good for this as you can push XML data over the socket and use the built in support for processing the XML, or you can send binary data just as easily.
As for the security model it's just the standard flash one. You can make network connections back to the server that the swf file came from with no issues. If you want to make a connection to a different server then that server needs to give your client permission to connect to it by hosting a crossdomain.xml file
I'm not sure about the Flash side of things, but this would be pretty simple to do in Silverlight. I am pretty sure you'd easily be able to make a server request in Flash too.
I'd do some searching for long polling.

Resources