I'm using EventBridge and have set it up so if an S3 bucket receives a new file, my function is called.
From that function (which I would prefer be in C#, but other languages would be fine too if it's simpler) I want to call my application's API. Just do a Post with something like https://myip.com/newFile?name=thenewfilename.txt
My understanding is that it would be better to put 'myip.com' as an environment variable so it could be changed more easily?
Any example or code which shows how to do this?
Related
I’ve a robot with Wi-Fi: it's set up as server. I’ve a website and I want to change some of the robot’s parameters by entering data into the website. How can I do this?
you would write a JSON API in you favorite Language/Framework and than invoke it from a website. Look for AJAX call with javascript
Part of it depends on what system you use. This becomes easy if you use ROS. Maybe try looking into this: http://wiki.ros.org/Robots/TurtleBot/indigo
Other wise, you just need to set up a receiver on the robot. In that case look at socket programming.
I am making a rails application that will make API calls to Eventbrite, using HTTParty.
I do not know how to structure my eventbrite.rb in my \lib directory file so that I can call it in my controller.
My eventbrite.rb file so far:
require 'HTTParty'
class EventBriteApi
def eventbrite
HTTParty.get()
end
end
The url I am sending a GET request to is something like this: www.eventbriteapi.com/v3/events/search?q=concert&sort_by=best&venue.city=san francisco
I already have an authorization token so I just need to know the format in which to structure my class, and how to actually make the right call in the controller, as well as how to grab the variables from the form in my view.
Thanks in advance.
Use existing API libraries for EventBrite, if you just want to learn, then its cool. The best way to learn is to see how others have done it.
https://github.com/ryanj/eventbrite-client.rb/blob/master/lib/eventbrite-client.rb
#^ Go through the code and see how he has done it.
I have a PHP page that has many javascript variables and I want to read a specific javascript variable then post this value using HTTP post.
I know how to post the value using Indy but I don't know how to read JS variable. Please advise what tool I should use, any code snippet would be much appreciated.
Unless the JS variable is assigned a static value in its code (in which case, just grep the JS code for what you need), then you will have to actually execute the JS code using a real JS scripting engine, just like a webbrowser would.
I want to generate QR codes in ruby on rails, to run in the background of my website written in rails. Saw this http://code.google.com/p/qrcode-rails/ but cannot work out how I could get this to work for me. Basically in RoR I want to:
Pass a generator a string, my unique code, a 20 character length number (e.g. 32032928889998887776) and have an image generated with the name 'code'_qr.jpg and saved in a resource folder to be attached to an email that my program will send out.
How would I do this, does anyone know?
And while I'm asking (not so important that I get this answer now) but how would I implement QR code reading in, to get that code back, from a web cam? Thanks.
If you just need to write the data from the URL to a file, you can open up a stream, read from the file, and simply write the data to disk -- just remember to use the same extension (.jpg in this instance.)
Note that you could also simply send the link in the email (or post it as an inline image in the email.) If you really, really want to write it to disk and send it as attachment in your production system, the first-class solution for Ruby image processing is ruby-vips or ImageMagick.
Finally, since it's a disk operation, you're going to want to do it outside the normal web request cycle -- you're probably best off farming the operation out with delayed_job, or at the very least triggering the process with an AJAX request. Both of these give you the advantage that you can present a progress bar for the operation.
For one of our desktop applications we use a HTML-based interface, loaded from local files into a WebBrowser control.
This works fine, but now we want to load the files from a different source, and are trying to stream them in using IPersistStreamInit (like this example on MSDN). It seems to work OK, except for the referenced javascript .js files (JQuery et al). It tries to load those from the "about:" location resulting in errors.
What I would really like is to get a callback event whenever additional files are streamed, and substitute the right data. That might be asking for a bit too much though, so suggestions for workarounds are welcome!
Call CreateURLMoniker() to obtain an IMoniker interface, load your HTML data into it via its Load() method (which takes an IStream interface as input), and then you can use the browser's IPersistMoniker interface instead of its IPersistStreamInit interface to process the data. The URL you pass to CreateURLMoniker() will be used as the base URL.
You could use a lightweight custom protocol handler using an Asynchronous Pluggable Protocol, which would give a callback for files.
I have some demo code at http://www.jasontpenny.com/blog/2010/03/23/custom-protocol-handler-in-delphi/