LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-02-2005, 01:33 PM   #16
whizbit
Member
 
Registered: Jul 2005
Location: uk
Distribution: mandriva....not out of choice
Posts: 65

Original Poster
Rep: Reputation: 15

so what if i used the same process to make that number u got smaller again....
does that work
 
Old 07-02-2005, 02:30 PM   #17
whizbit
Member
 
Registered: Jul 2005
Location: uk
Distribution: mandriva....not out of choice
Posts: 65

Original Poster
Rep: Reputation: 15
does that mean everyone is now trying to do what i said and ignoring me now
 
Old 07-02-2005, 05:38 PM   #18
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Just because you don't get a reply in an hour doesn't mean we're ignoring you. *I* had a server with a disk failure I had to take care of. That takes priority.

How do you want to make the number 'smaller'? In what way? In representation? In value?

Can you give us an example on a smaller scale?
 
Old 07-02-2005, 05:46 PM   #19
vladmihaisima
Member
 
Registered: Oct 2002
Location: Delft, Netherlands
Distribution: Gentoo
Posts: 196

Rep: Reputation: 33
Maybe you could give a small example of what you want to do.

And a personal remark (because I don't understand what you want I might not answer your question).

If you have a 300k file (this is the size on disk), the biggest number you could store would be 2 at the power 300*1024*8 that is 2 at the power 2457600. This would be the case when you would use binary enconding.

Example:

The number 255 in base 10 is 255 -> in ascii would be 0x32 0x35 0x36 -> on disk would be 0011 0010 0011 0101 0011 0011 -> 3 bytes
The number 255 in base 16 is ff -> in ascii would be 0x66 0x66 -> on disk would be 0110 0110 0110 0110 -> 2 bytes
The number 255 in computer memory is 1111 1111 -> written directly on disk (no conversion to ascii) would be 1111 1111 -> 1 byte

As I said, if this doesn't help and you want aid, you must ask a complete question and maybe give an example too.
 
Old 07-02-2005, 06:02 PM   #20
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
I *MAY* be understand the original question, but I am not sure, as it does not seem to make sense to me.

I believe he's saying that since 300kb of hex data can be stored as 150kb in binary, "can that process be repeated to reduce it to 75kb?" The answer is, of course, no. Hex digits have 4 "significant bits", which means 2 hex digits are the same as 1 byte in binary. This cannot be repeated, since all 8 bits are now significant.
 
Old 07-02-2005, 06:18 PM   #21
whizbit
Member
 
Registered: Jul 2005
Location: uk
Distribution: mandriva....not out of choice
Posts: 65

Original Poster
Rep: Reputation: 15
ok i see what u getting at...u just saw a number get half by not obey which base there in
 
Old 07-02-2005, 06:22 PM   #22
whizbit
Member
 
Registered: Jul 2005
Location: uk
Distribution: mandriva....not out of choice
Posts: 65

Original Poster
Rep: Reputation: 15
if increase u use binary as the base....u can converter that to a base 10 number......ok but if u convert it to base 100 does the size still decrease remember u need to use 100 symbols to represent in the end result so the resulting file is half plus 100 bytes
 
Old 07-02-2005, 06:24 PM   #23
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
You do obey the base they're in. That's the whole deal: base conversion.
 
Old 07-02-2005, 06:32 PM   #24
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Base 100? Quite an odd base, but a file in base 100 would be 64/25 as large as the original binary file.
 
Old 07-02-2005, 06:42 PM   #25
whizbit
Member
 
Registered: Jul 2005
Location: uk
Distribution: mandriva....not out of choice
Posts: 65

Original Poster
Rep: Reputation: 15
ok just a question how are u converting a base to base
anywayz u got a serious of 1 and 0s u pair them off to 2 different values
e.g 01 is 1 and 10 is 0........ok u run thru the file once ........u not lost any information as u just reverse the process
but thats only halfing it in one process
 
Old 07-02-2005, 06:50 PM   #26
whizbit
Member
 
Registered: Jul 2005
Location: uk
Distribution: mandriva....not out of choice
Posts: 65

Original Poster
Rep: Reputation: 15
i dont want to obey there rules...i have a 150 file representing a number....
all i do is half that number
i still can get to 300k
but i want to know how to traverse the power of 2.......e.g so i can say convert me base number into binary numbers
 
Old 07-02-2005, 07:04 PM   #27
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
I'm still confused. Please give a concrete example. Here's how I interpret this. You have a file containing data like:
Code:
01AACCEF
and you want the binary version like
Code:
00000001101010101100110011101111
, except in the actual memory that would all only be 4 bytes.

Is that correct? If not, please give a similar example.
 
Old 07-02-2005, 07:41 PM   #28
whizbit
Member
 
Registered: Jul 2005
Location: uk
Distribution: mandriva....not out of choice
Posts: 65

Original Poster
Rep: Reputation: 15
rigth now tell me what that binary number is if it was in base n
or what method can i applie to n to reversed down to binary


just off topic...if u applied every 0 and 1 in to a program that asked for just the output of a given electronic circuit, we should end up with a really smal number of 0 and 1s....but that could recalculate a bigger number just say this is the 0 and 1s of the out put that i had
but remember we still have 0 and 1s....they can be knocked down further if u do the same with those numbers
but u would get a differnt result if u used differnt numbers....
as u are not finding a unique number...u just using a unique number and tranversing down it calculation
and using a multiply of that calculation to get back to that number u wanted
any number can be switch to a higher number in its own sequence
now all i would do is tell program to read n
ok ill just an show u what i want
let a = input
if a = odd number the subtract 1 else a/2
write 1 or 0 to file e.g. if was odd the write 1 if was even write 2

so u just did this....
no say u got this number 01010101001010101001
now that represents how many times u can multipley by 2 nd if u need to add 1
and depends when u wanted to stop is entirely up to u

repeat
i wuld love to travesre the prime bases



ok we can go back to creating only one outcome.....using the least information
.
 
Old 07-02-2005, 08:05 PM   #29
whizbit
Member
 
Registered: Jul 2005
Location: uk
Distribution: mandriva....not out of choice
Posts: 65

Original Poster
Rep: Reputation: 15
ok i do a process that is reverisble...the process i do will result ina small number.....
that number u can use to get back to my number
e.g i keep halfing in the method i explains recording all the numbers...that means i have a base number whixh is the size of binary representation dont i yes i know it not much of a reduction when u only do it once..but if u keep finding the next binary representation just for that number
e.g by doing the same calculation u get the same ratio dont u
i just want to know how to calculate the ratio and give u a number like 14 and make it mean something to another number i chosen for u to have
 
Old 07-02-2005, 08:46 PM   #30
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Ok, so if you have a given reversible process, then yes, that would work. How does this relate to your original question?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
writing raw data to a tiff file James_dean Programming 4 10-25-2005 05:03 AM
Reading raw hard disk sectors villie Programming 4 05-13-2004 12:18 AM
Capturing raw mouse data pld Linux - Software 4 04-11-2004 08:13 PM
Raw Syn Packet with Data GodSendDeath Programming 4 04-06-2004 04:53 PM
Raw Packet Data vanibhat Linux - Security 1 08-01-2003 07:42 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration