Blobs

Hi@All!

I completely new to RoR.

I have a table which looks like this:
[ id | width:int | height:int | data: blob ]

The blob contains a matrix of double precision values (64 bits).
Apparently RoR gives me a string when i read the blob. How do I convert
this string to a double matrix? Or rather, how do I turn 4 bytes into a
Float?

Thanks,
Par

Pete Y. wrote:

Par Skoglund wrote:

Or rather, how do I turn 4 bytes into a
Float?

You probably want to look at String.unpack and its opposite Array.pack.

Pete Y.
http://notahat.com/

upack did the trick.

Thanks a million, Pete!

Par Skoglund wrote:

Or rather, how do I turn 4 bytes into a
Float?

You probably want to look at String.unpack and its opposite Array.pack.

Pete Y.