hoangduit / openmeetings

Automatically exported from code.google.com/p/openmeetings
0 stars 0 forks source link

Preview for a multiple page document: the preview of pages are shuffled #721

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I uploaded a a multiple page document to a server.
When I looked into the left bottom corner (where the preview for pages is), 
 I see that the pages are in wrong order. However, the order in the 
original document is right, only preview is wrong. 

Which version of OpenMeetings are you running?
0.8

Original issue reported on code.google.com by e.rovin...@gmail.com on 4 May 2009 at 11:26

GoogleCodeExporter commented 9 years ago
I recently made a patch fix this problem

Original comment by CTpaH...@gmail.com on 4 May 2009 at 11:48

Attachments:

GoogleCodeExporter commented 9 years ago
Can you explain why your patch should fix this behavior?
You only changed: * pre +"_page-%04d.jpg\"* to * pre +"_page-%%04d.jpg\"* for 
the
windows version. Why?

Original comment by seba.wag...@gmail.com on 4 May 2009 at 11:54

GoogleCodeExporter commented 9 years ago
Firstly, I replaced the * pre + "_page.jpg \" "* at * pre +" _page-% 04d.jpg \ 
"*.
This gives us the right files in the alphabetical order of sorting. 

Secondly, in the version for windows, I added the second percent sign in order 
to
transmit it to the command line

Аnd third - in the patch can be seen that I clearly do sort a list of files. 
All this
provides the correct order of preview.

I'm attaching the new version of the patch. The essence of the fix is more 
obvious here.

Original comment by CTpaH...@gmail.com on 4 May 2009 at 12:39

Attachments:

GoogleCodeExporter commented 9 years ago
There must be something wrong in your patch.

CreateLibraryPresentation:Line 76
Arrays.sort(files);

=> what is this for?

Original comment by seba.wag...@gmail.com on 4 May 2009 at 1:05

GoogleCodeExporter commented 9 years ago
I applied the first part of the change into r2002

Original comment by seba.wag...@gmail.com on 4 May 2009 at 1:47

GoogleCodeExporter commented 9 years ago
> Arrays.sort(files);
> => what is this for?

Java spec reads: 
There is no guarantee that the name strings in the resulting array will appear 
in any
specific order; they are not, in particular, guaranteed to appear in 
alphabetical order. 
http://java.sun.com/javase/6/docs/api/java/io/File.html#list()

I believe the patch author wants to ensure that the list is sorted.

Original comment by alexei.f...@gmail.com on 4 May 2009 at 2:08

GoogleCodeExporter commented 9 years ago
And yes; it should be "allfiles". 

Let us compare what was before and after the patch.
I download the same file containing more than ten pages. The contents of the 
file
library.xml before the patch:

$ grep -w "thumb" library.xml
    <thumb lastmod="1241444110000" size="7649">_thumb_page-9.jpg</thumb>
    <thumb lastmod="1241444110000" size="3239">_thumb_page-1.jpg</thumb>
    <thumb lastmod="1241444110000" size="2884">_thumb_page-12.jpg</thumb>
    <thumb lastmod="1241444110000" size="6793">_thumb_page-4.jpg</thumb>
    <thumb lastmod="1241444110000" size="1948">_thumb_page-0.jpg</thumb>
    <thumb lastmod="1241444110000" size="7001">_thumb_page-3.jpg</thumb>
    <thumb lastmod="1241444110000" size="5838">_thumb_page-2.jpg</thumb>
    <thumb lastmod="1241444110000" size="5213">_thumb_page-11.jpg</thumb>
    <thumb lastmod="1241444110000" size="5942">_thumb_page-8.jpg</thumb>
    <thumb lastmod="1241444110000" size="7406">_thumb_page-7.jpg</thumb>
    <thumb lastmod="1241444110000" size="6883">_thumb_page-6.jpg</thumb>
    <thumb lastmod="1241444110000" size="7315">_thumb_page-5.jpg</thumb>
    <thumb lastmod="1241444110000" size="5210">_thumb_page-10.jpg</thumb>

Here we see that the order is wrong

The contents of the file library.xml after the patch:

$ grep -w thumb library.xml
    <thumb lastmod="1241444403937" size="1012">_thumb_page-0000.jpg</thumb>
    <thumb lastmod="1241444403953" size="1745">_thumb_page-0001.jpg</thumb>
    <thumb lastmod="1241444403953" size="3187">_thumb_page-0002.jpg</thumb>
    <thumb lastmod="1241444404000" size="4056">_thumb_page-0003.jpg</thumb>
    <thumb lastmod="1241444404015" size="3878">_thumb_page-0004.jpg</thumb>
    <thumb lastmod="1241444404015" size="4022">_thumb_page-0005.jpg</thumb>
    <thumb lastmod="1241444404031" size="3886">_thumb_page-0006.jpg</thumb>
    <thumb lastmod="1241444404046" size="3871">_thumb_page-0007.jpg</thumb>
    <thumb lastmod="1241444404046" size="3362">_thumb_page-0008.jpg</thumb>
    <thumb lastmod="1241444404062" size="3787">_thumb_page-0009.jpg</thumb>
    <thumb lastmod="1241444404078" size="2773">_thumb_page-0010.jpg</thumb>
    <thumb lastmod="1241444404078" size="2815">_thumb_page-0011.jpg</thumb>
    <thumb lastmod="1241444404093" size="1629">_thumb_page-0012.jpg</thumb>

As you can see that sorting alphabetically in my case is consistent with the
numerical comparison.

Alexei Fedotov absolutely right -the call File.list() does not guarantee any 
sort.
Therefore Arrays.sort (allfiles) in r2002 commented out in vain.

Original comment by CTpaH...@gmail.com on 4 May 2009 at 2:23

GoogleCodeExporter commented 9 years ago
okay see r2003

Original comment by seba.wag...@gmail.com on 4 May 2009 at 2:46

GoogleCodeExporter commented 9 years ago
> Alexei Fedotov absolutely right

No I was not. :-) I missed that you used "files" instead of "allfiles".

Original comment by alexei.f...@gmail.com on 5 May 2009 at 5:47

GoogleCodeExporter commented 9 years ago
Issue 740 has been merged into this issue.

Original comment by alexei.f...@gmail.com on 9 Jun 2009 at 4:25