#ruby-lang - Mon 16 Apr 2007 between 02:24 and 10:42

NY Lost Funds



OlatheUncleD: I haven't really learned that.
sgrover: Try p instead of puts for arrays.
sgroverOlathe: Thanks. using p tells me the first character in the line is "\000", so a null.
apparently a null is not treated as whitespace.. :)
Using the gsub(/[^A-Za-z0-9]/, '') gives me the results I'm after - consistently.
OlatheAlso, p str.unpack('C*') or p str.unpack('H*') can help you see what characters there are.
Here's a nice problem: http://www.facebook.com/jobs_puzzles/?puzzle_id=1
sgroverThat makes my head hurt.. :)
halorgiumso why are you generating a struct, why not just use the hash that rails provides you?
you could do OpenStruct.new(hash_to_make_into_a_struct)
jtoyI am unaware of OpenStruct
it seems to be almost the same as Struct?
halorgiumalmost, yes
jtoyI just changed some code around to make it work with Struct
is OpenStruct better to use anyway? should I replace my code with OpenStruct?
halorgiumi'm not sure you are actually wanting to use a struct
why are you converting the "columns" from hash?
jtoyI just want to have my report lines look like objects where I can call methods on it
halorgiumuse OpenStruct then
jtoywhat do you mean bout converting columns form hash?
do you know if OpenStruct is faster than Struct? I imagine it would be slower
halorgiumyou are doing silly things with Struct, you don't need to care about Struct name
jtoyhalorgium: oh that, I just changed that part of the code to be http://pastebin.ca/442638 does that seem appropriate?
halorgiumjtoy: it seems a bit silly to be creating and destroying this class definition
jtoyhalorgium: ok, what seems better than? I need to make sure all the columns are attributes for the current struct I am using
halorgiumcould you provide a YAML dump of the columns and other related variables
columns is an Array, right?
jtoyyes, its just [a,b,c,d] , and the data for those columns are objects, when those objects are displayed with to_s and display numbers usually
halorgiumdo these columns change? if not, why not have the struct as a class you can use for all "lines"
AnalphaBestiedont use a struct but a class with attributes in your case
halorgiumwhere is the column data stored?
it seems really weird dynamically changing the column names
jtoyhalorgium: the columns change all the time
so sometimes its [a,b,c,d], and then the next report could be [g,d,f,r]
are you saying just making one big struct with all the fields, and jsut use the fields that are requested at that time?
halorgium: the column data is stored in def columns
halorgium: thanks for the help
ocherhi, what is the best way to convert hash to string which will be evaluated later by module_eval?
apeiroswhy would you do that?
ocheri have class method called owner: def owner(eval_owner, action_owners = {})

Page: 2 9 16 23 30 37 44 

IrcArchive

NY Lost Funds