View unanswered posts | View active topics It is currently Mon May 19, 2025 6:56 am



Reply to topic  [ 7 posts ] 
 Battle tab sorting 
Author Message
User avatar

Joined: Mon Oct 10, 2011 1:31 am
Posts: 115
Reply with quote
I'm pretty sure it occasionally happens to a lot to see a ship in battle tab randomly that has no debuffs on what so ever that's far, far stronger. But I found a glitch in the process of going through battle tab, sorting puts the higher rank in reverse order.

Image

Almost seems as if GL sorts by first 3 numbers, instead of just sorting by the whole number; that sounds like a ridiculous method.


Mon May 21, 2012 6:37 pm
Profile
User avatar

Joined: Sat Oct 15, 2011 5:09 am
Posts: 3473
Reply with quote
yeah, i get my 105s before my 70s in my BT.

sorting by alpha vs. sorting by numbers ...

_________________
Rank 3950 Litheor Governor 100% DCR r385-r2200 GL Marauder #26
_____________Image
PvP leaderboards: 70212 raids: #1; 40852 kills: #1; 96377 hacks: #3;


Tue May 22, 2012 1:30 am
Profile WWW

Joined: Sun Jun 20, 2010 4:50 am
Posts: 569
Reply with quote
Drekentai wrote:
I'm pretty sure it occasionally happens to a lot to see a ship in battle tab randomly that has no debuffs on what so ever that's far, far stronger. But I found a glitch in the process of going through battle tab, sorting puts the higher rank in reverse order.

Image

Almost seems as if GL sorts by first 3 numbers, instead of just sorting by the whole number; that sounds like a ridiculous method.


What:
Actually, this indicates that the ASP is treating the ranks as STRINGS instead of numbers for sorting. for an example use windows file system, it treats all file names as strings even if they are entirely composed of didgits.

How:
When you compare strings you compare from the 1st didgit forward, and extra didgits are compared verses nulls.

Why:
String compare uses the ascii (or now a-days unicode if supported) character values to determine if one should be above another.

Since special characters come first, followed by numbers followed by letters you get "wierd" sorting

Notes:
I use this loophope to nail important folders or files to the top of a file list all the time at work, I will stick a bang/exclamation-point at the begining of something I always want to sort to the top.

When you use string compares this way you would have to pad the begingins with 0s to make the sort correct.

So in a file system I always use a larger number than I expect a set of filews or folders, or servers to reach.

I might name my servers: GL-Web01, GL-Web02, GL-Web03

I might name files GL_001.html, GL_002.html, GL_003.html

That is pretty much the only way to get strings to compare correctly as they would in a true numerical sort.

Solution(s):
It IS possible for Dan to change this code to treat those values as true numbers, or he could also change the web-code to count characters and pad 0s at the begining; both of these options might be a bit slower to sort the list though.

Another option, which should be snappier, is he could change the view he grabs the sql data from to have two columns, one the normal rank as we see it, one a, say 8 character "rank" that has padded 0s and is a string representation of the rank of the user, it should be a pretty simple thing to implement, then just use that as a hidden column in the interface for him to do sorting on..

_________________
Image
Join Us Today! http://apps.facebook.com/galaxylegion/loader.php?q=bGVnaW9uaW5mby5waHA/YWN0aW9uPXJlcXVlc3QmbGVnaW9uaWQ9MjY3

When a man of genius speaks, a confederacy of dunces swells up to denounce him. -Jonathan Swift


Tue May 22, 2012 5:54 am
Profile
User avatar

Joined: Mon Oct 10, 2011 1:31 am
Posts: 115
Reply with quote
QCubed wrote:
What:
Actually, this indicates that the ASP is treating the ranks as STRINGS instead of numbers for sorting. for an example use windows file system, it treats all file names as strings even if they are entirely composed of didgits.
How:
When you compare strings you compare from the 1st didgit forward, and extra didgits are compared verses nulls.
Why:
String compare uses the ascii (or now a-days unicode if supported) character values to determine if one should be above another.
Since special characters come first, followed by numbers followed by letters you get "wierd" sorting
Notes:
I use this loophope to nail important folders or files to the top of a file list all the time at work, I will stick a bang/exclamation-point at the begining of something I always want to sort to the top.
When you use string compares this way you would have to pad the begingins with 0s to make the sort correct.
So in a file system I always use a larger number than I expect a set of filews or folders, or servers to reach.
I might name my servers: GL-Web01, GL-Web02, GL-Web03
I might name files GL_001.html, GL_002.html, GL_003.html
That is pretty much the only way to get strings to compare correctly as they would in a true numerical sort.
Solution(s):
It IS possible for Dan to change this code to treat those values as true numbers, or he could also change the web-code to count characters and pad 0s at the begining; both of these options might be a bit slower to sort the list though.

Another option, which should be snappier, is he could change the view he grabs the sql data from to have two columns, one the normal rank as we see it, one a, say 8 character "rank" that has padded 0s and is a string representation of the rank of the user, it should be a pretty simple thing to implement, then just use that as a hidden column in the interface for him to do sorting on..


Even though this theory is correct and solution would work; GL runs on PHP, not ASP. To my memory from ASP.NET programming; it doesn't have pre-made sorting methods. But PHP does include this, which leads me to wonder if they were used or if Dan made his own sort method. PHP's built in sort methods can sort letters and numbers combined (flags can be included to specify a certain sort pattern). So if you passed say, your sever names as an array in the sort method in mixed order, you can easily have it sort by the end numbers - instead of the first character (php sort - for reference).

Though, because the sorting itself is done with javascript, the actual programming language itself is irrelevant. So the issue would lay within the sorting method used within javascript.


Tue May 22, 2012 6:13 am
Profile

Joined: Sun Jun 20, 2010 4:50 am
Posts: 569
Reply with quote
sorry, my bad, php, I always default to asp.net since most of the web-apps I support have been asp.net; in both cases you could use use javascript as you mentioned.

Javascript also offers the ability to sort via numeric values as well:

Sort numbers (numerically and ascending):

var points = [40,100,1,5,25,10];
points.sort(function(a,b){return a-b});
The result of points will be:

1,5,10,25,40,100


That said, just FYI, asp.net can sort numbers as numbers so long as their data-type is numberic, and not string, if it's sting then you go through the same hoops I described, if you type them as numbers then the sorting works properly using the sort method.

_________________
Image
Join Us Today! http://apps.facebook.com/galaxylegion/loader.php?q=bGVnaW9uaW5mby5waHA/YWN0aW9uPXJlcXVlc3QmbGVnaW9uaWQ9MjY3

When a man of genius speaks, a confederacy of dunces swells up to denounce him. -Jonathan Swift


Wed May 23, 2012 2:51 pm
Profile
User avatar

Joined: Thu Oct 13, 2011 8:37 pm
Posts: 4415
Reply with quote
Am I the only one who is completely and utterly lost?


Wed May 23, 2012 4:30 pm
Profile

Joined: Sun Jun 20, 2010 4:50 am
Posts: 569
Reply with quote
Epicownage wrote:
Am I the only one who is completely and utterly lost?


Yes ;) =P

_________________
Image
Join Us Today! http://apps.facebook.com/galaxylegion/loader.php?q=bGVnaW9uaW5mby5waHA/YWN0aW9uPXJlcXVlc3QmbGVnaW9uaWQ9MjY3

When a man of genius speaks, a confederacy of dunces swells up to denounce him. -Jonathan Swift


Wed May 23, 2012 4:41 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.