#ruby - 09 September 2018
« Back 1 day Forward 1 day »
[00:10:42] fschuindt: Hi there, folks. I'm just starting this project: https://github.com/fschuindt/toucan A framework for CLI applications. I hope someone find use of it. :] (Any kind of contribution is welcome!) Thank you.
[04:21:27] Sigyn: has left #ruby: ("Leaving the channel (no spam or action taken for 30 days.) /invite Sigyn #ruby again if needed")
[09:12:33] leitz: This morning's work has been to understand more of what havenwood talked about. Especially tests. https://github.com/LeamHall/ruby_namespace
[14:03:09] havenwood: garyserj: The single letter aliases were removed because they "... conflict with scratch variable names"
[15:02:28] apeiros__: is there a nice umbrella term for authentication, authorization, audit which isn't just the AAA abbreviation?
[15:09:57] apeiros: for real? I always thought the last A was for Auditing. but may well be, after all I never read it from a formal source.
[15:10:48] yxhuvud: yes. it is about producing those horrible csv files that are used for measuring usage.
[15:15:46] apeiros: anyway, I think I got my umbrella term: AccessControl (and billing for me isn't part of that :D)
[15:35:06] ignazioc: I have a huge dictionary in CSV format with more than 1million rows.The first column contains a word and the second one the translation. The lines are sorted.I need to find all the words that matches an input string, and show all the translation.This is not difficult, but it takes ~2sec on my machine.I'm wondering if I would have better performance
[15:35:43] ignazioc: I cannot use the word as index, because I'm interested on words that matches the input
[15:39:53] ignazioc: I'm making an Alfred workflow (do you know alfred?) so I cannot have too many dependencies and it must be really fast.
[15:40:40] apeiros: I wouldn't know why your code being an alfred workflow implies not too many dependencies.
[15:42:46] ignazioc: alfred workflow do not have a real "installation" process. this is why dependencies are bad. Because if you wanna share it, you need to explain how to prepare the machine.
[15:43:51] apeiros: if you just leave out your actual requirements, you'll get unsuitable solutions.
[15:44:33] apeiros: yes. binary search is based on comparisons. those work just fine on prefixes. but you'll have the know from when on you consider it a match.
[15:46:38] ignazioc: sorry I'm confused :) In a list of sorted words, I can find a specific one using binary search. this is clear.
[15:47:29] ignazioc: but if I have a list like AAA, AAB, AAC, ABB and I'm search for "everything that starts with "AA"
[15:48:15] apeiros: you compare the first 2 letters. and you use a binary search variant which gives you left & right boundary.
[15:52:03] ignazioc: hum, right. I can take in account only the part of the word with the same lenght of the input
[15:58:25] apeiros: or alternatively (since ruby's bsearch sadly does not support a find-max mode) a reversed wordlist. then you do bsearch twice.
[16:03:59] ignazioc: @apeiros you mean, first time I get the first word that matches my criteria, then I reverse the dataset and search for the last one?
[16:05:08] apeiros: but yes. that's what I meant by "you want the boundaries". search first and last index matching your criterion
[16:09:48] apeiros: it is. if you work with incomplete requirements. such as omitting "performance matters"
[16:12:31] ignazioc: I was expecting a smaller file to work with. I'm ok to wait 1 sec, but with this huge file, the performances are becoming important.
[16:17:31] apeiros: or rather, if you split it up well (assuming you can deploy multiple files instead of just one)
[18:48:56] guardian: hello, what's the idiomatic way to use h.dig(:foo, :bar) and set it to true only if it's nil
[19:24:54] apeiros: guardian: since dig doesn't take a block and there's no Hash/Array#bury, you'll have to do this by hand, initializing all intermediate objects if necessary.
[21:05:08] lembron: hi, gem/bundler question - i want to have "two bundles" installed, from windows AND wsl ussage in "the same thing" - but those lockfiles collide with each other.. -- can i do smth to "make it use Gemfile.win.lock" or so?
[21:05:53] lembron: otherwise bundler refuses todo anything without install inbetween, even tho "both rubys" technically have everything installed they need
[21:47:09] AndreYuhai: Hello! I wonder how this guy's "include" lines work without "require_relative" or something like that? https://github.com/eVanilla/instabot.rb/blob/master/lib/instabot/core.rb I would really like to know how
[21:50:26] apeiros: AndreYuhai: by having this: https://github.com/eVanilla/instabot.rb/blob/master/lib/instabot.rb
[21:51:19] apeiros: though if they'd do it correctly, they'd require instabot in instabot/core (also they'd use require instead of require_relative, but I've given up on that)
[21:53:15] AndreYuhai: apeiros: Yes I had seen that but I couldn't understand how that file effects also core.rb . I mean if I am not mistaken he is even using "login" method inside that core.rb.
[21:58:42] apeiros: you don't have to do the require directly in the file where you're using the constant. just somewhere in your code before you access the constant.
[21:59:28] apeiros: but it's good practice to require all files you rely on in each file you rely on. even if only via an indirection like here by requiring 'instabot' (which in turn requires everything)
[22:03:11] AndreYuhai: apeiros: well, what if I wanted to run core.rb directly? Would it work in this situation?
[22:03:46] AndreYuhai: I mean for example just below the code we could create an instance an run a method of that class which also runs that "login" method