What is [Application] in Mono for Android? - mono

I'm new to mono and working through the Mono For Android tutorials. Can anyone point me to some documentation which explains the meaning of the [Application] tag above my classes?... Here's my issue:
I have come accross an issue where I have created two seperate classes App1.cs & App2.cs, both of these extend the Application Class (Public Class App1 : Application).. etc.
There is a tag above this declaration [Application] which seems to be causing deployment issues, although it builds fine. If I comment one of these out, the application builds and deploys fine.
I have searched for info on these tags, but as yet cannot find anything in the search, FAQ's or on google... I guess the square brackes are causing me search problems. Any help would be great...
Thanks
C

In Android applications you can subclass the Application class in order to maintain global state in your app. An app can have at most one Application class, and it is shared throughout the app. In order to register your Application class it needs to be registered in AndroidManifest.xml (this applies to any Android component). Mono for Android uses attributes to generate the manifest during compilation, so any class decorated with ApplicationAttribute will generate configuration at build time.
Since only one Application class is allowed, this would explain the problems you are seeing when you try to register two of them. My guess (without having context into what you're trying to do here) is that you probably want to subclass Activity for these classes instead of Application.

Related

Can I render and debug Objective-C code in VSCode

My project comprises a C++ core, iOS and Android wrappers (ObjC / Java) and a Python-wrapping-CMake build-system.
C++ works fine. However an Obj-C header file (with .h extension) marks syntax errors everywhere:
Does there exist some extension for handling this? I can't find one anywhere.
Xcode is a complex combination of different applications like interface builder, instruments, device manager and many more these were separate applications at a time so putting all this together in some other IDE wouldn't be easy task however there are few people those are trying something like AppCoda but still too far from the actual product.

Appcelerator Hyperloop vs. Plain Titanium Modules

I've started playing around with Appcelerator Hyperloop. While it seems great to access native APIs from JS from day zero, it does raise a few questions about architecture of the platform and the performance.
Currently (AFAIK) a Titanium app has a main UI thread (that runs the native UI controllers) and a JS thread (that runs the JS logic). Each call from JS to Native is passed though the "Bridge" (which is the expansive operation in an app).
Also, Titanium API doesn't cover all the native API and abstracts as much as it can. But if new APIs are introduced it could take time for Appcelerator to implement those into the platform.
One of my favorite things about Titanium is the ability to extend it (using objective-c for iOS and java for Android) - allowing to use native APIs that are not covered by Titanium, and also developing a really native performance controls in case we need to do anything that's too "heavy" for JS. And, as mentioned it's developed 100% native for each platform.
Now that Appcelerator introduced Hyperloop I've done a simple test app and saw that Hyperloop is not translated into native code but just to normal JS code:
var UILabel = require('hyperloop/uikit/uilabel');
var label = new UILabel();
label.text = "HELLO WORLD!";
$.index.add(label);
And another thing about it is that you have to run on the main thread.
So we basically have a few things come to mind here as far as Hyperloop architecture goes:
We still have a bridge? if Hyperloop is JS that calls "special" Hyperloop require then we still have a bridge, that now not only acts as a bridge but also needs to do some sort of reflection (which is also an expansive operation)?
Until now JS ran in it's own thread - so now running in a single main thread seems to be a potential source to more UI blocking operation.
The old-fashioned modules were truly native (not including the bridge call) - so how do Hyperloop-enabled apps compare with those?
There isn't much documentation or articles about Hyperloop that explain the inner working yet - so if anyone has any answers have been trying apps with it could be very helpful.
Answering your questions straight-forward:
There are no Kroll-Proxies involved anymore, since actual classes are being generated on runtime. This is done by using the hyperloop-metabase that does reflection (as you already said) to build an AST that grabs the actual signatures, types, classes, methods, properties, etc.
We did not see any performance-issues with running on the main-thread for now. If you do so, please file a JIRA-ticket so we can investigate the use-case.
The old-modules were "less native" then now, simply because they were all wrapped by the Kroll-proxy (by extending every view from TiUIView and every proxy from TiProxy / TiViewProxy. Hyperloop does not work with those, making the module-development much more faster by also allowing the developer to test his/her process live in their app without the need of packaging and referencing the module manually. Hyperloop modules are nothing else then CommonJS modules that are already used frequently across Alloy and other Ti-components.
I hope that gives you a quick overview on how Hyperloop works. If you have further questions, let us know!
Hans
(As a detailed answer to the above comment)
So let's say you have a tableview in iOS. The native class is UITableView and the Titanium-API is Ti.UI.TableView / Ti.UI.ListView.
While the ListView already provides a huge performance-boost compared to the TableView by abstracting the Child-API usage to templates, those child-API's (Ti.UI.Label, Ti.UI.ImageView, ...) are still custom classes that are wrapped and provide custom logic (!) e.g. keeping track of it's parent-references, internal data-structures and locks to jump between the threads.
If you now check the Hyperloop example of a native UITableView, you access the native API's directly, so no proxy behind it needs to manage sections, templates, items etc. Of course we deliver that API through a kroll proxy in order to display it in Titanium, but you don't "jump between the bridge" with every call you make from the SDK.
The easiest way to see that is to actually run some bigger example like the tableview, collectionview and view-animation. If you do a fast scroll through these, you already feel the performance boost compared to "classic" Titanium API's, simply because the only communication between your proxy and (like a Ti.UI.Window you want to add it to) is the .add() to receive the native API of the type HyperloopClass.
Finally, of course it still makes sense to use Ti.UI.ListView for example, because it comes with the builtin utilities that Titanium devs love (events, easy configuration and layout-handling). But thats also where the benefit of Hyperloop comes along, by allowing the developer to access those API's him-/herself.
I hope that helps a bit more to understand it.

Can I use Ninject Modules in any way in constraining the resolution of a request

In our web project we are using Ninject. Now we are adding plugins to our application. We want plugins to be able to add their own bindings. Ninject modules seems like a logical solution to this problem.
However, I don't see any guidance on how to avoid the following problem. What if a plugin adds a binding to an interface that already had a binding. Now the DependencyResolver will throw an exception when trying to resolve that interface.
I'm trying to make a change to our DependencyResolver that doesn't require rewriting all of the binding statements we've already written in the main application. I don't want a plugin to be able to break my main application. If a plugin needs to apply constraints to make it's bindings work then it is its responsibility.
So here's what I want.
A plugin would not be able to break the core app or another plugin because it added a binding.
It should not be necessary for any change to be made to core application or another plugin when I want to add a new plugin with its own bindings
Where there are multiple instances to choose from it should do the "logical" thing. The core app should get the instance it always would have gotten in the absence of the new plugins. The plugin should get the instance it specifically bound.
It seems like I should be able to override the resolving methods of StandardKernel so that it can implement these rules. It seems like knowing what module a binding was a part of would help resolving. But I can't find module or module name as part of the context, request, bindinginfo, etc.
Any thoughts on how to resolve this issue. I don't see that Ninject seems to answer what seems like a very obvious need for a modular system. A new module shouldn't be able to break an app. (It should only be able to "break" itself.)
You should have a look at Ninject.Extensions.ChildKernel. You could create a ChildKernel per plug-in and then load the plugins' module in their own ChildKernel.
This means that a plugin cannot rely on the bindings of another plugin, but a plugin may rely on the bindings of the Parent Kernel (root / application kernel). So you can provide certain types/services to the plugins.
By the way, if the implementation of Ninject.Extensions.ChildKernel does not match your needs, you might very well choose to implement your own extension. It's not that much code (see ChildKernel source)

Embeding streaming player inside my app IOS

I'm trying to create an iPhone app which plays local radio station in my district. I found this player to work best for me :
https://github.com/DigitalDJ/AudioStreamer
When testing it against my requirements it did the best without any doubt.
I thought I'll use this players API and it should be straightforward(not really for a newbie). How exactly I do that is where I'm stuck now. Because when I run the player original project it runs smooth, but when I copy code inside Classes to my app, this is what happens :
Ok, I've been developing some apps(test apps) for two weeks maybe and I lack experience.
How do you usually embed/import other projects code into your code and user the other codes api?
EDIT
So per Sunil Pandey answer, this cannot be run using IOS SDK version 5.0?
EDIT 2 :
I feel like I'm really close now, have this one issue :
Receiver 'AudioStreamer' for instance message is a forward declaration
It's declared in my h file. as AudioStreamer *streamer
As said Sunil Pandey, ARC mecanism is enabled for your project. With ARC, your project require at least iOS4 on the phone.
I would suggest you to disable ARC for the file you imported from the third party librairy. So you can keep using ARC in your own code (this mean, you never use retain, release, autorelease).
To disable ARC for each file of your AudioStreamer library, refer to How can I disable ARC for a single file in a project?
You must have implemented ARC inside your project. that's why it is giving you this error.
If you are using ARC then only way to use this project library is to create a static library of your AudioStreamer lib and then import it inside your app
Or
If you don't want to use ARC inside your app then you can turn it off by following method
select your target -> Build Setting -> Apple LLVM Compiler 3.0 - Language
set Objective c Automatic Reference Counting to NO

Flash Builder 4.5 for PHP does not generate CRUD php classes for services while the previous version did?

I recently upgraded to Flash Builder 4.5 for PHP since I’m working on a big PHP/Flex project and thought that it would be easier to integrate the two.
What do you know? The feature that generate the php class to feed a flex/PHP service trough AMF is appears to be missing!
Time to downgrade or am I overlooking something?
I believe it's still there, but that feature should only be used for building a test application. It breaks a lot of best practices such as creating the connection in the class (it should be injected or retrieved from an outside class that manages the DB) and it puts the database definition info in the class (username, password, etc.). I believe that when you use that feature that a popup tells you that it is not intended for production use. When building a service class it is best to define your classes based off of the functionality you need to provide.