ght

Activity Graph

Page 1 of 8 | Next »

2015-10-13

[07:51:57] ght: Remote host closed the connection

2015-10-05

[15:51:50] ght: Question: I have a Ruby 2.2 application that uses XMLRPC client, and I have the XMLRPC call surrounded in a begin/resuce block, and the rescue is for SocketError, XMLRPC::FaultException => e
[15:52:20] ght: And that normally works good, except, it looks like that XMLRPC call is periodically generating "Error: Authorization failed. HTTP-Error: 401 Unauthorized"
[15:52:42] ght: I've been researching and can't seem to find it - how does one rescue such errors for XMLRPC::Client?
[15:55:39] ght: jhass: "Error: Authorization failed. HTTP-Error: 401 Unauthorized"
[15:56:00] ght: I need to be able to rescue that and let the application continue executing as I do with SocketErrors and FaultExceptions
[15:56:09] ght: Yes, there's a backtrace that leads to that specific XMLRPC call.
[15:56:28] ght: where I'm rescuing SocketErrors and FaultExceptions
[15:56:37] ght: but apparently not this
[15:57:03] ght: Well, it's proprietary code, I'd have to modify it.
[15:57:27] ght: But the point being, this exception should be caught by rescuing SocketErrors and XMLRPC::FaultExceptions?
[15:57:43] ght: It's coming from a cron job
[15:57:50] ght: I don't see the exception class specified
[15:58:25] ght: Interesting, ok
[16:03:09] ght: jhass: Here's the backtrace as provided in the local user account's mailbox, since cron generates an email to that user if a job's exit status is error:
[16:03:13] ght: Backtrace: ["/home/tzrd/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/xmlrpc/client.rb:491:in `do_rpc'", "/home/tzrd/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/xmlrpc/client.rb:286:in `call2'", "/home/tzrd/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/xmlrpc/client.rb:267:in `call'"
[16:03:47] ght: and the error is "Authorization failed. HTTP-Error: 401 Unauthorized".
[16:03:52] ght: If that is of any use to you.
[16:04:26] ght: And this is an XMLRPC::Client call that is called over and over, and works 99% of the time, it just happens that at some point, the API provider is down or returns that for whatever reason.
[16:04:53] ght: Interesting
[16:05:19] ght: So I need to rescue RuntimeError within the begin rescue block surrounding the client call to ensure this exception is handled?
[16:05:22] ght: That seems broad
[16:05:52] ght: I need the app to keep rolling, not crash, as I do with SocketErrors and FaultExceptions
[16:06:56] ght: for what it's worth, this should not be occurring. I always assumed it was the API provider barfing, but this XLMRPC::Client call is called over and over to the same provider with the same credentials, and out of nowhere returns that.
[16:12:45] ght: So this discussion about rescuing a specific exception class within my Ruby code is off-topic to Ruby?
[16:13:26] ght: There's always an issue.
[16:14:07] ght: I see, thank you.
[16:15:17] ght: So, since I'm at the mercy of XMLRPC::Client here and, even though it probably shouldn't be, it's raising RuntimeError when it hits a 401 unauthorized, is it safe to say that I should simply add RuntimeError to my rescue block to allow code execution to continue?
[16:15:50] ght: Or will that cose other problems in case other aspects of the program fail? It's a small begin / rescue block, it simply encompasses the XMLRPC::Client call itself
[16:16:45] ght: No doubt.
[16:17:43] ght: Yes, well normally, the only exceptions I seem to encounter with XMLRPC::Client are SocketError and XMLRPC::FaultException
[16:18:06] ght: but for some reason, this generic RuntimeError pops up from time to time. Not sure why the API provider randomly returns a 401 unauthorized, but, there you have it.

2015-10-01

[04:01:44] ght: Question: I want to check if a number is within a range, such as 1..3
[04:01:55] ght: I know with case, it's when 1..3
[04:02:04] ght: can you simply do if x == 1..3
[04:02:11] ght: Or what would the syntax be for that?
[04:02:25] ght: instead of having to write "if x == 1 || x == 2 || x == 3"
[04:03:31] ght: so if (1..3).include?(x)
[04:03:43] ght: Thank you, very helpful.
[04:04:18] ght: What would the syntax for cover be in this scenario?
[04:04:44] ght: lol, ok. Thank you.

2015-09-29

[00:15:03] ght: Question: on an old Rails 3.2 site, is it possible to have a link_to link that opens in the same tab?
[00:15:20] ght: So that it leaves the current page and opens a new page in the same tab? By default, it's generating a new tab.
[00:15:29] ght: Is it possible to force the browser to behave that way?
[00:18:40] ght: bricker: I see, thank you.
[00:24:36] ght: bricker: Sorry if a bother, but it's not working. This old site is on Rails 3.2, if that matters. We've tried appending :target => "_blank" and :target => "blank" and neither work, it generates a new tab and opens the link.
[00:24:41] ght: Is there something we could be missing?

2015-09-28

[22:56:15] ght: Question: When working on an old Rails 3.2 site, we want to ensure that blank isn't allowed in a field "name". What's the model validator on Rails 3.2 for that?
[22:56:44] ght: Sorry, my client may have sent that last sentence twice.

2015-09-17

[08:06:19] ght: Ping timeout: 250 seconds
[09:44:19] ght: has joined #ruby
[09:44:19] ght: has joined #RubyOnRails

2015-09-13

[00:45:20] ght: Question: What would the validates_format_of command be to not allow spaces on a string?
[00:45:28] ght: The site in question is rails 3.2
[00:46:26] ght: Sigma00: perfect, thank you
[00:46:51] ght: One last question regarding this: Is it possible to specify the error message returned as "spaces not allowed"?
[00:47:06] ght: Or will Rails autodetect that and send that error accordingly on model validation?
[00:50:13] ght: Sigma00: Brilliant, thank you sir.

2015-08-31

[18:37:12] ght: Afternoon, gentlemen.
[18:38:20] ght: That's a good question jhass, excusing the Tumblr-like SJW mindset, are there actually any women in here right now?
[18:38:57] ght: Haha, will do.

2015-08-30

[04:39:56] ght: Evening guys.
[04:41:04] ght: I'm bored, late night coding this Ruby project.
[04:41:22] ght: No one to talk to, wife is out at her birthday party, kids are asleep, all my friends are asleep.
[04:41:28] ght: So, figured I'd give old #ruby a shot.
[04:42:32] ght: Haha, wow.
[04:42:47] ght: Didn't realize we were rolling SJW in #ruby.
[04:42:51] ght: That's fine, I'll keep it to Ruby questions.

2015-08-29

[18:44:09] ght: Question: We're attempting to utilize a check_box_tag and the box being checked is successfully passing true, but when the box is unchecked nothing is passed, which is apparently an issue.
[18:44:48] ght: Assuming our check box tag is check_box_tag "Value", true, model.column
[18:45:19] ght: What would the syntax be for passing true if checked and false if not? Note that we have to use check_box_tag, not f.check_box
[18:55:52] ght: Good heavens we cannot get check_box_tag to work right with boolean values.
[19:01:25] ght: Fixed it with the hidden_field_tag solution.
[22:59:34] ght: I have a question. When using the mysql2 gem, you have to set cast_booleans to true when executing a MySQL query to utilize stored boolean values.
[22:59:50] ght: Otherwise, the stored boolean values will appear as what they literally are, tinyint values of 1 or 0.
[23:00:14] ght: My question is, why on God's green earth is it not a default to cast_booleans as true, and one would have to specify cast_booleans to false to override?
[23:00:30] ght: When the hell would anyone ever really want to store and utilize tinyint values for anything other than boolean?
[23:01:06] ght: Why on God's mostly blue earth then.
[23:01:11] ght: I'm just curious, the logic defies me.
[23:01:18] ght: What a random ass thing for me to have to research.

2015-08-28

[04:45:37] ght: So gentlemen, what's the word on Rails 5?

2015-08-26

[18:34:46] ght: Question: Assuming that commcheck_start_dt is a DateTime object, and user_profile["dates"]["tz"] is an ActiveSupport::Timezone object, would the following if condition accurately ensure that the date represented...
[18:35:03] ght: in commcheck_start_dt is either the same day or in the future relative to user_profile["dates"]["tz"} -
[18:35:06] ght: commcheck_start_dt.year >= user_profile["dates"]["tz"].now.year && commcheck_start_dt >= user_profile["dates"] && commcheck_start_dt.day >= user_profile["dates"]["tz"].now.day
[18:35:38] ght: Well, I should say:
[18:35:40] ght: if commcheck_start_dt.year >= user_profile["dates"]["tz"].now.year && commcheck_start_dt >= user_profile["dates"] && commcheck_start_dt.day >= user_profile["dates"]["tz"].now.day
[18:36:06] ght: damnit, I fucked that up.
[18:36:07] ght: One second.
[18:36:38] ght: if commcheck_start_dt.year >= user_profile["dates"]["tz"].now.year && commcheck_start_dt.month >= user_profile["dates"]["tz"].month && commcheck_start_dt.day >= user_profile["dates"]["tz"].now.day
[18:36:55] ght: unver: Thank you, I assume you mean date ranges?
[18:37:48] ght: Hmm, I've never used DateRange()
[18:38:17] ght: So, with those conditions, how on earth would DateRange apply to this situation?
[18:38:19] ght: I'm reading about it now.
[18:38:40] ght: commcheck_start_dt is a DateTime object, and user_profile["dates"]["tz"] is an ActiveSupport::TimeZone object.
[18:39:00] ght: I just need to check to ensure commcheck_start_dt is either the current date or in the future relative to user_profile["dates"]["tz"]
[18:41:32] ght: My initial thought is simply to check whether or not the year, month, and day are >=
[18:41:39] ght: I figure if all of those conditions are met then it will be in the future, no?
[18:41:50] ght: So forgetting about cleaning up the interface, just to check and ensure the logic will work.
[18:42:01] ght: if commcheck_start_dt.year >= user_profile["dates"]["tz"].now.year && commcheck_start_dt.month >= user_profile["dates"]["tz"].month && commcheck_start_dt.day >= user_profile["dates"]["tz"].now.day
[18:42:01] ght: Will that statement work for ensuring this conditon?
[18:42:25] ght: will that ensure commcheck_start_dt is either the same day or in the future realtive to user_profile["dates"]["tz"]?
[18:42:40] ght: I know the .now.year and all those are correct, I'm just asking about the logic
[18:42:49] ght: becuase they're of two different types
[18:42:56] ght: one is DateTime, one is ActiveSupport::TimeZone
[18:43:08] ght: I could create a supplemental DateTime Object and then >= I suppose
[18:43:25] ght: do what?
[18:44:31] ght: Ok, I'll do that then, thank you
[18:55:14] ght: The fuck was that about?
[18:55:20] ght: What a clever guy.
[18:55:29] ght: Was that a disgruntled Python user?
[18:57:00] ght: shevy: fair point.

2015-08-25

[00:50:20] ght: Indeed, sir.
[00:54:28] ght: Question: I cannot, for the life of me, remember the syntax for ensuring the currently-saved value is selected by default on a form_for .select when using options_for_seoect.
[00:54:54] ght: Example: f.select :myvalue, options_for_select([["One", 1], ["Two", 2]])
[00:55:06] ght: Anyone?
[00:57:02] ght: That helps narrow it down, thank you Radar.
[00:58:20] ght: So the issue being, it's not iterating through a collection, I'm using the cocoon gem which allows for the dynamic addition of rows in an HTML table.
[00:59:24] ght: as I recall, the syntax is akin to f.select :myvalue, options_for_select([["One", 1], ["Two", 2]], {}, something_referencing_parent_object)
[01:04:57] ght: Got it.
[01:05:13] ght: If anyone is curious, the solution is to specify :selected => f.object.myvalue
[01:07:14] ght: How is asking if anyone is aware of the answer to the question specified angering?
[01:07:29] ght: "Anyone?" is short for "is anyone aware of the solution?"
[01:11:38] ght: Rules -4.
[01:12:19] ght: haha, no.
[01:12:24] ght: I was not aware of rule -4.
[01:12:31] ght: Is that like Super Mario Bros level -1?
[01:28:00] ght: "Any ideas?" apparently falls under the category of "begging / pleading".
[01:28:14] ght: Sounds like a normal suffix to a question, but, so it goes.
[01:29:06] ght: "Begging / pleading" would be "For the love of God people, does anyone have any ideas? I'll do anything, I'll name my next kid <insert_nick> after you, whatever it takes"
[01:29:24] ght: That's more "begging / pleading". "Any ideas?" or "Anyone?" is normal conversation.
[01:29:32] ght: But me, personally, I'll adhere to rule 10 henceforth.
[01:54:57] ght: Is the current version of Ruby still considered slow relative to PHP and Python?
[01:58:09] ght: shevy: Thank you. I was just reading the same.
[01:58:15] ght: https://www.amberbit.com/blog/2014/9/9/ruby-the-bad-parts/
[01:58:20] ght: http://www.isrubyfastyet.com/
[01:58:23] ght: Those were interesting.
[01:59:50] ght: Just in case your'e talking to me, from the first link:
[01:59:52] ght: "However, one might argue that it???s like comparing apples and oranges. It would be more fair to compare Ruby with another language of similar nature. A great candidate for such confrontation is Python. It???s a dynamically-typed, interpreted language, just as Ruby. In the distant, ancient times of Ruby 1.8, the faster of two languages was Python. The difference wasn???t nearly as huge as with C++, but it was there. However, the Release of version 1.9 o
[02:00:11] ght: I"m sure that was cut off, but basically it says what you said, taht Ruby was slow back in 1.8, slower than Python, but has been speeding up with each release.
[02:42:11] ght: So we just landed our first cross-platform mobile app client, and considering all the work we do in ruby and RoR, I was considering using RubyMotion for the app development.
[02:42:25] ght: Any of you guys work with RubyMotion much for cross-platform app dev? The app isn't very complicated.
[02:43:07] ght: Anyone here have any general thoughts or feedback on RubyMotion? Any professional experience utilizing it?
[02:43:51] ght: pipework: Thank you for the feedback, care to elaborate?
[02:43:55] ght: You don't support their model? What do you mean?
[02:44:25] ght: On one hand, it looks nice on the surface, on the other I notice the community isn't massive, which is a little disconcerting, we like a large, active community when possible.
[02:44:35] ght: Which is why Rails was attractive.
[02:44:39] ght: pipework: You do, yes.
[02:44:42] ght: So that's the issue?
[02:44:58] ght: I see, thank you.
[02:47:45] ght: hmm, ok.
[02:48:02] ght: Ox0dea: Do you have or does anyone you know have experience with RubyMotion/
[02:48:17] ght: No worries, thank you.
[03:28:18] ght: At some point I need to sit down and memorize regex.

2015-08-24

[02:17:29] ght: Question: I was told previously that if you use a conditional statement with ||, where you're checking if one or the other statement is true, if the left statement is true Ruby will not evaluate the right statement.

2015-08-22

[04:02:43] ght: Evenin gguys

2015-08-21

[21:41:42] ght: You doing the whole leap year check?
[21:41:55] ght: hyy: I have code where I did this manually, hang on.
[21:43:06] ght: hyy_: Here you go - https://gist.github.com/anonymous/78511251e81fa031bc67
[21:43:16] ght: That's some old code, now I just use DateTime / Date objects.
[21:43:28] ght: But back before I knew to do that, I did a lot of manual date manipulation.
[21:43:46] ght: when 2 is when month is 2, to determine how many days are in feb
[21:46:53] ght: I not know computer pls to halp
[21:47:15] ght: The "hackery"
[21:47:40] ght: You mean deploying a remote ssh tunnel listening on 443/tcp so that sysadmins think you're just grabbing https traffic?
[21:47:49] ght: Which is what I did previously to bypass our content filter.

2015-08-19

[00:48:36] ght: Ruby can't fail? Is there talk of Ruby failing?
[00:51:10] ght: ACTION 's head explodes
[00:52:07] ght: ACTION is away - dead
[00:53:01] ght: I've heard the buffalo thing, yes.

2015-08-18

[00:38:19] ght: You know, it's funny, when we set out on the app building wing of our company, we were choosing between base languages: Phython, PHP, and Ruby
[00:38:51] ght: and it never ceases to amaze me how the Python guys try to act elitist, despite it being, from all accounts, more simplistic than Ruby.
[01:54:42] ght: What's the exact error?
[01:59:29] ght: How did you install it?
[01:59:52] ght: The su - and gem uninstall bundler
[02:00:22] ght: Unexpected racisim from PeteRoss.
[10:15:47] ght: Question: MySQL saves these boolean values as 1 if true and 0 if false, yet when I load them, == true or == false fails
[10:15:57] ght: but == 1 or == 0 works, of course.
[10:16:11] ght: Is there some other method I should be using for boolean values with the Mysql2 gem to confirm true or false?
[10:16:14] ght: besides == 1 or == 0 ?
[10:17:58] ght: Looks like you use this: :cast_booleans => true
[10:18:00] ght: When executing the query.
[10:32:30] ght: Question: I have an array that looks like this: [{"id" => 1, "cl_id" => 15}, {"id" => 2, "cl_id" => 22}, {"id" => 3, "cl_id" => 82}]
[10:33:04] ght: I was wondering, without having to loop through the array until you hit a match, is there a Ruby command to simply look for the array element with the "cl_id" value 82?
[20:24:07] ght: Question: I have an array that looks like this: myArr = [ {"id" => 1, "cl_id" => 12}, {"id" => 2, "cl_id" => 28}, {"id" => 3, "cl_id" => 93}]
[20:24:38] ght: Is there a technique for pulling the array element that contains "cl_id" => 93 without having to iterate through the array itself?
[20:24:44] ght: Or the array index, rather.
[20:25:05] ght: Ok, I'll read up on that, thank you.
[21:31:34] ght: Question: I have an array formatted as myarr = [{"GroupName"=>"MyFirstGroup", "Id"=>114}, {"GroupName"=>"Interest - Email", "Id"=>101}, {"GroupName"=>"New Customer", "Id"=>102}, {"GroupName"=>"New Lead", "Id"=>135}]
[21:32:01] ght: and I have another object with a string, mystring["notes"] = "Here are a bunch of notes. That includes Interest - Email."
[21:32:24] ght: What is the best way to see if any of the "GroupName" fields match a string within mystring["notes"]?
[21:33:07] ght: Normally, I would .each through myarr and see if mystring["notes"].include? the object in that iteration of the each loop.
[21:33:14] ght: Hmm, .any? I'll look that up.
[21:58:00] ght: jhass: I've been researching .any? and testing it in irb, and I'm so far unable to utilize it in the manner needed.
[21:58:03] ght: Not sure what I'm missing.
[21:58:07] ght: Here's a gist of my exact issue: https://gist.github.com/anonymous/e02ba24385664eb6e340
[21:58:42] ght: Right, I'm just not sure how to use it in my specific situation.
[21:59:33] ght: Is the way I'm searching for the match already a properly efficient way?
[21:59:38] ght: The .each loop in that gist?
[21:59:54] ght: jhass: Ok, will give that a shot, thank you.
[22:00:04] ght: shevy: That's what I was thinking, yes.
[22:00:11] ght: I figured this wasn't the most efficient way.
[22:02:24] ght: Heavens, what the crap is the syntax in this situation.
[22:03:15] ght: Awesome, thanks jhass.
[22:08:37] ght: jhass: My last question on the matter, is, I need to be able to perform operations on the individual matches from the .any? call. Is that possible?
[22:08:56] ght: For example, if two "GroupName" entries match, for each one I want to perform operations.
[22:12:40] ght: jhass: .select worked perfectly, thank you
[22:13:45] ght: Question: If you write logger.debug() statements throguhout your code, then later set your LOG_LEVEL to Info so these debug messages are not output, do those logger.debug statements simply being present in the code slow down execution in any way?
[22:16:12] ght: Got it, thank you.

2015-08-17

[08:08:07] ght: Ping timeout: 260 seconds
[08:32:17] ght: has joined #ruby
[08:32:17] ght: has joined #RubyOnRails
[15:18:16] ght: Question: Anyone familiar with what the syntax might be for utilizing the |response, request, result, &block| format with RestClient in Ruby on POST or PUT statements?
[15:18:27] ght: It's working fine when using on GET, and there are dozens of examples when using GET
[15:18:35] ght: but I can't determine the syntax for POST or PUT
[15:19:06] ght: And because of this RestClient is throwing exceptions with 4XX HTTP codes on POST, and I could encase the entire thing in a Begin Rescue block
[23:40:51] ght: How's it going?
[23:41:20] ght: FYI, if any of the guys who were working with me on manual GC utilization last night, I implemented it on an old Ruby 2.0.x app that normally uses quite a bit of RAM.
[23:41:44] ght: It has a throttling engine, I set it so that it runs GC.start on throttle implementation, so it only runs after X number of API calls
[23:41:54] ght: And the RAM usage has shown dramatic improvement.
[23:42:00] ght: So thank you, that was great advice.

2015-08-16

[06:32:56] ght: haha, ok.
[06:33:05] ght: Thank you Ox0dea.
[06:49:33] ght: Question: if you declare a hash like myhash = { "Val1" => 100, "Val2" => nil, "Val3" => 200 }, will a GC.start elimnate the "Val2" element of the hash, or does the Val2 element really exist at all in the first place?
[06:49:42] ght: eliminate*
[06:52:21] ght: [k-: Thank you
[06:54:10] ght: I see, very nice, thank you Ox0dea.
[06:54:23] ght: It's very nice of you Ruby experts to hang around and help up-and-comers like myself.
[06:54:35] ght: Saves me hours of research sometimes, so really, thank you.