Collaborative Button using google Drive Realtime Api - google-drive-api

i'm new to the realtime api and i want to implement a trivial test project that will help me understand the structure of the api. Sorry if my question sound stupid but i don't think i really understand how to use the api.
What i want to do is create a button and when you press the button on the one app the same button will be pressed on the other apps.
What i would like to know is how to model this button in the collaborative data model.
Could i use variables like isPressed or isRollOver to pass the buttons state or i can create a hole button object somehow?
i want to use java or javascript.
thank you!

The realtime data model can consists of a combination of CollaborativeMap, CollaborativeList, CollaborativeString, and primitive javascript types.
I think for your use case you'd probably want a CollaborativeMap where you map a button name to a boolean value. You can then add an event listener to the CollaborativeMap to find out when the button's value changes.

Related

Map pinning in react native

I am looking for a way to capture user click and create a pin on the map view. Does anyone has any idea where can I start, I was not able to find anything.
There are two solutions for your issue.
Using RN's native MapView component, there are no easy solutions. You can create a pin when `onRegionChangeComplete is triggered. But you'll get the coordinates of the center of the map only. I've set up a running example for you here.
You can use this very well done package. In this package, there is an onPress method that you can use. It'll return you the coordinate of the point you just pressed.
You should look at the onRegionChange prop from the MapView component. That's a function that will be triggered whenever the user drags the map. Between that and the annotations props you should be able to achieve what you want.

Add Swing objects in Play 2.0 framework

Good afternoon,
I want to know if it will be possible to add Scala Swing objects (especially JFrame objects) in a Play 2.0 application, I look for something like this but I haven't found nothing.
I need a Text Area that the user can write, and after that when he/she submit, I need to create an instance of a Scala class which after that it will show in a JFrame are (if I can) something related with the textarea input.
I can do the textarea form with HTML but the other part I don't know how to do it if not with JFrames.
Are many other ways to do this?
The example of what I can do is (it's a App related on Lambda Calculi):
x ---> create a Var elemnt and display it in a JFrame
\x.x ----> create a Abs(Var,Var) element and display it in a JFrame
...
Can anyone help me?
Thanks in advance
Piotr's comment is correct; the two technologies (HTML and Swing) are very separate. I'm not sure exactly what you're trying to accomplish; however, it sounds like what you want to do is possible via Javascript. A good tutorial for Javascript can be found here: http://www.codecademy.com/tracks/javascript. Javascript is also very easy to integrate into a Play project; you can place your Javascript files in your project's /public folder and reference them from your HTML files using <script> tags.

Get a tooltip by mouseover with Fusion Tables

As a beginning self-made amateur programmer I’m currently trying to get some things done with Google Fusion Tables.
I made a map with markers and got the HTML of that map. But I wish to add the function of a tooltip by a mouseover of a particular marker. I found a tutorial to work this out but I can’t enable the tooltips.
The following link shows the progress so far: http://jsbin.com/cipejicewo/1/watch?html,js,output
1 I don’t have to change something in this script that fits to the specific Fusion Table where its linked with, do I? When I do have to change the javascript, what are the specific elements I have to rename?
2 How can i call google.maps.FusionTablesLayer.enableMapTips(options)? And where do I have to put this whole ‘function init’ code in the html-file? Directly in the script that described above? Off course without losing the functions that the html already provides. Besides that, I get that I have to change the tableid and change the select column and geometry column name, but is there something more I should change in this function I'm going to add?
I'm struggeling with it now for days. And I'm out of options, so every help would be welcome. Thanks in advance!
It's not clear what your code currently looks like, but these 2 things you'll need to do first:
when you use another FusionTable than the example, make sure that the table is public and downloadable
You must use your own key(it's the variable apiConsoleKey in the example). Follow the steps in Acquiring and using an API key to get a valid key.

How can I display which Event strings are available for an object in AS3?

I see that in an ide like FlashDevelop, when I add an event listener to certain objects, it'll auto-populate with the event strings that this object will dispatch (I'm assuming, anyway). I'd love to do this with my custom objects (esp. when it comes to sharing this code with co-workers), to clear up possible confusion as to what to listen for.
Does anyone know how to discern which events will be dispatched?
Thanks,
I don't think there is a way to link suggestions to a method call as strictly as exists with the inbuilt stuff like addEventListener(), but that shouldn't stop you from producing perfectly readable code for you and your colleagues (especially if you are using FlashDevelop).
For starters, using your own event class with static properties representing the event strings you can use will provide a useful code hint by default:
From here, you can add code comments that work with FlashDevelop to produce a very precise tooltip:

Retrieving all address information along Google Maps route

I am developing an Windows Forms application using VB.NET that offers the user to lookup addresses on Google Maps through a Web Browser. I can also successfully show the directions between two points to the user, as well as allow the user to drag the route as he/she pleases. My question now is - is it possible for me to get the lattitude/longitude information of the route, i.e. the overview_polyline array of encoded lattitude/longitude points and save it to e.g. a text file on my computer? Or is it possible to get a list of all the addresses located both sides of the route over the entire length of the route, and then save the data to a file on my computer? I'm using HTML files to access and display the Google Maps data in the Web Browser item.
Thank you
This is actually pretty simple if your just looking for the screen coordinates.
// this probably should be in your form initialization
this.MouseClick += new MouseEventHandler(MouseClickEvent);
void MouseClickEvent(object sender, MouseEventArgs e)
{
// do whatever you need with e.Location
}
if your strictly looking for the point in the browser, you need to consider the functions
browser.PointToClient();
browser.PointToScreen();
So, this method is usable if you know exactly where your form is (easy to get its coords) and where you webbrowser control is (easy to get coords of this as well since it's just a control in your form) and then, as long as you know how many pixels from the left or right, and from the top or bottom the image will be displayed, once you get the global mouse click coords (which is easy) you can predict where it was clicked on the image.
Alternatively, there are some scarier or uglier ways to do it here...
You can use the ObjectForScripting property to embed code to do this in the webbrowser. It's ugly to say the least. MSDN has some documentation on the process here: http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.objectforscripting.aspx
Because its really ugly, maybe a better solution is to use AxWebBrowser - it's ugly too but not so scary.
In addition, I found this post of someone wanting to do it on a pdf document, and a MSFT person saying its not possible, but really what he is trying to say is that it isn't built in, even with a pdf document its still possible to predict with high to certain accuracy where it was clicked if you use the first method i described. Here is the post anyway: http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/2c41b74a-d140-4533-9009-9fcb382dcb60
However, it is possible, and there are a few ways to do it, so don't get scared from that last link I gave ya.
Also, this post may help if you want to do it in javascript:
http://www.devx.com/tips/Tip/29285
Basically, you can add an attribute on the image through methods available in the webbrowser control, you can add something like onclick="GetCoords();" so when it is clicked, the JavaScript function will get the coords, and then you can use javascript to place the values in a hidden input field (input type="hidden") which you can add through the webbrowser control, or if there is one already on the page, you can use that. So, once you place the coords using javacript into that input field, you can easily grab the value in that using the webbrowser control, eg:
webbrowser1.document.getElementById("myHiddenInputField").value
That will get the value in that field, which you've set through JavaScript. Also, the "GetCoords()" function i mentioned is called SetValues() in the javascript method link i provided above (in the devx.com site) but I named it GetCoords because it makes more sense and didn't want to confuse you with the actual name they used, you can change this to any name you want of course. Here is the javascript they were using, this only gets the coords into a variable, doesn't put it into a hidden input field, we will need to do that in addition (at the end of the javascript SetValues/GetCoords function).
function SetValues()
{
var s = 'X=' + window.event.clientX + ' Y=' + window.event.clientY ;
document.getElementById('divCoord').innerText = s;
}
These guys are just saving it inside a div element, which is visible to users, but you can make the div invisible if you want to use a div field, there is no advantage or disadvantage in doing that, you would just need to set the visible property to false using javascript or css, but still, it is easier to use a hidden input field so you don't need to mess with any of that.
Let me know how you get along.