I want to use Google Translate as part of a C code I am writing. I understand that Google Translate is used with JavaScript. How do I get it work as part of my C code?
How do I make a connection from my C code to the Google site?
You can use the Google Translate API with cURL.
First make sure you're not violating their terms of service. Just because it's freely available on the web doesn't mean it's freely available to embed into applications.
Then look into a library that lets you "simulate" web interactions from C, such as cURL.
Related
I am trying to use SQS on aws (on a linux box) using generic C. Not using any sdk (not that there is one for C). I can not find an example I can relate to. Sorry, I don't relate to these newfangled languages. I am proficient in Cobol, fortran, pascal and C. Not python, c++, c# or java. There are "steps" on amazon site, but honestly they expect proficiency on aws and an object oriented language. I just want to create my own https get command for accessing SQS/SNS, can anyone provide a 'C' snipet that creates a complete url with the version 4 signature? Or point me in the correct direction?
Have a look at https://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html
If you're proficient with any programming language, you should be able to understand all of that code. It's just string operations and some hashing for which you'll have to use another library. There's also lots of comments to help you with the details.
You can use libcurl for the call:
Use CURLOPT_AWS_SIGV4 argument for the signature https://curl.se/libcurl/c/CURLOPT_AWS_SIGV4.html
You can take a look at CURLOPT_WRITEFUNCTION if you want to store the result into a variable: https://curl.se/libcurl/c/CURLOPT_WRITEFUNCTION.html
And for debugging purpose CURLOPT_VERBOSE can be useful too: https://curl.se/libcurl/c/CURLOPT_VERBOSE.html
Note that you need a version of libcurl superior to 7.75.
I want to build a restful (CoAP) web service which can execute c code to handle events.
Therefore I'm searching a lib which provides me with a rest api in C and cgi similar to
restcgi which is sadly in c++ or CGI-Simple which is in perl.
The server is running on a embedded device so it has very limited resources and the services will be accessed only by machines.
Thank you very much.
You may be interested in Raphters framework and its architecture. It's pretty small, so you can examine the code, the framework itself can be used as a FastCGI backend for some web server, e.g. for nginx.
I have recently came across one quite interesting CoAP library which uses libevent. You will aslo want to check Klone embeddable HTTP server by the same guys at KoanLogic. I have previously looked at libcoap, but it didn't find it very usable at the time. You may also wish to try using either libuv, libev or libevent. But I guess it's probably gonna be much easier to adopt some of the code from WT repository and get your CoAP/HTTP server done.
Is it possible to use Lua with Google App Engine? I recognize that there will be a lot of Java glue, but I would like to use Lua for most of the logic.
It might be possible with a port of Lua such as Kahlua or Jill (Lua implemented in Java). The Lua Users Wiki page on Lua Implementations does not show any ports written in Python.
But you wouldn't be able to use "vanilla" Lua because that is written in C; as you're probably aware, GAE only allows Java and Python code.
I haven't used it, but Lunatic Python purports to be a way to run Lua in Python or vice versa. If that's true, then you could use their tools to create a Lua interpreter running in a Python app running on Google App Engine. Sounds promising.
we have to work with RL-RTX (RTOS) in our project.in that we have to do some web pages.we have experience in building web pages in linux using "go-ahead webserver".
can we code in c language and store that executable in .cgi extension and call from the browser?
Yes, you can. Almost all web servers can be configured to serve cgi. You could use something like libcgi to handle the interface in your c code. Still, it would probably be more efficient to use some kind of scripting language rather than c.
I was going to make an AIR application but I need to execute an external application and because of the security restrictions in Adobe AIR... I was thinking why not try and bypass it by writing some C code that does something like System("file to execute"); and then use Alchemy to change it into a swc and us that in my application... Anyone tried this sort, or think it could work?
What you need to understand about Alchemy is that it compiles C into the same bytecode as actionscript, and it runs under the same virtual machine (AVM2) as flash/flex as3 applications.
The reason Alchemy is able to be faster for some operations is that the compiled C (compiled to bytecode) is given access to raw "memory" (ApplicationDomain.domainMemory) via some optimised AVM2 instructions that were added in flash 10.
What I'm trying to get at is that because Alchemy simply runs on top of the AVM2, it is restricted in the same way as any other application. Alchemy in an AIR application can do more than Alchemy in the browser sandbox, but it is still restricted by that sandbox.
If you really need to execute an external application, you'll need to look into something like Shu or Zinc.
Sorry I couldn't be any more help.
This will not work - Alchemy is not really / really not suited for programs that interact with the outside world. I don't think it will support doing a system call, and even if Alchemy would support it the flash/air runtime will most certainly still block it.
If you don't need cross platform behavior you can look into creating an oldfashioned 'projector'. It is possible to launch programs from a projector exe using fscommand- just be aware the executable you want to launch has to be located in a folder named fscommand next to the binary. If that is not sufficient you could try a third party commercial tool like http://www.northcode.com/.
No, Richard Szalay's correct: Alchemy compiles C code into ActionScript bytecode, so the resulting SWF is still subject to the same sandbox restrictions as any other; the AIR restrictions may be looser, but using Alchemy provides no benefit in that respect.
However, you can still "call out" of the sandbox using a socket connection, provided you have an app listening for the connection; check out Merapi -- it might be able to help as a simple solution, if you were open to using Java, although you could certainly roll your own with something else, like C#.