RE: [SPAM] - Re: Converting decimal to binary - Bayesian Filter detected spam

2006-01-10 Thread Gordon Bruce
Actually CONV converts from any base to any base so if it is base 10
then just replace the 16's with 10's. 

Too much time looking at dump's.

-Original Message-
From: Bill Dodson [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 10, 2006 3:09 PM
To: Gordon Bruce
Cc: Ed Reed; mysql@lists.mysql.com
Subject: [SPAM] - Re: Converting decimal to binary - Bayesian Filter
detected spam

If you really do mean decimal (base 10) you could use Gordon's solution 
like this:

SELECT
MID(CONV(HEX(245),16,2),1,1) AS `7`,
MID(CONV(HEX(245),16,2),2,1) AS `6`,
MID(CONV(HEX(245),16,2),3,1) AS `5`,
MID(CONV(HEX(245),16,2),4,1) AS `4`,
MID(CONV(HEX(245),16,2),5,1) AS `3`,
MID(CONV(HEX(245),16,2),6,1) AS `2`,
MID(CONV(HEX(245),16,2),7,1) AS `1`,
MID(CONV(HEX(245),16,2),8,1) AS `0` ;

Results:
+---+---+---+---+---+---+---+---+
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---+---+---+---+---+---+---+---+
| 1 | 1 | 1 | 1 | 0 | 1 | 0 | 1 |
+---+---+---+---+---+---+---+---+


Hope this helps.



Gordon Bruce wrote:

If by Decimal you mesn HEXIDECIMAL you can use CONV 
where the 1st arg is the HEX value, 
2nd arg is From Base 
and 3rd arg is To Base. 

You will have to suround the aliases with `'s if you really want 
the names to be numeric.


mysql select MID(CONV('A5',16,2),1,1) AS `7`,
-MID(CONV('A5',16,2),2,1) AS `6`,
-MID(CONV('A5',16,2),3,1) AS `5`,
-MID(CONV('A5',16,2),4,1) AS `4`,
-MID(CONV('A5',16,2),5,1) AS `3`,
-MID(CONV('A5',16,2),6,1) AS `2`,
-MID(CONV('A5',16,2),7,1) AS `1`,
-MID(CONV('A5',16,2),8,1) AS `0` ;
+---+---+---+---+---+---+---+---+
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---+---+---+---+---+---+---+---+
| 1 | 0 | 1 | 0 | 0 | 1 | 0 | 1 |
+---+---+---+---+---+---+---+---+
1 row in set (0.00 sec)

-Original Message-
From: Ed Reed [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 10, 2006 12:16 PM
To: mysql@lists.mysql.com
Subject: Converting decimal to binary

Can anyone tell me if it's possible, in 4.1.11, to convert a decimal
number to binary and have the result be returned as a separate field
for
each bit? For example, what I'd like to do is,

Select ConvertToBin(245);

And have a result that looked like this
+---+---+---+---+---+---+---+---+
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---+---+---+---+---+---+---+---+
| 1 | 1 | 1 | 1 | 0 | 1 | 0 | 1 |
+---+---+---+---+---+---+---+---+

- Thanks



  



-- 
Bill Dodson
Parkline, Inc. http://www.parkline.com
phone: 304-586-2113 x149
fax: 304-586-3842
email: [EMAIL PROTECTED]


Email Disclaimer

The information in any email is confidential and may be legally
privileged. It is intended solely for the addressee. Access to the email
message by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, or distribution of the message, or
any action or omission taken by you in reliance on it, is prohibited and
may be unlawful. If you have received an email message in error, please
notify the sender immediately by email, facsimile or telephone and
return and/or destroy the original message.

Thank you.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: [SPAM] - Re: Converting decimal to binary - Bayesian Filter detected spam

2006-01-10 Thread Ed Reed
Thanks Gordon and Bill but this has one big problem
 
If my decimal number is 8 the result ends up,
 
Results:
+---+---+---+---+---+---+---+---+
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---+---+---+---+---+---+---+---+
| 1 | 0 | 0 | 0 |   |   |   |   |
+---+---+---+---+---+---+---+---+

when what i really need is,
 
Results:
+---+---+---+---+---+---+---+---+
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---+---+---+---+---+---+---+---+
| 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
+---+---+---+---+---+---+---+---+
 
Any thoughts?




 Gordon Bruce [EMAIL PROTECTED] 1/10/06 1:44 PM 
Actually CONV converts from any base to any base so if it is base 10
then just replace the 16's with 10's. 

Too much time looking at dump's.

-Original Message-
From: Bill Dodson [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 10, 2006 3:09 PM
To: Gordon Bruce
Cc: Ed Reed; mysql@lists.mysql.com 
Subject: [SPAM] - Re: Converting decimal to binary - Bayesian Filter
detected spam

If you really do mean decimal (base 10) you could use Gordon's solution 
like this:

SELECT
MID(CONV(HEX(245),16,2),1,1) AS `7`,
MID(CONV(HEX(245),16,2),2,1) AS `6`,
MID(CONV(HEX(245),16,2),3,1) AS `5`,
MID(CONV(HEX(245),16,2),4,1) AS `4`,
MID(CONV(HEX(245),16,2),5,1) AS `3`,
MID(CONV(HEX(245),16,2),6,1) AS `2`,
MID(CONV(HEX(245),16,2),7,1) AS `1`,
MID(CONV(HEX(245),16,2),8,1) AS `0` ;

Results:
+---+---+---+---+---+---+---+---+
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---+---+---+---+---+---+---+---+
| 1 | 1 | 1 | 1 | 0 | 1 | 0 | 1 |
+---+---+---+---+---+---+---+---+


Hope this helps.



Gordon Bruce wrote:

If by Decimal you mesn HEXIDECIMAL you can use CONV 
where the 1st arg is the HEX value, 
2nd arg is From Base 
and 3rd arg is To Base. 

You will have to suround the aliases with `'s if you really want 
the names to be numeric.


mysql select MID(CONV('A5',16,2),1,1) AS `7`,
 - MID(CONV('A5',16,2),2,1) AS `6`,
 - MID(CONV('A5',16,2),3,1) AS `5`,
 - MID(CONV('A5',16,2),4,1) AS `4`,
 - MID(CONV('A5',16,2),5,1) AS `3`,
 - MID(CONV('A5',16,2),6,1) AS `2`,
 - MID(CONV('A5',16,2),7,1) AS `1`,
 - MID(CONV('A5',16,2),8,1) AS `0` ;
+---+---+---+---+---+---+---+---+
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---+---+---+---+---+---+---+---+
| 1 | 0 | 1 | 0 | 0 | 1 | 0 | 1 |
+---+---+---+---+---+---+---+---+
1 row in set (0.00 sec)

-Original Message-
From: Ed Reed [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 10, 2006 12:16 PM
To: mysql@lists.mysql.com 
Subject: Converting decimal to binary

Can anyone tell me if it's possible, in 4.1.11, to convert a decimal
number to binary and have the result be returned as a separate field
for
each bit? For example, what I'd like to do is,

Select ConvertToBin(245);

And have a result that looked like this
+---+---+---+---+---+---+---+---+
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---+---+---+---+---+---+---+---+
| 1 | 1 | 1 | 1 | 0 | 1 | 0 | 1 |
+---+---+---+---+---+---+---+---+

- Thanks



 



-- 
Bill Dodson
Parkline, Inc. http://www.parkline.com 
phone: 304-586-2113 x149
fax: 304-586-3842
email: [EMAIL PROTECTED] 


Email Disclaimer

The information in any email is confidential and may be legally
privileged. It is intended solely for the addressee. Access to the email
message by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, or distribution of the message, or
any action or omission taken by you in reliance on it, is prohibited and
may be unlawful. If you have received an email message in error, please
notify the sender immediately by email, facsimile or telephone and
return and/or destroy the original message.

Thank you.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql 
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED] 



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql 
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] 





RE: [SPAM] - Re: Converting decimal to binary - Bayesian Filter detected spam

2006-01-10 Thread Ed Reed
Well I solved the problem by using LPAD but it would be nice if there was a 
more elegant way of handling this problem.
 
Thanks for the help.

 Ed Reed [EMAIL PROTECTED] 1/10/06 2:52 PM 
Thanks Gordon and Bill but this has one big problem

If my decimal number is 8 the result ends up,

Results:
+---+---+---+---+---+---+---+---+
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---+---+---+---+---+---+---+---+
| 1 | 0 | 0 | 0 | | | | |
+---+---+---+---+---+---+---+---+

when what i really need is,

Results:
+---+---+---+---+---+---+---+---+
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---+---+---+---+---+---+---+---+
| 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
+---+---+---+---+---+---+---+---+

Any thoughts?




 Gordon Bruce  [EMAIL PROTECTED]  1/10/06 1:44 PM 
Actually CONV converts from any base to any base so if it is base 10
then just replace the 16's with 10's. 

Too much time looking at dump's.

-Original Message-
From: Bill Dodson [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 10, 2006 3:09 PM
To: Gordon Bruce
Cc: Ed Reed; mysql@lists.mysql.com 
Subject: [SPAM] - Re: Converting decimal to binary - Bayesian Filter
detected spam

If you really do mean decimal (base 10) you could use Gordon's solution 
like this:

SELECT
MID(CONV(HEX(245),16,2),1,1) AS `7`,
MID(CONV(HEX(245),16,2),2,1) AS `6`,
MID(CONV(HEX(245),16,2),3,1) AS `5`,
MID(CONV(HEX(245),16,2),4,1) AS `4`,
MID(CONV(HEX(245),16,2),5,1) AS `3`,
MID(CONV(HEX(245),16,2),6,1) AS `2`,
MID(CONV(HEX(245),16,2),7,1) AS `1`,
MID(CONV(HEX(245),16,2),8,1) AS `0` ;

Results:
+---+---+---+---+---+---+---+---+
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---+---+---+---+---+---+---+---+
| 1 | 1 | 1 | 1 | 0 | 1 | 0 | 1 |
+---+---+---+---+---+---+---+---+


Hope this helps.



Gordon Bruce wrote:

If by Decimal you mesn HEXIDECIMAL you can use CONV 
where the 1st arg is the HEX value, 
2nd arg is From Base 
and 3rd arg is To Base. 

You will have to suround the aliases with `'s if you really want 
the names to be numeric.


mysql select MID(CONV('A5',16,2),1,1) AS `7`,
 - MID(CONV('A5',16,2),2,1) AS `6`,
 - MID(CONV('A5',16,2),3,1) AS `5`,
 - MID(CONV('A5',16,2),4,1) AS `4`,
 - MID(CONV('A5',16,2),5,1) AS `3`,
 - MID(CONV('A5',16,2),6,1) AS `2`,
 - MID(CONV('A5',16,2),7,1) AS `1`,
 - MID(CONV('A5',16,2),8,1) AS `0` ;
+---+---+---+---+---+---+---+---+
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---+---+---+---+---+---+---+---+
| 1 | 0 | 1 | 0 | 0 | 1 | 0 | 1 |
+---+---+---+---+---+---+---+---+
1 row in set (0.00 sec)

-Original Message-
From: Ed Reed [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 10, 2006 12:16 PM
To: mysql@lists.mysql.com 
Subject: Converting decimal to binary

Can anyone tell me if it's possible, in 4.1.11, to convert a decimal
number to binary and have the result be returned as a separate field
for
each bit? For example, what I'd like to do is,

Select ConvertToBin(245);

And have a result that looked like this
+---+---+---+---+---+---+---+---+
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+---+---+---+---+---+---+---+---+
| 1 | 1 | 1 | 1 | 0 | 1 | 0 | 1 |
+---+---+---+---+---+---+---+---+

- Thanks



 



-- 
Bill Dodson
Parkline, Inc. http://www.parkline.com 
phone: 304-586-2113 x149
fax: 304-586-3842
email: [EMAIL PROTECTED] 


Email Disclaimer

The information in any email is confidential and may be legally
privileged. It is intended solely for the addressee. Access to the email
message by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, or distribution of the message, or
any action or omission taken by you in reliance on it, is prohibited and
may be unlawful. If you have received an email message in error, please
notify the sender immediately by email, facsimile or telephone and
return and/or destroy the original message.

Thank you.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql 
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED] 



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql 
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] 







Re: [SPAM] - Re: Converting decimal to binary - Bayesian Filter detected spam

2006-01-10 Thread Francesco Riosa
And another one is (in inverse order for laziness):

select
  (8  1) AS `0`
, (8  2  1) AS `1`
, (8  4  1) AS `2`
, (8  8  1) AS `3`
, (8  16  1) AS `4`
, (8  32  1) AS `5`
, (8  64  1) AS `6`
, (8  128  1) AS `7`
;


Ed Reed wrote:
 Well I solved the problem by using LPAD but it would be nice if there was a 
 more elegant way of handling this problem.
  
 Thanks for the help.

   
 Ed Reed [EMAIL PROTECTED] 1/10/06 2:52 PM 
 
 Thanks Gordon and Bill but this has one big problem

 If my decimal number is 8 the result ends up,

 Results:
 +---+---+---+---+---+---+---+---+
 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
 +---+---+---+---+---+---+---+---+
 | 1 | 0 | 0 | 0 | | | | |
 +---+---+---+---+---+---+---+---+

 when what i really need is,

 Results:
 +---+---+---+---+---+---+---+---+
 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
 +---+---+---+---+---+---+---+---+
 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
 +---+---+---+---+---+---+---+---+

 Any thoughts?




   
 Gordon Bruce  [EMAIL PROTECTED]  1/10/06 1:44 PM 
 
 Actually CONV converts from any base to any base so if it is base 10
 then just replace the 16's with 10's. 

 Too much time looking at dump's.

 -Original Message-
 From: Bill Dodson [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, January 10, 2006 3:09 PM
 To: Gordon Bruce
 Cc: Ed Reed; mysql@lists.mysql.com 
 Subject: [SPAM] - Re: Converting decimal to binary - Bayesian Filter
 detected spam

 If you really do mean decimal (base 10) you could use Gordon's solution 
 like this:

 SELECT
 MID(CONV(HEX(245),16,2),1,1) AS `7`,
 MID(CONV(HEX(245),16,2),2,1) AS `6`,
 MID(CONV(HEX(245),16,2),3,1) AS `5`,
 MID(CONV(HEX(245),16,2),4,1) AS `4`,
 MID(CONV(HEX(245),16,2),5,1) AS `3`,
 MID(CONV(HEX(245),16,2),6,1) AS `2`,
 MID(CONV(HEX(245),16,2),7,1) AS `1`,
 MID(CONV(HEX(245),16,2),8,1) AS `0` ;

 Results:
 +---+---+---+---+---+---+---+---+
 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
 +---+---+---+---+---+---+---+---+
 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 1 |
 +---+---+---+---+---+---+---+---+


 Hope this helps.



 Gordon Bruce wrote:

   
 If by Decimal you mesn HEXIDECIMAL you can use CONV 
 where the 1st arg is the HEX value, 
 2nd arg is From Base 
 and 3rd arg is To Base. 

 You will have to suround the aliases with `'s if you really want 
 the names to be numeric.


 mysql select MID(CONV('A5',16,2),1,1) AS `7`,
 - MID(CONV('A5',16,2),2,1) AS `6`,
 - MID(CONV('A5',16,2),3,1) AS `5`,
 - MID(CONV('A5',16,2),4,1) AS `4`,
 - MID(CONV('A5',16,2),5,1) AS `3`,
 - MID(CONV('A5',16,2),6,1) AS `2`,
 - MID(CONV('A5',16,2),7,1) AS `1`,
 - MID(CONV('A5',16,2),8,1) AS `0` ;
 +---+---+---+---+---+---+---+---+
 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
 +---+---+---+---+---+---+---+---+
 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 1 |
 +---+---+---+---+---+---+---+---+
 1 row in set (0.00 sec)

 -Original Message-
 From: Ed Reed [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, January 10, 2006 12:16 PM
 To: mysql@lists.mysql.com 
 Subject: Converting decimal to binary

 Can anyone tell me if it's possible, in 4.1.11, to convert a decimal
 number to binary and have the result be returned as a separate field
 
 for
   
 each bit? For example, what I'd like to do is,

 Select ConvertToBin(245);

 And have a result that looked like this
 +---+---+---+---+---+---+---+---+
 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
 +---+---+---+---+---+---+---+---+
 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 1 |
 +---+---+---+---+---+---+---+---+

 - Thanks





 


   


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: [SPAM] - Re: Converting decimal to binary - Bayesian Filter detected spam

2006-01-10 Thread Francesco Riosa
Francesco Riosa wrote:
 And another one is (in inverse order for laziness):

 select
   (8  1) AS `0`
 , (8  2  1) AS `1`
 , (8  4  1) AS `2`
 , (8  8  1) AS `3`
 , (8  16  1) AS `4`
 , (8  32  1) AS `5`
 , (8  64  1) AS `6`
 , (8  128  1) AS `7`
 ;
   
but this one looks better:

select
  (8  1) AS `0`
, (8  1  1) AS `1`
, (8  2  1) AS `2`
, (8  3  1) AS `3`
, (8  4  1) AS `4`
, (8  5  1) AS `5`
, (8  6  1) AS `6`
, (8  7  1) AS `7`
;

http://dev.mysql.com/doc/refman/4.1/en/bit-functions.html



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]