Previous Thread
Next Thread
Print Thread
Rate Thread
#101344 09/27/2000 7:18 PM
Joined: May 2000
Posts: 243
Member
Member
Offline
Joined: May 2000
Posts: 243
Ok, say I have a bunch of files that I want to open, get a number. Then sort the files based on that number. I thought of useing a hash. But I don't have much experience in useing hashes. Anyone have any suggestions?

------------------
My Freeware Board

Sponsored Links
#101345 09/27/2000 10:58 PM
Joined: Sep 2000
Posts: 14
Junior Member
Junior Member
Offline
Joined: Sep 2000
Posts: 14
Just for clarity.

You want to sort the order in which you open the files?

------------------
-Twenty7
http://www.englishhouse.com/twenty7/

That game called Infantry
http://infantry.nmebase.com/

#101346 09/28/2000 8:39 AM
Joined: May 2000
Posts: 243
Member
Member
Offline
Joined: May 2000
Posts: 243
No, say I have a files named 1.3df, 2.3df, ect ect.. I want to open them. Then get a number out of the file. The files are setup like this:

Name|Name|Name|Name|$Number|Name|

And I want to get the $Number and sort it by that.

------------------
My Freeware Board

#101347 09/28/2000 6:20 PM
Joined: Aug 2000
Posts: 3,590
Moderator
Moderator
Offline
Joined: Aug 2000
Posts: 3,590
Using a has is probably the simplest way, that I know of anyway. I am sure there are better ways though. Open the file, put the file name as the key, and the number as the...whatever it is called, then sort by the key...

------------------
Da Wannabe Cannuck

#101348 09/28/2000 7:33 PM
Joined: Sep 2000
Posts: 755
P.I.T.A. / Programmer
P.I.T.A. / Programmer
Offline
Joined: Sep 2000
Posts: 755
Correction, put the value into the key and the file name into the value, as he apparently (still can't fully understand what he is asking) wants to go through the list of files, open each one, read in a value, then sort the filenames in accordance with what value was found inside.

so if 2df had #9 and 3df had #2 then he would want the files in order as:

3df
2df

I think.

Given that, values in the hash, sort keys, print out.

Zanardi, please learn how to FULLY explain, with lots of details. It will only help you.

--mark


"Annnnnnnndd now, opening for Iron Maiden...... WYLD STALLYNS!!!" --Bill S. Preston, Esquire and Ted "Theodore " Logan
Sponsored Links
#101349 09/28/2000 9:17 PM
Joined: May 2000
Posts: 243
Member
Member
Offline
Joined: May 2000
Posts: 243
Yeah Mark, your right. To exactly tell you what I'm doing. This is part of the news script I made at my site:
http://www.outpostd34.com/3do

In the '3do Archives' Section near the bottom I have a table called "Latest 10 3do's", and you see it has listed. Rating and the number of downloads it has. Well I want to change it to the 10 most downloaded files. Everytime someone clicks on to download a file. It opens up the $filename.3df (The $filename variable is the number of which the news file was added. thats how I get the number) and then adds 1 to the current number of downloads. So I want to open all the files. And sort them by the number of downloads the have. This is what one of the files looks like:

15|zanardi|[email protected]|Jedi Knight|A shotgun. Works with dflt.mat. Has custom textures|9-24-00|zanardi|[email protected]|Shot Gun|dflt.cmp|shotgun.zip|nshot.jpg|2|2|7|weapon|

The first number 2 that you see (Feild number 12) is the number of downloads the file has. the other numbers are just part of the rating system. Hope that helps ya a little bit.



------------------
My Freeware Board

#101350 09/28/2000 10:38 PM
Joined: Sep 2000
Posts: 755
P.I.T.A. / Programmer
P.I.T.A. / Programmer
Offline
Joined: Sep 2000
Posts: 755
K but you still haven't answered what the output should be.

Do you want to list the files in order of the numbers (high to low) found at field 12?

--mark


"Annnnnnnndd now, opening for Iron Maiden...... WYLD STALLYNS!!!" --Bill S. Preston, Esquire and Ted "Theodore " Logan
#101351 09/29/2000 7:50 AM
Joined: May 2000
Posts: 243
Member
Member
Offline
Joined: May 2000
Posts: 243
Yes, In order, high - low. Feild 12 [Linked Image]

------------------
My Freeware Board

#101352 09/29/2000 5:30 PM
Joined: Sep 2000
Posts: 14
Junior Member
Junior Member
Offline
Joined: Sep 2000
Posts: 14
It would be easier to use only one data file and have each line as an entry.

then sort all the lines in that file by the number.



------------------
-Twenty7
http://www.englishhouse.com/twenty7/

That game called Infantry
http://infantry.nmebase.com/

#101353 10/06/2000 7:01 PM
Joined: May 2000
Posts: 243
Member
Member
Offline
Joined: May 2000
Posts: 243
No need to help me any more [Linked Image] I figured it out on my own. See the finished product:
http://www.outpostd34.com/3do/archive.shtml#top10

------------------
My Site

My Board

Sponsored Links

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Bill B
Bill B
Issaquah, WA
Posts: 87
Joined: December 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240506)