Google App Engine (GAE) WEB-INF/lib order - eclipse

Hey guys i'm working on a project with Google App Engine. To get Data from my devices we're using MQTT. The org.eclipse.paho.client.mqttv3.* library starts a Thread with "client.connect()".
After some researches i found that you cant just simply create Threads when working with GAE. Following error is shown:
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup")
So i continued searching and someone told to use following code instead of a "normal" Thread:
Thread monitoringThread = ThreadManager.createThreadForCurrentRequest( new Runnable() {..}
So i decompiled the paho library, looked up where the Thread is created and changed it.
I created a new class exported it as mymqttclient.jar
In eclipse i changed the order of my build at Properties -> Java Build Path -> Order and Export so mymqttclient.jar is loaded before the mqtt-client-0.4.0.jar So that it will use my created function with the monitoringThread.
But how can i change the order of the .jar's in the web-inf/lib ?
Thank you very much for your answers, i couldnt find something useful until now.

Firstly there is no need to decompile any of the Paho code it is all available from here.
Since you can now get the clean source, why not just modify the original class and rebuild the jar file, then you don't need to worry about messing with the Classpath to get your class to load first?

Related

Issue with FilePicker in BlackBerry 10

I've being trying to implement a native File picker on BlackBerry 10 today, I linked it against the required Library -lbbcascadespickers
Included <bb/cascades/pickers/FilePicker> that links to the FilePicker.hpp class and all seems fine, but when I try to create a new File picker it says "error: 'FilePicker' was not declared in this scope"
Code is as follows:
FilePicker* filePicker = new FilePicker();
filePicker->setType(FileType::Picture);
filePicker->setTitle("Select Picture");
filePicker->setMode(FilePickerMode::Picker);
filePicker->open();
// Connect the fileSelected() signal with the slot.
QObject::connect(filePicker,
SIGNAL(fileSelected(const QStringList&)),
this,
SLOT(onFileSelected(const QStringList&)));
// Connect the canceled() signal with the slot.
QObject::connect(filePicker,
SIGNAL(canceled()),
this,
SLOT(onCanceled()));
I'm brand new to BlackBerry development so don't really know what to do, I've cleaned the project and built it many times but it won't play.
I was going by the example on BlackBerry's website:
https://developer.blackberry.com/native/reference/cascades/bb_cascades_pickers__filepicker.html
I wanted to open it from QML (I'm using Qt Quick and not BB components)
If anyone can help it will be deeply appreciated
The compiler can't find FilePicker. So either use a using to tell the compiler where to look:
using namespace bb::cascades::pickers;
or fully qualify the name of the class:
bb::cascades::pickers::FilePicker* filePicker = new FilePicker();

iOS Application framework

I have created an ios application that can talk to the database and get the messages from the server and all i want to do now is to distribute this aplication as a templet and other application can import my current project and use it, Now i been went throw many tricks and tips such as making an Static framwork using xcode bundles and Aggregate target type and got it work with some script found hear: http://codefriend.blogspot.com.au/2011/09/creating-ios-framework-with-xcode4.html
what i want to know is whether its the correct approach for such a problem or should i been looking at something else. All i want to create is an framework for my team so that they can produce other application
without worrying about or writing same files and code again and again. And is it possible to bundle all the .xib and .html files too?
This is what we use to create framework:
https://github.com/kstenerud/iOS-Universal-Framework

NServicebus MessageHandlers in a different Project don't get hit

My problem:
I have web project which implements NServicebus and should listen to messages.
Trying to keep my solution tidy I set up a different project for all my messagehandlers.
I now find that these messagehandlers do not get "hit" with messages.
To my understanding NServicebus scans all dll's in the debug folder of the web project to find any classes implementing IHandleMessages<>.
I referenced the messagehandlers class library project in my webproject and it appears in my debug folder, however it does not seem to get hit.
What does work
In a console sample project the inclusion of a referenced project which contains messagehandlers works as expected.
In my web app it works when I move my
messaghandlers to the web app project itself.
Reading through the website http://docs.particular.net/nservicebus/hosting/nservicebus-host/ I found that there are overloads for the Configure.With() method.
However:
I do not know if I need them. They text only seem to suggest that
this will limit the places where NServicebus looks for the
implementations of the interface.
these overloads do not exist in the Configure.WithWeb method which I'm using.
I can solve my problem by moving all the messagehandlers to my web project, but this does not seem like the best solution.
Am I missing something here?
When using NServiceBus in a web project, use NServiceBus.Configure.WithWeb() instead of NServiceBus.Configure.With().
Also, in order to load message handlers in a web application, you need to include the .LoadMessageHandlers() line after .UnicastBus() as described in Hosting NServiceBus in your own Process. Otherwise any IHandleMessages<T> implementations are not loaded and your web application operates as a send-only endpoint.

unable to create new static Library out of existing source code

I'v done quite a bit of R&D on creating static libraries in iOS and came across some well written blogs. I followed this link and also this to create a static library. I have follwed the steps specified in those blogs i.e, i added all the implementation files(.m) to the static library and deleted them from the main target etc... But, i am getting around 700 erros (which is quite bizarre) when i try to build the code. i am posting a screenshot of my errors here..
Is there anything that i am missing here or doing wrong?
Please check the imported Header files.
The .m files, which have these errors, may have the same imported files.
Maybe a semi-comma or parentheses is missing or used incorrectly.

Using GWT + Twitter4j

I am trying to build a simple gwt project that fetches tweets and displays them.The server passes back the tweets of type twitter4j.Tweet to the client.
Both modules import twitter4j.Tweet.
But when I run I get the following error:
--- ERROR: Line 37: No source code is available for type twitter4j.Tweet; did you forget to inherit a required module?.
I seem to have problems in inheriting twitter4j. All the posts I have seen about inheriting a jar file are not clear about how to do so. I understand I must write an inheritance instruction into gwt.xml file, something like
---
but if I try
---
it does not work. Can anyone please explain?
In a post I found on the Web one person suggested not to inherit it but:
-- Don't put twitter4j to your gwt.xml. Just add it your project class path. and make all functionalities like status updating and all in your serviceImpl. Try
This confuses me even more. I have added the jar file to my project libraries. But it does not work
I suspect I am missing something quite elementary here, but I am totally stuck. Is there something like a GWT path?
Many thanks for any help
Keep in mind that everything in your client package is compiled to JavaScript and executed in the user's browser. Thus, you'll only be able to use twitter4j's classes on the server-side of your application; you'll have to create some sort of light-weight GWT-serializable "proxy object" to pass data back and forth between your client and server tiers.
Since you can't use twitter4j on the client side of your app, you will not need anything in your .gwt.xml file referencing it. Instead, you'll add twitter4j to your classpath and do all your updating on the server side (as mentioned toward the bottom of your question). You do mention that it "does not work," but there's not enough information in your question to try to figure out why.