| | |
Is Java the wrong language for a duplicate file scanner?
![]() |
•
•
Join Date: Nov 2008
Posts: 37
Reputation:
Solved Threads: 0
So i've downloaded netbeans, and had a play around.
But I'm thinking is Java the wrong language to design a duplicate file scanner.
The program if not obvious should hopefully atleast identify any files that exist on a computer more than once (copies).
Im also going to try and make it available online, a bit similar to online virus scanning websites.
Ive got the website up in HTML, but im willing to scrap that if the duplicate file scanner cant be added to the website code as a plugin / object etc.
Is java the wrong language, is netbeans not the best IDE? Shall I consider AJAX
But I'm thinking is Java the wrong language to design a duplicate file scanner.
The program if not obvious should hopefully atleast identify any files that exist on a computer more than once (copies).
Im also going to try and make it available online, a bit similar to online virus scanning websites.
Ive got the website up in HTML, but im willing to scrap that if the duplicate file scanner cant be added to the website code as a plugin / object etc.
Is java the wrong language, is netbeans not the best IDE? Shall I consider AJAX
•
•
Join Date: Sep 2008
Posts: 1,574
Reputation:
Solved Threads: 197
Personally I would write this in C over Java. Only because Java is Object oriented and the problem you have posed isn't. Well sort of, but even more the fact that C will probably be much faster than Java for this project.
Also, this topic has been posted on daniweb before, so you might want to try to find the thread. I'm not sure how you plan to implement it, but in any case, be sure to consider something: does the file have to match exactly in order to be considered a match? Or will it be based on what % of the file matches? In either case, be sure to discontinue scanning the file at any point if its determined it doesn't match. You might want to consider using Tries. See Trie based cheat checker.
Also, this topic has been posted on daniweb before, so you might want to try to find the thread. I'm not sure how you plan to implement it, but in any case, be sure to consider something: does the file have to match exactly in order to be considered a match? Or will it be based on what % of the file matches? In either case, be sure to discontinue scanning the file at any point if its determined it doesn't match. You might want to consider using Tries. See Trie based cheat checker.
Last edited by BestJewSinceJC; Nov 14th, 2008 at 9:24 pm.
If there is already a class available that can search through all of the files on your System, why not make a Decorator class or a class that Maps files (or file names) to a number, and if the file is encountered again, replace the value with an incremented form of the same value, then return the map?
-Alex
-Alex
•
•
Join Date: Nov 2008
Posts: 37
Reputation:
Solved Threads: 0
thanks for the replys guys
but...
i dont want to use C - I'm not bothered about speed, loading or scanning duration of the intended application
and i find the post before mine abit confusing
If anyone here has information or a link to information that will help me incorporate a Md5 checksum to a GUI please let me know
Nothing complication because I want to be able to understand how it and specific code works!
but...
i dont want to use C - I'm not bothered about speed, loading or scanning duration of the intended application
and i find the post before mine abit confusing
If anyone here has information or a link to information that will help me incorporate a Md5 checksum to a GUI please let me know
Nothing complication because I want to be able to understand how it and specific code works!
I am not sure you will find a specific article relating md5 to a java GUI, but it isn't really different to just md5 in a command-line environment. If you can get your checksums generating, just attach it to a GUI, by events or whatever your requirement may be.
•
•
Join Date: Dec 2008
Posts: 53
Reputation:
Solved Threads: 6
I can't see a problem with writing this in Java. For the checksums, you could look at the MessageDigest class, or just use some other fairly strong hash function. MD5 isn't necessarily the best choice: it's designed to be a secure hash function, and trades performance for that security. IMO, what you need for duplicate recognition is just a "fairly strong" hash function: a good-quality 64-bit hash function should be ample. The advantage of MD5 is simply that you get it "out of the box". You could also try using a large buffer for your I/O and doing it in a separate thread to the hash calculation-- it may give a gain on some systems (multiprocessor and uniprocessor).
A very sliiight downside to writing this program in Java is that Java provides no way to signal to the operating system to read files without going via the file cache-- so you get slightly slower one-off reads than are in principle possible on most OSs.
A very sliiight downside to writing this program in Java is that Java provides no way to signal to the operating system to read files without going via the file cache-- so you get slightly slower one-off reads than are in principle possible on most OSs.
> it's designed to be a secure hash function, and trades
> performance for that security
Maybe you got that the other way around since a lot of vulnerabilities or staged attacks have been found with MD5 making it a unsafe choice for security applications.
> a good-quality 64-bit hash function should be ample
Doesn't seem like a wise choice given that the MD5 algorithm which used 128 bit has been compromised.
IMO since many still sites still use the MD5 checksum to check the integrity of downloaded files, the situation with MD5 isn't as bad as it seems.
> in Java is that Java provides no way to signal to the operating
> system to read files without going via the file cache
File cache?
> performance for that security
Maybe you got that the other way around since a lot of vulnerabilities or staged attacks have been found with MD5 making it a unsafe choice for security applications.
> a good-quality 64-bit hash function should be ample
Doesn't seem like a wise choice given that the MD5 algorithm which used 128 bit has been compromised.
IMO since many still sites still use the MD5 checksum to check the integrity of downloaded files, the situation with MD5 isn't as bad as it seems.
> in Java is that Java provides no way to signal to the operating
> system to read files without going via the file cache
File cache?
I don't accept change; I don't deserve to live.
•
•
Join Date: Dec 2008
Posts: 53
Reputation:
Solved Threads: 6
•
•
•
•
> it's designed to be a secure hash function, and trades
> performance for that security
Maybe you got that the other way around since a lot of vulnerabilities or staged attacks have been found with MD5 making it a unsafe choice for security applications.
•
•
•
•
> a good-quality 64-bit hash function should be ample
Doesn't seem like a wise choice given that the MD5 algorithm which used 128 bit has been compromised.
•
•
•
•
> in Java is that Java provides no way to signal to the operating
> system to read files without going via the file cache
File cache?
Re MD5: I guess we are talking about two different things here: security and file uniqueness, hence the confusion. I would personally use MD5 hashing since it seems to be a widely used technique for testing file uniqueness and optimize if and only if required. Also, coming up with a good hash solution [if that is what you were suggesting to the OP] is far from a walk in the park, though it seems to be a good exercise in learning more about hash functions.
> Yep-- the OS will generally automatically cache data read from file.
If you are talking about kernel file caching which results from reliance on system calls to do I/O, memory mapping the file solves that issue.
> Yep-- the OS will generally automatically cache data read from file.
If you are talking about kernel file caching which results from reliance on system calls to do I/O, memory mapping the file solves that issue.
I don't accept change; I don't deserve to live.
![]() |
Other Threads in the Java Forum
- Previous Thread: Connect 4 java program help
- Next Thread: Display how sort works? Please help
| Thread Tools | Search this Thread |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card chat class classes client code collision columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress input integer intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop machine map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle physics plazmic print problem program programming project recursion scanner server set sharepoint smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads tree trolltech unlimited utility webservices windows






