dominikh changed the topic of #cinch to: The IRC Framework | Latest version: Cinch 2.1.0
Dwarf has quit [Read error: Connection reset by peer]
Dwarf has joined #cinch
Dwarf has quit [Ping timeout: 245 seconds]
Dwarf has joined #cinch
kludge` has quit [Disconnected by services]
kludge` has joined #cinch
michal_papis has joined #cinch
mpapis has quit [Ping timeout: 240 seconds]
michal_papis is now known as mpapis
v0n has quit [Ping timeout: 240 seconds]
v0n has joined #cinch
cyrusdavid has quit [Ping timeout: 240 seconds]
cyrusdav- has joined #cinch
dentarg has joined #cinch
rikai has quit [Quit: No Ping reply in 180 seconds.]
rikai has joined #cinch
rikai has joined #cinch
postmodern has joined #cinch
<dentarg> cinch, heroku and ENV variables, someone got it working?
<dentarg> I get the same behaviour as resure at http://irclog.whitequark.org/cinch/2013-08-24
<dentarg> really strange
<dominikh> never used heroku, sorry
postmodern has quit [Quit: Leaving]
Azure has quit [Ping timeout: 264 seconds]
Azure has joined #cinch
Azure has quit [Quit: Textual IRC Client: www.textualapp.com]
Azure has joined #cinch
Azure has quit [Client Quit]
Azure has joined #cinch
Azure has quit [Client Quit]
Azure has joined #cinch
Azure has quit [Client Quit]
Azure has joined #cinch
Azure has quit [Quit: Textual IRC Client: www.textualapp.com]
Azure has joined #cinch
Azure has quit [Client Quit]
Azure has joined #cinch
xeviox|afk is now known as xeviox
kludge` has quit [Ping timeout: 245 seconds]
kludge` has joined #cinch
leftylink has quit [Quit: reboot recommended]
leftylink has joined #cinch
Dwarf has quit [Remote host closed the connection]
nOgAnOo has joined #cinch
nOgAnOo has quit [Excess Flood]
nOgAnOo has joined #cinch
nOgAnOo has quit [Excess Flood]
nOgAnOo has joined #cinch
ayonix has quit [Remote host closed the connection]
ayonix has joined #cinch
Dwarf has joined #cinch
xeviox is now known as xeviox|afk
cloud|nix has joined #cinch
cloud|nix has quit [Read error: Connection reset by peer]
geopet has joined #cinch
<CM-Punk> If I'm reading from a field in a JSON file and I need the code to see if the contents on the field match one or another like this(I know this is wrong, but that's why I'm asking you and I hope you can figure it out by what I'm doing): if mood == ('happy'|'joy') where mood was earlier defined as the JSON field)
<CM-Punk> How do I do this?
<CM-Punk> Bascially I'm trying to match a JSON field with one variable or another
<catepillar> couple of ways to do it
<catepillar> the "traditional" would be
<catepillar> if mood == 'happy' or mood == 'joy'
<CM-Punk> OH
<CM-Punk> Okay
<catepillar> i might do something like
<catepillar> if ['happy','joy'].include? mood
<catepillar> makes it easier to maintain if you need to add more
<CM-Punk> Right
<CM-Punk> catepillar, that's second method gives me an argument error
<catepillar> it might be contain? instead of include
<catepillar> no, it's definitely include
<catepillar> working just fine for me
<CM-Punk> Here, I'm actually working on AI for my bot, so let me give you the code that I have here...
<CM-Punk> http://pastie.org/private/z6l9dnorewnnbvazooaa Let me know if you need to see check_sexuality catepillar
<CM-Punk> This is simply a test plugin so I can integrate everything into the bot's AI plugins later
<catepillar> i assume the error is at 71?
<CM-Punk> Yeah
<catepillar> there is an error at 67
<catepillar> you didn't provide any arguments for the include?
<CM-Punk> I was....
<CM-Punk> Shit
<CM-Punk> Hold on
<catepillar> also your tabbing is a bit off
<CM-Punk> Okay, so I added the arguments to 67. Bot is 'bi' user is 'female' and bot is 'female' but I'm getting the rescue at the then
<CM-Punk> end*
<CM-Punk> Also, how is my tabbing off? I am really trying to learn formatting
<CM-Punk> Here's the updated code
<catepillar> your return statements are always decreasing a tab level
<catepillar> which then throws off you end's
<catepillar> also semi-colons are unneeded in most circumstances
<CM-Punk> Oh
<catepillar> line 75 & 76 are a logic error
<catepillar> they probably aren't compatible
<catepillar> this should work
<catepillar> provided all unseen methods are defined and correct
<catepillar> you do have some ends at the end of the file that i dont think belong
<CM-Punk> Well, if I remove any it tells me unexpected end of input
<catepillar> this is where your tabbing being off makes it hard to tell
<CM-Punk> Hold on
<CM-Punk> Let me see
<CM-Punk> http://pastie.org/private/pqzkjbgeoueuv1542p2gca Here is the updated code catepillar
<catepillar> ahh
<catepillar> the problem is the determine_sex function
<catepillar> if else block doesn't have a end
<CM-Punk> sexes
<CM-Punk> Oh
<leftylink> ctor indentation too deep
<catepillar> here is everything fixed and indented properly
<CM-Punk> I am still getting an incompatible
<catepillar> post the error up
<CM-Punk> Well it's not an error
<CM-Punk> [14:07:20] <Victoria> I am a bi female and you are a female...
<CM-Punk> [14:07:21] <Victoria> We are not compatible.
<leftylink> found the bug
<leftylink> 2.1.1 :008 > a = 1 => 1
<leftylink> 2.1.1 :009 > puts "TRUE" if ([1, 2].include? a && 3 == 3) => nil
<leftylink> but what about this?
<leftylink> 2.1.1 :011 > puts "TRUE" if ([1, 2, true].include? a && 3 == 3)
<leftylink> that prints "TRUE"
<catepillar> that should print true...
<catepillar> a=1, right?
<leftylink> so what?
<leftylink> oh, yes
<leftylink> a = 1
<leftylink> I set that right before
<leftylink> puts "TRUE" if ([1, 2].include? a && 3 == 3)
<leftylink> that prints nothing
<leftylink> see why?
<CM-Punk> I don't see why, no
<CM-Punk> But I'm just...you know...new
<CM-Punk> XD
<leftylink> what is the difference between [1, 2] and [1, 2, true]?
<CM-Punk> But isn't that asking it to look for 'true'?
<leftylink> exactly.
<leftylink> it's checking if true is in the list
<leftylink> clearly not what you want.
<catepillar> ahhhh
<catepillar> ([1, 2].include? a) && 3 == 3
<catepillar> works
<leftylink> ...
<leftylink> why not [1, 2].include?(a)
<catepillar> or that
<leftylink> this is why I do not favor method calls without parentheses. although I still use puts without parentheses
<catepillar> also, using 'and' instead of '&&' works
<CM-Punk> That works
<CM-Punk> :D
<leftylink> 'and' vs '&&' is an interesting thing. I know rightyrei has been bitten by that very bug. let me see if I can find it
<leftylink> or it was an 'or' vs '||' bug
<leftylink> either way, since that happene dI stopped using 'and' and 'or' for boolean checks
<leftylink> even though, irnoically, using 'and' here would help, not hurt
<CM-Punk> Updated it to 'and', still works
<catepillar> i exclusively use and and or
<CM-Punk> Thanks guys
<CM-Punk> Hey
<CM-Punk> Would
<leftylink> dammit, it is pretty hard to search through commit logs for "and" and "or"
<leftylink> to see where my bug was
<CM-Punk> if (['straight','bi'].include?(botSexuality) and sexes == 'different') or (['gay','bi'].include?(botSexuality) and sexes == 'same') or (botSexuality == 'straight' and sexes == 'different')
<CM-Punk> Would that work?
<CM-Punk> Instead of having tons of ifs?
<leftylink> catepillar: my bug would have been related to having something like `a = false or true`
<leftylink> do that, then see what the value of a is afterward
<leftylink> that's why I always use && and ||
<CM-Punk> So would my idea work?
<leftylink> CM-Punk: isn't the third part of the disjunction subsumed by the first?
<CM-Punk> Oh yeah
<CM-Punk> It would be
<CM-Punk> lul
<leftylink> my answer to the question that incorporates my laziness and my desire to see people test their code would be "why don't you write tests for it and then you can refactor at will"
<leftylink> also, related bug using `and` would be `a = true and false`
<leftylink> guess the value of a after executing that
<cout> leftylink: Errno::ENOENT: No such file or directory :)
<catepillar> leftylink, why would you be doing a `a=true and false` to begin with
<catepillar> but everything i got was a return value of false stored to a
<leftylink> catepillar:
<leftylink> wrong
<leftylink> check a again
<leftylink> the return value is not the value stored to a.
<leftylink> and of course I'm not actually doing a = true and false, I'm doing a = complicated_expr1 and complicated_expr2
<leftylink> where complicated_expr1 evaluates to true and compliated_expr2 evaluates to false
Dwarf has quit [Ping timeout: 264 seconds]
<catepillar> see i actually prefer the behavior of `a = true and false`
<leftylink> ok then
<leftylink> it didn't suit my needs
<leftylink> I definitely need a to be false and not true when doing this, so I have to use &&
<leftylink> but there are instances where 'and' is useful, and I guess you found them
<catepillar> well, i suppose i rarely do assignments like that
<catepillar> but in actual if statements the and makes more sense to me
<leftylink> reminds me of python, which is why I used it at first
Dwarf has joined #cinch
postmodern has joined #cinch
<CM-Punk> Okay, maybe a third mind can help out on this
geopet has quit []