construct a cache editor

Posted on 1998-07-06
Last Modified: 2010-03-30
This is what I am trying to do. Perhaps you can point me in
the general direction because I am confused. I have been
researching sorting methods and I am confused. I want to
take the cache entries which are html gif jpg and class
files mostly and put them into order according to when
they were last modified. I want to display this in a window
like a database but it is an editor. So I will have an html
file followed by the images and java in it in the order.
I want to be able to erase one html file and all the images
and java that go with it so I can edit my cache. I figured
I have to get the file names first and order them; but also
it would be nice if I could look in the html file and extract all the src's and get just the image file names
without the paths and also get all the java class files.
This would be better than just erasing the following
files after the html file. Can you give me some hints and
pointers. Dont ware your brains out with details, just get
me started would be okay. I figure the sort method is in
the java.util but maybe also in the but I do not
see how I demand it to sort in any specific way. I mean
it seems like you just sort and this means alphabetically;
but I want to sort numerically and specifically in the
time and date area. Since the time is measured in seconds
then I must sort the seconds column. Can you help?
Question by:johnh619
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
LVL 16

Expert Comment

ID: 1224747
There seem to be a bunch of questions here: getting at the cache, identifying pages in pages and sorting. Perhaps you could identify more clearly which you are interested in, or, if it is some or all of them, at least separate them.


Author Comment

ID: 1224748
step 1:get all files names from cache(this could be four caches
in IE-c:/windows/tempor~1/cache1 thru 4)
step 2:sort according to last second of modification(it must
be to the second and not just to the minute)
step 3: take one htm file and either erase all the gif, jpg,
midi, class files from it to the next htm file or, what would
be better would be to extract all the src's file names and
class file names from one htm file and then erase all the files
using this extraction.

Author Comment

ID: 1224749
also is this true: that in order to describe the sort method
as either alphbetic sorting or numerical or some type of sorting,
do I have to describe it with logic or is the sort method further
subdivided into types which I can not find. Incidentally I found
this thing call the java explorer which is an applet which
downloads and makes a double window, you can look at the part of
each class file or push the button and access a sun java site
for additional info. I thought maybe it is this additional info
which I desire and which I can not find in books.
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.


Author Comment

ID: 1224750
I hope you got my last reply, it has been a week since I sent it.
But if possibly did not get it then I write again. If you are too
busy I will understand. In the mean time I have been compressing
my site images with Gif Wizard, it really needed it. Now my pages
load almost twice as fast. I paid them $19 for one month unlimited use. Sincerely JohnH
LVL 16

Expert Comment

ID: 1224751

I have no experience with the first two components of the question. I have been working in an application environment for the last year, not applet/browser.

If you want, I can help you with the last question; the sort.


Author Comment

ID: 1224752
Please help me with the sort then and I will resubmit some or
all of the question and let them find someone else to help
perhaps. Thankyou
Incidentally I was wondering: Do you work for this company and
trade your points in for cash and they use this as an incentive
system. I could not imagine what you would do with so many points
and I figured you did not have to ask to many questions yourselfs. Sincerely JohnH
LVL 16

Expert Comment

ID: 1224753
Sorry, I missed you're reply here somehow. Are you still looking for help with the sort?

No, none of the experts work for experts-exchange, nor do we receive any cash. The experts are all volunteers. This site operates more like a bulletin board or newsgroup than anything else. The format just makes it a lot more focussed.


Author Comment

ID: 1224754
yes please help with numberic sort for date and time down to
the second
LVL 16

Accepted Solution

imladris earned 50 total points
ID: 1224755
OK, I don't know how your data is going to be represented when you read it in. But for starters I will assume that you will have the information on File names and times in a Vector. A Vector is convenient for such things since it automatically resizes, and it provides some standard housekeeping methods to boot. Furthermore, then, the files will each be represented by some object, which will then go into the Vector. Each object should implement a Sortable interface (we'll get into that at the end) and the Vector can be sorted by the following routine:

public static void ssort(Vector sv)
{      int gap,i,j,tmp;
      Sortable a,b;

      int l=sv.size();
      for(gap=l/2; gap>0; gap/=2)
      {      for(i=gap; i<l; ++i)
            {      for(j=i-gap; j>=0; j-=gap)
                  { a=(Sortable)sv.elementAt(j);
                    {      sv.setElementAt(b,j);
                    else break;

This is a relatively straightforward implementation of a standard shellsort. A Vector of objects is passed in, and they are rearranged into sorted order. In order to do that, the objects must be sortable, i.e. provide a comp method which will reveal the correct order of any two objects. The Sortable interface would be:

public interface Sortable
{   public int comp(Sortable o);

The shellsort routine assumes that comp returns -1 if a is less than b, 0 if they are equal and 1 if a is greater than b (similar to strcmp in C).

So finally, in this scenario, you would need a file object that provides a comp. It would be something like the following:

public class FileEntry implements Sortable
{    String name;
      long  timestamp;

     ...  (whatever methods you need)

     public int comp(Sortable o)
     {   FileEntry f=(FileEntry)o;

This structure is assuming that the timestamp instance variable  got the timestamp of the file from the lastModified() method in the File class in the io package.. That allows a standard comparison to reveal their ordering.

Let me know if there is anything you need clarified.


Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Java: How do I open the default windows program for a given file type 3 63
ejb entity bean example issue 2 43
import as existing maven project 3 78
Java import explained 4 49
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question