@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5



Comments:

<0> Well, maybe, we're not sure if we can help you or not. You gotta show us some code (in a pastebin not on irc) and ask a more specific question. =)
<1> Ok -- It's just a complicated one hangon
<1> http://pastebin.ca/90602
<1> That's my code -- what it does is it checks whether a pharmaceutical name is in a string
<1> I want to produce a list of only the unique strings -- so that any given pharmaceutical name can't appear twice
<1> ((String)formularies.get(y))
<1> That is the array of pharmaceutical names
<1> results_uniques looks something liek this:
<1> "2002-01-00858","Pegylated interferon alfa and ribivirin (48 wks)","Interferon alfa and ribavirin (48 wks)",100000
<1> You with me Zenethian?
<2> J_A_M, use a Set
<1> A set won't help in this case
<1> The string's are not identical..only parts of the string are the same
<1> And not the same parts each time, so I can't use substring
<0> regular expression time.
<3> use a net.tmorris.adt.set.Set



<1> Zenethian - what's the best way to do this with regex?
<3> don't interate a list by performing a random access each time
<3> *iterate
<1> Well, how else?
<3> I have rewritten net.tmorris.adt.set.Set - I have it here and it is much better
<3> use an Iterator
<3> get(int) is O(n)
<0> why not construct a list of the relevant parts using an iterator?
<3> so iteration is O(n^2)
<1> Well, the relevent parts are all over the place.
<1> IT could be @ any part of the string really
<0> Oh
<0> then how do you know how to compare them?
<3> com.contractualj.adt.set.Set allows you to specify the "equaling" strategy
<1> Because of the drugname they have in common
<1> the formularies.get(y)
<0> and how do you know what the drug name is?
<1> an arraylist
<0> Okay
<1> So do you see what I'd like to do?
<0> So what's the problem?
<1> My code doesn't work.
<1> hehe
<0> you iterate the list, find out which drug it is, lookup the details of how to find the substring you need, apply the substring, check it against a list, if it exists in the list discard, otherwise append. Voila.
<1> I use contains
<1> Should I be iterating the formularies array?
<0> Then what the hell is a problem?
<0> lol
<0> if you iterate over it
<1> I don't know.
<1> It's not working
<1> It's ONLY returning results that occur once.
<3> debug it
<1> I'vebeen trying
<3> with a debugger
<1> I have one..
<1> It doesn't help
<3> nonsense, it should take a few seconds
<0> dude
<3> it's pretty obvious to me anyway
<0> just throw your code away
<0> and start over
<1> Ok
<0> lol
<3> what Zenethian said
<1> So should I iterate over the formulary list?
<1> Or the results list
<0> Why do you add all of them to an array, and then backpedal them back off?
<1> Well, I have a lot of things im doing in the code
<3> here's a hint, which isn't exactly nice, but will help your situation - have one for loop per method
<1> I have unique results, studies results, and ratios results
<1> So I have 3 results, all stemming from one original arraylist
<0> WHy are they all in an array? Why not make a cl*** for your data?
<1> It's easier this way
<0> overall your design is way too linear
<0> Obviously it isn't.
<1> You only saw one part of the code.
<1> You saw a tiny tiny part
<0> Yeah, which makes me think the whole thing is designed very very poorly.
<1> Not really..
<1> There's nothing wrong with it, everything else works except this function



<0> You have a ton of data where the only thing that even makes any sense of them is an array position, which is instantly bad mojo.
<1> What else can I do?
<1> other than arraylists
<0> All three points of data are related, right?
<1> Yeah
<0> I really don't understand your code at all. You iterate through results_uniques twice,
<1> Ok, well i'll explain that
<1> The first one is to populate the results_uniques list
<1> Second one is to remove duplicates
<1> Then i'm left with a list of unique results
<0> This would seem so much easier if you used something that didn't allow you to add a value once it's there, like a HashMap
<0> don't remove duplicates
<1> Why?
<0> build lists of uniques
<1> Ok
<0> As you iterate through your whole list
<0> Catalog each unique you see
<1> That's what the problem is: I got stuckt here
<1> As you saw in the code I showed you
<1> I don't really know how to use iterator's very well - how do I say something like formulary.get(y)
<0> you don't. That's why it's an iterator.
<0> an iterator loops linearly
<1> But that's not what I want then
<0> it doesn't provide random access.
<1> IT won't accomplish what I need to do
<1> I need to iterate through 2 lists @ same time
<1> Maybe I can ..
<0> how do you know what formulary you need then?
<1> I don't *Need* any
<0> where does that come from?
<0> then why are you using them?
<1> formulary = arraylist of drug names
<0> yeah
<1> I need to make sure that my strings are all unique
<1> Based upon the drug names
<0> okay
<0> DO you discard the un-unique ones?
<1> So, I want a list where no 2 drugnames are found
<1> Yes
<1> That's what i've been doing
<0> So the first one you encounter is the one kept, and all others are discarded.
<1> See, that's the problem.
<1> It's not keeping the first one I encounter for some reason.
<1> Probably because of the way I was looping through it
<0> yeah
<0> you have one too many loops
<1> Can you explain how i'd do this properly?
<0> Make an EMPTY arraylist called results_uniques
<1> yep
<0> better yet
<0> make it a hashmap
<0> so you can test it.
<0> or a Set
<1> Wait, one thing:
<0> or something
<1> The results_uniques has to come from somewhere..
<0> it will.
<1> No, I mean..
<0> oh wait
<1> I'm matching against something
<1> from formulary
<0> no you aren't.
<1> If I have an empty results_unqiue..
<1> what am I checking duplicates?
<0> you'll be matching results_studies
<1> lol
<1> yeah
<1> that'd work too
<0> all you do
<0> is copy results_studies into results_unique
<0> and then you try and subtract
<0> that's very backwards
<1> ok
<0> start out blank


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #java
or
Go to some related logs:

#kl
#kl
#c++
#allnitecafe
how to draw a line and find coordinate of that line in vc++
#india
#allnitecafe
#php
al sana nalet
notty sms



Home  |  disclaimer  |  contact  |  submit quotes