How can I get the memory that my Java program uses via Java’s Runtime api?

There are similar questions out there, but they seem to avoid answering this specific question. How can I get the memory that my Java program uses via Java’s Runtime api? The answer here indicates that I can do something like this: System.out.println(“KB: ” + (double) (Runtime.getRuntime().totalMemory() – Runtime.getRuntime().freeMemory()) / 1024); But this always returns the … Read more

Linux API to list running processes?

I need a C/C++ API that allows me to list the running processes on a Linux system, and list the files each process has open. I do not want to end up reading the /proc/ file system directly. Can anyone think of a way to do this? Answer Is the source of ps … Read more

Why is Ruby unable to verify an SSL certificate?

This is my first time trying to use the XMLRPC::Client library to interact with a remote API and I keep receiving this error: warning: peer certificate won’t be verified in this SSL session Searching around I’ve found loads of people that have gotten that error. Usually it’s with self-signed certificates and they just want it … Read more

How To Rate-Limit An API [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago. Improve this question What is the best way to limit requests for an API? Basically, we want to … Read more

API Design: HTTP Basic Authentication vs API Token

I’m currently creating an authentication system on front of a public web API for a web application. Given that each user account has an API key and each request must be authenticated, I have two alternatives: Using an HTTP Basic Authentication, like GitHub does. Requests must be sent to the URL with basic authentication … Read more

facebook Uncaught OAuthException: An active access token must be used to query information about the current user

I’ve been struggling to find out what is happening with this. My scripts were working fine for a bit and suddenly half stopped. I’m accessing the api and am getting back an access token. With the access token, I can access a users public info just fine. However, when I try to post info to … Read more

Podcast search API [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 5 years ago. Improve this question Is there any podcast directory search API out there apart from the iTunes search API? I have looked around … Read more

Sinatra – API – Authentication

We going to develop a little API application in Sinatra. What are the authentication options available to secure the API calls? Answer Sinatra has no built-in authentication support. There are some gems available, but most are designed for user authentication (i.e. for a website). For an API, they seem like overkill. It’s easy enough to … Read more

Using Rspec, how do I test the JSON format of my controller in Rails 3.0.11?

I’ve scoured the web, but, alas, I just can’t seem to get Rspec to correctly send content-type so I can test my JSON API. I’m using the RABL gem for templates, Rails 3.0.11, and Ruby 1.9.2-p180. My curl output, which works fine (should be a 401, I know): mrsnuggles:tmp gaahrdner$ curl -i -H “Accept: application/json” … Read more