how to read a .ptn file from java - java

Any one knows what .ptn file is and how to open that, just got the file from client and couldnt able to figure out what is this , searched a lot but no luck .
Also have the requirement from client that
my application should read this .ptn file from Java
is this possible ?
thanks

This seems rather obvious, but if a client is paying you to write code to read a file, you're entirely within your rights to ask what the file is, and where it comes from. If it's some internal or proprietary format, you can ask for documentation.
Of course, you might start by simply opening the file in a text editor, to see if it's just something trivial.
This wonderful web site is a repository of information about file formats; searching "PTN" brings up nothing, unfortunately, which suggests that it's nothing very common.

Related

Questions about loading files in a program

Sup!
I'm trying to understand the concepts and differences between them to load and save files, and trying to figure out the best way to load files with a program I'm making (a database). I'm using Java, but try to help me in a more general way, if possible. Whatever help I get is a lot welcome and I thank you already for it.
I know there is "File Reader" in Java and a lot of programs use files in .txt format. I tried to open a .doc file with Notepad, just to see what would happen, and NOTHING was a text. I expected that, not everything though.
I just don't know how to make a file that is not a .txt. How that happens?
This is a big one. When I load a file, should I load all its content and let it ready for use, or should I just keep the file path and read from it as I use, using offsets and pointers starting from the file path? How should I do this either way?
In this database program of mine, some things will be images (for example), and if I were to use a .txt, I would give each image a label that the program would read and then interpret it like the label of the image, and then get the image. How could I do that?
I was sure I had more questions. If I do I ask again.
Once more, thanks in advance for the attention and help.
When it comes to the .txt bit, all "plain text" will work. Just change the file extension to .ini or .sql (if sql is installed) and change it in your filepath too.

How to extract text from pdf and doc file without downloading

I have searched a lot before asking that question. I have a program(java) which crawls some wep pages and trying to find some .doc and .pdf files and it can download them but only one .pdf or .doc can cover up to 3-4mb which is not good because there are millions of files.. so I decied to extract their text without downloading the whole file. Basically, I need to see pdf or doc file online and download their text only but I could not figure out how to do that. If necessary I can provide my code.
Edit:This question can be closed now since I got the idea and (no)solution.
Thanks for help.
And What's up with those downgrades on question ?
That is not possible. You can only start extracting the document once you download the bytes.
(unless you also have control over the server, you could do the extraction server-side and provide a txt download link)
Reading a file from a website on the Internet without downloading it is impossible.
If you have control of the server you could write a web service that can parse the files on demand and extract the parts you are interested in, which would then be sent to the client.
If not, and if you're up for a more challenging problem, you could write an HTTP client that starts downloading the file and parses it on the fly, downloading only as much as you need to extract the part(s) you need. This might or might not be feasible (or worthwhile) depending on where in the files the "interesting" bits were located. If they're close to the beginning in most cases then you might be able to reduce the download size significantly.
A detailed explanation of how to accomplish this is probably beyond the guidelines for StackOverflow answer length.

Reading lyrics information from a .kar file in java

I want to develop a karaoke player in Java that works with kar files. I got it to play the song, but I coundn't make it read the lyric information from the file. I've searched a lot, but I coundn't find any clue about how kar files work.
How can I do it? I appreciate some example.
Thanks.
I don't think there is a Java library for that so you'll have to write it on your own code.
First, you need to know the inner structure of a .kar file. Since these files are so small, they're probably some kind of text files. Try opening one of them with your text editor and see what it looks like. Then you'll know how to process it.
Apologies as I don't have a definitive answer for you. I have seen several discussions about this but no real solid solutions. Here are a couple links to others' discussions on the topic. It seems to be a much more complicated task than one might imagine, as it is an uncommonly used file type. From what I know, it consists of MIDI data, albeit with slightly different meta data.
Reading lyrics information from a .kar file
How to read MIDI file in C#?
Can you open the .kar file in a text editor? What does it give you?
The best I could find is this:
"KAR"
Origin: The Company Tune 1000 A file kar (kar) is in fact, a midi
file, but whose words are standardized in events meta of the type
TEXT. The texts starting with # are additional indications compared to
the words. Example:
#L specifies the language of the words
#I any additional information
#T information of title
#KMIDI KARAOKE SPINS information of copyright
and type of file
Several lines of titles and information can be present. KaraWin
extracts information from titles to post them. The text even has a
very simple format to him: \ indicates a page break, /a return
indicates has the line
Source.
Besides that, according to Wikipedia, XBMC is an open source program that supports kar files. Since it's an open source project, you can download its code. If you are really interested, you can try searching among its 10k+ files (in C, not Java), how they do it. Maybe you can ask them or in their forum for a little bit of guidance.
You can also try in this yahoo group about karaoke software.

How to write/change a visio file with java (jacob)

I wasn't able to find anything useful about how to write a visio file with java, and probably looked through every article on the web.
If found a lot of stuff about doing it with c#, vb, and other stuff but couldn't find what I need.
I also found this, but I am not sure if this (reverse engineering) could do what I need >>How to generate MS Visio diagram automatically?<<. Because I really want to create a vsd file with my java application write a lot of data into it (from an xml file for example) and open it afterwards with visio to check and correct that data.
It took me a while to find this
http://www.java2s.com/Open-Source/Java/Development/jacob-1.15/com/jacob/samples/visio/Catalogvisio.htm <<
which at least allowed me to open a visio file.
But I still need to know how to write into that file and save it afterwards.
So in short, my acutal attempt is to use jacob, but I don't know how to do stuff like "add block at position x,y" with that com bridge. Is there a docu for that stuff?
any help would be appreciated
thanks

Android: .java files readable from .apk file?

I'm currently developing an application for a company which includes livescoring. The XML-files I access (from the net like: "http://company.com/files/xml/livescoring.xml") are not intended to be public and should only known to me.
I was wondering if it is possible for anyone to decode the .apk file and read my original .java files (which include the link to the XML files).
So, I renamed the .apk file to .zip and could access the "classes.dex", which seemed to include the .java files (or classes). Googling led me to a tool named "AvaBoxV2" which decoded this "classes.dex" file. Now I have a folder including an "out" folder where files named .smali exist. I opend one of these with an editor and finally there is the link to the xml file. Not good. :(
Is there a way to encrypt my app or the classes.dex file? I don't want to tell that company, that anyone can access the original xml-files. Maybe signing the app probably helps?
Also, do you know a really noob-friendly tutorial to prepare apps (signing, versioning,...) for Google Market?
Thanks in advance!
The .java source code is not included in the APK.
It is possible to disassemble the Dalvik bytecode into bytecode mnemonics using a tool like baksmali, but there's no way a user can recover the original .java source.
Furthermore, you can use a tool like proguard (included in the Android SDK) to obfuscate your byte code, making it hard to interpret the behavior of the disassembled bytecode.
You can make small tricks too, like storing the link string in some sort of obfuscated form, and then de-obfuscating it at run-time in your app (a simple example would be to use base 64 encoding, but someone could probably reverse that quickly if they wanted to).
That said, it's pretty trivial for someone to run tcpdump and sniff the network traffic between your device and the server, and get the URL that way, so there's no way to completely prevent anyone from getting this value.
Yeah, its impossible to fully prevent something like this. Its the same on a desktop application, or any other application.
As mentioned, obfuscation will help, but people who are persistent can still get past it. Especially for something like a url like that.
One solution of making it much more tricky for hackers is to use PHP on your webserver and some sort of token system to determine if the request is coming from your app or not... That would get a bit tricky though, so I don't really suggest it.

Categories