Is this relevant: http://www.google.ca/search?sourceid=chrome&ie=UTF-8&q=ruby+unpack
On Fri, Dec 24, 2010 at 9:05 AM, Subhash Bhushan <[email protected]> wrote: > Hi Barney, > > In Java, using toDouble and toLong works just fine. > In this case, I am using a Ruby on Rails client, not java, to extract > values. Couldn't find an appropriate method in Ruby to do this conversion... > > Regards, > Subhash Bhushan. > > On Fri, Dec 24, 2010 at 9:56 PM, Barney Frank <[email protected]>wrote: > >> Have you tried extracting values using Bytes.toDouble(value) or >> Bytes.toLong(value)? >> >> >> On Fri, Dec 24, 2010 at 9:20 AM, Subhash Bhushan < >> [email protected]> wrote: >> >>> Hi, >>> >>> I am using a Ruby on Rails client to extract values from HBase via >>> Stargate. >>> >>> >>> -------------------------------------------------------------------------------------------------------- >>> "price" field has been defined as follows: >>> private Double price; >>> >>> -------------------------------------------------------------------------------------------------------- >>> I have inserted values into HBase like this: >>> p.add( >>> Bytes.toBytes("detail"), >>> Bytes.toBytes("price"), >>> timeStamp, >>> Bytes.toBytes(item.getPrice())); >>> >>> -------------------------------------------------------------------------------------------------------- >>> When I extract value of price via Stargate, i get the following value: >>> val...@\x91,\x00\x00\x00\x00\x00 >>> >>> -------------------------------------------------------------------------------------------------------- >>> >>> How do I convert this into proper Double value in Ruby? >>> Or should I always store fields as String? The same applies to my Long >>> variables too. >>> >>> Regards, >>> Subhash Bhushan. >>> >> >> >
