facebook-java-api on red5, can they work together? - red5

I have a Adobe Flash Builder GUI application that connects to Red5 to communicate.
can i use the red5 to call facebook API calls? can anyone provide an example? all the examples that i can find are with tomcat.
thanks!

Unfortunately they can't.
facebook-java-api cannot work with red5 because it requires the session data that does not pass into red5 and uses variables that i received only by a java Servlet.
there is also a facebook java api called TinyFbClient (www.socialjava.com).
this client is small, very easy to understand with very nice examples.
here i didn't have to use sessions, but i do need to get the uid of the user i want to query on. the client side can forward that information when needed.
TinyFbClient depends on jersey (http://download.java.net/maven/2/com/sun/jersey/) but unfortunately jersy does not compile on red5 properly. if you'll try to use the binary version you'll just get the error
java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl
and that is because the compiled binary cannot operate properly.
I resolved the issue by installing tomcat and allowing the user to connect to tomcat first, with tomcat i fetch the session and the relevant facebook data, stores it in a database and then with red5 i manipulate the data as needed.
hopefully this information will be found useful.
update
i had the previous error message because i did not copy the relevant jars (jersey and jsr311) to the red5 directory. unfortunately it did not solve the problem.
i tried different versions of jersey (1.0.x,1.1.x,1.2). the code did compile but any calls to a facebook api would just stop the application.
i decided to do the facebook information fetching part in tomcat and then to deliver it to red5.

Yes, it can work in Red5. Especially if you had it working in Tomcat, since we provide an embedded Tomcat server.

Related

How to understand the ternjs framework

I am going to create a language specific tool to support hight-lighting, code completion etc and found ternjs is a good framework to use. I read the document from http://ternjs.net/doc/ but not quite understand how it works. Based on that document ternjs needs a server to be launched to support the client side. I inspected the on line demo from http://ternjs.net/doc/demo/#simple. When I type command in this demo, I didn't see any http communication happens between my browser and the ternjs server. I am confused about how ternjs server work in this case. Is there a way for me to setup one locally?

Worklight Analytics, Native Java API, no messages in dashboard

Worklight 6.2.0
Native Worklight App on Samsung Galaxy S4, Android 4.4.2
WLAnalytics.enable();
WLAnalytics.log("some text", new org.json.JSONOBject() );
WLAnalytics.send();
// and also go on to successfully call an adapter
Analytics Dasboard shows the app version and adapter activity. Log Search does not show any application log messages and the dropdown for selecting applications shows "All Applications" only, no sign of my app.
Have I missed some initialisation step? Any other ideas?
** edited to add **
It has been suggested that we should use the method:
WLAnalytics.log("some text");
In our 6.2.0.00 CLI environment there is no such Java method.
The answer is that there a further initialisation requirement that seems to be necessary when working with a pure Native application, these are typically build using the Worklight CLI tooling.
This is the initialisation, note the call to Logger.setContext()
WLAnalytics.enable();
Logger.setContext(this);
Then this works
WLAnalytics.log("My test message2", new org.json.JSONObject());
It's worth noting that the call to WLAnalytics.send() is not necessary in normal running as typically the analytic data is buffered and sent as a piggy-back on adapter calls. However while testing a call to send() does help.
Further, if running in an environment where the Analytics WAR is on a separate machine from the Worklight Server WAR there are additional latencies. Hence testing all of this needs care.
For now, I suggest that you just use the WLAnalytics.log(String) method. There are some clear inconsistencies that need to be dealt with whether it be through documentation or code fixes.
The WL.Logger APIs were originally created to send log data to a custom adapter, which is why they take a dictionary/object for extra metadata. The data sent to the custom adapter could be read as a valid JSON object to run operations on the adapter.
The WL.Analytics APIs mimicked the WL.Logger APIs for the same purpose: parsing the JSON on a worklight adapter. The Operational analytics server came as a convenience to intercept and display some of these logs, but not all of them are being captured as you have learned.
Your questions are all valid though, as none of this is described in the documentation. In future releases, we may make use of the extra JSON object passed into the API in the Operational analytics console, but for right now they only serve their original purpose of sending the analytics to a custom adapter.

Capture web driver network traffic across all browsers

I want to capture all the network calls from Web Driver in Java. I am not doing any UI testing, just testing JS execution and, requests and responses of some network calls.
I tried using Browser Mob as is suggested in most forums, but I need it to work across all browsers. It worked flawlessly with Firefox, but I was facing some issues with the others. Safari driver doesn't event support a Proxy capability.
I don't want to use Fiddler as it involves some manual steps around invoking and storing the calls. Whereas, Browser Mob being an in-code proxy can be integrated in a more smoother fashion.
I also tried using the RC-like package included in Selenium standalone server package. But, I have some HTTPS calls and some nested iframes in cross domains. I am particularly interested in some cross domain POST call and it doesn't work out that well. Also, people keep saying it's not recommended to use that package.
So, I had a solution where we can use a standalone proxy server running on a machine. Using host entries, we'll point Web Driver to hit the proxy instead of the actual server. The proxy will record all the incoming calls and route them to the actual server host. Later, I can make a request to the proxy which will return me all the calls it intercepted. I am not sure whether it's still called a proxy or a router.
I came across TCPmon, but it's no longer being supported. Does anyone know some similar tools that could run on Unix systems or any alternate solutions?
We modified the Fiddler rules script to include a new exec action. If you use their native script editor, it also provide auto complete features and we were comfortably able to get around it. The syntax is similar to that of JavaScript.
The Fiddler package comes with a ExecActions.exe which can be used to pass console arguments to a running Fiddler instance using the command prompt.
The code we wrote processed all the sessions captured by Fiddler and wrote it to a file in a custom JSON format and later used GSON to deserialize it.
Please let me know, if you want further details.

How to address Firebase from an Arduino?

Background: I've a sensor hooked up to an arduino printing readings through the serial monitor. I want to log these in firebase.
I've done a bit of digging on this, and my research has shown me that an arduino simply can't handle the SSL needed to talk to firebase properly.
Any suggestions for workarounds? Checking SO and google's only turned up "it can't be done", but I figured I'd ask anyway. Any lateral thinking is appreciated, thanks!
If you figure out a way, let us (support#firebase.com) know. That would be an awesome hack!
Some thoughts:
You might want to look into the Spark Core (available for pre-order). They mention SSL support, though it's unclear to me what that means exactly.
You could proxy the requests through a server that can speak SSL. For instance, you could run a tiny node.js service on an Amazon EC2 box that just proxies REST requests to Firebase (e.g. using http-proxy).
If you're hardcore, you could try to get the Arduino talking to an external ethernet controller that has built-in SSL support (e.g. this one), but that's probably a big project. :-)
Longer-term, we might expose a non-SSL endpoint for Firebase requests that's specifically for this sort of low-end hardware use-case. Ping us at support#firebase.com if you want to start a dialog.
Here's a php script I whipped together to solve for Arduino no https.
It's basically a form that GETs to the php script and then sends it off to your Firebase database.
http->php->Firebase
https://github.com/robertcedwards/httpFirebase
*Make sure you add Heroku or your server to the whitelist of IPs that can post to Firebase
I know its an old question but visitors from google keep coming.
Have a look at this post: http://www.devacron.com/arduino-firebase/
[EDITED]
These arduino libraries might help:
firebase-arduino
https://github.com/googlesamples/firebase-arduino
https://github.com/ed7coyne/firebase-arduino
To install it:
Download the zip file, go to Sketch>Manage Libraries>add .zip file
Now you have access to
#include <FirebaseArduino.h>
and can begin using it with
Firebase.begin("example.firebaseio.com", "token_or_secret");
Follow the example at https://github.com/ed7coyne/firebase-arduino/blob/master/examples/FirebaseDemo_ESP8266/FirebaseDemo_ESP8266.ino

need a way to securely communicate between Priviliged Helper Tool (installed using SMJobBless) and the application

I am trying to install a privileged helper tool to perform some elevated work. I am using SMJobBless for the same.
I am able to install the tool fine and also able to communicate with it. I am using Mac OS X 10.8.4 and using NSXPCConnection for the same.
I have added .mach service in the plist which will be installed in /Library/LaunchDaemons. I am using [initWithMachServiceName:options:] in the app as the helper is privileged tool and [– initWithMachServiceName:] in the helper to listen. The communication is working fine.
But the problem is I tried the same communication with another application I created which did not have any codesign at all (the helper tool installer earlier was codesigned). I tried to connect to the mach service of the helper tool and was able to connect easily. This is a problem because anybody can communicate with it then and make it do anything.
I wanted some way to securely communicate between my application and the helper tool.
Thanks a lot.
As you've said that you're not signing the second app, I believe that that is the problem that is allowing a 2nd app from calling the helper application. From the Apple docs and specifically the ReadMe file in SMJobBless, it states: -
The Service Management framework uses code signatures to ensure that the helper tool is the one expected to be run by the main application
This document should be able to assist you in getting the helper app correctly associated with its owner.
Note that it references a python script, which is provided here.
Answering my own question: I had logged a radar bug for the same and Apple said that the behavior was intended:
"It is up to the privileged helper to not expose insecure operations"