vtx

Activity Graph

Page 1 of 1

2018-01-17

[12:31:54] vtx: has joined #ruby
[12:33:19] vtx: hi guys, is there an idiomatic/simple way of comparing two arrays in ruby? essentially i want to check that two arrays contain the same elements, regardless of order. so [“a”,”b”,”c”] and [“c”,”b”,”a”] would be considered equal. how can i do this?
[13:00:43] vtx: Quit: vtx
[14:41:41] vtx: has joined #ruby
[14:46:33] vtx: Client Quit

2018-01-12

[10:44:31] vtx: has joined #ruby
[16:23:24] vtx: Quit: vtx

2018-01-10

[09:02:47] vtx: has joined #ruby
[15:35:37] vtx: Quit: vtx

2017-12-23

[02:15:16] vtx: Quit: vtx
[12:10:42] vtx: has joined #ruby
[12:26:40] vtx: Quit: vtx
[12:46:22] vtx: has joined #ruby
[13:25:21] vtx: Quit: vtx
[17:30:29] vtx: has joined #ruby
[17:38:11] vtx: Ping timeout: 268 seconds
[18:27:41] vtx: has joined #ruby
[18:32:01] vtx: Ping timeout: 248 seconds
[18:33:54] vtx: has joined #ruby
[18:38:35] vtx: Ping timeout: 256 seconds
[18:44:30] vtx: has joined #ruby
[18:49:28] vtx: Ping timeout: 272 seconds
[18:51:36] vtx: has joined #ruby
[18:56:56] vtx: Ping timeout: 252 seconds
[19:06:47] vtx: has joined #ruby
[19:11:27] vtx: Ping timeout: 248 seconds
[19:26:09] vtx: has joined #ruby
[19:31:11] vtx: Ping timeout: 248 seconds
[19:42:05] vtx: has joined #ruby
[19:46:41] vtx: Ping timeout: 248 seconds
[19:53:37] vtx: has joined #ruby
[19:58:10] vtx: Ping timeout: 268 seconds
[20:04:00] vtx: has joined #ruby
[20:08:31] vtx: Ping timeout: 248 seconds
[20:13:50] vtx: has joined #ruby
[20:18:46] vtx: Ping timeout: 272 seconds
[20:42:22] vtx: has joined #ruby
[22:16:59] vtx: Quit: vtx

2017-12-22

[09:50:55] vtx: has joined #ruby
[15:20:53] vtx: Quit: vtx
[15:51:10] vtx: has joined #ruby
[16:59:23] vtx: Quit: vtx
[17:33:32] vtx: has joined #ruby
[17:49:18] vtx: Ping timeout: 265 seconds
[17:58:54] vtx: has joined #ruby
[18:35:11] vtx: Ping timeout: 248 seconds
[20:21:19] vtx: has joined #ruby
[23:13:50] vtx: Quit: vtx
[23:30:15] vtx: has joined #ruby

2017-12-21

[01:23:47] vtx: has joined #ruby
[01:25:23] vtx: hi guys, has anyone here used mongodb with ruby? some of my queries take 10-20 seconds to complete, and when i have a number of queries running as part of a single request, my request takes minutes to complete. i was wondering if anyone had experience of improving mongo performance with the ruby driver? or if there are some options i can provide that will speed up my query completion time?
[02:07:14] vtx: *.net *.split
[02:51:43] vtx: Quit: vtx
[11:06:03] vtx: has joined #ruby
[11:07:15] vtx: Client Quit
[11:37:20] vtx: has joined #ruby
[11:38:42] vtx: hi guys, has anyone here used mongodb with ruby? some of my queries take 10-20 seconds to complete, and when i have a number of queries running as part of a single request, my request takes minutes to complete. i was wondering if anyone had experience of improving mongo performance with the ruby driver? or if there are some options i can provide that will speed up my query completion time?
[13:14:54] vtx: hi guys, when creating a `BSON::Regexp::Raw` instance with: BSON::Regexp::Raw.new(/^#{name}\/.*/), i get: “warning: flags ignored” how can i get rid of this warning?
[13:33:32] vtx: apeiros: sorry, i’m using it when querying my mongodb, and i guess it’s the point at which i execute my query that i get the warning
[13:35:14] vtx: apeiros: um im not sure, i’m using “require “mongo”” which i guess is the default choice?
[13:35:56] vtx: apeiros: sorry
[13:40:37] vtx: apeiros: so i have “gem "mongo", ">=2.4.3"” in my gemfile
[21:05:53] vtx: Quit: vtx
[22:14:11] vtx: has joined #ruby
[23:09:15] vtx: Quit: vtx

2017-12-17

[02:16:42] vtx: Quit: vtx

2017-12-16

[02:20:15] vtx: Quit: vtx
[13:07:57] vtx: has joined #ruby
[13:29:19] vtx: Ping timeout: 256 seconds
[13:34:07] vtx: Quit: vtx
[18:06:11] vtx: has joined #ruby

2017-12-15

[22:29:34] vtx: has joined #ruby
[22:30:20] vtx: hi guys, is there a way to find out how many unused methods i have defined in my ruby code?
[22:33:09] vtx: um, i guess i just wanted to see if i had any unused code in my project
[22:33:44] vtx: lol, i agree
[22:45:09] vtx: leitz: zenspider: baweaver: thanks everyone!

2017-12-14

[03:04:53] vtx: Quit: vtx
[10:43:05] vtx: has joined #ruby
[18:57:17] vtx: Quit: vtx
[19:18:37] vtx: has joined #ruby
[19:19:31] vtx: Client Quit
[22:10:58] vtx: has joined #ruby
[22:11:36] vtx: hi guys. is it possible to have my sinatar app store data that is avaiable across requests?
[22:12:57] vtx: Radar: ummmm i was hoping just to persist a cache of external requests, in a hash
[22:40:34] vtx: havenwood: sorry, thanks, but i got my stuff working with a class var, but thanks so much for your help!
[22:46:47] vtx: Quit: vtx

2017-12-13

[11:58:24] vtx: has joined #ruby
[11:59:31] vtx: hi guys, if i have a hash of 20 key-value pairs, how can i select a subset of the key-value pairs? e.g. i want to paginate my hash to the client, so how would i skip the first 10 keys, then get the next 5 keys, returning keys and values 10-15 to the client?
[12:28:04] vtx: Quit: vtx
[14:59:38] vtx: has joined #ruby
[16:07:01] vtx: Quit: vtx
[16:17:13] vtx: has joined #ruby
[18:22:17] vtx: Quit: vtx
[18:45:20] vtx: has joined #ruby
[20:43:05] vtx: guys are there any easy ways of measuring the performance of a sinatra endpoint? and finding out what calls take a long time to complete?

2017-12-10

[15:37:12] vtx: has joined #ruby
[15:40:41] vtx: connection is created for every request. how can i force settings.db to not reference the db via services?
[15:40:41] vtx: hi guys. i have a configure block in my sinatra app that looks like: https://gist.github.com/anonymous/3425b88a733e84b004d03a9921a43beb so, i want to instantiate services once at startup, and then set the db on my settings. so that, every time i try to use the db, only one connection is ever created, and that connection is used by all requests. however, calling settings.db seems to call into services.db every time i try to use settings.db, which means a ne
[16:03:44] vtx: guys does anyone here use mongo with ruby? my application keeps creating connections to the database instead of reusing the same connection
[16:15:03] vtx: Quit: vtx
[18:57:03] vtx: has joined #ruby
[18:57:39] vtx: guys does anyone here use mongo with ruby? my application keeps creating connections to the database instead of reusing the same connection
[19:00:02] vtx: RickHull: sorry, that’s my class
[19:00:52] vtx: so, i have API::Services as a class that contains all the code for parsing my env config, and setting up the necessary resources like loggers and in this case, a db connection
[19:01:43] vtx: RickHull: um okay, i’ve spent some trying moving stuff around, but it’s still not working, so i guess i’ll paste it anyway
[19:04:20] vtx: RickHull: so this is my config.ru: https://gist.github.com/anonymous/75a221227555732eb9afbca638e50712
[19:04:47] vtx: i’ve moved all the stuff around setting the db on the application into config.ru, so it’s completely removed from the api endpoints
[19:05:37] vtx: RickHull: i’m basing this off http://recipes.sinatrarb.com/p/databases/mongo which talks about using set to set a property on the application, which then can be access via settings
[19:06:26] vtx: so, the idea is, i create a connection at startup, and that connection gets reused for every request
[19:07:11] vtx: but looking at my mongo logs, every time i hit the endpoint, mongo prints out the number of connections, and that number continues to grow for every request
[19:14:52] vtx: RickHull: yep, but that’s jsut because later on in their code, they access database before accessing their collection name
[19:19:11] vtx: um i guess i can try, i’ve only ever set it up before with config.ru etc, but i’ll give it a go to see if it narrows down the issue
[20:26:23] vtx: RickHull: so, running the smaller example worked, i.e., multiple requests doesnt result in multiple connections, so i’m gonna try and change up my main app to be similar to see if it works
[20:29:50] vtx: RickHull: yeah, so, thinking back to it, i did the whole services api layer to enable mocking for my spec tests, i.e. because the configure block runs when the file is loaded, my expect calls weren’t able to mock the db connection
[20:32:03] vtx: gah, changing the endpoint i’m calling to access the db connection isn’t working
[20:33:55] vtx: is it possible to somehow find out what part of my code is causing the new connection to be created?
[20:44:13] vtx: oh i think i fixed it! just double checking
[21:07:44] vtx: RickHull: thanks so much for your help! i really appreciate it! \o/
[21:07:47] vtx: Quit: vtx

2017-12-07

[11:27:48] vtx: has joined #ruby
[11:28:13] vtx: hi guys, has anyone here set up sinatra endpoints over https?
[11:31:26] vtx: dminuoso: is it possible to add support for https entirely within my app code?
[11:31:42] vtx: i guess i should explain my setup
[11:54:04] vtx: serve over https if possible
[11:54:04] vtx: i have a react app that is deployed in docker, to marathon. the react app by default runs over https. i also have a sinatra app that is deployed to the same marathon instance. because sinatra is by default running over http, when the https react app requests data from its endpoints, the request fails because sinatra isnt running over https. the workaround right now, is to explicitly specify http when accessing the react app. but i guess i need to have the sinatra app
[19:00:06] vtx: Quit: vtx
[19:43:39] vtx: has joined #ruby
[19:43:47] vtx: Client Quit

2017-12-04

[16:44:46] vtx: has joined #ruby
[16:46:10] vtx: hi guys. is there a way i can get a date as “1970-01-01 00:00:00 UTC” in ruby?
[18:54:19] vtx: Quit: vtx
[19:22:22] vtx: has joined #ruby
[23:39:04] vtx: Quit: vtx

2017-11-30

[11:29:37] vtx: has joined #ruby
[11:31:10] vtx: guys does anyone here use ENV vars for configuring their ruby apps? what approach do you take for handling complex conifgurations? i have a bunch of host names and ports that i want to store in a host map. is it okay to pass this as a JSON blob to an ENV var and parse it at startup?
[11:39:27] vtx: apeiros: lol that’s what i’m reading too
[11:45:52] vtx: i think i’m gonna just pass in JSON blobs to my env :(
[12:05:00] vtx: darix: because changing it would require a new commit/PR/build?
[12:07:56] vtx: what configuration management?
[12:09:35] vtx: apeiros: yep
[13:44:58] vtx: Quit: vtx

2017-11-23

[11:33:23] vtx: has joined #ruby
[11:36:40] vtx: hi guys, does anyone here use sinatra? i’m trying to connect to a mongodb, and although i can connect, i think my client is cerating new connections for every request. looking at this recipe: http://recipes.sinatrarb.com/p/databases/mongo what does `:set` do? is it part of sinatra, or ruby in general? i currently assign my db connection as follows: `@db = mongo[database].database`, rather than using :set - is this why new connections are created for every request? w
[11:36:41] vtx: using :set solve this my ensuring only one connection is made and reused?
[11:43:21] vtx: oh, as an aside to that, maybe my code needs to do `@db ||= mongo[database].database`?
[11:43:41] vtx: tbuehlmann: is set part of sinatra DSL or is it a ruby thing?
[11:47:58] vtx: okay thank you, i really appreciate it!
[12:57:04] vtx: Quit: vtx
[13:34:50] vtx: has joined #ruby
[17:59:06] vtx: Quit: vtx
[18:58:36] vtx: has joined #ruby
[19:22:48] vtx: guys in my rspec tests, i have `allow(Mongo::Client).to receive(:new).with(any_args).and_return(mock_database_map)`, however, when i run my tests, MongoDB still attempts to connect to local host, failing repeatedly, and none of my specs are ran
[19:23:46] vtx: the line in my application that connects to mongo is `mongo = Mongo::Client.new(["#{host}:#{port}"], :database => database)` - how can i stop this from connecting? or rather, how can i tell my tests that the connection was always successful?
[19:26:03] vtx: leitz: i don’t want the database connection to happen during my tests
[19:26:10] vtx: i want to mock out the responses
[19:26:49] vtx: neither am i haha
[19:27:38] vtx: i guess it would be a nice to see what connection is actually taking place, i.e. to see if i’m missing something in my mock
[19:29:48] vtx: is there a way to have ruby print out all the calls that are happening? so i can see why my mock isnt working? or rather are there any tools that you can pass a line of ruby to, and they tell you how to mock that line?
[20:37:32] vtx: guys at what point does a configure block run?
[20:44:26] vtx: Quit: vtx
[20:50:18] vtx: has joined #ruby
[20:51:10] vtx: c-c: so, the configure block in a sinatra application?
[20:51:55] vtx: i.e. if my class extends Sinatra::Application, and that class contains `configure do…end`, at what point does that block actually run?
[21:33:55] vtx: Quit: vtx

2017-11-20

[11:58:32] vtx: has joined #ruby
[12:04:20] vtx: guys has anyone here worked with sinatra before? i’m struggling to understand what my urls should look like if i want to pass in a list of unknown length to my endpoint?
[13:40:34] vtx: adaedra: so if i have a search form, allowing users to filter on a result set, what would my endpoint look like if i wanted to filter on a string and on some check boxes being checked or not? e.g. if a user searches for “failure”, and of three checboxes, “active”, “closed”, or “deleted”, they check “active” and “closed”, i would want my endpoint to be able to search based on the “failure” string, and also for “active” and “closed”
[13:41:13] vtx: so, say my endpoint looks like /api/v1/search/:query/and/:checkboxes, how can i pass multiple values to “checkboxes”
[13:42:38] vtx: adaedra: but then wouldn’t that mean i’d have to define my search like: /api/v1/search/:query/and/:checkbox1/:checkbox2/:checkbox3?
[13:42:52] vtx: *search endpoint
[13:44:14] vtx: adaedra: how can i define a url like that in sinatra? is it like /api/v1/search/:query, and then i have to manually extract the params from :query?
[13:48:07] vtx: adaedra: thank you so much! this is exactly what i needed!
[13:49:02] vtx: Quit: vtx

2017-11-15

[11:31:44] vtx: has joined #ruby
[11:33:17] vtx: hi guys, i am trying to stub out a web request with WebMock. something i’m doing isn’t quite right, because my app seems to be hitting the back end service with a valid request. is there a way i can have WebMock print out the syntax of any requests that are happening during test execution, so i can add them to my tests and stub them out properly?
[14:25:32] vtx: Read error: Connection reset by peer
[14:28:41] vtx: has joined #ruby
[14:29:04] vtx: Client Quit

2017-11-14

[11:53:08] vtx: has joined #ruby
[11:57:39] vtx: hi guys. i am trying to mimick a request that i’m seeing in my browser. i’m using RestClient to do this. looking at the params sent in for the request i’m mimicking, some param names contain a . and a _, i.e. i have params called “_.id” and “_.name”. in ruby, i’m trying to create a hash with these same param names, e.g { :_.id => “1234”, :_.name => “myid” }, but ruby doesn’t like that my symbols have underscores and periods in them. is there
[11:57:40] vtx: way to define keys of hashes with periods or underscores?
[18:20:11] vtx: Quit: vtx
[20:43:09] vtx: has joined #ruby
[22:19:24] vtx: Quit: vtx

2017-11-01

[00:08:01] vtx: has joined #ruby
[00:11:54] vtx: hi guys, does anyone here have experience testing sinatra apps with rspec? i can test a simple /status endpoint with: https://gist.github.com/anonymous/10bd887c820269458a9859ff24df3725 but i don’t know how to test more complex endpoints. for example, say i have a /user endpoint that connects to an ldap service or something similar. how can i mock out calls to those services using expect/allow?
[08:48:38] vtx: Quit: vtx
[09:47:29] vtx: has joined #ruby
[14:48:35] vtx: Quit: vtx

2017-10-31

[13:20:33] vtx: has joined #ruby
[14:34:07] vtx: Ping timeout: 260 seconds
[16:16:59] vtx: has joined #ruby
[16:19:21] vtx: hi guys i have just started work on a sinatra application with a few endpoints. now that i have behaviour defined for some of the endpoints, i want to write some spec tests. is there an easy way to introduce rspec to my project? i used `bundle gem <my gem>` to create the intial boilerplate, and i’m curious if a similar solution exists for rspec testing?
[18:10:58] vtx: Quit: vtx
[21:17:29] vtx: has joined #ruby
[21:36:10] vtx: hi guys, in rspec, i am testing a class whose initialize sets up some database connections. when i run my tests, the initialization runs, and fails. this doesn’t cause my tests to fail, but i would like to somehow skip or avoid calling the methods that try to connect to databases, or, make my app think it has obtaind a valid db connection. what should i be doing to achieve this? my application uses `Mongo::Client.new` to connect t
[22:50:02] vtx: Quit: vtx

2017-10-27

[00:01:16] vtx: has joined #ruby
[00:37:26] vtx: Quit: vtx

2017-10-26

[00:03:12] vtx: has joined #ruby
[00:58:09] vtx: Quit: vtx
[11:48:10] vtx: has joined #ruby
[12:13:05] vtx: Ping timeout: 240 seconds
[12:13:22] vtx: has joined #ruby
[12:22:41] vtx: Quit: vtx
[16:18:55] vtx: has joined #ruby
[16:54:07] vtx: Quit: vtx
[23:04:07] vtx: has joined #ruby
[23:06:09] vtx: Remote host closed the connection
[23:08:56] vtx: has joined #ruby
[23:57:53] vtx: Ping timeout: 248 seconds

2017-10-25

[15:18:22] vtx: has joined #ruby
[15:21:42] vtx: hi guys. i am new to ruby and i want to try and start off right when it comes to writing tests for my application. i’ve seen some discussion about specs vs units when testing ruby, and i’m not sure what the difference is, or if they are two names for the same “thing”. i’ve also browsed repositiores and some people seem to have what look like integration tests as what i would assume to be unit tests. i’m from a java background, and in the past i’ve used j
[15:21:43] vtx: for writing unit tests for my code. beyond that, i want to actually write “good” tests, in a more general sense. what resources or sites or books should i be looking at to get an idea of the different types of tests in the ruby ecosystem, i.e. what is considered a unit/integration/system test and what is the difference in unit/spec tests, and also, what actually makes a good, effective test?
[15:28:41] vtx: havenwood: ah okay. so are specs the more “ruby” way of doing things?
[15:30:09] vtx: havenwood: ohhhh so i can mix and match whatever styles i want? but how would that work if the “test” approach requires that i extend Minitest::Test, whereas the spec style does not?
[15:32:33] vtx: i guess i don’t really understand why both these approaches exist?
[15:33:40] vtx: i guess before, in my previous jobs, system testing and integration testing were considered to be the same thing
[15:33:53] vtx: havenwood: for spec/test style
[15:35:39] vtx: havenwood: but who does find the distinction helpful?
[15:35:59] vtx: i mean, is the intent that less technical qa engineers can discern what tests are doing more easily?
[15:36:45] vtx: yeah that’s what i thought too lol
[15:37:01] vtx: i might just go with the test style, since i guess i’m more comfortable with the syntax
[15:37:10] vtx: since it’s just like writing actual ruby?
[15:38:20] vtx: i guess the syntax of the test style better reflects how the code in my application is structured
[15:39:44] vtx: it’s something i’ve always struggle with
[15:40:17] vtx: i can write tests that assert a bunch of stuff, but my test suites rarely inspire confidence in me that my application works as expected :/
[17:37:29] vtx: Quit: vtx
[18:03:24] vtx: has joined #ruby
[23:12:14] vtx: Quit: vtx

2017-10-20

[14:18:12] vtx: has joined #ruby
[14:18:32] vtx: hi guys, has anyone here ever authenticated against an ldap server with ruby?
[18:11:38] vtx: Quit: vtx
[19:33:05] vtx: has joined #ruby
[19:45:31] vtx: Quit: vtx

2017-10-09

[12:41:42] vtx: has joined #ruby
[12:43:00] vtx: hi guys, if i have a hash of three hashes, and each sub hash contains an oid hash, whose path is [:_id][:oid][:str], how can i extract only this value from all three hashes, into an array?
[12:56:08] vtx: al2o3-cr: https://gist.github.com/anonymous/2f9bfc9f7634df6e2a364e9794ff855a so the path names are different here, but i essentially want to extract the [“_id”][”$id”][“$oid”] from each of the three hashes
[13:11:03] vtx: al2o3-cr: yes! thanks very much :)
[16:12:48] vtx: Read error: Connection reset by peer