Android app that called external .exe - java

I am about to make an app on android but I have 0 experience about it.
This project is important and kind of a big challenge to me.
With that being said, I will try my best to explain about it so you guyz can give me an accurate approach
So assuming I have a program written in C,C++. Either an .exe or bunch of library.
What this executable do is to process the data and generate a file with bunch of binary and weird output. This process is called pre-processing.
Then result file will then be fed into Matlab or python and the graphical result will be generated. This is called post-processing and also the final goal.
Right now I can't afford to get matlab installed so my boss only asked me to go up to the pre-processing part.
The project will be displaying the pre-processing on the screen of a android device even if it might be unreadable.
I have done some research and found several ways to accomplish this:
1/ write a simple app using java and use JNI to call the main function of the .exe
2/ write a simple app using c++ and get the result straight from the .exe
That's all i can come up with, can any expert give me some suggestions please.
I am looking for a solution that would get me pass the pre-processing phase but also be efficient and easy if I get a chance to work on post-processing phase later.
Thank you very much

Related

Compile java to object files compatible with C/C++

So I am working(actually still planning) on a GUI project, and I need control over every single pixel on the window. I have done a lot of Java and I know how to do that, the problem is that I want to do all the logic on C++(because I just love how it works) and I don't even know how to setup a GUI in C++(I already took a small look at Qt, but I haven't done anything great).
So I had this idea of writing all the GUI related things in Java and somehow compile java source files to object files that can be linked with the rest of C++ code. This is just a personal project I am working on so I don't care if I lose the cross-compatibility of Java.
Thanks to anyone who took time to read this.
Look into JNI. Years ago, when doing the game of life in programming class, I chose to have a C function do the pixel work, just like you are thinking of, because it, ahem, back then, made the graphics work run many times faster. Noticeably, back then anyway.
Write the Java Program and Compile
Generate header file from java class
Write the C Program
Generate Shared Library File
Run Java Program
Here's one of probably many resources to show you.

How do I proceed in an attempt to find audio files which play the same song but are in different compressed formats?

all i want is suppose i have same song named as song.mp3 and song.aac now i want my program to identify that they are same, i know this is non-trivail task to do.
so far i have tried fingerprinting audio using dejavu python library which produces 2 different fingerprints for our case song.mp3 and song.aac, hence it doesnt suit need of my program.
I also tried MD5 using FFMPEG but as expected it gives different hash for even same songs downloaded from different websites
Do you guys have any idea how do I proceed?
It would be even great to provide me step wise procedure and library to achieve my goal.
thank you
Audio fingerprinting is incredibly complex, and difficult to get right. You do not really want to come up with your own algorithm just like that, because it likely is much worse than established methods (being better than established methods requires doing some research ;-)).
One of the open source solutions for audio fingerprinting which I found is http://echoprint.me/codegen
You can use that in your application, either by calling directly into the libcodegen API, or by spawning subprocesses for audio analysis.

Copying all the DATA from SD card/USB pendrive

I've been learning Java for a month now. I've already managed to code some very simple stuff like prime number generator and a simple calculator. Now i'd love to try working on something more complex.
Here's my idea - I'd love to make a program that can copy pictures from SD card or USB with a single click (something that my parents can use very easily to copy all their photos to a folder without my help)
I was brainstorming quite a bit about it and before i start i want to ask following questions:
1. Are there any inbuilt Java methods that can help me with the following task?
2. What are the other (non-beginner) Java features that i'd need to read about?
I want to start it from the scratch, make it simple at first and progressively add more features to practice and learn some more.
Any pointers or tips much appreciated.
I'd suggest doing this as a script. The script can invoke java if you'd like to improve your java skills. However, scripting languages can also copy/move files very easily. If you choose java, read about file I/O, reading files, writing files, etc.
Here's a link for windows. Not sure what your operating system is, but you could create an executable script on mac, linux, etc.
http://www.wikihow.com/Write-a-Batch-File

How can I launch an external application from a Java GUI in Linux?

I'm creating a Java application that helps people to learn Chinese. I've already created a Java GUI but I'm struggling to work out how to create a button that launches an external application in a new window.
I've looked up various tutorials on process, desktop and runtime but they all seem to deal with outputting data on the console, and I can't figure out how to apply them to this case.
Any help at all would be greatly appreciated! Thanks!
EDIT
So I've incorporated the runtime code into my class and I've got it to list the contents of my file but can't get it to launch the application using "/home/kate/Desktop/PTAMM ./PTAMM" or "./PTAMM /home/kate/Desktop/PTAMM" or "./ home/kate/Desktop/PTAMM PTAMM" (I tried the last two out of desperation). Any suggestions? Thanks!
Here you go
Runtime.getRuntime().exec("command to launch executable");
See
API doc
I've looked up various tutorials on process, desktop and runtime but they all seem to deal with outputting data on the console,
No that is wrong! Desktop.open(File) ..
Launches the associated application to open the file.
(Emphasis mine)
So Desktop.open(new File("word.doc")) might open MS Word or the Open Office Writer, while Desktop.open(new File("spreadsheet.xls")) might pop MS Excel of OO Calc.
To play with the Desktop class, try the code on the File Browser GUI thread.
If you decide to go with using Runtime. I suggest:
Read & implement all the advice shown in When Runtime.exec() won't.
Use ProcessBuilder to construct the Process. ProcessBuilder even has a convenience method to merge the output streams, to make them easier to 'consume'.
You might conclude after reading that article that usingDesktop is the simpler option. There are many traps & pitfalls involved with using a Process. ;)

Printing multiple file types using java

Hey i was wondering if there is a specific api for printing a bunch of common file types(pdf,doc,docx,txt, etc..). I am trying to develop program similar to HP's eprint. eprint annoys me because it prints an email as well as the file attached to it. I just want something i can send files directly to. I have found that java has a printing api, but that seems to focus on printing something from a gui window. any ideas much appreciated!
Thanks
Morpheous
It would be difficult for Java alone to be able to print a variety of different file types, and most of the time I've seen Java programs use other programs to do the printing by using Runtime.exec. If you're going to be trying to use this though, please be sure to read this extremely important article: When Runtime.exec() won't

Categories

Resources