473,326 Members | 2,175 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

sort color array?

me
good day,

i found this message:
and i want to know more about it too.
==========================================

Hey all,

example:
$s_Colors="0066FF;0066CC;3366CC;0033FF;003399;0033 66;99CCFF;3399FF;0099FF;66
99CC;336699;006699;66CCFF;33CCFF;00CCFF;3399CC;009 9CC;003333;99CCCC;66CCCC;3
39999;669999;006666;336666;CCFFFF;99FFFF;66FFFF;33 FFFF;00FFFF;00CCCC;99FFCC;
66FFCC;33FFCC;00FFCC;33CCCC;009999;66CC99;33CC99;0 0CC99;339966;009966;006633
;66FF99;33FF99;00FF99;33CC66;00CC66;009933;99FF99; 66FF66;33FF66;00FF66;33993
3;006600;CCFFCC;99CC99;66CC66;669966;336633;003300 ;33FF33;00FF33;00FF00;00CC
00;33CC33;00CC33;66FF00;66FF33;33FF00;33CC00;33990 0;009900;CCFF99;99FF66;66C
C00;66CC33;669933;336600;99FF00;99FF33;99CC66;99CC 00;99CC33;669900;CCFF66;CC
FF00;CCFF33;CCCC99;666633;333300;CCCC66;CCCC33;999 966;999933;999900;666600;F
FFFFF;CCCCCC;999999;666666;333333;000000;43dddd;65 432b;777665;4443cc;CCCCC3;
A906B0;9CC33F;C8C8C8;688888;777752;66E554;7655FF;5 55577;D4DCE8;99AECE;3A5A8A
;9A0030;EF3F6B;FFF543;C906CF;AA2222 ";
And true a function i add random colors in the string,
$s_Colors.= ";".strtoupper($_POST['colorvalue']);

then i make one array:
$a_Colors=array_change_key_case(split(";",$s_Color s), CASE_UPPER);
when i do
sort($a_Colors);
print_r($a_Colors);

or
asort($a_Colors);
print_r($a_Colors);
the values are not correct sorted..!
oke i understand the difference of the hex index so anybody idea??

Cheers,

D
================================================== =
Jul 17 '05 #1
6 4084
me wrote:
good day,

i found this message:
and i want to know more about it too.
==========================================

Hey all,

example:
$s_Colors="0066FF;0066CC;3366CC;0033FF;003399;0033 66;99CCFF;3399FF;0099FF;66
99CC;336699;006699;66CCFF;33CCFF;00CCFF;3399CC;009 9CC;003333;99CCCC;66CCCC;3
39999;669999;006666;336666;CCFFFF;99FFFF;66FFFF;33 FFFF;00FFFF;00CCCC;99FFCC;
66FFCC;33FFCC;00FFCC;33CCCC;009999;66CC99;33CC99;0 0CC99;339966;009966;006633
;66FF99;33FF99;00FF99;33CC66;00CC66;009933;99FF99; 66FF66;33FF66;00FF66;33993
3;006600;CCFFCC;99CC99;66CC66;669966;336633;003300 ;33FF33;00FF33;00FF00;00CC
00;33CC33;00CC33;66FF00;66FF33;33FF00;33CC00;33990 0;009900;CCFF99;99FF66;66C
C00;66CC33;669933;336600;99FF00;99FF33;99CC66;99CC 00;99CC33;669900;CCFF66;CC
FF00;CCFF33;CCCC99;666633;333300;CCCC66;CCCC33;999 966;999933;999900;666600;F
FFFFF;CCCCCC;999999;666666;333333;000000;43dddd;65 432b;777665;4443cc;CCCCC3;
A906B0;9CC33F;C8C8C8;688888;777752;66E554;7655FF;5 55577;D4DCE8;99AECE;3A5A8A
;9A0030;EF3F6B;FFF543;C906CF;AA2222 ";
And true a function i add random colors in the string,
$s_Colors.= ";".strtoupper($_POST['colorvalue']);

then i make one array:
$a_Colors=array_change_key_case(split(";",$s_Color s), CASE_UPPER);
when i do
sort($a_Colors);
print_r($a_Colors);

or
asort($a_Colors);
print_r($a_Colors);
the values are not correct sorted..!
oke i understand the difference of the hex index so anybody idea??

Cheers,

D
================================================== =

What exactly is NOT working? the UPPERCASE function: here is why - from
the manual:

array_change_key_case() changes the keys in the input array to be all
lowercase or uppercase. The change depends on the last optional case
parameter. You can pass two constants there, CASE_UPPER and CASE_LOWER.
The default is CASE_LOWER. **The function will leave number indices as
is.** and a hex value is considered a number.

try:
$a_Colors= explode(";",strtoupper($s_Colors));
sort($a_Colors);
print_r($a_Colors);
Michael Austin.
Jul 17 '05 #2
me
Hey Michael,

Wel as you probaly tested the colors are sorterd in a alpha numeric way but
not in a hex ritme..
I want to have a all the colors that are example in the range of red
together.. and if you make a test and print a table with the colors you see
that they are not sort properly.

Cheers,

M

"Michael Austin" <ma*****@firstdbasource.com> wrote in message
news:gr*****************@newssvr22.news.prodigy.co m...
me wrote:
good day,

i found this message:
and i want to know more about it too.
==========================================

Hey all,

example:
$s_Colors="0066FF;0066CC;3366CC;0033FF;003399;0033 66;99CCFF;3399FF;0099FF;66 99CC;336699;006699;66CCFF;33CCFF;00CCFF;3399CC;009 9CC;003333;99CCCC;66CCCC;3 39999;669999;006666;336666;CCFFFF;99FFFF;66FFFF;33 FFFF;00FFFF;00CCCC;99FFCC; 66FFCC;33FFCC;00FFCC;33CCCC;009999;66CC99;33CC99;0 0CC99;339966;009966;006633 ;66FF99;33FF99;00FF99;33CC66;00CC66;009933;99FF99; 66FF66;33FF66;00FF66;33993 3;006600;CCFFCC;99CC99;66CC66;669966;336633;003300 ;33FF33;00FF33;00FF00;00CC 00;33CC33;00CC33;66FF00;66FF33;33FF00;33CC00;33990 0;009900;CCFF99;99FF66;66C C00;66CC33;669933;336600;99FF00;99FF33;99CC66;99CC 00;99CC33;669900;CCFF66;CC FF00;CCFF33;CCCC99;666633;333300;CCCC66;CCCC33;999 966;999933;999900;666600;F FFFFF;CCCCCC;999999;666666;333333;000000;43dddd;65 432b;777665;4443cc;CCCCC3; A906B0;9CC33F;C8C8C8;688888;777752;66E554;7655FF;5 55577;D4DCE8;99AECE;3A5A8A ;9A0030;EF3F6B;FFF543;C906CF;AA2222 ";
And true a function i add random colors in the string,
$s_Colors.= ";".strtoupper($_POST['colorvalue']);

then i make one array:
$a_Colors=array_change_key_case(split(";",$s_Color s), CASE_UPPER);
when i do
sort($a_Colors);
print_r($a_Colors);

or
asort($a_Colors);
print_r($a_Colors);
the values are not correct sorted..!
oke i understand the difference of the hex index so anybody idea??

Cheers,

D
================================================== =

What exactly is NOT working? the UPPERCASE function: here is why - from
the manual:

array_change_key_case() changes the keys in the input array to be all
lowercase or uppercase. The change depends on the last optional case
parameter. You can pass two constants there, CASE_UPPER and CASE_LOWER.
The default is CASE_LOWER. **The function will leave number indices as
is.** and a hex value is considered a number.

try:
$a_Colors= explode(";",strtoupper($s_Colors));
sort($a_Colors);
print_r($a_Colors);
Michael Austin.

Jul 17 '05 #3
> "Michael Austin" <ma*****@firstdbasource.com> wrote in message
news:gr*****************@newssvr22.news.prodigy.co m...
me wrote:
good day,

i found this message:
and i want to know more about it too.
==========================================

Hey all,

example:

$s_Colors="0066FF;0066CC;3366CC;0033FF;003399;0033 66;99CCFF;3399FF;0099FF;66

99CC;336699;006699;66CCFF;33CCFF;00CCFF;3399CC;009 9CC;003333;99CCCC;66CCCC;3

39999;669999;006666;336666;CCFFFF;99FFFF;66FFFF;33 FFFF;00FFFF;00CCCC;99FFCC;

66FFCC;33FFCC;00FFCC;33CCCC;009999;66CC99;33CC99;0 0CC99;339966;009966;006633

;66FF99;33FF99;00FF99;33CC66;00CC66;009933;99FF99; 66FF66;33FF66;00FF66;33993

3;006600;CCFFCC;99CC99;66CC66;669966;336633;003300 ;33FF33;00FF33;00FF00;00CC

00;33CC33;00CC33;66FF00;66FF33;33FF00;33CC00;33990 0;009900;CCFF99;99FF66;66C

C00;66CC33;669933;336600;99FF00;99FF33;99CC66;99CC 00;99CC33;669900;CCFF66;CC

FF00;CCFF33;CCCC99;666633;333300;CCCC66;CCCC33;999 966;999933;999900;666600;F

FFFFF;CCCCCC;999999;666666;333333;000000;43dddd;65 432b;777665;4443cc;CCCCC3;

A906B0;9CC33F;C8C8C8;688888;777752;66E554;7655FF;5 55577;D4DCE8;99AECE;3A5A8A
;9A0030;EF3F6B;FFF543;C906CF;AA2222 ";
And true a function i add random colors in the string,
$s_Colors.= ";".strtoupper($_POST['colorvalue']);

then i make one array:
$a_Colors=array_change_key_case(split(";",$s_Co lors), CASE_UPPER);
when i do
sort($a_Colors);
print_r($a_Colors);

or
asort($a_Colors);
print_r($a_Colors);
the values are not correct sorted..!
oke i understand the difference of the hex index so anybody idea??

Cheers,

D
=============================================== ====

What exactly is NOT working? the UPPERCASE function: here is why - from
the manual:

array_change_key_case() changes the keys in the input array to be all
lowercase or uppercase. The change depends on the last optional case
parameter. You can pass two constants there, CASE_UPPER and CASE_LOWER.
The default is CASE_LOWER. **The function will leave number indices as
is.** and a hex value is considered a number.

try:
$a_Colors= explode(";",strtoupper($s_Colors));
sort($a_Colors);
print_r($a_Colors);
Michael Austin.


me wrote:
Hey Michael,

Wel as you probaly tested the colors are sorterd in a alpha numeric way but not in a hex ritme..
I want to have a all the colors that are example in the range of red
together.. and if you make a test and print a table with the colors you see that they are not sort properly.

Cheers,

M


[top-post-corrected]

Now that is a horse of a different color. :)

Once you have your array, you will need to break it down into RGB order

FFFFFF
|||||+--> Blue LSByte
||||+---> Blue MSByte
|||+----> Green LSByte
||+-----> Green MSByte
|+------> Red LSByte
+-------> Red MSByte

and sort where Red is predominate etc..., I am guessing you already
figured that one out. In essence you need a 3-dimensional array (not
multiple arrays)... and a way to sort it and still keep the colors intact.

to see how difficult this would be look at a chart I found:
http://www.forestasia.com/tools/colour_chart.asp

After 2.5 hours, I am giving up and going to bed... good night.

Michael Austin.

oh... I guess I should have hit the send button....
Jul 17 '05 #4
Look here for a colorchart::

http://www.xs4all.nl/~sjeef/Nederlands/colorchart.html

Gerard Schaefers
--
Voor meer kook- en eetplezier? Kijk hier!
http://www.xs4all.nl/~sjeef/Nederlands/Recepten.html
Jul 17 '05 #5
me
Thanks but hehe how can i do this in php? :)

I need a color algoritme? that knows wich part is in red and wich part is in
green etc etc??

Cheers,

M
"Sjeef" <sjeef@(WEGHALEN)zeepost.nl> wrote in message
news:40***********************@news.xs4all.nl...
Look here for a colorchart::

http://www.xs4all.nl/~sjeef/Nederlands/colorchart.html

Gerard Schaefers
--
Voor meer kook- en eetplezier? Kijk hier!
http://www.xs4all.nl/~sjeef/Nederlands/Recepten.html

Jul 17 '05 #6
me wrote:
Thanks but hehe how can i do this in php? :)

I need a color algoritme? that knows wich part is in red and wich
part is in green etc etc??

Cheers,

M
"Sjeef" <sjeef@(WEGHALEN)zeepost.nl> wrote in message
news:40***********************@news.xs4all.nl...
Look here for a colorchart::

http://www.xs4all.nl/~sjeef/Nederlands/colorchart.html

Gerard Schaefers
--
Voor meer kook- en eetplezier? Kijk hier!
http://www.xs4all.nl/~sjeef/Nederlands/Recepten.html


Sorry can't help you in this.

Gerard Schaefers
--
Voor meer kook- en eetplezier? Kijk hier!
http://www.xs4all.nl/~sjeef/Nederlands/Recepten.html
Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: lawrence | last post by:
Is there an easy way to sort a 2 dimensional array alphabetically by the second field in each row? Also, when I use sort() on a two dimensional array, it seems to work a lot like...
4
by: its me | last post by:
Let's say I have a class of people... Public Class People Public Sex as String Public Age as int Public Name as string end class And I declare an array of this class...
4
by: Brett | last post by:
I have two arrays and i wish to sort the first one numerically, but after sorting, I would like the second array to be in the same matching order as the first array. ie. @l1={3,1,2};...
40
by: Elijah Bailey | last post by:
I want to sort a set of records using STL's sort() function, but dont see an easy way to do it. I have a char *data; which has size mn bytes where m is size of the record and n is the...
3
by: gambler | last post by:
let's say you have: var games = new Array(); games = new GAME(gameNum, rotNum1, rotNum2, ... ); ( so a sparsley populate array which enables me to locate a game usin the game number...
7
by: ritchie | last post by:
Hi all, I am new to this group and I have question that you may be able to help me with. I am trying to learn C but am currently stuck on this. First of all, I have a function for each sort...
9
by: Steve Wasser | last post by:
I need to sort a two-dimensional array. Each day I process a file with 9 comma-delimited fields, and varying amount of records (lines). I want to pull in each line, split it according to the comma...
21
by: yeti349 | last post by:
Hi, I'm using the following code to retrieve data from an xml file and populate a javascript array. The data is then displayed in html table form. I would like to then be able to sort by each...
5
by: Jan Smith | last post by:
I've searched the overloads for the Array.Sort method, and I haven't found a clear answer to my question. Maybe it's not in Array.Sort. Here's the question: I initialize an array X with the...
48
by: Alex Chudnovsky | last post by:
I have come across with what appears to be a significant performance bug in ..NET 2.0 ArrayList.Sort method when compared with Array.Sort on the same data. Same data on the same CPU gets sorted a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.