I am triying to access microphone button at this page by using Processing. I got the source so I managed to launch my own pageIn order to do possible changes.
Is this possible? If it is not, is there any workaround to manipulate controls of this page?
This is going to be much more complicated than you're currently thinking.
If all you want to do is interact with the controls on that page, then you might look into the Robot class. This restricts you to deploying as a Java application (not as JavaScript), but it allows you to do things like move and click the mouse. That might be the way to go if you just want to interact with that page.
However, what you probably want is to use the underlying API being used by that page. If this is the case, you don't actually care about that webpage- that's just another client that's calling the API on the server. You need to create your own client that calls that same API.
To do that, you're going to need to write JavaScript that calls the API. Here is a guide on how to use the API.
It's hard to answer general "how do I do this" type questions. It's much easier to answer specific "I tried X, expected Y, but got Z instead" type questions. So I highly recommend reading the link I gave you (google is also your friend), trying to write some code, and posting an MCVE along with a specific question if you get stuck. Good luck.
Related
I feel like this is a simple enough thing to do and can't believe how hard of a time I'm having finding the example I need so alas, human help please! You failed me Google :)
FYI I've written a bit of code in my life (Java, C, ASM, PHP), new to APIs.
As the title lays bare, I want to retrieve info (tickets out of our ticketing system meeting certain conditions) via a GET request, loop through each ticket, and update each one (PUT) based on certain conditions.
If there's a tutorial you know of that covers that, please point me to it! If not, if you could please fill in some of these holes?
I wound up in Postman, is this an appropriate environment to accomplish such? Of course you can make individual API calls here but I got lost trying to string the aforementioned sequence together. Is it possible via "Create API?" This makes it sound like I'm creating my own API server for other users to access data from. If it is possible via "Create API," where's the dang run code button?! If not Postman, what tool should I be using to write code in? And again, if you have any code samples/videos closely resembling said scenario for that tool.
Thank you for any assistance you can offer.
Cheers,
Jay
You want to interact with your ticketing system: read existing tickets, and update them. Correct?
To do this, your TICKETING SYSTEM must have an "api" (possibly - but not necessarily - a REST API).
If it does, you might be in luck. But you need to learn the API first, possibly from product documentation. If it doesn't, there's probably not much you can do except to interact with the system as a "normal user".
If it has an API, and if it's a relatively simple API (like REST), you can use the API manually (e.g. through POSTMAN), or you can use it programmatically (using Python, C#, Java or just about any programming language you feel comfortable with).
In summary, you need to:
Determine if your ticketing system provides any kind of web api
If so, get the API details
If at that point you want proceed, determine what programming language or framework you'd like to use.
Hopefully that gives you a bit of "direction".
Can someone guide me as googling does not send me to the right places.
I want to adapt netlogo to include players real or simulated with other technologies. I need to interface the netlogo core (running an established game) and have the moves and choices determined by the external entities, which may be human or automania.
In searching for the API to allow this, I can find is the controlling API which is seems to be for running NetLogo muitiple runs of a model and not what I want.
And please before you close this again suggest how I can make this more focused as the problem is finding the starting point....
Can anyone assist.
Regards
Robert
There are two main ways to interface between NetLogo and the "outside world":
The extensions API.
The controlling API.
Which one to use depends on what you're trying to achieve.
You say that you:
need to interface the netlogo core (running an established game) and have the moves and choices determined by the external entities, which may be human or automania.
That, to me, sounds very much like a job for the extensions API, which is what has been suggested to you on the netlogo-devel group. Extensions allow to add new "primitives" to NetLogo, and those primitives can be written in any language that runs on the JVM (Java, Scala, Clojure, etc.)
So if you have a game written in NetLogo and a bot written in some other language that the JVM can interface with (possibly by using the JNI), you could write a new NetLogo extension command that calls out to the bot (e.g., something like bot:play game-state). A game written in NetLogo could then use that command to let the bot play its turn.
If that is indeed what you want to do, then Jeremy has already given you a good starting point in his netlogo-devel answer, and there is not much we can add to this until you have more specific questions.
You also said, however, that you looked at using the controlling API, so maybe what you had in mind is to have a game written in some other language, and use a NetLogo model to generate the behaviour of a particular player in that game. The controlling API allows you to do that. (It's not just for running a model multiple times!) If you look at the examples in the controlling guide, you'll see that you can use the API to send commands to a NetLogo model and to report the results back to your external program. The only constraint is that this external program needs to be able to talk to the JVM.
If you don't think this answers you question, please try to give us a concrete example of a precise thing that you want to do but do not think can be achieve in one of these two ways. We might be able to help you better than.
I have been learning coding for about a month now. I have some good experience with Python, and additionally I have completed this web development course on Udacity.
Now, I have a good foundation for programming, but one thing that confused me a lot is how to interact with various websites and APIs. The course I did briefly touched on this in terms of XML and JSON files and how some webpages offer their pages in these formats for easier reading by other machines.
But there are still a bunch of tasks which I have no idea how to approach whatsoever, but want to eventually do. I have constructed some hypothetical examples for the purpose of this question. I will post my current rough understanding of how I would do them below each one, and would appreciate feedback (on the API interaction, not on the front-end or on any back-end algorithms/AI/parsing):
Creating a phone application (disregarding the front-end part) which can then communicate with and perform rudimentary tasks on my computer.
I have no idea how to do this, and my guess would be that I would have to look into some external application/API meant for this process and implement this on both-ends of the system.
Being able to write a bot which goes on to a game website and controls the object via script. (e.g going onto a pacman game website written in flash and automatically controlling the character to avoid the ghosts)
I don't even know if this is possible, or how browser flash games interact handle the user-server interaction. Would I have to post some data via HTTP manually in the same way that playing in the keyboard would do? Or is everything done client side, in which case how would I fake user input? How would I get information on the ghost's position to work the AI?
Creating a mobile app for my school by allowing users to put their username and password into the app and then having the app automatically log in to the school and fetch certain data (e.g timetable) and return back in a readable form.
I'm guessing that I would take the input from the user on my mobile-app, and then navigate to the school's login page and POST this data in the relevant forms to log in. And then that I would (somehow, not sure), navigate to the timetable URL through my code while still managing to stay logged in, and then parse the html there?
I would appreciate some detail on how these kind of things are done, preferably with reference to these examples, so that I can get a better conceptual understanding.
Thanks!
Note: I have asked all those various questions mostly rhetorically, just so that those reading can get a better understanding of what my current programming level and understanding of APIs is at. I do not expect nor require specific answers for each and every question (so I hope this doesn't get flagged as being too vague or requiring too much detail!), I just would appreciate some responses telling me roughly how each of these APIs work approximately and how I would even start at looking at how to do these things.
You asked too many questions and honestly speaking I am not able to read and grasp entire text posted by you.
So, I am focusing only the title of your question:
"A conceptual understanding of API"
API (Application Programming Interface) means a set of functions which you can directly use by simply passing parameters to them.
Actually, in application development there are many common functions which every application programmer have to use. So, instead of coding them every time by every programmer, they are already coded in functions which you can use simply by passing parameters to them (if they need any external parameter).
Example:
I am offering you a maths API, set of functions {add, sub, mul, div}. You can pass two numbers to any of these four functions and get desired result instead of coding every time for ever operation like add, sub, mul and div.
Hope it helps...
APIs are getting more and more popular and are used by developers to ease the process of developing applications to multiple platforms AND allow them to give other developers the ability to integrate their application's functionality into their own applications.
I've used APIs countless times before, but I'm now at the stage of developing my own applications. And as a developer who strives to create multi-platform applications - I need to use an API.
I'm going to use the RESTful approach as it's recommended the most.
After reading and looking for some background information, I came across: REST API Tutorial (which is really good site!), I learned that APIs basically receive HTTP requests, and return data in JSON/XML format.
However, there were 2 questions left unanswered to me:
In what form do APIs come in? Are APIs actually files? a set of commands......?
How do I actually write APIs? I'm talking about the server-side, data-handling code, and not the application/language-specific code (for sending out HTTP requests etc...)
It'd be great if someone could help me and answer the questions above as I have zero experience with APIs.
Any help is appreciated - much thanks!!
Just a quick from-the-gut answer: They are whatever you want them to be!
Off the top of my head, I would define an API as requiring two main elements:
Some documentation which makes it quite clear how to use the logic your systems prvides
Some way to call those systems. That may be as simple as a web-site that accepts POST-messages, and checks them for certain variables and values in order to perform specific tasks.
In short, it should be entirely up to you. Just make sure you provide simple, clear and acurate documentation.
UPDATE, as an asnwer to the comment below:
That is how I interpret it, and it would seem that Wikipedia is more or less in agreement with me. PHP would be a perfect example: You could for instance create a PHP-file which processes a POST, and instead of outputting html, outputs XML with the resulting data needed. Then a third party app could POST to your PHP application, and receive and process the resulting XML.
Apis come as a response to a http request. It is a plain text response that u can use encoded via json or xml as you described.
There are a plenty of frameworks to help you develop and API.
In Ruby u can use grape or rais-api or even rails itself.
There is a lot more available, but this are the ones im most used to use.
I was making a website for a music band, and i was wondering the best way to play background music on the website without interrupting the flow of the music (even for a split second).
At the moment, i am considering using frames, but this is not supposed to be good practice. Please someone tell me how i can do this. I would prefer to use HTML to code the website as i have not yet mastered coding in flash.
This might sound controversial, but here's an idea: Don't play music on your website. Seriously, don't. I think everyone knows how incredibly annoying that is, and asking a group of software developers to help you out with that is going to be like asking a group of sheep the best way to make a lambskin coat.
If you really have to do it, frames would be the simplest way, so I'd do that. But you're not going to do it anyway, right?
I can think of four ways:
Frames, as you said.
Make your entire website in Flash and have only one page. You need to know Flash to be able to do this, which could make this difficult.
Pop-out your music player. This is probably the easiest approach, but the downside is this could be annoying, and a lot of web browsers these days would block it.
Use AJAX and dynamically load all your site content within one page, like Gmail. Users will need to have newer browsers, and this will take quite a bit of coding on both the client and the server side.
The only way to prevent the music from stopping is to not let the page your music component is on reload. Currently the only way to do this is to use frames, unfortunately.
The only alternative is to develop the whole site in Flash or another technology that doesn't rely on changing pages as navigation.
It wouldn't be pretty but you could do it using AJAX. Have the master page with the header/footer/navigation controls with a big empty content div, and instead of regular links you have calls to AJAX functions that return HTML to be injected in the content div.
I tend to agree with the others who recommend frames. It may be considered "bad practice", but so is playing background music in the first place.
As was said, to do that you have to prevent your website from relaoding.
An option to achieve this might be to use asynchronous requests to modify your website content without reloading the whole page, that's basically what Ajax is about.
That being said, I sort of agree with Alex here : dont' play music.
This may be a topic for another post, but why would you cosnider IFrames to be good practice? you could out the content you want to change into an IFrame and have your code running your music player ouside it. When you load a page it woul load on the IFrame. Just a thought...
You would most likely need flash or a new window (pop-up) outside of the window.
Don't use frames. Ever.
EDIT: To all the people downmodding and commenting on this, not a single person has given a valid reason why you SHOULD use frames.
Just to clarify my position, please read ANY article on usability, the web, and frames.
For those still learning (and to those old people to dumb to update)
Frames break the unified model of the web.
Frames cause problems for search engine robots.
Frames make URLs stop working.
Frames break bookmarking.
Frames make printing more difficult.
Frames hurt accessibility.
Frames increase technical complexity.
and the #1 reason to not use frames......
USERS HATE THEM!
http://www.456bereastreet.com/archive/200411/who_framed_the_web_frames_and_usability/
Are there seriously this many people out there suggesting frames are a valid solution in 2009? How disappointing.