On Thu, Jul 19, 2012 at 10:37 AM, Alexander Rose <
alexander.r...@weirdbyte.de> wrote:

> Hi Bob,
>
> >
>
> In line 1289: if (crcMap.containsKey(newName)) {
> it should be: if (crcMap.containsValue(newName)) {
>
>
I disagree. One thing I changed is that we are also cataloging the
local-file names, and they have no CRC. So they have to be keyed to their
name. The simplest way I could think of was to catalog all files by name
and the remote files also by CRC. So Key is right.



>
> I argue the name you create is not necessarily unique:
>
> if (pt > ptSlash) // is a file extension, probably
>   newName = newName.substring(0, pt) + "[" + iFile + "]" +
> newName.substring(pt);
> else
>   newName = newName + "[" + iFile + "]";
>
> three files, A and B have the same content, C differs
> fileNameA (iFile=1): "foo"
> fileNameB (iFile=2): "bar"
> fileNameC (iFile=3): "foo[1]"
>
>
And the problem is what?

1) A will have the new name "foo"
2) B will be renamed "foo" and not included.
3) C will be left as "foo[1]" because it doesn't match any other files.

Let's say it was like this:

fileNameA (iFile=1): "foo"
fileNameB (iFile=2): "bar"
fileNameB (iFile=3): "foo"  (different from foo)
fileNameC (iFile=4): "foo[1]" (different from foo)

then we end up with:

fileNameA (iFile=1): "foo"
fileNameB (iFile=2): "foo" (not included)
fileNameB (iFile=3): "foo[1]" (different from foo)
fileNameC (iFile=4): "foo[1][4]" (different still, with a new number
because it  matches name foo[1] but is different)

Right? Maybe I'm too tired. I guess I'm not seeing the issue there.

Well, maybe like this:

fileNameA (iFile=1): "foo"
fileNameB (iFile=2): "bar"
fileNameC (iFile=3): "foo[4]" (different from foo)
fileNameC (iFile=4): "foo" (different from foo and foo[4])

Now that might be a problem, because #4 will be renamed "foo[4]" but it is
different. I get it.

How about if we just disallow [ and ] ? Then we have:

fileNameA (iFile=1): "foo"
fileNameB (iFile=2): "bar"
fileNameC (iFile=3): "foo[4]" (different from foo) --> foo_4_
fileNameC (iFile=4): "foo" (different from foo and foo[4]) ---> foo[4]


I want to avoid using # -- it's a special character for the web, and if the
file is ever extracted, it could be a problem potentially.

 http://mysite.com/read.php?myfile=xxxxxx#yyy

How about just having

        newName = TextFormat.replaceAllCharacters(newName, "[]", "_");

instead of

        newName = TextFormat.replaceAllCharacters(newName, "#", "_");

?

Bob

-- 
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Chemistry Department
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to