shevy

Activity Graph

Page 1 of 401 | Next »

2016-07-27

[06:58:05] shevy: ceegee as far as I know, puppet makes use of regular ruby so you can use regular ruby syntax
[06:58:45] shevy: they use non-ruby parts though
[06:59:06] shevy: https://github.com/puppetlabs/puppetlabs-ruby#usage
[07:01:06] shevy: how does the class you wrote look like?
[07:01:10] shevy: cam you put this on a pastie
[07:04:22] shevy: from your description alone, this sounds like non-ruby code
[07:10:09] shevy: yeah this is very strange
[07:10:29] shevy: it looks very much like ruby but it is not
[07:11:12] shevy: ['group1', 'group2'] looks like an array but without looking at the specification it is hard to say
[08:34:35] shevy: is it recommended to use autoload?
[08:59:44] shevy: pytho code reads strangely https://github.com/sassoftware/conary/blob/master/conary/cmds/commit.py#L31
[08:59:55] shevy: so many .__init__ s
[09:02:21] shevy: be back later

2016-07-26

[07:20:03] shevy: etehtsea two reasons I could think of; (1) it may be so rare that nobody uses it (2) nobody thought about it; in case (2) you can make a suggestion to the ruby core team at https://bugs.ruby-lang.org/projects/ruby-trunk
[07:38:09] shevy: no idea, I don't think I have ever needed to slice bytes from a string in the first place
[07:38:21] shevy: my strings are oldschool "bla" so I just do [start, end]
[09:03:25] shevy: the best way to handle complexity is to beat it down with a club or a bat until it surrenders and submits to simplicity
[09:19:00] shevy: I don't think you will have much luck finding people who use any special technique here for their ruby scripts
[09:19:20] shevy: "artefacts" or "feature files", that sounds very alien. I don't think I can recall anyone else having asked this here
[12:54:27] shevy: what is that
[13:07:26] shevy: then it performed what was inside the .bat file
[13:07:59] shevy: note that your above example "ruby compile path" can never have worked, so your example can not have worked
[13:09:19] shevy: and still you do not supply a webpage
[16:20:43] shevy: don't they eat ham and eggs in some crazy ass country for breakfast
[16:39:57] shevy: you have not even finished all books and already look for more books!
[17:22:55] shevy: I get an error too
[17:22:57] shevy: ArgumentError: argument out of range
[17:23:46] shevy: not sure why the specified variant does not work... it should work since you manually provide the proper format
[17:25:54] shevy: good catch
[17:58:37] shevy: toretore some questions will never be answered :)
[19:05:14] shevy: speed speed speed
[19:55:06] shevy: I don't think it can
[20:53:26] shevy: only dev release
[20:53:57] shevy: ftp://ftp.ruby-lang.org/pub/ruby/2.4/

2016-07-25

[06:53:56] shevy: zacts do you only read ruby books or do you also write ruby code :)
[10:17:56] shevy: has $.width;
[10:17:56] shevy: class ImageFile {
[10:19:11] shevy: so much has cheeze
[13:29:59] shevy: properties set on an error?
[17:21:21] shevy: https://kristerw.blogspot.co.at/2016/07/code-behaving-differently-in-c90-c99.html
[17:21:34] shevy: I want something like this for ruby 1.0 1.6 1.8 1.9 and 2.x and beyond!
[17:56:17] shevy: RubyNewby123 just abstract the things; class Player, class Game
[17:57:06] shevy: if a user needs to input data to either class Player or class Game, he can do so either on class Player; or you let class Game handle the input and then pass it to class Player. class Choice sounds very abstract
[18:10:47] shevy: RubyNewby123 well the user is whoever runs your code at hand
[18:10:54] shevy: so this can be you or someone else
[18:15:31] shevy: RubyNewby123 well, I remember you were fetching user input right?
[18:15:52] shevy: you could let class Player do so instead
[18:16:04] shevy: I mean class Game
[20:05:54] shevy: 2.4.0 is inofficial dev release
[20:06:37] shevy: when you write user-install, you mean gem?
[20:12:52] shevy: miqlas-H you may have to file an issue request at https://bugs.ruby-lang.org/projects/ruby-trunk - there are not many haiku people so if you don't point out how things may work, nobody else may know :D
[20:17:44] shevy: hah I was ruthless in removing USB stuff
[20:18:02] shevy: until I realized that some external USB hdd's may be killed if you just disconnect them :(
[23:06:12] shevy: I am not sure many here know how to add a new encoding; you could try to ask Martin Duerst, he writes a lot of encoding stuff https://github.com/ruby/ruby/blob/trunk/ChangeLog#L16

2016-07-24

[10:13:21] shevy: zenspider! you are back
[10:24:08] shevy: was the cat
[15:27:09] shevy: there are two major different ways to use a block
[15:27:19] shevy: the simpler one is to use {} to the method
[15:27:30] shevy: in your example the faulty line is: start = Choice.new("Start", "You arrive at the castle entrance.", [cross_drawbridge], { puts "hello!"})
[15:28:13] shevy: invoke_method('arg1','arg2') { your block here }
[15:28:38] shevy: that is one way
[15:29:30] shevy: http://mudge.name/2011/01/26/passing-blocks-in-ruby-without-block.html has a good summary
[15:29:50] shevy: and http://rakeroutes.com/blog/anonymous-blocks-as-function-arguments-in-ruby/
[15:30:07] shevy: in your case you don't seem to need any block or?
[15:30:57] shevy: if you want to get the content of the block, and if you don't use the &variant, you can check via: yielded_part = yield if block_given?
[15:31:50] shevy: blocks are just an extra argument available to every method in ruby but not every method needs to make use of blocks
[15:32:31] shevy: if you already know C# then a lot of the setup of your code will work about 1:1, your class-based design on the sample code is already quite good, definitely not the newbie stage
[15:37:35] shevy: well the foo() { block } syntax I find very simple
[15:37:58] shevy: you can see it used in sinatra
[15:38:05] shevy: do/end rather than {}
[15:38:16] shevy: http://www.sinatrarb.com/
[15:38:23] shevy: get '/hi' do
[15:41:41] shevy: it is not good to ask whether you can ask. it is better to just ask, someone here can reply
[15:43:28] shevy: you can use variables yes
[15:44:23] shevy: it can become a bit complicated
[15:44:38] shevy: for instance, in one class, I have something like this: class Foo; def initialize; instance_eval(&block) if block_given?; end; end
[15:45:08] shevy: I also did not comment why I did it there so I have no idea why I am doing it :D
[15:46:49] shevy: yes just assign it
[15:47:07] shevy: in my above example: @foo = yield if block_given?
[15:47:21] shevy: or in your example when you use the variable.call part, for procs
[15:49:25] shevy: well appeal, you have all the usual way to pass arguments into methods - and on top of it you can also use blocks
[15:49:35] shevy: but just because a feature is available does not need that you need or need to use it
[15:50:18] shevy: but you already see that you can design very succinct domain specific APIs; rails is a domain-specific language, sinatra is
[15:50:26] shevy: prawn probably is too
[15:50:43] shevy: Prawn::Document.generate("hello.pdf") do; text "Hello World!"
[15:51:25] shevy: File.open or File.new... one of those two at the least, they make use of blocks meaning they will automatically call .close on the file handle
[15:54:10] shevy: I am sure it is simple in ruby too
[15:54:20] shevy: right now I have no real idea to what part of the code you refer to
[15:54:56] shevy: a lot of your code can be shortened
[15:55:13] shevy: the stray returns should not be necessary either
[15:55:43] shevy: puts "" is equivalent to puts, btw
[15:56:56] shevy: what do you mean with main?
[15:58:10] shevy: there are several ways to do this
[15:58:45] shevy: actually jhass mentioned the two main ones that came to my mind :)
[15:59:56] shevy: RubyNewby123 well, you can check if the user passed in a class Player or whether it is a String
[16:47:49] shevy: RubyNewby123 it is beauty!
[16:47:56] shevy: look at it
[17:29:16] shevy: loop is doing a loop
[17:29:44] shevy: this is why I can not relate to Fiber http://ruby-doc.org/core-2.2.0/Fiber.html
[17:29:46] shevy: Fiber is doing... a fiber
[17:48:07] shevy: yorickpeterse I like that!
[20:45:43] shevy: hmm I missed this talk from matz yet! a month ago https://www.youtube.com/watch?v=EB8j-i5x6Hc
[22:06:03] shevy: zacts its summer time
[22:06:06] shevy: things are hot
[22:06:18] shevy: and coding during hot temperature here is awful
[22:50:19] shevy: no wonder you only read books, it's too hot to actually code!!!
[22:50:44] shevy: it would be extreme programming

2016-07-23

[07:26:49] shevy: ClayCons sorta
[07:26:53] shevy: ruby gnome stuff
[07:27:13] shevy: there are not that many ruby people write oldschool GUIs, a lot of this has been taken over by the www
[08:53:35] shevy: https://github.com/ruby-gnome2/ruby-gnome2
[09:10:00] shevy: if anyone is using that
[10:51:00] shevy: hmmm I just realized... xmas is not that far away... will we have a 2.4.x stable release before xmas?
[12:47:51] shevy: is it common to find the "opposite" of .uniq? that is, rather than return an array with all duplicates removed, to actually return the duplicates themselves instead? (for another method/operation)
[12:54:27] shevy: xpitr cool, that is about 5 lines shorter than what I used haha
[15:34:46] shevy: has joined #ruby
[16:22:17] shevy: val = Hash.new; val['enabled'] = true; puts 'it is true' if val['enabled'] == true # outputs "it is true" for me
[18:59:58] shevy: I anticipated it sorta
[19:00:30] shevy: I did not click on either links; some other dude comes in to be desperate in showing yet another link.... but I am a suspicious person altogether
[19:13:29] shevy: here are gem growth stats over time http://bestgems.org/stat/gems
[19:13:47] shevy: sorta linear
[19:14:11] shevy: GNUYawk <--
[19:35:40] shevy: what reports

2016-07-22

[05:53:53] shevy: zacts hah, I also like slackware. In fact I have it installed right now... though I compile from source via ruby scripts
[06:56:19] shevy: hmm I have some password protected .rar files
[06:56:41] shevy: I know the password, so I can manually open them, but there are many of them, is there a way to batch-extract them via ruby? if I could feed in the password
[07:01:48] shevy: the help option shows it
[07:11:54] shevy: 123.digits
[07:44:01] shevy: good old virtues
[07:44:05] shevy: like to not get into your way
[08:32:34] shevy: ziyan_ this is in general how ruby works
[08:32:54] shevy: whoever is the first to define a top-level constant, such as a module or a class, wins in the sense of defining that namespace
[08:33:07] shevy: like if someone adds: module Configuration; end and then in your code you try to do: class Configuration; end
[08:33:26] shevy: ruby will issue an error
[08:33:38] shevy: like "TypeError: Foo is not a class"
[08:34:42] shevy: you can get rid of it perhaps if you really need to, like via: Object.send :remove_const, :Foo
[10:01:15] shevy: I wanna do: class 1980; end
[10:01:47] shevy: guess I prefix with Y ... still ugly
[15:45:28] shevy: mustmodify have him learn php and be done with it
[15:47:32] shevy: hmmm how do I sort a hash? or rather, each key is just a pointer to an array, and the array itself has one slot for the year
[15:57:27] shevy: books help but at the end of the day, the best way is to write code on your own no matter what is your skill level or learning curve/speed
[15:58:15] shevy: a railser!
[16:01:15] shevy: mpr555 just have some things that you want to write, the rest will happen on its own eventually
[16:04:00] shevy: I find reading ruby code by others quite difficult :) or perhaps depending on the style/structure used
[21:46:36] shevy: I am wondering at which point the use of @instance_variables in any given class, becomes excessive
[21:48:30] shevy: please don't
[22:34:03] shevy: we had that question perhaps a month ago :D
[23:45:27] shevy: hellcode well, compare storing all data in a hash, or putting the data into @ivars there
[23:46:18] shevy: many of my classes for commandline use have means to determine whether they run with colour support or without; so I may have this in one instance variable
[23:47:16] shevy: but there are some more toggleable states so more instance variables spring into existence
[23:48:02] shevy: when I then have a fairly big class, and its reset() method having like +10 instance variables, it feels clunky and big

2016-07-21

[03:44:47] shevy: postapocallyptic why do you use begin/end
[03:46:54] shevy: postapocallyptic here the threads are part of the array but all dead, run it: https://gist.github.com/shevegen/6e6b7da9d17d477073caf9bb7df73c32
[05:31:27] shevy: zacts have you finally finished all the ruby books
[06:53:30] shevy: anyone seen http://bestgems.org/ yet? I just found it via google accidentally
[07:44:43] shevy: could .select work with that new thingy... .dig or whatever it was on class Hash
[09:08:52] shevy: language rankings! http://redmonk.com/sogrady/2016/07/20/language-rankings-6-16/?
[09:12:16] shevy: interesting that php is so high up there
[09:14:12] shevy: worse is better stands the test of time
[12:36:13] shevy: postapocallyptic I just modified your code; as you can see when you compare to your code, the output is different
[12:36:20] shevy: that time we have a collection of dead threads
[12:36:26] shevy: in your case, we had nil objects
[14:04:37] shevy: are we getting rich again here
[14:04:40] shevy: ACTION feels excited!
[22:45:41] shevy: bleep I do that
[22:47:23] shevy: bleep for instance that was one class I wrote today to batch-compile several programs (just an Array you supply; or via the commandline respectively): https://gist.github.com/shevegen/78aa32325e36e8a3c8e5cb8e8c6de17f
[22:48:12] shevy: bleep I only write a short header usually and I use another class to extract that header and display it on the commandline, if I request it via that class
[22:48:43] shevy: I don't think there is any standard. most people probably do not write any comments at all
[22:52:25] shevy: you can get a list of the valid encoding formats
[22:53:16] shevy: Encoding.list
[22:53:45] shevy: elomatreb I think it scans for the minimum tokens required... I have seen different variants all working fine
[22:54:58] shevy: what reason is there not to?
[22:56:43] shevy: that has not been my experience
[22:58:37] shevy: everything works fine there
[23:01:06] shevy: well they used to have $KCODE in the old days :)
[23:01:20] shevy: not sure if this is still needed in ruby past 1.9.x era

2016-07-20

[00:01:32] shevy: not sure, you have to ask those who are good at tests. I found it very boring to write tests
[00:01:45] shevy: I guess it may be easier to integrate them from the get go
[00:02:40] shevy: one obvious benefit, aside from the disadvantage that it may be boring, is that you can ensure a certain sense of realiability of your code, that, at the least during the conditions that you tested for and evaluate, it would work in a reproducible manner
[00:04:09] shevy: also have a look at the graphics at https://wiki.debian.org/ReproducibleBuilds - while this has not much to do with testing in ruby, it has a little bit to do with managing packages in general in a reproducible manner; it's also why I think the NixOS philosophy is cool and how fpm vaguely taps into it; nixos should promise that you can re-build any target-set of packages that go along together and work
[00:16:17] shevy: not sure, you can handle it as regular input to methods
[00:16:34] shevy: either like in a class: def initialize(commandline = ARGV); Foobar.new(ARGV)
[00:16:44] shevy: it is tainted input by default though
[02:32:52] shevy: Ping timeout: 264 seconds
[02:35:08] shevy: has joined #ruby
[04:36:28] shevy: Ping timeout: 264 seconds
[06:54:13] shevy: has joined #ruby
[07:32:16] shevy: Ping timeout: 264 seconds
[07:35:08] shevy: has joined #ruby
[12:32:31] shevy: new method Enumerator::Lazy#uniq. [Feature #11090]
[12:32:42] shevy: ACTION is the inofficial ruby changelog bot.
[13:10:07] shevy: creating/starting a new project is so much more work than adapting something :(
[13:29:59] shevy: no_gravity anything unclear?
[13:30:45] shevy: do you not read
[13:32:13] shevy: just add the missing "end"
[13:32:50] shevy: a bit of fails ongoing here ;)
[13:33:00] shevy: but we are there now!
[13:33:29] shevy: well your example used $user->name
[13:33:53] shevy: so we can conclude that it was an object that had this method or slot? If it is a hash though, you can use .fetch()
[13:34:48] shevy: you have put [{}] there
[13:34:57] shevy: so a hash put into an array
[13:35:08] shevy: if you don't need the array, it may be simpler to just work with the hash
[13:57:36] shevy: it outputs what you tell it to output
[14:52:04] shevy: have it a single .rb file, let the user copy it to that path; you can provide an internal way to copy it to that path too, on first run, unless it is not already there
[14:54:20] shevy: your requirement was /usr/local/bin
[14:55:09] shevy: setup.rb will use the local path at where site dir is, e. g. if someone has ruby at /Programs/Ruby/2.3.1, it will... I think... go to /Programs/Ruby/2.3.1/lib/ruby/site_ruby/2.3.0/ - something like that
[14:55:30] shevy: unsure whether you can use setup.rb to install into some other target area
[14:56:06] shevy: hmm setup.rb supports --installdirs= and --rubypath=path
[14:59:59] shevy: gem install ./foobar.gem should work, I think
[21:34:26] shevy: but what about true == 42