dreinull75

Activity Graph

Page 1 of 2 | Next »

2015-11-26

[07:22:21] dreinull75: has left #ruby: ("undefined")

2015-11-22

[03:45:55] dreinull75: *.net *.split
[03:56:04] dreinull75: has joined #ruby
[15:18:46] dreinull75: tomorrow someone will probably tell me that I can't run a crucial app on a linux server any more. I'm in windows hell. Right now there's a laptop plugged into our network but I guess it has to leave. What are the solutions for running a really small sinatra app on windows? It runs fine on JRuby. However, I somehow need to frequently update my git repo.
[15:31:52] dreinull75: havenwood does jruby hava some kind of ecosystem that will help me?
[15:32:59] dreinull75: I think I could do a per user install but then would like to be able to remotely tell clients to update. ie run the server on the client.
[15:33:51] dreinull75: havenwood can't say. I want a simple solution
[15:34:46] dreinull75: I hava a sinatra app that talks to a db through sequel and outputs some html/pdf. I don't hava problem running this script on a client machine.
[15:35:13] dreinull75: right now it's on that linux machine, users going there via local ip.
[15:54:11] dreinull75: havenwood sounds good to me.
[15:57:29] dreinull75: havenwood nice, thank you!
[15:59:46] dreinull75: adaedra but not recommended. I find it particularly hard to read
[15:59:58] dreinull75: *in many cases*

2015-11-14

[17:34:23] dreinull75: minitest: one method ina class makes this chain call user.address.street. I dont't want to create all that stuff. Can I tell minitest to mock that? I can use the Mock Object but I don't want to mock every method in the chain.
[17:35:14] dreinull75: as it is, I have to go. I will check in a couple minutes :)

2015-11-12

[11:02:40] dreinull75: how do I dynamically subclass a class from another module? what do I put in the parens? http://fpaste.org/289546/14473260/
[11:03:35] dreinull75: ljarvis well, that would just give me the class name, won't tell ruby where it comes from, right?
[11:04:13] dreinull75: Since it's OtherModule::klass
[11:04:38] dreinull75: ljarvis that always just returns the class symbols.
[11:06:13] dreinull75: ddv I'm building an API with a core module and an extended module that allows some tolerance towards errors
[11:06:34] dreinull75: the extended module does exactly the same with some added sugar.
[11:07:20] dreinull75: so instead of writing all classes over and over again with a single include I could as well do this dynamically.
[11:12:54] dreinull75: ljarvis: oh, misunderstanding on my part. The mapping already returns classes. I assumed they were just symbols.
[11:13:08] dreinull75: of course, the the whole thing works just fine.
[11:13:25] dreinull75: a problem of representation of values in ruby/irb
[13:51:24] dreinull75: I'm still struggling to dynamically create subclasses. Here's code and comment: https://eval.in/private/68b6418acdec0b
[13:52:03] dreinull75: apeiros as long as theres MariaDB :)
[13:53:58] dreinull75: apeiros that troubled me before too
[13:58:44] dreinull75: apeiros, thank you, working now! https://eval.in/private/75c7f26e5f9c65
[14:01:49] dreinull75: wow, this is cool stuff. I'm metaprogramming myself a grave.

2015-11-10

[00:17:32] dreinull75: Remote host closed the connection
[00:18:32] dreinull75: has joined #ruby
[12:01:54] dreinull75: Remote host closed the connection
[16:03:04] dreinull75: has joined #ruby

2015-11-08

[22:47:38] dreinull75: has joined #ruby
[22:47:43] dreinull75: This bugger sometimes produces nil: @d=Data[rand Data.count] ??? is there a cool way to loop until s is true?
[22:49:23] dreinull75: j416 not nil
[22:49:34] dreinull75: adaedra not my Database
[22:49:49] dreinull75: Can't fix it
[22:49:58] dreinull75: Testing random data on what is
[22:53:39] dreinull75: pontiki: yes, you're right. -1
[22:54:08] dreinull75: anyway, I'll just break if @d.
[23:06:56] dreinull75: until works fine. Could be done in one line as well
[23:07:14] dreinull75: anyway, I'm randomly heading to bed now.

2015-11-05

[13:58:18] dreinull75: has left #ruby: ("undefined")

2015-11-01

[00:49:06] dreinull75: I can rescue inline for stuff like this: user.address.street rescue "Fail". Is it possible to rescue elsewhere? Like if user hits nil to end the chain immediately? (without changing user.address.street))
[00:49:54] dreinull75: darix sure, but then I'd have to change that line.
[00:50:42] dreinull75: I know about monads and try and stuff. In this case I just want to stop execution of that line.
[00:50:54] dreinull75: Like rescue does.
[00:51:54] dreinull75: maybe not, but it does the job.
[00:52:07] dreinull75: I'd like to outsource that a bit
[00:53:37] dreinull75: I'm using a Null object that returns more Null objects but that doesn't look very smart
[00:56:47] dreinull75: well, I need to sleep. The Null object does seem to be ok for now.
[01:08:09] dreinull75: yes, I'm about to /dev/null for a while

2015-10-31

[16:49:39] dreinull75: is it possible to namespace methods? I have a bunch of methods from classes and subclasses that I want to iterate over. However, some methods I excluded. So if there's a way to group or namespace methods, I'd be happy to know.
[16:50:03] dreinull75: I _want_ excluded
[16:50:49] dreinull75: how's that rgb-one and shevy?
[16:51:19] dreinull75: Success don't know which methods the classes will get. Besides, I don't like that approach.
[16:52:38] dreinull75: ok, so I define my methods outside the class.
[16:53:01] dreinull75: Makes sense. I thought about telling the methods inside that they also have a second home
[16:54:07] dreinull75: ok, great. In Ruby there's always a simple way to accomplish something difficult.
[17:11:35] dreinull75: hm, the methods I want are actually defined in a module that defines them dynamically in a self.included method. So I would have to create module inside the self included method that is somehow accessbile. That coorect?
[17:23:58] dreinull75: It's headbending. The module that creates the methods is included by a bunch of classes. What I'm doing is creating accessor methods to DB table columns. So each table has its own class and columns. All created dynamically and added to the sequel base classes. So later on for my templates I want to have all of my methods that I have defined statically or dynamically and add some magic (the delegator method thing I managed the day before yesterday).
[17:24:57] dreinull75: So I figured that there are so many Sequel methods and superclass methods that I'm losing track.
[17:26:42] dreinull75: Ox0dea probably. But how am I going to learn that stuff without doing?
[17:28:22] dreinull75: I guess I have to see for myself how things turn bad. Also this last week has taught me many interesting things.
[20:31:39] dreinull75: method_added is nice but how do I know which class added it? Via ancestors? Is there a better way?
[20:34:44] dreinull75: Ox0dea oops, included works as well.
[20:35:01] dreinull75: I love that Module stuff
[20:36:41] dreinull75: no, not included. self it is. You're right.
[21:40:25] dreinull75: Let's rock, it works.
[21:41:09] dreinull75: I created a method logger module/class with class vars that keep track of all whitelisted defined methods.
[21:41:31] dreinull75: Feeling great now.
[21:42:10] dreinull75: off for a beer. mission accomplished.
[21:54:26] dreinull75: Actually, I like fpaste.org better.
[21:54:52] dreinull75: But I'm off anyway.
[21:56:42] dreinull75: Joshua__ you can just paste the URL

2015-10-29

[19:47:29] dreinull75: Ox0dea: I got it: https://eval.in/459582
[19:47:43] dreinull75: Ox0dea that's what I was trying to get.
[19:49:54] dreinull75: feed it whatever you feel like and it'll do: https://eval.in/459587
[19:51:08] dreinull75: Ox0dea thanks for your help again. Even if it was mostly rubberducking :)
[22:01:01] dreinull75: Is there a better way to check for nil or empty? ("foo".nil? || "foo".empty? ? "bar" : "foo" #=> "foo")
[22:01:53] dreinull75: Ox0dea I thought I'm on the #ruby channel???!!!ELF
[22:02:31] dreinull75: Ox0dea I have no association with this Rails thing whatsoever
[22:05:27] dreinull75: Ox0dea by now you know I'm not here for simple solutions (TM)
[22:08:01] dreinull75: Ox0dea the blank? method looks nice though: respond_to?(:empty?) ? !!empty? : !self
[22:09:37] dreinull75: zenspider now that you're here we'll all behave

2015-10-28

[20:09:26] dreinull75: Ox0dea: hi, I've been looking at your Module and I'm not sure why you chse extend. I've now tried prepend but my methods are not caught.
[20:10:18] dreinull75: Ox0dea let me fix an eval for you...
[20:20:44] dreinull75: Ox0dea: https://eval.in/private/8fe339e3ccb634
[20:21:21] dreinull75: Ox It's not putsing anything. That's confusing.
[20:23:08] dreinull75: Ox0dea prepended it used to be :)
[20:24:55] dreinull75: yes, that's the problem. Any idea how to include them in this magic?
[20:26:08] dreinull75: because Sequel seems to add complexity to that business. I don't know when it adds its methods to the classes.
[20:40:21] dreinull75: Ox0dea: https://eval.in/private/df71e62b15fe22 works
[20:40:40] dreinull75: with a little help from here: http://stackoverflow.com/questions/27740139/how-to-dynamically-define-all-instance-methods-of-class-in-module
[22:03:13] dreinull75: ok, it's pointless to prepend or extend a delegated class.
[22:04:14] dreinull75: pipework: I have a Presenter < SimpleDelegator subclass
[22:05:01] dreinull75: pipework since you can send pretty much anything to the class I can't just catch all with a prepended module.
[22:06:34] dreinull75: I'm getting there. It's just a matter of time :)
[22:07:54] dreinull75: I guess I need to get down to the object instance level to capture methods instead of the class.
[22:11:31] dreinull75: so is it possible to have all that dynamic method definition as singleton methods?
[22:17:01] dreinull75: Ox0dea not yet sure what I'm exactly looking for.
[22:17:40] dreinull75: Objects in a delegated class only have singleton methods?
[22:19:35] dreinull75: I don't know. How do I find out?
[22:23:41] dreinull75: Ox0dea doing my reading..
[22:34:46] dreinull75: well, time to go- its late

2015-10-27

[21:24:18] dreinull75: "foo"[2].chr #=> "o" which is ok, "foo"[3].chr returns an error. Is it possible to find out which class/method returned the nil?
[21:25:33] dreinull75: Ox0dea, um, well I know the source here. I mean dynamically. This is not my actual code :)
[21:25:59] dreinull75: I want to return some specific message
[21:26:29] dreinull75: It's a string creating app that can't have nil. I need some readable stuff.
[21:26:56] dreinull75: So in order to give the user some idea what's going on I need to tell them where the nil originated from.
[21:27:36] dreinull75: If it's worth waiting for?
[21:29:44] dreinull75: "foo"[3].chr rescue p $!.receiver still returns nil though
[21:32:10] dreinull75: Ox0dea I've thought about that too and I'm not sure. For my decorators that's a good idea. For everthing else nil might come handy too.
[21:33:07] dreinull75: I could handle these things just fine with nil checks but it will look ugly. So I'm trying to simplify things a bit for the user.
[21:34:47] dreinull75: The problem ist that I'm working with DB associations. If they are missing there's a problem. So I want to tell the user to check their data. If not just spit out some Strings with data.
[21:36:14] dreinull75: I'm using these method calls in slim templates so there is not much room for logic
[21:38:23] dreinull75: Is there a way to create wrapper methods in the simple delegate subclass for the methods concerned? If nil, return some message, if valid forward them?
[21:43:15] dreinull75: Ox0dea thought maybe there'S a simpler method
[21:53:28] dreinull75: Ox0dea: wow, that's cool. Thank you!
[21:58:05] dreinull75: I think I've seen that before...
[21:59:54] dreinull75: https://twitter.com/brixen/status/657259014460346368
[22:00:49] dreinull75: in a more controlled environment this looks straight forward :)
[22:57:21] dreinull75: Ox0dea kinda, doing the Javascript tour now
[22:57:47] dreinull75: I should really check out opal
[23:00:22] dreinull75: Ox0dea: wow, I tried something similar via the initialize method but probably called super too late.
[23:02:11] dreinull75: Ox0dea I'm going to study this tomorrow, I'm falling asleep. Thank you for looking into it.
[23:03:26] dreinull75: Ox0dea why? It solves a problem and I'm using this in a local environment only. So as long as I'm happy and it works I'm fine.

2015-10-26

[08:54:17] dreinull75: has joined #ruby
[08:54:36] dreinull75: yikes, how do I require a gem only on jruby or mri?
[08:58:35] dreinull75: ok found it, thansk

2015-10-13

[22:31:58] dreinull75: has left #ruby: ("undefined")

2015-10-08

[00:22:05] dreinull75: Ping timeout: 268 seconds
[19:48:55] dreinull75: has joined #ruby

2015-10-04

[19:44:15] dreinull75: has joined #ruby
[19:47:34] dreinull75: I use Sequel for Object mapping and I need a simple way to visualize the objects. It's all just strings, numbers and dates and some associations. So I was thinking maybe here's someone who has done this kind of object preseantion before. I'm using Sinatra so any CSS or JS solution would be highly appreciated.
[19:48:22] dreinull75: I did Google but couldn't really come up since I'm lacking terminology for what I'm doing.
[19:49:23] dreinull75: I should read before I hit enter...

2015-09-12

[22:29:49] dreinull75: has left #ruby: ("undefined")

2015-09-09

[07:34:41] dreinull75: has joined #ruby

2015-09-07

[03:07:33] dreinull75: Ping timeout: 265 seconds

2015-09-03

[19:47:12] dreinull75: has joined #ruby
[19:47:51] dreinull75: what does "ArgumentError: string contains null byte" mean when creating a Tempfile?
[19:48:24] dreinull75: I'm trying to feed the Tempfile an image stored in my DB (jpg).
[19:49:16] dreinull75: file=Tempfile.new(DB[:fotos].where(:ID => 34).first[:Foto], '.jpg')
[19:49:36] dreinull75: I'm not setting a filename here, dorei
[19:50:47] dreinull75: tobiasvl, ouch.
[19:50:58] dreinull75: let me try again
[19:52:37] dreinull75: ok, got it, thought the first string was supposed to be the content of the file. Misunderstanding here. Thanks for helping out.

2015-07-01

[16:50:35] dreinull75: has left #ruby: ("undefined")

2015-06-26

[05:47:34] dreinull75: Remote host closed the connection
[05:48:07] dreinull75: has joined #ruby

2015-06-20

[15:01:26] dreinull75: 3.x "I" => "III". Any super simple solutions?
[15:02:50] dreinull75: havenwood unbelievable. I knew there was something :)
[15:03:05] dreinull75: couldn't remember what it was though.

2015-06-17

[10:03:49] dreinull75: Remote host closed the connection
[10:03:59] dreinull75: has joined #ruby

2015-06-13

[11:11:28] dreinull75: anybody here responsible for slim2html?
[13:50:31] dreinull75: A1F4 Photoshop, for sure
[14:41:47] dreinull75: the sinatra folks live forever (and everywhere)

2015-06-12

[09:48:48] dreinull75: does anybody know how to use rack-ssl with puma? I can bind to ssl and tell puma where my certs are but then I don't need rack-ssl and its convenient http-> https services.
[09:49:17] dreinull75: not a rails question btw :)
[09:51:00] dreinull75: adaedra sure, I want to use puma only
[09:51:28] dreinull75: shevy it would be.
[09:51:55] dreinull75: yesterday I looked at the state of ruby and gtk. It's awful. Too complicated.
[09:52:38] dreinull75: shevy did I see you in the commiters list
[09:53:29] dreinull75: ok, was probably some other guy
[10:04:43] dreinull75: feel free to code my stuff. No need to have me hang around :)
[10:05:00] dreinull75: github is weird today. apparently just for me
[10:05:27] dreinull75: adaedra I can send you a git repo :D
[10:06:11] dreinull75: I can make it any flavor you like. CVS? SVN?
[13:11:09] dreinull75: Remote host closed the connection
[13:12:58] dreinull75: has joined #ruby

2015-06-08

[16:59:34] dreinull75: before I start tinkering, I have image data as a blob in a db. I assume it's jpeg data. What's the easiest way to work with that data? Write to file and read it?
[17:00:36] dreinull75: it's meant for a sinatra app, i.e needs forwarding

2015-06-01

[10:43:49] dreinull75: Ping timeout: 258 seconds
[20:48:43] dreinull75: has joined #ruby
[20:51:15] dreinull75: is this a good idea? class A; def foo; A.new; end; end; I'm returning an instance of A inside A because I need a modified version of A. But is this a good idea? Possibly deeply nested objects et al?
[20:51:45] dreinull75: Arrays return modified arrays all the time
[20:51:57] dreinull75: centrx no, instance method
[20:53:23] dreinull75: I'm using a Sequel dataset and my method returns a modified dataset. Unless I create a new instance of it it's returned as a Dataset without all the bells and whistles I've added before.
[20:56:58] dreinull75: ok, why's that?
[20:58:40] dreinull75: ljarvis definitely looks better than my examle
[21:01:57] dreinull75: ljarvis: it's nothing special. I create a Presenter class like this Presenter.new(Data.where(:x => "y")). Then inside Presenter I have a more narrow def like def narrow; self.class.new(self.where(:foo => "bar"))); end;
[21:03:24] dreinull75: ljarvis there's more than one of those extra filters so this just makes it easier for me to continue working with the data as expected. Without creating the Presenter again outside.
[21:04:16] dreinull75: ljarvis yes, basically
[21:10:12] dreinull75: wallerdev were the hoi polloi
[21:15:49] dreinull75: this channel is really great. I don't know where I'd be without your help.
[21:19:15] dreinull75: shevy that would solvve some problems
[21:19:28] dreinull75: monads do help, too

2015-05-28

[18:48:11] dreinull75: so how do I load a file on irb startup? -r is for gems, just the file name executes?
[18:48:42] dreinull75: oh, just tried ./file
[18:48:49] dreinull75: ljarvis thanks
[18:51:05] dreinull75: extend and include seem to be troublemakers in ruby world. Nobody really gets it right away.
[19:08:44] dreinull75: and I'm still using rvm. It does a great job and never had any worries.
[19:09:35] dreinull75: looks like the fight between rbenv chruby and rvm is fiercer than that between vim and emacs
[19:10:11] dreinull75: I'd usually say triy one and if it doesn't work move on and try the second
[19:10:47] dreinull75: these things are meant to keep you worry free. if it doesn't do it, get out quickly.
[19:12:00] dreinull75: same with python and ruby. Never managed to get python running with envs and whatever the hell they want me to install.
[19:13:10] dreinull75: totally not getting it :) I'm an absolut failure.
[19:37:02] dreinull75: how can I use "testing" in my dev.rb file. ARGV doesn't seem to work here: irb -r ./dev.rb testing
[19:41:46] dreinull75: bootstrappm 2.2.2p95
[19:43:41] dreinull75: Welcome to TESTING. You are using ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]. Have fun ;) []
[19:44:05] dreinull75: where [] is p ARGV
[19:47:46] dreinull75: bootstrappm I use all kinds of weird gems in irb. might be related to that
[19:47:55] dreinull75: I'll skip it for now.
[19:48:06] dreinull75: thanks for looking into it though

2015-05-24

[18:53:42] dreinull75: how can I do % operations with hex values? Like 33%10 => 3
[18:54:08] dreinull75: no, thats int
[18:54:25] dreinull75: "\0x33"%"\0xf"
[18:55:24] dreinull75: oh, the 0 was wrong
[18:56:58] dreinull75: IceDragon I have some weird "crypto" sh??$%. Someone tried to be smart and reverse strings: s becomes | for example
[18:57:37] dreinull75: is it something known?
[18:57:47] dreinull75: had to figure it out myself
[18:58:35] dreinull75: so is there some simple solution? I have to hop to the next f and subtract the last digit from that
[18:58:47] dreinull75: sorry, missing words for hex calculations
[19:03:39] dreinull75: Mon_Ouie yes I know that but in order to decode I have to use hex values. Like ef => f0-f
[19:04:35] dreinull75: IceDragon well yes, next life.
[19:04:45] dreinull75: thats why we have ruby, right?
[19:06:50] dreinull75: 0x33%0xf #=> 6 ? I expect 3.
[19:08:24] dreinull75: Mon_Ouie of course
[19:08:43] dreinull75: "\x33"%"\xf" #=> "3"
[19:12:23] dreinull75: Mon_Ouie you're right
[22:48:34] dreinull75: btw, I found my "de/encryption" algorithm with hexadecial numbers
[22:48:40] dreinull75: >> "string".split('').map{|c| (c.codepoints[0]-(c.unpack('h')[0].hex*2-15)).chr}.join

2015-05-22

[18:58:25] dreinull75: apeiros oh, does work, somehow
[18:58:46] dreinull75: but not the full ascii table. That one only works in my regular terminal runbning it from a file
[19:00:04] dreinull75: sorry gotta go, bells ringing