I want check mtproto proxy by android java programming language.
I tried some ways like:
new Socket().connect(a, b);
or
InetAddress.getByName(a).isReachable(b);
But i want use other way or better way.
Related
We have Objective C and Andoid Java applications and would like to create a component using C# and Xamarin that would interact.
Is there a way these technologies can communicate with each other (Objective C <-> Xamarin and Android Java <-> Xamarin).
Not sure how you do this but searching here it may be possible to create a static library in Objective C/Java that can be called from Xamarin.
From there I understand that you can start the Objective C/Java app from the Xamarin Main method and afterwards can call other static library methods.
Ideally we would like to call from the Objective C/Java app to Xamarin.
According to Miguel in this post it is possible but are there any examples anywhere.
Hope the explanation makes sense.
Thanks
From the wording of your question, this is not possible.
Xamarin does offer the ability to create 'bindings' between C# and Objective C/Java static libraries and has a section on the Developer documentation on doing so (Objective C Bindings or Java Wrappers).
The key part is that this is for static libraries and not for general application functionality i.e. user interactions.
You will need to weigh up the benefit between migrating the disparate projects to a shared Xamarin solution whereby you will enjoy the code sharing (especially with the Xamarin Forms offering) or simply writing the functionality into separate libraries for the different platforms.
Good luck
I am simultaneously developing native applications for both Android and iOS. I know there is no "good" way to write code once and have it run on both platforms--technically yes, I could use Phonegap, but from a user standpoint they wouldn't feel like native apps due to the differences in the platform.
But is there a way to share subsets of controller code between the two platforms? I am talking about the "invisible" code, i.e. code that has nothing to do with (directly) drawing the UI and does not use the iOS and Android frameworks. For example if I was developing Angry Birds, what's the best way to implement the physics equations governing the flight trajectory of the birds? How do I best share this kind of code between the two platforms? By "best" I mean how can I 1)minimise development time, 2)simplify maintenance and 3)simplify future upgrades.
Options I see:
Using server side to compute logic and then any UI can display it no matter on what platform. This option however will require network connection or may have slow response due to ping.
Write common code in C/C++. This option is more complicated but it will work in 100% cases as c/c++ compiles to native code that means it's supported by almost all operating systems.
Write common code in scripting language like Python, LUA ... This one will require interpreter on client side. Also there's can be performance issues if you'll execute scrip on each frame and do complicated logic in it.
Using phoneGap/ mono/ marmelade ... This will limit native functionality and you'll always depend on 3rd party and not on native SDK. But if you developing openGL es game maybe marmelade is the way to go.
On my opinion C/C++ is the way to go, especially if you are developing a game and don't want to limit yourself to one platform.
PS: If I was developing game like angry birds I would use BOx2d and not implementing physics by myself.
EDIT:
Native code only supported on windows phone 8
Writing in C may be the answer.
Objective C is just a superset of C, and you can write your model layer as just a wrapper of c functions.
According to this article, you can do something very similar in Android using JNI.
As you say, this is only possible for the model layer. You'll have to write Objective C for the view and controller layers in iOS, and you'll be in the same situation on Android.
I'm trying to write a plugin for a Java Application. The plugin should be able to tell the Java Application that new events have been recognized (Observer Design Pattern, Polling ... thats not the point). The problem is that the events are tracked gestures coming from a Microsoft Kinect controller (I´m using C++ and the Microsoft Kinect SDK because I have to). So that means I have to communicate between the Java Application and my Kinect Application.
I thought of something like an adapter design pattern where the Java application is "including" the interface (c++ header file, dll etc.). First I thought of JNI but then I have to write a DLL that will be used on both application sides, right? Another thing I thought of was to provide the gesture data via a protocol like UDP (or something more lightweight?). The last thing I heard of was to write a COM+ assembly ... but to be honest my knowledge about COM+ is rather little.
JAVA APPLICATION << ----- ??? ----- >> KINECT APPLICATION
May be you should have a look at google's Protocol Buffers.
Since you are considering JNI.
I'd suggest you refer to this IBM tutorial.
JNI allows the java application to call c/c++ methods and vice-versa.
Also have a look at this
question, if you are calling java from c++.
I have found some examples such as here, here and here which recommend you either used a shared memory structure or else use sockets.
I think that in this case, letting your programs communicate through sockets would be the best idea since your applications will not be that tightly coupled, so you just need to expose an IP, a port and a set of commands.
According to this it seems possible to create a C++ server on the Kinect, but other than that I can't say much since I have never worked on Kinect related projects.
JNI (Java Native Interface) allows the java application to call c/c++
methods.
All this requires that we have a means of communicating (Integrating Java
with C++) between Java and C++. This is provided by the JNI (Java Native
Interface).
For a practical example of using the JNI and calling native methods from Java, see this InfoWorld article.
I'm working on a java problem that (at least is trying) to utilize the twitter API, however, it is my first project using any type of API and I am a little confused. What is the benefit of using a java library for the twitter API such as Twitter4J and how would one go about not using one? I'm a little fuzzy on the topic of APIs in general and I'm not finding anything in my searches that really makes it clear how to use one.Do I need to use a Java library or can I do it without one? what are the pros and cons of using one vs not using one. I am relatively new to this and am having some issues. Any help?
First what an API is:
An application programming interface (API) is a particular set of
rules ('code') and specifications that software programs can follow to
communicate with each other. It serves as an interface between
different software programs and facilitates their interaction, similar
to the way the user interface facilitates interaction between humans
and computers. An API can be created for applications, libraries,
operating systems, etc., as a way of defining their "vocabularies" and
resources request conventions (e.g. function-calling conventions). It
may include specifications for routines, data structures, object
classes, and protocols used to communicate between the consumer
program and the implementer program of the API
The use of the Twitter4J API would allow you to easily call commands that do complex operations, such as get tweets as they are coming in. For projects such as this, using an API is best way to go about it as you are also going to be required to get an access key which allows you permission to use the API.
Examples using Twitter4J: http://twitter4j.org/en/code-examples.html
You need to distinguish between an "API" and a "Library"
You NEED the Twitter API: it's the thing that connects twitter to your code. You can use this to send a "post this to my account" command for instance.
You CAN use a library: it helps your code talk to the api, by doing some of the work for you. You can call a function with only a string as parameter, and this function calls the forementioned send-to-twitter API
You can ofcourse say things like that the library has an API, but this would be confusing the situation a bit.
In the end it is quite nice to use the library because it helps you by writing code in your language.
I know how to create small desktop applications in Java. I want to know, can I make Windows Metro style apps in Java? Because on the web only C++/C/C#/JavaScript etc. are mentioned. If yes can you please give me some reference for a quick start. If not which one will be easiest language to start?
You can only create metro style apps with C#, VB, JavaScript and C++. There is currently no support for authoring metro style applications with Java.
You cannot make metro style apps with Java.
For the other part of your question, regarding starter's guide and which language is easy, MSDN has a starter's guide which helps building new metro style apps, this, this and this should be helpful.
And which language is easiest, well it depends on the developer, someone who has been developing .NET or WPF or Windows Forms applications maybe more comfortable with he familiar environment and may prefer developing using C++ and XAML or VisualBasic, depending on what he has been using before, while someone coming from web development may prefer javascript.
For new developers, i would recommend using C# and XAML, but again it is my choice, and not everyone will agree with it.
Here is another link which points to guides at MSDN, and adds some additional detail.
I believe you will not be able to use Java and WinRT. The best option for you to try is C#, because this is the language that is closest to java, in my opinion.
WinRT is still based on COM, so you should be able to access it from Java using something like the Java-COM bridge. Using that would probably be quite hard (you'd have to use strings for method names etc.).
If you wanted to use WinRT comfortably from Java, that would require modifying the Java runtime and possibly also the compiler to make them aware of WinRT types.
Actually you can quite easily write a metro style web application by using a CSS library like this one: http://metroui.org.ua/
With this CSS, it is possibly to generate plain old HTML with Java on the server side (e.g. via a servlet) and then reverence the CSS classes.
I did this by using the org.apache.ecs library (it's very old but it works pretty good).
C# and Java are similar, but with different Frameworks. Look into developing Metro Style apps in C#. Remember to sign up for a developer's license for Windows Store Apps!
You could write your app in Java and cross compile into JavaScript using GWT. We do this successfully with a couple of Windows (Phone and Desktop) apps. Additionally, the code can be shared with your iOS and Android ports.
here what i found in sourceforge.net
http://sourceforge.net/directory/os:windows/freshness:recently-updated/?q=slibrary
this is the most close ui to metro theme i saw.