« Back to channel list

#ruby - 10 June 2016

« Back 1 day Forward 1 day »
[00:01:11] banister: bougyman doesnt it do exactly what he said
[00:01:18] banister: "Must specify both proxyPort and proxyHost (or neither)"
[00:01:26] banister: both true, or both false
[00:01:42] bougyman: yes, it seems to.
[00:01:45] bougyman: but farking confusing.
[00:02:00] bougyman: trying to save keystrokes, I guess?
[00:02:08] bougyman: or is this an idiom i'm just dumb to?
[00:02:14] banister: bougyman it's stupid, you can just use ==
[00:02:20] banister: !!foo == !!bar
[00:02:20] freerobby: has joined #ruby
[00:02:37] bougyman: ok, but the double-bang is the right choice here?
[00:03:30] nadir: has joined #ruby
[00:04:27] banister: wait, xor does the opposite
[00:04:56] bougyman: banister: that's wrong.
[00:05:00] banister: oh got it cos it's if rather than unless
[00:05:17] bmorrison: has joined #ruby
[00:05:30] banister: so you could rewrite it as: raise "foo" unless !!foo == !!bar
[00:05:34] banister: so == is the opposite of ^
[00:06:00] banister: foo == bar is equivalent to !(foo ^ bar)
[00:06:06] banister: where foo/bar are bools
[00:06:43] banister: bougyman yeah if you dont cast to bool (!! just casts to a bool) then you get god knows what behavoiur is defined for ^ for that type
[00:07:08] bougyman: understood.
[00:07:16] banister: interesting trick thanks for sharing
[00:07:17] bougyman: I think this is an internal practice, I see it all over this codebase.
[00:07:26] banister: yeah it's fucked, i've never seen it before
[00:07:41] banister: i'd rather use `==` it's less arcane
[00:07:43] duckpuppy: has joined #ruby
[00:12:23] banister: Weet niet wat the fuck je praat
[00:14:02] tatsuo: has joined #ruby
[00:15:23] johnDoe111: has joined #ruby
[00:15:35] Vile`: has joined #ruby
[00:18:51] surrounder: banister: getting there ;)
[00:18:51] n_blownapart: has joined #ruby
[00:19:02] banister: surrounder lol
[00:19:27] banister: surrounder that's a cool dutch expression, almost as good as kanker homotje
[00:19:34] DukeDave: has joined #ruby
[00:19:35] vikid: has joined #ruby
[00:19:35] Eleeleth: has joined #ruby
[00:19:37] alxndr: has joined #ruby
[00:19:37] meinside: has joined #ruby
[00:19:38] bcavileer: has joined #ruby
[00:19:40] jpinnix_______: has joined #ruby
[00:19:43] banister: r we being hax0red
[00:19:45] jaguarmagenta: has joined #ruby
[00:19:45] flyinprogrammer: has joined #ruby
[00:19:46] joaomdmoura__: has joined #ruby
[00:19:48] grvgr: has joined #ruby
[00:20:00] tjohnson: has joined #ruby
[00:20:01] jxf: has joined #ruby
[00:20:23] tfitts: has joined #ruby
[00:20:24] shelling__: has joined #ruby
[00:20:38] tubuliferous_: has joined #ruby
[00:20:50] vcoinminer: has joined #ruby
[00:20:53] ELCALOR: has joined #ruby
[00:20:54] aphprentice: has joined #ruby
[00:20:55] acerna: has joined #ruby
[00:20:57] frem_: has joined #ruby
[00:20:59] kireevco: has joined #ruby
[00:21:00] eam: looks like the irccloud is raining
[00:21:00] podman: has joined #ruby
[00:21:04] maladr0it: has joined #ruby
[00:21:23] HashNuke__: has joined #ruby
[00:21:25] mroth: has joined #ruby
[00:21:25] ijij_: has joined #ruby
[00:21:26] jmhmccr: has joined #ruby
[00:21:31] adamf: has joined #ruby
[00:21:31] andersh: has joined #ruby
[00:21:32] bove: has joined #ruby
[00:21:35] pmarreck: has joined #ruby
[00:21:36] spastorino: has joined #ruby
[00:21:37] deepak_: has joined #ruby
[00:21:38] boxrick1: has joined #ruby
[00:21:39] jord: has joined #ruby
[00:21:42] lancetw: has joined #ruby
[00:21:59] daemonwrangler: has joined #ruby
[00:22:02] colstrom: has joined #ruby
[00:22:10] Travis-42: has joined #ruby
[00:22:11] jimeh: has joined #ruby
[00:22:12] mitsuhiko: has joined #ruby
[00:22:25] kapowaz: has joined #ruby
[00:22:39] zero7: has joined #ruby
[00:22:42] Rodya_: has joined #ruby
[00:22:52] yo61: has joined #ruby
[00:23:31] dorje: has joined #ruby
[00:25:31] Dios: has joined #ruby
[00:25:46] LinuxHippie: has joined #ruby
[00:26:08] Meow-J: has joined #ruby
[00:26:25] bttf: has joined #ruby
[00:26:32] mleung: has joined #ruby
[00:27:19] Dios: has joined #ruby
[00:28:43] allcentury: has joined #ruby
[00:29:59] matp: has joined #ruby
[00:31:06] aupadhye: has joined #ruby
[00:34:20] Fuzai: has joined #ruby
[00:35:31] Fuzai: Hi there, is there anyone around that's familiar with UUIDTools and specifically namespaces that could shed some light on this for me? I'm familiar with UUID's but I feel like I'm failing to grasp the concepts/logic/reasoning/use of uuid namespaces. Thanks!
[00:36:13] johnDoe111: has joined #ruby
[00:36:45] certainty: has joined #ruby
[00:38:03] jabreity__: has joined #ruby
[00:38:03] jabreity__: has joined #ruby
[00:39:04] moeabdol: has joined #ruby
[00:39:37] nankyokusei: has joined #ruby
[00:41:55] LaT0rtue: has joined #ruby
[00:44:45] ixti: has joined #ruby
[00:45:56] APhilp: has joined #ruby
[00:46:03] Wolland: has joined #ruby
[00:47:18] griffindy: has joined #ruby
[00:47:37] gnufied: has joined #ruby
[00:50:50] ur5us: has joined #ruby
[00:52:49] ur5us: has joined #ruby
[00:57:53] arescorpio: has joined #ruby
[01:01:12] yfeldblum: has joined #ruby
[01:01:27] Yiota: has joined #ruby
[01:02:49] RobertBirnie: has joined #ruby
[01:04:05] echosystm: has joined #ruby
[01:04:33] echosystm: i need to run a ruby script as an executable on a server
[01:04:42] echosystm: it depends on a particular ruby version and various gems
[01:04:52] echosystm: with rvm, i used to use an alias to do this
[01:04:57] echosystm: how do you do this with rbenv?
[01:05:23] echosystm: ie. i want to just ./run-my-program without setting up any rbenv stuff in advance
[01:09:20] skweek: has joined #ruby
[01:09:46] shevy: Fuzai I think a madman did UUID
[01:09:51] devbug: has joined #ruby
[01:11:23] taylorrf: has joined #ruby
[01:11:24] blackmesa: has joined #ruby
[01:12:48] postmodern: has joined #ruby
[01:13:19] duckpuppy: has joined #ruby
[01:15:16] hutch34: has joined #ruby
[01:17:37] aberen: has joined #ruby
[01:19:22] maladr0it: what's so hard about uuid?
[01:19:36] maladr0it: (speaking from ignorance)
[01:20:48] Dios: has joined #ruby
[01:26:47] shevy: you never saw one
[01:27:21] AcidCras_: has joined #ruby
[01:27:34] coffeecupp: has joined #ruby
[01:29:27] allcentury: has joined #ruby
[01:31:30] lightt: has joined #ruby
[01:32:07] vdamewood: has joined #ruby
[01:36:12] ensyde__: has joined #ruby
[01:37:31] certainty: has joined #ruby
[01:39:02] vdamewood: has joined #ruby
[01:40:20] karmatr0n: has joined #ruby
[01:44:06] achamian: has joined #ruby
[01:46:48] Wolland: has joined #ruby
[01:49:54] coffeecupp: has joined #ruby
[01:50:44] LoneHerm_: has joined #ruby
[01:51:51] Rodya_: has joined #ruby
[01:51:56] sneakers: has joined #ruby
[01:54:27] dopie: has joined #ruby
[02:00:03] ElFerna: has joined #ruby
[02:00:28] gnufied: has joined #ruby
[02:08:56] flashpoint9: has joined #ruby
[02:10:22] sp4rrow: has joined #ruby
[02:13:53] Kus: has joined #ruby
[02:14:00] xlegoman: has joined #ruby
[02:15:24] Niham: has joined #ruby
[02:18:02] Yzguy: has joined #ruby
[02:20:31] jaguarmagenta: has joined #ruby
[02:21:57] Ronis_BR: has joined #ruby
[02:22:21] Ronis_BR: I'm building ruby from sources and I'm getting and error related with libxml2 when trying to install nokogiri
[02:22:35] Ronis_BR: I have to installations, in one everything is fine
[02:22:36] bougyman: and libxslt
[02:22:41] bougyman: nokogiri needs them both
[02:22:43] Ronis_BR: bougyman: it is all installed
[02:22:47] bougyman: no it isn't.
[02:22:55] maladr0it: hey guys is ruby used for anything other than web dev?
[02:22:56] bougyman: libxslt-dev and libxml2-dev ?
[02:22:59] bougyman: (or -devel)
[02:23:01] bougyman: maladr0it: yes.
[02:23:06] bougyman: maladr0it: I don't do web dev.
[02:23:14] Ronis_BR: bougyman: it works if I do NOKOGIRI_USE_SYSTEM_LIBRARIES=1 gem install nokogiri
[02:23:17] bougyman: I use ruby for infrastructure automation, mostly.
[02:23:28] bougyman: Ronis_BR: ok, so you have the system libraries installed, then.
[02:23:41] bougyman: nokogiri bundles its own if you don't use that ENV var.
[02:23:46] maladr0it: awesome. i really like scripting languages but don't like web dev
[02:23:48] Ronis_BR: bougyman: but I need to use the bundle
[02:23:51] maladr0it: just job searching atm
[02:23:51] bougyman: and they may not build on your env for whatever reason.
[02:23:59] bougyman: maladr0it: for what position?
[02:24:06] Ronis_BR: bougyman: I notice that in the machine that it is working, ruby is installed in /usr/local/lib
[02:24:12] bougyman: I have some system engineering positions open, this may be serendipity.
[02:24:15] maladr0it: i'm a fresh grad so basically anything haha
[02:24:16] Ronis_BR: bougyman: on the other, it is in /usr/local/lib64
[02:24:28] maladr0it: i have experience doing automation though
[02:24:34] bougyman: hard to get a job as a system engineer fresh out of school.
[02:24:39] bougyman: unless you have work exp, too.
[02:24:49] maladr0it: i did a year of work exp
[02:24:49] Ronis_BR: bougyman: do you think this make any difference?
[02:24:57] bougyman: it could, Ronis_BR
[02:25:05] maladr0it: they liked me so much they offered me stupid money to stay but i moved country
[02:25:09] Ronis_BR: bougyman: how can I make ruby be installed in /usr/local/lib?
[02:25:20] bougyman: --prefix=/usr/local
[02:25:43] Ronis_BR: bougyman: but it is in /usr/local
[02:25:55] bougyman: You're confusing me now.
[02:26:03] Ronis_BR: bougyman: the problem is with /usr/local/lib dir
[02:26:18] Ronis_BR: bougyman: in one installation, the files are being installed in /usr/local/lib
[02:26:30] Ronis_BR: bougyman: on the other, in /usr/local/lib64
[02:26:35] Ronis_BR: I have no idea why
[02:28:13] Ronis_BR: bougyman: same os, two machines with the same configuration
[02:28:33] moeabdol: has joined #ruby
[02:30:13] allcentury: has joined #ruby
[02:35:04] johnDoe111: has joined #ruby
[02:35:28] Ronis_BR: bougyman: no idea?
[02:38:21] certainty: has joined #ruby
[02:40:26] nankyokusei: has joined #ruby
[02:41:13] karmatr0n: has joined #ruby
[02:42:12] TubaraoSardinha: has joined #ruby
[02:42:16] coffeecupp: has joined #ruby
[02:45:58] Vingador: has joined #ruby
[02:47:37] Wolland: has joined #ruby
[02:52:41] Rodya_: has joined #ruby
[02:54:57] Axsuul: has joined #ruby
[02:55:03] jackjackdripper: has joined #ruby
[02:58:23] ruby[bot]: -b *!*@gateway/web/freenode/ip.151.80.113.194$#ruby-banned
[02:58:42] roamingdog: has joined #ruby
[02:58:58] mostlybadfly: has joined #ruby
[03:00:09] banister: has joined #ruby
[03:00:22] sandstrom: has joined #ruby
[03:04:06] jancel: has joined #ruby
[03:09:30] wjimenez5271: has joined #ruby
[03:11:13] karmatr0n: has joined #ruby
[03:12:25] mistermocha: has joined #ruby
[03:12:31] dionysus69: has joined #ruby
[03:14:03] duckpuppy: has joined #ruby
[03:14:40] blackmesa: has joined #ruby
[03:14:42] kiki_lamb: has joined #ruby
[03:14:43] tildes_: has joined #ruby
[03:17:16] Niham: has joined #ruby
[03:17:20] braincrash: has joined #ruby
[03:18:30] aberen: has joined #ruby
[03:20:30] RobertBirnie: has joined #ruby
[03:21:11] k3rn31: has joined #ruby
[03:24:49] nando293921: has joined #ruby
[03:27:19] sepp2k: has joined #ruby
[03:30:57] allcentury: has joined #ruby
[03:33:49] karmatr0n: has joined #ruby
[03:35:36] djbkd: has joined #ruby
[03:39:11] certainty: has joined #ruby
[03:39:25] skade: has joined #ruby
[03:40:22] kareeoleez: has joined #ruby
[03:44:46] achamian: has joined #ruby
[03:47:34] gix: has joined #ruby
[03:48:29] Wolland: has joined #ruby
[03:49:46] flashpoint9: has joined #ruby
[03:53:01] k3rn31: has joined #ruby
[03:53:33] learath: has joined #ruby
[03:53:47] learath: hey, I'm trying to load a fairly large json (~400m) and getting an out of memory error
[03:54:15] learath: Are there any simple steps I can take, short of just shrinking the json?
[03:57:00] TubaraoSardinha: learath: You can either increase the memory limit (or overall memory) of the environment you are trying to run
[03:57:27] TubaraoSardinha: Or break the json in smaller chunks and parse incrementaly
[03:59:18] learath: How do I increase the memory limit?
[04:00:27] pawnbox: has joined #ruby
[04:00:35] jancel: has joined #ruby
[04:01:08] learath: ah the java way
[04:01:50] terminalrecluse: has joined #ruby
[04:02:12] yatish27: has joined #ruby
[04:04:23] der-landgraf: has joined #ruby
[04:14:43] dtoast: has joined #ruby
[04:16:25] aberen: has joined #ruby
[04:18:33] freerobby: has joined #ruby
[04:20:53] echosystm: has joined #ruby
[04:21:19] jaguarmagenta: has joined #ruby
[04:21:59] echosystm: has left #ruby: ()
[04:22:27] lightt: has joined #ruby
[04:22:32] Ronis_BR: has joined #ruby
[04:23:05] haraigo: has joined #ruby
[04:24:53] Madplatypus: has joined #ruby
[04:25:43] Rodya_: has joined #ruby
[04:25:55] duncannz: has joined #ruby
[04:26:58] duncannz: has joined #ruby
[04:28:48] kgrz: has joined #ruby
[04:30:02] last_staff: has joined #ruby
[04:31:44] allcentury: has joined #ruby
[04:34:18] howdoi: has joined #ruby
[04:36:49] johnDoe111: has joined #ruby
[04:37:49] sp4rrow: has joined #ruby
[04:38:43] pawnbox: has joined #ruby
[04:39:51] certainty: has joined #ruby
[04:41:17] nankyokusei: has joined #ruby
[04:43:17] p337rB: has joined #ruby
[04:43:40] sumobob: has joined #ruby
[04:49:57] Wolland: has joined #ruby
[04:53:36] Maletor: has joined #ruby
[04:57:09] skade: has joined #ruby
[04:57:39] swills: has joined #ruby
[04:59:14] pawnbox: has joined #ruby
[04:59:15] raeoks: has joined #ruby
[05:02:05] tildes_: has joined #ruby
[05:02:59] sandstrom: has joined #ruby
[05:03:09] jenrzzz: has joined #ruby
[05:03:09] jenrzzz: has joined #ruby
[05:07:24] jaguarmagenta: has joined #ruby
[05:08:03] giz|work: has joined #ruby
[05:09:28] kareeoleez: has joined #ruby
[05:10:38] jancel: has joined #ruby
[05:11:33] ramfjord: has joined #ruby
[05:12:13] craigp: has joined #ruby
[05:13:30] alfiemax: has joined #ruby
[05:14:00] mistermocha: has joined #ruby
[05:14:38] darkxploit: has joined #ruby
[05:16:42] blackmesa: has joined #ruby
[05:17:06] axxyhtrx: has joined #ruby
[05:17:31] achamian: has joined #ruby
[05:20:40] A124: has joined #ruby
[05:23:35] fenre: has joined #ruby
[05:24:13] kies: has joined #ruby
[05:25:24] freerobby: has joined #ruby
[05:26:47] Rodya_: has joined #ruby
[05:29:28] sauvin: has joined #ruby
[05:32:27] allcentury: has joined #ruby
[05:36:13] thoraxe: has joined #ruby
[05:40:34] certainty: has joined #ruby
[05:46:52] A124: has joined #ruby
[05:47:54] sphex: has joined #ruby
[05:48:42] TomyLobo: has joined #ruby
[05:50:33] Wolland: has joined #ruby
[05:50:41] Maletor: has joined #ruby
[05:51:28] Wolland_: has joined #ruby
[05:55:07] kareeoleez: has joined #ruby
[05:56:22] kareeoleez: has joined #ruby
[06:00:15] terminalrecluse: has joined #ruby
[06:00:56] kareeoleez: has joined #ruby
[06:01:26] giz|work: has joined #ruby
[06:02:48] moeabdol: has joined #ruby
[06:03:43] Macaveli: has joined #ruby
[06:05:29] certainty: has joined #ruby
[06:08:18] Ch4rAss: has joined #ruby
[06:09:24] darkxploit: has joined #ruby
[06:10:01] Antiarc: has joined #ruby
[06:11:00] kareeoleez: has joined #ruby
[06:12:02] skade: has joined #ruby
[06:12:18] jancel: has joined #ruby
[06:13:51] ravishankarjha: has joined #ruby
[06:14:14] yfeldblum: has joined #ruby
[06:14:39] solars: has joined #ruby
[06:16:27] sepp2k: has joined #ruby
[06:19:50] sandelius: has joined #ruby
[06:21:40] kareeole_: has joined #ruby
[06:23:57] MrBusiness: has joined #ruby
[06:26:11] Coldblackice: has joined #ruby
[06:26:56] firstdayonthejob: has joined #ruby
[06:27:29] Rodya_: has joined #ruby
[06:28:01] tAn: has joined #ruby
[06:29:25] jas02: has joined #ruby
[06:30:59] haraigo: has joined #ruby
[06:33:13] allcentury: has joined #ruby
[06:33:39] last_staff: has joined #ruby
[06:34:23] tmtwd: has joined #ruby
[06:35:31] aganov: has joined #ruby
[06:35:43] codecop: has joined #ruby
[06:40:30] MrBusiness: has joined #ruby
[06:41:46] sandstrom: has joined #ruby
[06:42:11] nankyokusei: has joined #ruby
[06:42:34] axxyhtrx: has joined #ruby
[06:47:15] giz|work: has joined #ruby
[06:48:40] blockchan: has joined #ruby
[06:49:16] Dimik: has joined #ruby
[06:50:03] pepee: has joined #ruby
[06:51:00] nadir: has joined #ruby
[06:52:03] nobitanobi: has joined #ruby
[06:53:01] Noxilex: has joined #ruby
[06:53:23] ur5us: has joined #ruby
[06:53:53] polll: has joined #ruby
[06:54:38] Ch4rAss: has joined #ruby
[06:55:37] nhhc: has joined #ruby
[06:56:08] sauvin: has joined #ruby
[06:57:13] norc: has joined #ruby
[06:57:17] tvw: has joined #ruby
[07:05:52] Spami: has joined #ruby
[07:06:38] agit0: has joined #ruby
[07:08:20] rbr: has joined #ruby
[07:08:33] vondruch: has joined #ruby
[07:08:39] c0mrad3: has joined #ruby
[07:09:08] aries_liuxueyang: has joined #ruby
[07:09:41] flashpoint9: has joined #ruby
[07:11:54] Axy: has joined #ruby
[07:12:09] pawnbox: has joined #ruby
[07:12:14] andikr: has joined #ruby
[07:12:18] TomyWork: has joined #ruby
[07:12:58] blockchan: has joined #ruby
[07:15:28] mistermocha: has joined #ruby
[07:16:01] duckpuppy: has joined #ruby
[07:17:30] blackmesa: has joined #ruby
[07:22:23] flughafen_: has joined #ruby
[07:23:30] sarbs: has joined #ruby
[07:24:42] A124: has joined #ruby
[07:25:37] roamingdog: has joined #ruby
[07:25:52] noobsu_: has joined #ruby
[07:26:31] giz|work: has joined #ruby
[07:26:51] k3rn31: has joined #ruby
[07:27:29] polll: has joined #ruby
[07:27:55] polll: has joined #ruby
[07:28:17] Rodya_: has joined #ruby
[07:29:31] jud^: has joined #ruby
[07:29:49] nertzy3: has joined #ruby
[07:30:26] MrBusiness: has joined #ruby
[07:32:07] pawnbox: has joined #ruby
[07:33:43] eGGshke: has joined #ruby
[07:33:47] lessless: has joined #ruby
[07:34:00] allcentury: has joined #ruby
[07:36:19] pepee: has joined #ruby
[07:37:08] edwinvdgraaf: has joined #ruby
[07:38:08] edwinvdg_: has joined #ruby
[07:38:31] johnDoe111: has joined #ruby
[07:40:03] DanielI: has joined #ruby
[07:44:00] sameerynho: has joined #ruby
[07:44:10] ash_workz: has joined #ruby
[07:49:39] darkxploit: has joined #ruby
[07:50:29] Staticillmatic: has joined #ruby
[07:51:21] moeabdol: has joined #ruby
[07:52:46] coffeecupp: has joined #ruby
[07:52:49] giz|work: has joined #ruby
[07:53:01] MrBusiness2: has joined #ruby
[07:53:24] Niham: has joined #ruby
[07:56:05] jud: has joined #ruby
[07:56:24] znz_jp: has joined #ruby
[08:00:17] al2o3-cr: has joined #ruby
[08:01:06] ocbtec: has joined #ruby
[08:01:54] ecksit: has joined #ruby
[08:02:59] ksinkar: has joined #ruby
[08:03:26] aberen: has joined #ruby
[08:04:17] mikecmpbll: has joined #ruby
[08:04:27] elementaru: has joined #ruby
[08:04:34] ksinkar: has anyone here used the Ruby Shell library recently? I am using it, but other than echo, I cannot access any other shell commands which are available in my shell through my PATH.
[08:04:58] norc: ksinkar: What library is that?
[08:08:01] nobitanobi: has joined #ruby
[08:08:17] Silthias: has joined #ruby
[08:09:54] phredus: has joined #ruby
[08:11:33] mark_66: has joined #ruby
[08:14:30] pawnbox: has joined #ruby
[08:15:53] thamster: has joined #ruby
[08:16:49] JohnBat26: has joined #ruby
[08:17:02] thamster: has joined #ruby
[08:17:12] thamster: has left #ruby: ()
[08:17:51] jazz1: has joined #ruby
[08:18:36] joonty: has joined #ruby
[08:19:03] jaruga___: has joined #ruby
[08:19:22] pawnbox_: has joined #ruby
[08:20:11] senayar: has joined #ruby
[08:23:03] dionysus69: has joined #ruby
[08:24:01] certainty: has joined #ruby
[08:25:19] crdpink: has joined #ruby
[08:25:46] TheHodge: has joined #ruby
[08:25:46] diegoaguilar: has joined #ruby
[08:25:52] rikkipitt: has joined #ruby
[08:26:36] sandelius: has joined #ruby
[08:29:08] Rodya_: has joined #ruby
[08:29:41] der-landgraf: has joined #ruby
[08:32:12] zacstewart: has joined #ruby
[08:33:09] der-landgraf: has joined #ruby
[08:33:12] tmtwd: has joined #ruby
[08:34:40] madgen: has joined #ruby
[08:34:42] allcentury: has joined #ruby
[08:36:13] Bish: has joined #ruby
[08:36:18] Bish: can i have a multiple .sub?
[08:36:24] Bish: multiline*
[08:37:12] norc: Bish: what do you mean? multiline regexp?
[08:37:31] Bish: >> "tes\nt".scan /test/
[08:37:32] ruby[bot]: Bish: # => [] (https://eval.in/586620)
[08:37:45] norc: Bish: use //x
[08:37:48] spikeheadon: has joined #ruby
[08:38:02] norc: Bish: that way whitespace and comments (!) are ignored inside the regular expression.
[08:38:13] spikey: has joined #ruby
[08:38:17] Bish: >> "tes\nt".scan /test/x
[08:38:18] ruby[bot]: Bish: # => [] (https://eval.in/586621)
[08:38:20] gregf_: i think /m
[08:38:21] norc: Every non-trivial regexp should use this as you can inline comment the blocks and bits. :)
[08:38:29] Bish: gregf_: /m is not ruby i think
[08:38:30] norc: gregf_: No, /m is for multiline matches
[08:38:39] norc: Or.. it might be.
[08:39:11] norc: gregf_: //m just causes newline characters to be matched by .
[08:40:31] Bish: okay, but that might be enough
[08:40:52] norc: Bish: Or you could simply gsub("\n", '') first
[08:40:53] pawnbox: has joined #ruby
[08:41:26] jhass: .delete("\n")
[08:41:37] jhass: stop deleting characters with gsub already
[08:42:25] Bish: ACTION uses gsub just so jhass gets mad
[08:42:30] Bish: DU JHASST MICH
[08:43:04] nankyokusei: has joined #ruby
[08:43:33] p337rB: has joined #ruby
[08:43:42] norc: jhass: Fair point.
[08:44:50] gregf_: rammstein
[08:47:43] diegoaguilar: has joined #ruby
[08:48:32] ksinkar`: has joined #ruby
[08:48:52] ksinkar`: has left #ruby: ()
[08:49:22] Ch4rAss: has joined #ruby
[08:50:08] Bish: >> "<a href=\"tes\nt\">".scan /<a [^>]*>/
[08:50:10] ruby[bot]: Bish: # => ["<a href=\"tes\nt\">"] (https://eval.in/586625)
[08:50:14] Bish: what exactly do i need /m for?
[08:51:31] xfbs: has joined #ruby
[08:52:05] jaruga___: has joined #ruby
[08:53:01] jazz2: has joined #ruby
[08:54:23] jazz2: Bish: sorry disconnected, when using anchors the m modifier is useful.
[08:54:48] gregf_: Bish: use a parser :|
[08:54:58] gregf_: oh, no *ignore me*
[08:55:13] Bish: if i wasn't only checking lings. i would
[08:55:19] Bish: lings, derp.
[08:55:24] jazz2: parser is better yeah, but maybe the case is simple enough to not need it.
[08:55:30] norc: Regexp means "REGular Expressions for Xml Parsing"
[08:55:36] norc: They must be great to handle XML.
[08:55:48] darkxploit: has joined #ruby
[08:55:55] Bish: well actually software works cool if people did nice html
[08:56:02] Bish: but people tend to
[08:56:17] norc: Bish: That is what Nokogiri excels at by the way. Parsing broken html/xml
[08:56:24] Bish: <a href="ht\ntp://this\t-is-a-link\nt\tsomewhere.com">a</a>
[08:57:55] mdw: has joined #ruby
[08:57:58] certainty: has joined #ruby
[08:58:01] nobitanobi: has joined #ruby
[08:58:17] jhass: jazz1: ruby is different, m doesn't affect ^ or $, only .
[08:59:03] gregf_: >> p "ht\ntp://this\t-is-a-link\nt\tsomewhere.com".gsub!(/\s+/,"");
[08:59:04] ruby[bot]: gregf_: # => "http://this-is-a-linktsomewhere.com" ...check link for more (https://eval.in/586632)
[09:00:20] jazz1: jhass: ah. ok makes sense. thanks :)
[09:00:46] norc: Bish: Why are you not using a proper xml/html parser?
[09:00:53] snowy: has joined #ruby
[09:01:09] Ch4rAss: has left #ruby: ()
[09:01:15] snowy: has joined #ruby
[09:01:37] axxyhtrx: has joined #ruby
[09:04:05] giz|work: has joined #ruby
[09:05:22] flughafen_: is anybody here using vimmonster forruby completion in vim
[09:06:09] mikecmpbll: has joined #ruby
[09:06:53] gregf_: *just types it all* :|
[09:07:04] alfiemax: has joined #ruby
[09:07:25] norc: flughafen_: you know that vi has autocompletion builtin right?
[09:07:27] gregf_: writing java using textpad could'nt be worse :|
[09:07:59] jazz1: are you doing that?
[09:08:16] flughafen_: norc: yeah, but i find it isn't that good.
[09:08:39] gregf_: jazz1: you mean me? *started off that way* :)
[09:08:58] marr: has joined #ruby
[09:09:10] jazz1: yep i meant you, & that sounds tedious.
[09:09:30] gregf_: jazz1: tedious , sure.. but you learn quite a bit
[09:09:33] sarlalian: has joined #ruby
[09:11:55] tjbiddle: has joined #ruby
[09:12:17] sepp2k: has joined #ruby
[09:12:51] blockchan: has joined #ruby
[09:14:56] jaguarma_: has joined #ruby
[09:15:24] darkxploit: has joined #ruby
[09:15:26] colegatron_origi: has joined #ruby
[09:15:30] johnDoe111: has joined #ruby
[09:15:38] blackmesa: has joined #ruby
[09:15:47] Ishido: has joined #ruby
[09:15:50] platzhirsch: has joined #ruby
[09:16:12] blockchan1: has joined #ruby
[09:16:57] duckpuppy: has joined #ruby
[09:18:09] toretore: has joined #ruby
[09:19:16] yatish27: has joined #ruby
[09:20:32] workmad3: has joined #ruby
[09:20:45] moeabdol: has joined #ruby
[09:23:37] Axsuul: has joined #ruby
[09:24:59] Ch4rAss: has joined #ruby
[09:25:16] Ch4rAss: has left #ruby: ()
[09:25:57] giz|work: has joined #ruby
[09:32:01] lessless: has left #ruby: ("Textual IRC Client: www.textualapp.com")
[09:32:09] evidex: has joined #ruby
[09:33:06] darkxploit: has joined #ruby
[09:33:45] nobitanobi: has joined #ruby
[09:35:27] allcentury: has joined #ruby
[09:37:53] tatsuo: has joined #ruby
[09:41:20] joonty: has joined #ruby
[09:43:26] lxsameer: has joined #ruby
[09:45:19] nobitanobi: has joined #ruby
[09:45:52] tatsuo: has joined #ruby
[09:47:25] jancel: has joined #ruby
[09:49:41] sepp2k: has joined #ruby
[09:52:41] pawnbox: has joined #ruby
[09:54:42] symm-: has joined #ruby
[09:58:19] bruce_lee: has joined #ruby
[10:08:27] nobitanobi: has joined #ruby
[10:08:40] certainty: has joined #ruby
[10:14:21] kknight: has joined #ruby
[10:16:25] johnDoe111: has joined #ruby
[10:17:09] lala2004: has joined #ruby
[10:17:36] ICantCook: has joined #ruby
[10:17:36] lala2004: hey -- i'm learning to code -- ruby -- does everything have to be in a function definition: https://gist.github.com/anonymous/85be6886678f8090ab62303218d9ca9e
[10:18:16] lala2004: i'm getting: undefined method `try_spin' for main:Object (NoMethodError)
[10:18:24] lala2004: but i clearly define it
[10:18:53] lala2004: oh -- order!!! got it
[10:19:21] Couch: has joined #ruby
[10:20:56] norc: lala2004: By the way, in Ruby functions are called "methods" :)
[10:21:14] lala2004: thanks! i'm new to computers
[10:22:03] tatsuo: has joined #ruby
[10:22:21] jaruga___: has joined #ruby
[10:23:21] norc: lala2004: But yeah, Ruby executes code from top to bottom. There is no static analysis like in C, where you can call a function before you declare it (in the same file).
[10:23:37] lala2004: that must be because it doesn't compile
[10:23:48] norc: lala2004: Well actually it does.
[10:23:50] lala2004: or it has too . . . but it does it at runtime (whatever that means)?
[10:24:04] norc: In that respect Ruby is similar to Java.
[10:24:41] moeabdol1: has joined #ruby
[10:25:23] workmad3: norc: err, java needs compilation to bytecode before it can run on the JVM
[10:25:30] norc: workmad3: And Ruby does exactly that.
[10:25:37] workmad3: norc: not explicitly
[10:25:37] lala2004: so -- there is a virtual machine that directly abstracts into, say, x86?
[10:25:46] norc: lala2004: Yes.
[10:25:53] workmad3: lala2004: since 1.9, yes
[10:25:56] norc: workmad3: 2.0
[10:26:06] norc: Or was it 1.9?
[10:26:08] workmad3: norc: I thought YARV became MRI with 1.9 :)
[10:26:12] norc: ACTION shrugs
[10:26:25] lala2004: sorry . . .
[10:26:31] norc: lala2004: MRI is Ruby slang for "Matz Ruby Interpreter"
[10:26:35] workmad3: YARV == Yet Another Ruby VM... MRI == Matz's Ruby Interpreter
[10:26:43] lala2004: which is a virtual machine
[10:26:44] jhass: lala2004: ignore them, all this is completely irrelevant for you currently
[10:26:54] lala2004: like a wrapper around the procesor
[10:27:07] workmad3: jhass: it's friday, let us shave yaks :P
[10:27:16] lala2004: jhass: sorry, I'm terrible at ignoring things -- i know it is a weakness
[10:27:23] norc: workmad3: Im curious though, what did you mean by "not explicitly" ?
[10:27:49] workmad3: norc: for java, you need to run `javac` in order to get the bytecode, the JVM doesn't actually include the source->bytecode compiler as part of the VM
[10:28:01] workmad3: norc: while with ruby, the source->bytecode compilation is part of the interpreter
[10:28:07] workmad3: and there's no separate compilation step
[10:28:18] norc: workmad3: Fair enough.
[10:28:23] norc: You could enforce it to be separate though.
[10:28:31] norc: Ship people ISeqs :D
[10:28:45] workmad3: you could, if you had a bytecode standard for the VM that you were commited to keeping stable
[10:29:37] norc: workmad3: The biggest problem though is that it needs require/autoloading support.
[10:29:56] norc: (in order to seamlessly ship a library as an iseq binary)
[10:30:11] workmad3: norc: that's not a huge problem... the bigger problem is `eval` ;)
[10:30:17] norc: evaling works..
[10:30:36] workmad3: not if you remove the source->bytecode compiler from the runtime and enforce the use of ISeqs
[10:30:57] norc: What do you mean?
[10:31:30] workmad3: eval needs to compile the string as ruby code... if you're going to remove the bytecode compiler and rely on ISeqs, then eval doesn't have a mechanism to compile with...
[10:31:44] nobitanobi: has joined #ruby
[10:31:59] norc: Oh you actually meant Kernel#eval there.
[10:32:06] norc: Fuck that.
[10:32:30] workmad3: agreed... but it's part of the language, and makes switching to a more java-esque VM style more difficult :)
[10:33:20] norc: workmad3: Though I think if there was enough support to make require/autoloading work with binary ISeqs, it could help a lot with the startup time of things like rails apps.
[10:33:49] norc: But I guess I should actually profile this first before making such claims.
[10:34:19] sandelius: has joined #ruby
[10:34:20] truenito: has joined #ruby
[10:34:32] workmad3: similarly, afaik there's not a commitment to having a stable VM bytecode in ruby currently either, which is the real stumbling block... without that, there's always the potential issue of an ISeq not working with your ruby version (solvable, but only if you're fine with just caching compiled ISeqs and throwing them away if there's any issues for a recompile from source)
[10:35:07] workmad3: I think python does that though, so it's probably not a big deal, and could help startup times :)
[10:35:18] norc: Considering we have had grammar changes even in minor versions, cross-version compability has never been much of a big feature of Ruby.
[10:35:24] norc: Yeah they do.
[10:36:02] norc: workmad3: Im wondering whether this could actually be the more sane approach to an app preloader like Spring.
[10:36:13] allcentury: has joined #ruby
[10:36:17] norc: Since you would essentially only be preloading something that has non side-effect.
[10:36:24] camilasan: has joined #ruby
[10:36:31] workmad3: norc: yeah... but imagine the error messages when you get told that your program won't load because `unexpected byte 0xff was encountered in ISeq` rather than a sensible parser Syntax error in a source file ;)
[10:36:47] lala2004: so LLVM is bytecode, could the yarv run that?
[10:36:53] workmad3: lala2004: no
[10:36:54] norc: lala2004: No
[10:37:01] norc: lala2004: Ruby uses a custom VM, not a very complex one either.
[10:37:06] vondruch: has joined #ruby
[10:37:18] lala2004: llvm is specific to cland?
[10:37:22] norc: lala2004: no
[10:37:24] norc: llvm is specific to llvm.
[10:37:41] workmad3: lala2004: no... but the LLVM VM is a different VM to the ruby VM, which means it runs a different bytecode
[10:37:43] norc: clang is just a compiler frontend for llvm
[10:37:50] lala2004: what is the relationship between clang . . . oh got it
[10:38:06] lala2004: norc: are there other frontends for llvm?
[10:38:18] norc: lala2004: Plenty!
[10:38:22] lala2004: so what could run llvm?
[10:38:29] workmad3: lala2004: bytecode is just a term for "We compiled our source into a machine code representation that corresponds to a virtual machine in our runtime"
[10:38:30] norc: lala2004: http://llvm.org/ProjectsWithLLVM/
[10:38:47] norc: lala2004: Rubinius is probably the best example, consideirng we are in #ruby.
[10:39:01] lala2004: oh -- thanks -- so bytecode is for a vm, where a binary is for specific hardware?
[10:39:03] sdothum: has joined #ruby
[10:39:38] norc: lala2004: Sure, I think that view is fine.
[10:39:56] lala2004: ha -- probably wrong but gets me to the next step at least
[10:40:08] norc: It seems quite correct actually.
[10:40:12] workmad3: lala2004: pretty much... there's nothing really stopping you from creating custom hardware that implements the instruction set of a VM, but I'm not aware that anyone has ever bothered :)
[10:40:39] norc: lala2004: In the end its just fancy terms. In reality you have so many levels of abstractions. If you compile C code, you have the following layers
[10:41:15] lala2004: as a beginner, it seems everything i think is wrong in some way
[10:41:29] lala2004: at least code runs -- that is a certain definition of reality
[10:41:30] norc: lala2004: C source code > Abstract Syntax Tree > (1-3 levels of) Intermediate Representation > (Possibly a VM) > Assembly > Instructions > Microcode
[10:41:43] lala2004: nice! that helps
[10:41:50] workmad3: lala2004: sometimes you need to learn something that isn't completely accurate in order to get a base of knowledge to understand the more accurate version
[10:42:07] elomatreb: Isn't the microcode independent from the program, basically CPU firmware?
[10:42:07] norc: lala2004: And then within that, Ruby emulates a virtual machine.
[10:42:12] norc: elomatreb: Correct.
[10:42:41] norc: elomatreb: firmware is a bit generic though, effectively its what allows modern processors to offer CISC but still get pipeline benefits from RISC.
[10:42:52] norc: (since it breaks CISC into RISC operations)
[10:43:37] elomatreb: norc: I think I just misunderstood your example above. (Close-to-metal programming isn't anything I want to have anything to do with)
[10:43:53] nankyokusei: has joined #ruby
[10:45:01] workmad3: elomatreb: modern CPUs don't actually run something like the x86 instruction set... instead they have what amounts to a compilation unit as part of the processer that accepts x86 machine code and compiles it into instructions for an internal microcode that's simpler and easier for the CPU to optimise
[10:45:29] babblebre: has joined #ruby
[10:45:38] workmad3: elomatreb: that's the Instructions > Microcode step norc meant (or at least, my understanding of it... I'm not much of a low-level coder either)
[10:45:45] norc: workmad3: Correct.
[10:46:03] elomatreb: I read the Wikipedia article on RISC once, that's basically anything I ever learned about that :shrug:
[10:46:25] norc: workmad3: The biggest benefit is that it allows for out-of-order execution. :)
[10:47:14] norc: (Technically its not necessary, but it makes it far more effective)
[10:47:43] norc: Or parallelism rather.
[10:48:33] workmad3: elomatreb: as you can probably see, the distinction is somewhat more fuzzy nowadays :) and it wasn't ever particularly sharp anyway
[10:49:23] norc: lala2004: Anyway. The point was to show that in programming you have many layers of abstractions. And Rubys VM is on the left side.
[10:49:45] workmad3: ^ there's a classic saying - "Every problem in programming can be solved by an extra layer of indirection"
[10:49:48] norc: lala2004: So you would have "Ruby VM" > "C Code" > etc.
[10:50:14] elomatreb: I'm continuously impressed that computers do anything, ever
[10:50:21] hakunin_: has joined #ruby
[10:50:34] workmad3: norc: technically, "C Code" sits off to the side of that, as the Ruby VM doesn't emit C Code, it emits instructions... but it's compiled from C Code :)
[10:50:56] norc: workmad3: Yeah I suppose.
[10:51:24] nobitanobi: has joined #ruby
[10:51:49] workmad3: elomatreb: yeah... the scariest thing about being a programmer is to realise just how fragile the entire edifice of the modern world is
[10:52:48] elomatreb: workmad3: Or how impressive it is that we can talk to people using a few grams of carefully etched sand
[10:52:50] polll: has joined #ruby
[10:53:39] workmad3: elomatreb: a few grams of carefully etched sand that only achieves anything by pretending that everything is a number!
[10:54:26] workmad3: really shows how powerful Gödelisation is...
[10:55:14] lala2004: norc: how can there be anything lower than instructions?
[10:55:32] norc: lala2004: the CPU is effectively running an interpreter of its own.
[10:55:35] joonty: has joined #ruby
[10:56:00] biox: has joined #ruby
[10:56:03] techietrash: has joined #ruby
[10:56:04] elomatreb: lala2004: The lowest level of "instructions" on your CPU are just logic gates of two transistors
[10:56:57] lala2004: ok -- so 0x37 might instruct the processor to xor two registers, you are saying that below that there is hardware incorporated instructions?
[10:57:03] seitensei: has joined #ruby
[10:57:46] norc: lala2004: an instruction gets decoded into microinstructions, and these microinstructions again consist of single operations.
[10:57:58] elomatreb: lala2004: Even a XOR gate is built using four NAND gates
[10:58:10] hk238: has joined #ruby
[10:58:36] lala2004: got it -- so the corpus of x86 instructions takes some number of transistors to execute
[10:58:41] norc: lala2004: an xor needs to connect registers to the alu, set the ALU to do things, and then force the cpu to jump to the next instruction.
[10:59:01] lala2004: say that is "n" transistors -- why do we now have billions >> n?
[10:59:23] elomatreb: because you can't reconfigure transistors on the fly
[10:59:38] workmad3: lala2004: something as simple as xor on two registers probably would pass through directly into a single microcode instruction... but the x86 instruction set has much more complicated instructions
[11:00:05] norc: lala2004: modern CPUs are really complex designs.
[11:00:19] lala2004: but still x86 worked on 1/100th (or even less) of the transistors of more recent chips
[11:00:22] norc: lala2004: For example during a single cycle a modern x86 CPU can execute up to 4 instructions.
[11:00:26] yqt: has joined #ruby
[11:00:50] workmad3: lala2004: I don't know if they're supported on modern CPUs, but some processors had instructions for things like squareroots, sine and cosine, etc.
[11:00:53] lala2004: is there something like a pie chart of what transistors on a modern chip are used for?
[11:01:04] norc: lala2004: dont think in terms of transistors.
[11:01:12] norc: lala2004: You cannot sensibly understand it from that perspective.
[11:01:25] workmad3: ^ it's like trying to understand an airplane in terms of atoms
[11:01:50] norc: lala2004: https://upload.wikimedia.org/wikipedia/commons/6/64/Intel_Nehalem_arch.svg
[11:01:51] elomatreb: But it's quite enlightening to understand how a computer is even able to operate. Maybe not for programming, but in general
[11:01:55] lala2004: fair enough -- but why would i want 4B transistors versus 4000 if 4000 is all it takes to run all x86 opcodes
[11:02:05] norc: lala2004: that diagram is as low as you can understand it without losing yourself.
[11:02:18] davedev24: has joined #ruby
[11:02:22] norc: lala2004: Look at that, and then begin to understand that modern processors are unbelievably complex.
[11:02:53] workmad3: elomatreb: if you want something fun - you can also construct all basic logic gates from NOR gates... and you can construct a NOR gate from a single transistor
[11:03:10] norc: and then start building arithmetic operations
[11:03:17] norc: try to build a half-adder without looking at the wiki
[11:03:18] lala2004: well, i'm impressed -- my teacher said that ruby coders don't understand how things work
[11:03:20] norc: then a full adder
[11:03:31] lala2004: that i should learn c because i would learn what the computer does
[11:03:34] elomatreb: workmad3: In Germany you actually do that in school if you pick CS in the higher grades
[11:03:43] norc: lala2004: C is a fine language but has different goals.
[11:03:51] workmad3: lala2004: if you learn C, you learn what a PDP11 does...
[11:03:54] norc: lala2004: C is useful when you need to write language close to the hardware.
[11:04:17] norc: For Kernel development there are only 2 sensible languages (a few others have been used successfully though)
[11:04:21] norc: C and possibly C++.
[11:04:24] workmad3: it has about as much actual resemblance to modern hardware as ruby... but it has 30+ years of intensive compiler optimisation behind it
[11:04:55] norc: lala2004: But if the task is to quickly provide a website, then C is not the right task because you are too close to the hardware.
[11:05:17] norc: In essence: Ruby developers don't _care_ about the hardware (as opposed to dont know)
[11:05:18] elomatreb: lala2004: If you really want to use a compiled language you could check out Rust (https://www.rust-lang.org/). Almost all the benefits with few of the risks of C
[11:05:31] flashpoint9: has joined #ruby
[11:06:39] k3rn31: has joined #ruby
[11:06:41] nobitanobi: has joined #ruby
[11:06:47] lala2004: does rust give you the h/w knowledge
[11:07:02] ytti: rust has no run time
[11:07:13] ytti: it can be used for anything
[11:07:14] lala2004: ytti: what does that mean?
[11:07:19] ytti: it means it's as low level a it gets
[11:07:42] norc: Just dont try Kernel development with it. :-P
[11:07:57] ytti: (i disagree greatly if C is fine language, i don't think it is, i think large amount of poor quality software is attributed to C being too hard to program right)
[11:07:58] elomatreb: Unless you're developing actual drivers you probably shouldn't be interested in HW knowledge for programming
[11:07:59] workmad3: lala2004: tbh, no language will really give you h/w knowledge (not even C)... the main thing C will give you is working knowledge of an ancient processor, and manual memory management
[11:08:01] joonty1: has joined #ruby
[11:08:21] lala2004: workmad3: i see
[11:08:25] norc: ytti: Well its fine for specific tasks, which is kernels and drivers.
[11:08:28] rodfersou: has joined #ruby
[11:08:29] workmad3: lala2004: what gives you hardware knowledge is having to interface with hardware (like elomatreb said)
[11:08:57] Emmanuel_Chanel: has joined #ruby
[11:09:05] elomatreb: If you're really interesting in Hardware get a Arduino or some similar microcontroller chip. Quite fun to play with
[11:09:17] elomatreb: *interested
[11:09:24] certainty: has joined #ruby
[11:10:01] workmad3: lala2004: C doesn't really expose you to things like having to move data from memory to registers, the instruction counter, etc. and it definitely won't expose you to the microcode optimisations of modern hardware... it's surprisingly far away from actual hardware for something that's claimed as 'low level' by so many :)
[11:10:32] lala2004: so -- breaking code, ida and the like might give one that knowledge
[11:10:43] tlaxkit: has joined #ruby
[11:10:48] chouhoulis: has joined #ruby
[11:10:49] norc: workmad3: And yet C requires you to be *aware* of all these things. If you have misaligned data, your program might crash. If you dont write cache line aware core, you suffer from extreme performance penalties.
[11:11:22] workmad3: norc: yeah, but it needs you to be aware of them in a way that's closer to PDP11s hardware than modern hardware
[11:11:42] workmad3: norc: that doesn't make it 'close to the metal', it makes it annoying ;)
[11:12:15] norc: workmad3: The headache I got yesterday when I learned why exactly I had to enable the A20 gate during boot sequence.
[11:12:18] norc: Unbelievable.
[11:12:52] workmad3: norc: compilers make up for a lot of the inconsistency though, so C compiles down to something pretty close to optimal for the underlying hardware in most cases
[11:12:53] norc: Not to mention why one of the common ways to do it was through the keyboard controller (that provoked a real wtf)
[11:13:05] lala2004: ok -- sorry, very basic again -- if I have a hash: freq = Hash['large' => 0, 'small' => 0, 'tiny' => 0, 'lose' => 0] and I want to increase 'large' by one?
[11:13:17] norc: workmad3: Indeed. Though cache line awareness is something the programmer has to do, the compiler can not help.
[11:13:28] norc: Or page boundary awareness.
[11:13:30] workmad3: lala2004: freq['large'] += 1
[11:13:47] lala2004: simple enough!
[11:13:59] workmad3: lala2004: also, I'd suggest using a hash literal - `freq = { 'large' => 0, 'small' => 0, ... }`
[11:14:13] norc: workmad3: And sadly the only way you can write good code there, is if you understand cache lines and paging.
[11:14:35] lala2004: is there an easy way to display all hash values at the end
[11:14:42] lala2004: or do i need to iterate it?
[11:14:47] workmad3: lala2004: `p freq`
[11:14:49] norc: lala2004: Id say start by iterating!
[11:14:53] norc: lala2004: Try things out.
[11:15:00] norc: Get experience. Get your hands dirty.
[11:15:08] workmad3: (if in doubt, `puts` and `p` give you insight into lots of things)
[11:15:48] Bish: my regex was /<a .../ to detect links
[11:15:56] Bish: someone did <a\n -_-
[11:16:08] workmad3: Bish: welcome to why you shouldn't use regexp to try and parse HTML :P
[11:16:15] lala2004: wow -- this works: https://gist.github.com/anonymous/307d37d9fbff43f66ef2eee732daa034
[11:16:20] Bish: well even if its broken html?
[11:16:43] johnmilton: has joined #ruby
[11:16:50] norc: Bish: Did you have a reason not to use an XML/HTML parser?
[11:17:08] Bish: well that regex was sufficent until now
[11:17:18] Bish: i really only wanted links, that's all i needed
[11:17:26] norc: lala2004: By the way! https://eval.in/ allows you to share code *and* have it executed. (gists are great for everything else though)
[11:17:31] johnDoe111: has joined #ruby
[11:17:44] duckpuppy: has joined #ruby
[11:18:04] norc: Bish: see, with nokogiri it would be: document.css(‘a’)
[11:18:14] workmad3: Bish: `<a\n` isn't broken HTML, afaik
[11:18:48] swills: has joined #ruby
[11:18:50] lala2004: norc: cool -- appreciate any tips on my code -- that was much easier than i thought
[11:19:04] lala2004: simulating a game i'm making for school -- a roulette wheel
[11:19:12] norc: lala2004: Considering you just started, just focus on figuring things out.
[11:19:40] norc: lala2004: aside from the usual "use 2-space indention, not tabs" that you hear in this channel I wouldn't really care to comment on else.
[11:19:43] lala2004: ok -- well that works -- i love the switch syntax
[11:19:46] norc: Otherwise you would be busy for a day rewriting this.
[11:20:30] gnufied: has joined #ruby
[11:20:57] mistermocha: has joined #ruby
[11:21:08] lala2004: ok -- well, i'm excited that i got something to work
[11:21:15] lala2004: thanks for all the understanding too
[11:21:18] norc: lala2004: It looks generally fine otherwise.
[11:21:21] norc: So you are on a good path.
[11:21:33] lala2004: i'll take it
[11:21:40] lala2004: good day all
[11:21:47] lala2004: has left #ruby: ()
[11:24:20] allcentury: has joined #ruby
[11:25:23] Axsuul: has joined #ruby
[11:28:21] deadnull_: has joined #ruby
[11:28:27] chouhoulis: has joined #ruby
[11:28:59] preller: has joined #ruby
[11:28:59] preller: has joined #ruby
[11:29:58] syath: has joined #ruby
[11:31:30] jaguarmagenta: has joined #ruby
[11:31:43] CloCkWeRX: has joined #ruby
[11:31:46] Fredrich010: has joined #ruby
[11:33:46] Bish: workdmad3 i never said <a\n would be the reason why the html is broken
[11:34:24] Bish: workmad3: *
[11:34:49] Bish: it can get much worse than that :D
[11:34:54] kareeoleez: has joined #ruby
[11:35:02] ruby[bot]: pro-tip - use tab completion for nicks. avoids typos in nicks.
[11:35:17] Bish: i scrolled up in irssi somehow couldn't tab during that
[11:35:19] preller: has joined #ruby
[11:35:19] preller: has joined #ruby
[11:35:30] jhass: get weechat :P
[11:35:39] Bish: i like irssi
[11:36:27] nobitanobi: has joined #ruby
[11:38:22] rodfersou: has joined #ruby
[11:43:59] blockchan: has joined #ruby
[11:47:02] blockchan1: has joined #ruby
[11:48:00] matp: has joined #ruby
[11:49:33] Yiota: has joined #ruby
[11:49:49] Silthias: has joined #ruby
[11:50:23] Wildfyr: has joined #ruby
[11:50:37] shevy: real men need real GUIs
[11:52:52] Bish: i feel like text interfaces are way more manly
[11:52:53] hutch34: has joined #ruby
[11:53:11] johnDoe111: has joined #ruby
[11:55:14] Hanmac: has joined #ruby
[11:55:16] jhass: what does usability have to do with my gender?
[11:55:52] workmad3: jhass: it has very little to do with your gender, but it has a lot to do with cultural gender-specific stereotypes
[11:56:28] jhass: doesn't sound like a good situation then
[11:56:54] lightt: has joined #ruby
[11:57:01] rikkipitt: has joined #ruby
[11:58:03] apeiros: Bish: in what way? that most interfaces are dicks to users?
[11:59:18] blackgoat: has joined #ruby
[12:00:28] shevy: text interfaces are a lot easier to do right
[12:00:45] apeiros: in a way. in a way they're a lot more difficult.
[12:01:24] swills: has joined #ruby
[12:01:50] moeabdol2: has joined #ruby
[12:02:06] Bish: i think different
[12:02:57] romistrub: has joined #ruby
[12:03:00] jhass: different from/than?
[12:03:14] Bish: apeiros: in a way that interfaces are a lot closer to the "engine" like a motorengine of a car => manly
[12:03:29] jhass: what a sad statement
[12:03:31] Bish: if you have a sort of syntax you can often reuse something
[12:03:34] jhass: ?offtopic
[12:03:34] ruby[bot]: this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related problems. Thanks!
[12:03:47] Bish: more flexieble etcpp, but as jhass said
[12:03:53] Bish: jhass: i wasn't 100% serious about that one :D
[12:04:18] jhass: sarcasm doesn't prevent reproduction
[12:04:44] romistrub: how do I create a subclass of String and then set its value as something from within a function? Is there something like my_string.value = "xyz"? I don't think it makes sense to do self = "xyz" from within a function
[12:05:06] apeiros: romistrub: a) don't do it, b) #replace
[12:05:16] jhass: romistrub: don't subclass string, wrap it
[12:05:29] k3rn31: has joined #ruby
[12:05:41] romistrub: jhass: apeiros I'll look into wrapping, thanks!
[12:05:43] Bish: jhass: what is this supposed to mean?
[12:06:05] apeiros: Bish: that your sarcasm is complicit in keeping stereotypes alive
[12:06:27] Bish: jesus christ, it's really easy to fall into the PC-trap in irc
[12:06:28] ElFerna: has joined #ruby
[12:06:44] apeiros: that's a rather sad excuse
[12:06:47] Niham: has joined #ruby
[12:06:56] duckpuppy: has joined #ruby
[12:07:15] apeiros: "oh no, don't hit on me you bad bad evil PC people you - *I* didn't do anything wrong!!!"
[12:07:33] apeiros: that's unmanly, btw. :-p
[12:07:35] Bish: excuse for what, there was nothing done wrong, the statement "real men need guis" is already sexist in a way, and it was not serious
[12:07:40] romistrub: google searched "wrap ruby class" and I'm getting "wrap ruby class method"
[12:07:56] jhass: romistrub: look into SimpleDelegator
[12:07:57] Bish: i gonna stop here, but you're overdoing it
[12:08:14] apeiros: Bish: sure. keep yourself telling that.
[12:08:25] jhass: apeiros: Bish #ruby-offtopic. now.
[12:09:08] zacstewart: has joined #ruby
[12:09:25] workmad3: jhass: do I need to go to #ruby-offtopic if I want to make a comment that your previous statement is like a teacher telling off bad children? :)
[12:09:44] workmad3: ok, will do!
[12:10:10] certainty: has joined #ruby
[12:10:30] jazz2: has joined #ruby
[12:10:37] kinnie: has joined #ruby
[12:12:47] ldnunes: has joined #ruby
[12:13:20] m_antis: has joined #ruby
[12:13:37] sandelius: has joined #ruby
[12:14:16] joonty: has joined #ruby
[12:14:51] romistrub: okay, how do I puts to terminal while in a subclass of TCPSocket
[12:15:07] synthroid: has joined #ruby
[12:15:14] romistrub: I'm getting a broken pipe error, presumably because there's no socket open yet and it's trying to do TCPSocket#puts
[12:15:27] Bish: romistrub: just do it </shialeabouf>
[12:15:41] Bish: oh, i get it, sorry
[12:15:52] troulouliou_div2: has joined #ruby
[12:15:56] Bish: that's a good question *awaits the answer*
[12:16:01] romistrub: Bish... que¿
[12:16:15] toretore: STDOUT.puts
[12:16:22] romistrub: toretore: thanks!
[12:16:23] Bish: dayum that was easy.
[12:16:28] bobina22: has joined #ruby
[12:16:39] jazz3: has joined #ruby
[12:17:28] sergio_101: has joined #ruby
[12:17:42] jhass: ACTION sees a tendency
[12:18:02] jhass: romistrub: prefer composition over inheritance, ask yourself whether you really need to subclass all that stuff
[12:18:50] Yiota: has joined #ruby
[12:18:56] romistrub: jhass: but... but... I'm just so used to using inheritance!
[12:19:18] jhass: baaad reason :P
[12:19:18] romistrub: jhass: is there a good reference or article on what you're talking about?
[12:19:32] jhass: pretty sure Clean Code talks about it
[12:19:34] romistrub: enh, I'm not an old dog
[12:19:39] romistrub: is that ruby-specific?
[12:19:54] jhass: nope, the examples use Java
[12:19:58] jhass: but apply to all OOP really
[12:20:16] jhass: I guess POODR could mention it too? never read it
[12:20:23] symm-: has joined #ruby
[12:20:44] romistrub: can you show me an example, then, of a simple, composed system?
[12:21:21] jancel: has joined #ruby
[12:21:24] toretore: romistrub: better: describe your current use case and then we'll describe how to do it with composition
[12:21:24] romistrub: (is there any way to disable all of the "==" messages [status updates] in the web-based freenode IRC client?)
[12:21:44] shevy: ewww webchat clients
[12:21:44] sandelius: this is pretty short and easy to grasp about the topic https://lucaguidi.com/2016/06/07/the-penguin-that-cannot-fly.html
[12:21:46] jhass: romistrub: yup, three bars at the top left, options
[12:21:52] sandelius: composition that is
[12:21:58] toretore: (or tell you that it is in fact a valid use of inheritance :P )
[12:21:58] shevy: can penguins fly?
[12:22:08] sandelius: no that's the problem :)
[12:22:10] dionysus69: has joined #ruby
[12:22:35] apeiros: romistrub: it's relatively simple: don't subclass classes you don't own
[12:23:03] shevy: this code is well documented
[12:23:05] shevy: class Penguin < Bird
[12:23:06] shevy: # LOL I'm a penguin
[12:23:12] romistrub: apeiros: gotcha, simple in principal
[12:23:29] sandelius: shevy haha right
[12:24:05] apeiros: "the idea is borrowed from Go" - I almost made a mess with my drink at that point :D
[12:24:21] romistrub: So I'm creating a WebSocket server, which is basically a TCPSocket with some special encoding, decoding, and control functionality
[12:24:49] romistrub: I know there are existing WebSocket servers, but I'm just getting back into programming and needed to get my hands dirty
[12:24:57] toretore: i don't think you can classify a websocket as-a tcpsocket
[12:25:11] Bish: the pengiun article doesn't provide a solution but one that doesn't exist :o
[12:25:40] sandelius: Bish no but it points out the problem with inheritance :)
[12:25:51] sandelius: not all inheritance is bad tho
[12:25:53] romistrub: toretore: disagree, programatticaly speaking they seem the same; an ideal case for inheritance, as their functions are almost identical, but with some pre-and-post-processing going on frame-by-frame
[12:26:17] toretore: romistrub: well, if that's the case then inheritance is ok
[12:26:36] toretore: romistrub: but you have to be really sure that there aren't any exceptions
[12:26:42] jhass: romistrub: see this websocket implementation: https://github.com/crystal-lang/crystal/blob/master/src/http/web_socket/protocol.cr#L34 it simply wraps an IO, it composes over it. It can do websocket over any kind of IO for free!
[12:27:01] romistrub: jhass: smart, over any IO
[12:27:08] toretore: i've thought the same many times and inherited something, only to discover that some assumptions made in the superclass aren't true for my case
[12:27:32] nerium: has joined #ruby
[12:27:45] c355E3B: has joined #ruby
[12:30:13] Bish: that ruby doesn't have ++ hurts me for the first time :( ouchy
[12:30:17] romistrub: Hah! I forgot how much I suck at reading someone else's code
[12:30:32] sandelius: off topic: I havent done any real PHP work but in most languages we use connection pools for creating new e.g database connections. But in PHP it seems like a new connection is created upon each request? Can this really be?
[12:30:55] Bish: sandelius: yes, php scripts lifecycles is during the request
[12:30:59] Bish: starts and ends with it
[12:31:03] toretore: it probably could. iirc, a php script is.. what bish said
[12:31:27] Gasher: has joined #ruby
[12:31:30] sandelius: Bish but but but wont the dataabse slap you in the face if you get many requests?
[12:31:41] jaruga___: has joined #ruby
[12:31:51] Xentil: has joined #ruby
[12:31:57] Bish: it probably does, but i guess they mysql module of php does some hacky things to recycles connections between multiple requests
[12:32:02] Bish: (just a guess, don't know)
[12:32:03] flashpoint9: has joined #ruby
[12:32:05] sandelius: you would end up with an insane amount of open connections
[12:32:32] Bish: depends if you stall them / limit the amount of multiple requests
[12:32:33] sandelius: (porting a php project to ruby)
[12:33:19] Bish: but your understanding is right, atleast some sort of connection has to be created every request
[12:33:26] norc: sandelius: if you know from the beginning well enough that its offtopic that you designate it as "offtopic:", start the conversation in #ruby-offtopic
[12:33:27] norc: Not here.
[12:33:34] norc: ?offtopic
[12:33:35] ruby[bot]: this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related problems. Thanks!
[12:33:46] Bish: but you can have "too many connections" error in ruby, too, so there is basicially no difference
[12:34:19] davedev24: has joined #ruby
[12:34:38] triangles: has joined #ruby
[12:34:44] romistrub: jhass: am I crazy, is there a class *within* a class in your link?
[12:34:52] blackmesa: has joined #ruby
[12:35:30] jhass: both classes and modules can be used as namespaces, true for Crystal and Ruby
[12:35:43] apeiros: >> Class < Module
[12:35:44] ruby[bot]: apeiros: # => true (https://eval.in/586751)
[12:35:48] norc: romistrub: The only notable difference between classes and modules is: classes can be instantiated and modules can be included from.
[12:35:48] apeiros: romistrub: ^
[12:35:53] apeiros: them classes be modules!
[12:35:55] jhass: there's even a couple of enums within the class! (Ruby doesn't have those ;) )
[12:35:57] norc: romistrub: Otherwise they are the same thing.
[12:36:49] Bish: sandelius: basicially jhass didn't want to help you, he just wanted to show off crystal :p
[12:37:03] Bish: romistrub: *
[12:37:31] Bish: jhass: do you have perfect threading/fibering by now :p
[12:37:40] armin: has joined #ruby
[12:37:53] pawnbox: has joined #ruby
[12:37:56] Bish: well atleast one that uses 1+ core
[12:38:02] norc: apeiros: What kind of syntax is that. o_o
[12:38:10] jhass: a single core is more than enough to beat ruby! :P
[12:38:18] norc: Is op< just short for kind_of?
[12:38:27] Bish: >> Class.method(:<)
[12:38:28] ruby[bot]: Bish: # => #<Method: Class(Module)#<> (https://eval.in/586752)
[12:38:38] apeiros: norc: < is "is subclass", not "is kind of"
[12:38:42] norc: Ah. Fancy.
[12:38:45] apeiros: instantiation vs. inheritance
[12:38:53] tknz: has joined #ruby
[12:39:09] norc: Thing I learn.
[12:39:37] last_staff: has joined #ruby
[12:39:43] p337rB: has joined #ruby
[12:39:48] apeiros: it's nice because `class Class < Module` maps neatly to `Class < Module`
[12:40:02] jhass: Bish: all ears if you have a ruby example showing websockets implemented using composition though
[12:40:09] toretore: `Class < Module` by itself looks a little wrong to me
[12:40:33] Bish: jhass: just wanted to mock you :D i love the idea of crystal
[12:40:43] edwardly: has joined #ruby
[12:40:43] edwardly: has joined #ruby
[12:40:50] jhass: >> c = Class; m = Module; c < m # feeling better toretore ? :P
[12:40:51] ruby[bot]: jhass: # => true (https://eval.in/586754)
[12:40:59] Bish: can't wait until it's "done"
[12:41:01] toretore: yes that's better :)
[12:41:17] romistrub: seriously, this reads like magic
[12:41:40] freerobby: has joined #ruby
[12:41:46] Bish: i don't understand how class X < Y can work if Class has a method :<
[12:41:55] Bish: guess it's static syntax
[12:41:59] jhass: Bish: there's some production stuff already using it afaik
[12:42:22] jhass: yes, class changes the grammar for the rest of the line
[12:42:29] Bish: guessed so
[12:44:42] apeiros: toretore: did you try turning them off and on again? :-p
[12:45:38] Infra-Red: has joined #ruby
[12:47:18] rikkipitt: has joined #ruby
[12:47:19] romistrub: what's this "record PacketInfo, opcode : Opcode" etc.,
[12:47:33] jhass: romistrub: you realize this ain't ruby, yeah? :P
[12:47:45] romistrub: jhass: I'm retarded
[12:48:14] romistrub: it looks so similar in some spaces
[12:48:26] jhass: romistrub: but to answer, it's a macro defining a struct with the given name and fields
[12:48:45] romistrub: okay, makes sense
[12:48:56] romistrub: that said, what lang is it?
[12:49:10] romistrub: so deceptively similar to RUby
[12:49:20] jhass: http://crystal-lang.org/api/toplevel.html#record%28name%2C*properties%29-macro
[12:49:26] jhass: it's Crystal
[12:50:15] romistrub: oh shazam, I thought that was the name of the websocket implementation :|
[12:54:46] fmcgeough: has joined #ruby
[12:55:27] romistrub: reading Crystal was like listening to Dutch while being a native english speaker
[12:55:30] davedev24: has joined #ruby
[12:55:34] Bish: crystal not even once
[12:55:45] romistrub: it sounds so close that you think you're having a stroke
[12:55:49] Bish: have u thought about that one BEFORE deciding for the name?
[12:56:23] romistrub: Bish: hilarious :P
[12:56:34] der-landgraf: has joined #ruby
[12:56:55] romistrub: dibs on crystaladdict.com
[12:57:40] der-landgraf: has joined #ruby
[12:58:18] xlegoman: has joined #ruby
[12:58:42] noobsu: has joined #ruby
[12:59:04] terminalrecluse: has joined #ruby
[12:59:28] phredus: has joined #ruby
[12:59:37] romistrub: I still have no idea what everybody was talking about when they were talking about wrapping... :| hahah
[12:59:51] xlegoman: has left #ruby: ()
[13:00:26] jhass: class WebSocket < TcpSocket -> class WebSocket; def initialize(socket); @socket = socket; end;
[13:00:38] ramortegui: has joined #ruby
[13:00:54] dstarh: has joined #ruby
[13:01:51] roamingdog: has joined #ruby
[13:02:56] cdg: has joined #ruby
[13:04:25] romistrub: jhass: gotcha, thanks
[13:04:37] blockchan: has joined #ruby
[13:04:55] romistrub: jhass: and why do I prefer that exactly? :P
[13:05:29] jhass: you have 100% control, now _and_ in the future, what interface your class provides
[13:05:58] romistrub: jhass: okay, thank u
[13:06:07] jhass: you don't have to worry about how any behavior _or changes of behavior_ of your parent class will affect the interface of your class
[13:06:12] jasondotstar: has joined #ruby
[13:06:33] swills: has joined #ruby
[13:06:45] lxsameer: has joined #ruby
[13:07:06] jhass: and finally it usually also makes your class more flexible by duck typing on the class it wraps, so you can just substitute TCPSocket for FakeSocket in your tests for example
[13:07:13] craigp: has joined #ruby
[13:08:57] jancel: has joined #ruby
[13:09:09] romistrub: jhass: thanks; is all this info in that book u linked me to?
[13:09:44] jhass: uh, I don't remember, probably not exactly like it
[13:09:50] jhass: but it sets the right mindset for sure
[13:09:55] romistrub: I'm definitely more of an Epimethius than Promethius type, so style books could serve me well
[13:10:04] roamingdog: has joined #ruby
[13:10:43] hutch: has joined #ruby
[13:10:49] hutch: good morning :)
[13:10:54] certainty: has joined #ruby
[13:10:57] romistrub: morning hutch
[13:12:02] blackmesa: has joined #ruby
[13:12:36] edwardly: has joined #ruby
[13:12:36] edwardly: has joined #ruby
[13:16:33] chouhoulis: has joined #ruby
[13:16:55] aegis3121: has joined #ruby
[13:20:05] snowy: has joined #ruby
[13:20:38] gregf: has joined #ruby
[13:22:12] Bish: how do i neatly get the time of yesterday? -24h
[13:22:19] Bish: i always end up substracting seconds, but that sucks
[13:23:22] chouhoulis: has joined #ruby
[13:24:00] blaxter: has joined #ruby
[13:24:09] toretore: what do you mean the time of yesterday, a Time object representing now - 24h?
[13:24:41] toretore: yes, then by subtracting 86400
[13:24:54] chris2: wrong for a leap second :P
[13:25:49] hutch: would Time.now - 1.day work ?
[13:26:01] ruby[bot]: toretore: # => undefined method `day' for 1:Fixnum (NoMethodError) ...check link for more (https://eval.in/586765)
[13:26:02] Bish: thats rails
[13:26:11] hutch: i was wondering about that…my mistake
[13:26:13] chris2: also just a multiplier
[13:26:35] toretore: Fixnum#day is `self * 86400`
[13:26:48] toretore: or Numeric#day whatever it is
[13:27:20] raeoks: has joined #ruby
[13:27:45] miqlas-H: has joined #ruby
[13:27:48] Axsuul: has joined #ruby
[13:27:53] miqlas-H: has left #ruby: ()
[13:28:07] chris2: http://sprunge.us/AFER
[13:28:33] jrafanie: has joined #ruby
[13:28:42] pawnbox: has joined #ruby
[13:30:05] malconis: has joined #ruby
[13:30:36] dionysus70: has joined #ruby
[13:30:48] Bish: mails.filter { sent_at > Time.now-3600*24 }.count
[13:30:54] Bish: still gotta love ruby for lines like that
[13:30:56] rippa: has joined #ruby
[13:31:06] Bish: especially if you keep in mind that that executes a sql statement
[13:31:36] malconis: has joined #ruby
[13:32:16] chris2: ... in postgresql just use current_date - 1
[13:32:20] jaguarmagenta: has joined #ruby
[13:33:17] swills: has joined #ruby
[13:33:42] zacstewart: has joined #ruby
[13:34:01] Bish: chris2: there underlying database doesn't really matter, just wanted people to know about my progasm about DSL with blocks
[13:34:25] kareeole_: has joined #ruby
[13:34:30] Bish: sequel changed my view of programming and jeremy evans is a genius, is he here HI JEREMY!
[13:34:40] chris2: unless you end up looking at the clock for each mail :P
[13:34:58] Bish: well, no that won't happen
[13:35:17] Bish: Time.now gets evaluated and turned to a string in the sql query
[13:35:35] chris2: totally obvious from the code :P
[13:35:41] nertzy2: has joined #ruby
[13:36:00] Bish: well, imho it is
[13:36:42] Bish: atleast after i said sql
[13:37:29] aegis3121: has joined #ruby
[13:38:05] ChiefAlexander: has joined #ruby
[13:38:55] Niham: has joined #ruby
[13:40:27] jrafanie: has joined #ruby
[13:41:13] mdw: has joined #ruby
[13:42:22] qasaur: has joined #ruby
[13:43:41] mdw: has joined #ruby
[13:44:31] mdw: has joined #ruby
[13:46:21] swills: has joined #ruby
[13:46:45] mrmortondk: has joined #ruby
[13:47:17] frem_: has joined #ruby
[13:48:11] leitz: has joined #ruby
[13:48:46] sandelius: has joined #ruby
[13:49:11] sankarshanmudkav: has joined #ruby
[13:49:24] sankarshanmudkav: has left #ruby: ()
[13:50:18] romistrub: So I'm trying to pass event handlers as lambdas into a function so that they can be called and passed certain variables (I thought this was their major use-case); but I keep getting a "undefined local variable: connection" (Name Error)
[13:50:22] romistrub: Here's the code: https://gist.github.com/anonymous/b750379be78556a2f49ab7ec90d9fd49
[13:50:30] palms: has joined #ruby
[13:50:46] Yiota: has joined #ruby
[13:50:56] romistrub: the error occurs at line 387
[13:51:18] Bish: .gsub(/\n\n/,'')
[13:53:05] jaruga___: has joined #ruby
[13:53:46] romistrub: say what.... :|
[13:54:07] romistrub: too much whitespace? :P
[13:54:16] toretore: romistrub: you are confused about the syntax
[13:54:33] romistrub: oh, simple as that, eh?
[13:54:39] toretore: you are calling a method, lambda, and trying to give it two arguments, connection & message
[13:54:48] Bish: romistrub: lambda { |param1,param2| doStuff(param1) }
[13:55:11] romistrub: .... embarrassing lol... thanks guys
[13:55:31] Bish: or lambda { |namedParam:nil,anotherNamedParam:nil| }
[13:55:49] romistrub: Bish: that for default values?
[13:57:11] johnDoe111: has joined #ruby
[13:57:53] workmad3: romistrub: optional named params
[13:58:15] Bish: you can also give "unamed" parameter default values
[13:58:29] Bish: as in lambda { |param1=nil,param2=nil| }
[13:58:48] romistrub: aren't they named param1 and param2? :P
[13:58:49] k3rn31: has joined #ruby
[13:58:50] ChiefAlexander: has joined #ruby
[13:59:05] Bish: ofc they're named in the lambda itself, but they will be assigned by the order of the parameters
[13:59:30] workmad3: yeah... I should have said 'optional keyword params' rather than named params :)
[13:59:43] daivyk: has joined #ruby
[13:59:57] romistrub: wait, so I think I see what you're saying
[14:00:08] davedev24: has joined #ruby
[14:00:50] romistrub: when you call it, you can name the param like f.call(namedParam2:val, namedParam1:val) ?
[14:01:17] Bish: useful for methods with many many params which also need default values
[14:01:33] lubekpl: has joined #ruby
[14:01:37] romistrub: in those cases I prefer passing hashes
[14:01:43] romistrub: maybe not the best stylistically
[14:01:48] Bish: romistrub: haha! there comes the fun part
[14:01:54] Bish: you can still do that
[14:01:59] Bish: with the splat operator
[14:02:01] romistrub: splat operator?
[14:02:02] apeiros: though, if your method takes many arguments, you should take a moment to reconsider your API
[14:02:13] romistrub: haha apeiros
[14:02:16] apeiros: sometimes it is right, but often it's a code smell.
[14:02:32] Bish: >> def test(one:'hi :3'); puts *args; end; test(*{one:'ho'})
[14:02:33] ruby[bot]: Bish: # => wrong number of arguments (given 1, expected 0) (ArgumentError) ...check link for more (https://eval.in/586769)
[14:02:40] romistrub: was that a typo, or is a "code smell" actually a thing?
[14:02:55] apeiros: my CS prof's opinion was 2-3 args max (I don't have any such opinion, but I think it's still a nice guideline)
[14:03:20] norc: Bish: NameError: undefined local variable or method 'args' for main:Object
[14:03:27] norc: Is what I would expect. :p
[14:03:27] Bish: yeah i did something wrong
[14:03:48] norc: Wait, splat on a Hash?
[14:03:51] CloCkWeRX: has joined #ruby
[14:03:53] Bish: guess you cannot use splat on literal
[14:03:55] norc: asm>> *{}
[14:03:56] ruby[bot]: norc: I have disassembled your code, the result is at https://eval.in/586770
[14:04:00] apeiros: prolly should have been **{}
[14:04:07] norc: asm>> foo(**{})
[14:04:08] ruby[bot]: norc: I have disassembled your code, the result is at https://eval.in/586771
[14:04:19] apeiros: it's pointless, though, as ruby will take the last hash as named args anyway
[14:04:21] norc: What does splat on a Hash do?
[14:04:27] Bish: oh yeah it was doublesplat
[14:04:38] apeiros: >> def foo(bar: ,baz: ); baz; end; foo({bar:1, baz: 2})
[14:04:39] ruby[bot]: apeiros: # => 2 (https://eval.in/586772)
[14:04:40] Bish: norc: exactly for that use case
[14:04:48] Bish: def test(one:); puts one; end; myArgs = {one:'ho'};test(**myArgs)
[14:04:53] Bish: >> def test(one:); puts one; end; myArgs = {one:'ho'};test(**myArgs)
[14:04:54] ruby[bot]: Bish: # => ho ...check link for more (https://eval.in/586773)
[14:04:56] apeiros: ^ kwargsplatlesshappiness
[14:05:01] norc: Bish: Ah.
[14:05:17] norc: Oh it should make sense.
[14:05:32] Bish: it's so awesome, just learned about it
[14:06:03] schmoot: has joined #ruby
[14:06:12] Bish: because you cannot call def test x=1,y=2 with only setting y, while x staying default
[14:06:14] norc: asm>> foo(**a)
[14:06:15] ruby[bot]: norc: I have disassembled your code, the result is at https://eval.in/586774
[14:06:34] norc: apeiros: That is some real disgusting crap there.
[14:06:52] apeiros: norc: wait for the implications. consider this: `def foo(a={}, b:); b; end; foo({b:1})` - what should it do?
[14:07:15] norc: apeiros: return nil?
[14:07:25] Bish: first param is a hash... so?
[14:07:36] norc: Why is it splatted? What
[14:07:38] apeiros: norc: in that case, you mean it should raise ;-)
[14:07:44] norc: apeiros: Oh yea.
[14:07:44] apeiros: (because b is required)
[14:07:46] norc: Why the heck
[14:07:53] apeiros: but yeah, I'd have the same expectation.
[14:08:18] norc: asm >> foo({b:1})
[14:08:20] norc: asm >> foo({b:1})
[14:08:22] apeiros: and with those words, spreading confusion and disbelief, I'll leave the stage - toodles ;-p
[14:08:22] norc: asm>> foo({b:1})
[14:08:23] ruby[bot]: norc: I have disassembled your code, the result is at https://eval.in/586778
[14:08:37] norc: FCALL|KWARG
[14:08:41] Bish: but well, if it worked as expected it would be awesome
[14:08:48] Bish: i understand why, i guess
[14:09:04] Bish: it will prefer keyword calling, since a has a defualt value
[14:09:14] norc: apeiros: Okay I get it now.
[14:09:20] apeiros: the reason was a rushed out hack-syntax for a make-shift kwarg syntax in ruby 1.9
[14:09:22] Bish: but.. that's weird
[14:09:32] apeiros: without actually having kwargs
[14:09:36] norc: apeiros: Apparently passing a hash literal adds the KWARG flag.
[14:09:44] norc: apeiros: If you stuff the Hash into a variable first its gone.
[14:10:03] Bish: that's really confusing
[14:10:05] jancel: has joined #ruby
[14:10:11] norc: >> def foo(a={}, b:); b; end; a = {b:1}; foo(a) # should raise
[14:10:12] ruby[bot]: norc: # => 1 (https://eval.in/586779)
[14:10:16] norc: Or not? o_p
[14:10:46] Bish: wow, is there actually a way to change a to a specified hash?
[14:11:01] eljimbo: has joined #ruby
[14:11:03] sergey_makagon: has joined #ruby
[14:11:31] Bish: apeiros: but imho that's not an implication, thats a stupid implementation
[14:11:41] certainty: has joined #ruby
[14:12:25] Yiota: has joined #ruby
[14:12:28] romistrub: >> def foo(a={}, b:); a; end; foo({c:1})
[14:13:17] apeiros: Bish: it's an implication of what I said before. and the reason of what I said before is, indeed, a stupid implementation.
[14:13:18] norc: apeiros: I remember that a long while ago kwargs were implemented by Ruby implicitly providing a Hash
[14:13:22] TomyWork: is there a more elegant way to express "ARGV.length == 1 and ARGV[0] == 'foo'"?
[14:13:29] JesseH2: has joined #ruby
[14:13:32] tubuliferous_: has joined #ruby
[14:13:32] apeiros: TomyWork: ARGV == ['foo']
[14:13:47] norc: apeiros: Which lead to some bizarre iseq assembly, because accessing these kwargs would actually call Hash#[]
[14:14:28] Bish: well it's not as bad as i expected
[14:14:48] Bish: b is required, and if you have b defined it will actually use that one
[14:15:08] Bish: >> def foo(a={}, b:); [a,b]; end; foo({:a=>4},b:3)
[14:15:09] ruby[bot]: Bish: # => [{:a=>4}, 3] (https://eval.in/586782)
[14:16:04] Bish: okay, no, it's bad
[14:16:10] naftilos76: has joined #ruby
[14:16:40] Bish: >> def foo(a={}, b:1); [a,b]; end; foo({:b=>4})
[14:16:41] ruby[bot]: Bish: # => [{}, 4] (https://eval.in/586783)
[14:16:43] Bish: this is worse, :o
[14:17:00] TomyWork: FCALL, not to be confused with FUCALL
[14:17:21] norc: apeiros: It makes no sense to me.
[14:17:54] Bish: so stupid!
[14:17:58] apeiros: norc: it's the result of trying to be backwards compatible to 1.9's syntax
[14:17:59] lxsameer: has joined #ruby
[14:18:15] apeiros: you have to look at it from that perspective and suddenly it makes sense. it doesn't make it any less stupid, tho.
[14:18:24] norc: apeiros: How about this:
[14:18:54] norc: apeiros: https://eval.in/586787
[14:19:11] norc: Let's see if you spot the most bizarre thing that barely any Ruby programmer has heard about.
[14:19:12] apeiros: norc: flip-flop?
[14:19:15] nando293921: has joined #ruby
[14:19:17] norc: Im amazed. :)
[14:19:36] norc: apeiros: I have yet to find a book that even mentions it.
[14:19:39] apeiros: I haven't seen many actually useful use-cases of those
[14:20:00] apeiros: the best one so far has been something to extract data from logs
[14:20:16] apeiros: not sure I could reconstruct it. it printed while the flip-flop was true.
[14:20:16] Mon_Ouie: has joined #ruby
[14:20:21] norc: Well Im sure it could be extremely helpful in obfuscated code contests.
[14:20:29] apeiros: haha, that anyway.
[14:20:50] apeiros: but I think you can win those using Ox0dea's numeric ruby stuff :o)
[14:21:25] TomyWork: so "if a .. b" evaluates as true from the time a first became true to the time a is no longer true and b starts and stops being true?
[14:22:13] norc: TomyWork: Correct.
[14:22:44] emptyflask: has joined #ruby
[14:23:13] d10n-work: has joined #ruby
[14:23:38] norc: TomyWork: chrisseaton made some research that showed that out of 1 million lines of code only 1 line on average used this operator.
[14:24:47] SilverKey: has joined #ruby
[14:25:33] phredus: has joined #ruby
[14:25:58] agent_white: has joined #ruby
[14:26:26] lxsameer: has joined #ruby
[14:27:49] Bish: apeiros destroyed my happiness.
[14:27:53] romistrub: agent_white: morning
[14:28:03] Bish: how can i ever use **{} again
[14:28:13] apeiros: Bish: soooo… business as usual?
[14:28:33] Bish: why do they actually make implicit conversion of hash with symbols to args
[14:28:39] Bish: without that, everything would be fine
[14:28:55] Bish: you would've to use **{} and all good
[14:30:11] apeiros: as I said - 1.9
[14:30:29] Bish: hdsfhdshf
[14:31:49] ChiefAlexander: has joined #ruby
[14:32:23] johnDoe111: has joined #ruby
[14:32:37] Bish: is there really no way around that? geze?
[14:32:51] xapak: has joined #ruby
[14:33:14] tjbiddle: has joined #ruby
[14:33:33] Rodya_: has joined #ruby
[14:33:40] Bish: xapak: hi
[14:34:54] polishdub: has joined #ruby
[14:35:18] xapak: Do you know what this means in Ruby (between quotes)? "$!"
[14:35:23] xapak: Cannot find definition.
[14:35:37] Bish: xapak: magic variable containing current error
[14:35:41] xapak: Saw a "raise $!" in a code
[14:35:46] shevy: xapak there is a good reference, zenspider
[14:35:50] Bish: so that just reraises the error
[14:36:13] apeiros: xapak: that's verbose for plain `raise`
[14:36:19] apeiros: (raise reraises the current error by default anyway)
[14:36:25] shevy: xapak http://www.zenspider.com/Languages/Ruby/QuickRef.html#pre-defined-variables
[14:36:26] karmatr0n: has joined #ruby
[14:36:28] apeiros: ?quickref xapak
[14:36:28] ruby[bot]: xapak: http://www.zenspider.com/Languages/Ruby/QuickRef.html
[14:36:41] apeiros: ah, shevy was faster *and* included the correct subsection :)
[14:36:57] shevy: yay I beat a bot! \o/
[14:37:11] kies: has joined #ruby
[14:38:08] xapak: shevy, Bish, apeiros, thank you very much. :)
[14:38:26] apeiros: shevy: you call me a bot? :(
[14:39:21] shevy: the ruby[bot]
[14:39:29] mistermocha: has joined #ruby
[14:39:34] shevy: it even has the bot as part of its name, unlike the sneaky ruboto bot
[14:39:50] shevy: well... that one has had bot as part of its name too actually
[14:39:59] shevy: but people did not notice that!
[14:40:10] xapak: has left #ruby: ()
[14:42:04] terrabl: has joined #ruby
[14:43:05] platzhirsch: Anyone working with pact here?
[14:43:16] Bish: apeiros: when will that be fixed! fix it now!
[14:44:02] apeiros: Bish: fix what?
[14:44:05] terrabl: Hey guys, Is there any reason that I would be getting a TestController is not a module (TypeError) in this code? It is saying that TestController is not a module? https://gist.github.com/terrabl/e7fb88ba471b21d9fdbc996a97ad1188
[14:44:09] Bish: that weird kwdshit
[14:44:43] polishdub: has joined #ruby
[14:45:00] apeiros: terrabl: you'd get it when some other code earlier defines it as a class
[14:45:07] apeiros: >> class X; end; module X; end
[14:45:09] ruby[bot]: apeiros: # => X is not a module (TypeError) ...check link for more (https://eval.in/586821)
[14:46:23] apeiros: also you can't invoke an instance method directly on the class (create, defined on line 6, upper file, invoked in line 9, lower file)
[14:47:20] SilverKey: has joined #ruby
[14:47:38] terrabl: I figured out what I did wrong, i accidently made a class TestController inside of the file I was requiring inside of loadtestcontroller.rb
[14:47:55] terrabl: I thought as a module I can just call the function as long as I required it in the file?
[14:48:22] terrabl: Like calling create from scheduler would run the TestControllers.create method?
[14:49:51] apeiros: no, that's not how it works
[14:49:54] snath: has joined #ruby
[14:50:30] tildes_: has joined #ruby
[14:50:31] terrabl: Sorry I'm new to ruby could you explain or point me in a direction that will help me understand.
[14:50:59] terrabl: I like the concept of modules, and need to implement them, but I think I am correlating them too closely to user defined regular old classes
[14:52:08] apeiros: terrabl: I'm a bit busy at the moment, so excuse me for just telling you to read a tutorial or book. class- vs. instance-methods is relatively basic.
[14:52:33] apeiros: i.e. should be covered by any introductionary material
[14:55:29] william3: has joined #ruby
[14:56:01] terrabl: apeiros: yeah i guess its probably something I could have looked up myself, sorry for bothering you.
[14:56:01] diegoviola: has joined #ruby
[14:56:27] apeiros: not a bother. asking is fine. just ain't got time now.
[14:57:08] dhollinger: has joined #ruby
[14:57:12] ChiefAlexander: has joined #ruby
[14:59:13] matejkonrad: has joined #ruby
[15:01:54] swills: has joined #ruby
[15:07:59] marr123: has joined #ruby
[15:08:34] aegis3121: has joined #ruby
[15:08:56] despai: has joined #ruby
[15:09:00] mtkd: has joined #ruby
[15:10:04] Asher: has joined #ruby
[15:10:26] taylorrf: has joined #ruby
[15:11:13] dionysus69: has joined #ruby
[15:12:11] TomyLobo: has joined #ruby
[15:12:26] certainty: has joined #ruby
[15:14:19] ramfjord: has joined #ruby
[15:14:21] tjbiddle: has joined #ruby
[15:16:10] learath: has left #ruby: ()
[15:22:58] rkazak: has joined #ruby
[15:26:36] hobodave: has joined #ruby
[15:27:58] chopin: has joined #ruby
[15:28:06] kgrz: has joined #ruby
[15:28:48] hutch34: has joined #ruby
[15:29:37] jancel: has joined #ruby
[15:30:41] shinnya: has joined #ruby
[15:33:06] jaguarmagenta: has joined #ruby
[15:33:14] RobertBirnie: has joined #ruby
[15:33:17] johnDoe111: has joined #ruby
[15:34:03] aep-shoutlet: has joined #ruby
[15:34:12] Rodya_: has joined #ruby
[15:34:24] lxsameer: has joined #ruby
[15:34:28] cschneid: has joined #ruby
[15:34:47] cschneid: How fast is array#reverse? I assume O(n)?
[15:34:50] aep-shoutlet: is x || false logically equivalent to x, or would values like nil be passed through in the second but transformed to false in the first?
[15:34:57] pawnbox: has joined #ruby
[15:35:49] Bish: aep-shoutlet: wyh dont u just test it
[15:36:25] aep-shoutlet: irb experiment confirms the behavior is different, thanks!
[15:38:39] apeiros: cschneid: O(n) is its algorithmic complexity. not to be confused with performance ("fast")
[15:38:48] tatsuo: has joined #ruby
[15:39:06] cschneid: yeah yeah. I know. I just want to verify that what I'm doing won't blow up in time if I give it a longer array
[15:39:15] kareeoleez: has joined #ruby
[15:42:00] GinoManWorks_: has joined #ruby
[15:43:08] apeiros: "I know, I'll still use the wrong terminology". never ceases to draw a smile on my face…
[15:45:16] cschneid: yeah, I get the difference between "fast" and "algorithmic complexity" but one is much longer to type :)
[15:45:38] cschneid: mostly I had code like: ` @lines = @lines.reverse.drop_while{|l| ! l.controller? }.reverse ` -- where I want to remove "everything after the last element that returns true to `.controller?`
[15:46:21] cajone: has left #ruby: ()
[15:46:24] AlexJakeGreen: has joined #ruby
[15:47:01] znz_jp: has joined #ruby
[15:48:02] rueben_: has joined #ruby
[15:48:12] apeiros: you could use .reverse_each.find_index. will be a little bit more code, though.
[15:48:20] kareeoleez: has joined #ruby
[15:49:28] cschneid: yeah. I'll probably leave this until it's too slow
[15:49:45] aberen: has joined #ruby
[15:50:26] emptyflask: has joined #ruby
[15:52:11] cajone: has joined #ruby
[15:53:35] ncthom91: has joined #ruby
[15:55:21] amclain: has joined #ruby
[15:55:45] sandstrom: has joined #ruby
[15:56:16] raeoks: has joined #ruby
[15:57:05] apeiros: oh, just learned that &. does not short-circuit :(
[15:57:12] terminalrecluse: has joined #ruby
[15:57:16] Wildfyr: has left #ruby: (""Sayonara"")
[15:57:19] kies: has joined #ruby
[15:58:02] kareeoleez: has joined #ruby
[15:59:10] whathappens: has joined #ruby
[15:59:14] hutch34_: has joined #ruby
[16:00:28] smathy: has joined #ruby
[16:00:44] emptyflask: has joined #ruby
[16:01:17] inukshuk_: has joined #ruby
[16:04:46] qasaur: has joined #ruby
[16:04:52] alfiemax: has joined #ruby
[16:06:50] kareeoleez: has joined #ruby
[16:08:04] pld: has joined #ruby
[16:12:03] [Butch]: has joined #ruby
[16:12:05] SCHAAP137: has joined #ruby
[16:12:27] davedev24: has joined #ruby
[16:12:37] troulouliou_div2: has joined #ruby
[16:13:23] certainty: has joined #ruby
[16:13:37] davedev24: has joined #ruby
[16:13:40] hutch34_: has joined #ruby
[16:14:03] axl_: has joined #ruby
[16:14:25] David_H_Smith: has joined #ruby
[16:15:39] jancel: has joined #ruby
[16:16:46] terrabl: Can you pass variables to a module method?
[16:17:22] taylorrf: has joined #ruby
[16:17:31] hutch34: has joined #ruby
[16:18:35] VeryBewitching: has joined #ruby
[16:18:45] swills: has joined #ruby
[16:18:49] mistermocha: has joined #ruby
[16:19:08] danostrowski: has joined #ruby
[16:19:53] madgen: has joined #ruby
[16:20:19] nando293921: has joined #ruby
[16:20:36] p0p0pr37_: has joined #ruby
[16:21:42] terrabl: Nevermind that was a stupid question, something else was wrong.
[16:21:46] hutch34_: has joined #ruby
[16:23:33] tildes_: has joined #ruby
[16:24:01] mistermocha: has joined #ruby
[16:24:54] kareeoleez: has joined #ruby
[16:26:07] ramfjord: has joined #ruby
[16:29:29] moeabdol2: has joined #ruby
[16:29:44] qasaur: has joined #ruby
[16:30:46] lubekpl: has joined #ruby
[16:32:23] alfiemax: has joined #ruby
[16:33:42] kareeoleez: has joined #ruby
[16:33:48] droidburgundy: has joined #ruby
[16:33:58] romistrub: newbie question: what's the best way to grab the first two letters of a string, and also chop those letters off the string at the same time?
[16:34:03] johnDoe111: has joined #ruby
[16:34:27] mosh: has joined #ruby
[16:35:00] Rodya_: has joined #ruby
[16:35:04] mleung: has joined #ruby
[16:35:16] mhib: has joined #ruby
[16:36:08] biberu: has joined #ruby
[16:36:09] aberen: has joined #ruby
[16:37:39] romistrub: found it... it's slice! :)
[16:37:44] mdw: has joined #ruby
[16:39:09] wrkrcoop: has joined #ruby
[16:39:12] rcvalle: has joined #ruby
[16:40:03] wrkrcoop: if i put a rescue and end statement at the end of my method, will that just catch any exception?
[16:40:46] kareeoleez: has joined #ruby
[16:41:12] gregf_: >> "foo"[/../]
[16:41:13] ruby[bot]: gregf_: # => "fo" (https://eval.in/586881)
[16:42:04] panpainter: has joined #ruby
[16:42:19] shevy: wrkrcoop if you just do rescue, without any specific exception, it is equivalent to: "rescue Exception", so yeah, this means you should rescue everything
[16:42:20] whathappens: has joined #ruby
[16:42:29] Dreamer3_: has joined #ruby
[16:42:30] al2o3-cr: gregf_: that won't work
[16:43:04] wrkrcoop: shevy yeah i was going to put this at the end of my method https://gist.github.com/ellismarte/a9dcecac3abb36cb02f4ddfd53bc288d
[16:43:09] smathy: shevy, actually it's equivalent to rescue StandardError /cc wrkrcoop
[16:44:01] wrkrcoop: is this standard practice? i imagine you can’t predict all possible errors so youd need something like this …
[16:44:05] gregf_: al2o3-cr: oh missed the chop bit
[16:44:25] duckpupp1: has joined #ruby
[16:44:27] wrkrcoop: seems sort of like try catch ...
[16:44:32] shevy: wrkrcoop dunno. people tend to say to "rescue the specific exception instead"... but I had to deal with specific errors let me find that...
[16:44:37] smathy: wrkrcoop, not really standard, no. Idiomatic Ruby generally doesn't rely on exceptions for normal flow.
[16:44:53] gregf_: >> "foobar"[2..-1]
[16:44:55] ruby[bot]: gregf_: # => "obar" (https://eval.in/586882)
[16:44:56] smathy: wrkrcoop, and fwiw, try/catch in ruby is something different.
[16:45:06] wrkrcoop: smathy: so how do you protect against unknown errors?
[16:45:07] smathy: *throw/catch sorry.
[16:45:39] smathy: wrkrcoop, mostly people just don't, they let unknown errors crash out.
[16:45:44] shevy: wrkrcoop https://gist.github.com/shevegen/72d00f5c10469eaf6686afec26f49ca4 - I was not really thinking about it, but if I would rewrite that part, I'd probably just do a non-specific rescue instead :P
[16:45:53] aberen: has joined #ruby
[16:45:54] wrkrcoop: smathy: shit … doesn’t that bring down the server?
[16:45:58] devbug: has joined #ruby
[16:46:16] shevy: I managed to have all these different errors too! one as a hdd crash :(
[16:46:18] wrkrcoop: shevy: thanks for sharing that with me
[16:46:30] smathy: wrkrcoop, depends on what "server" means, but generally people are writing ruby in environments that don't have a problem with that.
[16:46:44] wrkrcoop: smathy: oh … didnt know that
[16:46:44] smathy: wrkrcoop, eg. a web server process which just triggers a 500 and logs the exception.
[16:46:55] smathy: wrkrcoop, or a cron job which emails admin and exits.
[16:47:10] wrkrcoop: hmmm so now im thinking i dont need that exception ….
[16:47:18] smathy: ...or a sidekiq or job worker process that either logs and exits, or logs and requeues.
[16:47:41] wrkrcoop: alright thanks for the info ^^
[16:47:46] flashpoint9: has joined #ruby
[16:49:52] kareeoleez: has joined #ruby
[16:52:18] banister: has joined #ruby
[16:53:59] emptyflask: has joined #ruby
[16:54:35] pilne: has joined #ruby
[16:54:46] kallisti5: uugh.. Have to work with soap... I hate xml.
[16:54:47] kallisti5: REXML::XPath.each(doc, "//[self::description or self::id]").each {|des| agents.push({"id" => des[1].to_s, "description" => des[0].to_s})}
[16:54:51] flashpoint9: has joined #ruby
[16:55:03] kallisti5: trying to turn two items into a hash'ed array
[16:55:21] pragmatism: has joined #ruby
[16:55:27] kallisti5: But getting description, then id, then description
[16:55:38] kallisti5: ... there must be an easier way :-\
[16:55:59] dorje: has joined #ruby
[16:58:32] sumobob: has joined #ruby
[16:59:08] ChiefAlexander: has joined #ruby
[16:59:09] dorje_: has joined #ruby
[16:59:32] kareeoleez: has joined #ruby
[16:59:36] huyderman: has joined #ruby
[17:01:01] chouhoul_: has joined #ruby
[17:02:05] aegis3121: has joined #ruby
[17:02:13] shevy: I'd use temporary variables if only due to readability alone
[17:02:31] shevy: "//[self::description or self::id]" looks weird
[17:02:48] chouhoul_: has joined #ruby
[17:03:54] tomchapin: has joined #ruby
[17:05:11] norc: has joined #ruby
[17:05:39] firstdayonthejob: has joined #ruby
[17:08:07] prestorium: has joined #ruby
[17:09:04] romistrub: I have a loop in a thread and I want to shut down the thread after the loop exits, any idea how?
[17:09:52] johnDoe111: has joined #ruby
[17:10:36] norc: romistrub, Thread.exit
[17:11:36] rikkipitt: has joined #ruby
[17:11:49] TheCubeLord: has joined #ruby
[17:12:03] TheCubeLord: has joined #ruby
[17:13:02] romistrub: I put did my_thread = Thread.new { my_thread.exit }; will that work?
[17:13:09] toretore: romistrub: the thread will shut down when there is no more code to execute
[17:13:38] dorje: has joined #ruby
[17:13:53] certainty: has joined #ruby
[17:14:01] toretore: Thread.new{ while work_to_be_done; do_work; end }
[17:14:10] romistrub: gotcha; thx
[17:14:14] norc: romistrub, also remember to Thread#join
[17:14:20] romistrub: what's that?
[17:14:53] norc: &ri Thread#join
[17:14:53] `derpy: http://ruby-doc.org/core-2.3.0/Thread.html#method-i-join
[17:15:11] norc: apeiros, who is responsible for `derpy? It is still linking 2.3.0 docs
[17:16:23] al2o3-cr: norc: adaedra
[17:16:46] dorje_: has joined #ruby
[17:17:30] kareeoleez: has joined #ruby
[17:17:44] norc: ACTION pokes adaedra in the eye
[17:18:40] pilne: i think my first two "significant" projects are going to be porting my ghost blog to jekyll, and doing something simple with rails, anything else similar worth taking a look at (not my first language, first true dive into ruby though).
[17:19:04] norc: pilne, yes - I have a fairly useful recommendation:
[17:19:06] aberen: has joined #ruby
[17:19:07] norc: Pick something you like.
[17:19:33] ec: has joined #ruby
[17:19:43] norc: pilne, https://www.ruby-toolbox.com/ could be a useful thing to find stuff you might need.
[17:19:46] pilne: i like both of those! i enjoy doing my blog, but not juggling several node versions, and I enjoy the idea of creating interesting websites :)
[17:20:00] pilne: ty, going there now :)
[17:21:33] symm-: has joined #ruby
[17:21:46] mostlybadfly: has joined #ruby
[17:22:11] SilverKey: has joined #ruby
[17:23:21] ChiefAlexander: has joined #ruby
[17:24:02] snowy: has joined #ruby
[17:25:03] sergey_makagon: has joined #ruby
[17:29:49] noobsu_: has joined #ruby
[17:31:31] guacamole: has joined #ruby
[17:31:34] mwlang: has joined #ruby
[17:33:06] rafa2000: has joined #ruby
[17:33:20] leitz: has joined #ruby
[17:35:23] freerobby: has joined #ruby
[17:35:28] kareeoleez: has joined #ruby
[17:35:43] tildes_: has joined #ruby
[17:35:46] Rodya_: has joined #ruby
[17:36:28] blaxter: has joined #ruby
[17:37:08] snowy: has joined #ruby
[17:37:24] kareeole_: has joined #ruby
[17:40:00] malconis: has joined #ruby
[17:40:20] kent\n: has joined #ruby
[17:40:20] kent\n: has joined #ruby
[17:45:19] rafa2000: has joined #ruby
[17:46:24] sergey_makagon: has joined #ruby
[17:46:29] kareeoleez: has joined #ruby
[17:47:18] jancel: has joined #ruby
[17:47:52] Coldblackice: has joined #ruby
[17:49:07] raz: hmm anyone here happen to know how to wrap PTY.spawn, so a spawned 'stty size' will return terminal dimensions other than '0 0'? (because the latter screws with many tty-expected programs, which kinda defeats the purpose of using PTY to begin with :/ )
[17:50:12] raz: i've tracked it down to an ioctl TIOCGWINSZ that PTY.spawn apparently doesn't patch up (on purpose? by oversight? am i doing this wrong?)
[17:50:42] aegis3121: has joined #ruby
[17:51:43] leitz: In an initialize, are the assignments done in order? That is, can the second one use the output from the first?
[17:52:10] aberen: has joined #ruby
[17:52:33] shevy: initialize is a method like any other method
[17:52:50] shevy: normal ruby rules apply to it as well
[17:54:12] ghr: leitz like this? https://eval.in/586898
[17:55:26] loocash: has joined #ruby
[17:55:43] kareeoleez: has joined #ruby
[17:56:43] leitz: ghr, if you put and @ in front of the 'a' in line 5, yes. Just tested that, and it works.
[17:57:15] ghr: ah. so you want to read about instance variables (the ones with the @ infront of them) and attribue accessors :)
[17:57:18] leitz: So "@b = @a + b"
[17:57:56] leitz: Yeah, I'm setting up an initialize that will generate a name, based on gender.
[17:58:04] leitz: @gender comes before @name.
[17:58:27] Mon_Ouie: has joined #ruby
[17:59:09] jackjackdripper: has joined #ruby
[17:59:43] al2o3-cr: raz: show code as to what you're trying to do
[18:00:51] Axsuul: has joined #ruby
[18:01:00] raz: al2o3-cr: ruby -r pty -e 'PTY.spawn("stty size") { |r, _w, pid| puts r.read }'
[18:01:07] raz: when you run this, it will print '0 0'
[18:01:08] hackeron: has joined #ruby
[18:01:17] raz: when you run 'stty size' directly, it will display your current terminal size
[18:02:24] raz: i need the command running inside PTY.spawn to think it's running in a terminal that has a size that is not 0 0 (because many programs can't deal with that zero-size and crash) :)
[18:03:07] leitz: I'm pausing my reading of "programming ruby" to actually code. Trying to clean up a lot of my earlier misunderstandings with new misunderstandings.
[18:03:35] leitz: Taking a break now and then to read "The Ruby Way" when I'm too brain dead to code. Working through a cold/flu/something.
[18:03:39] nando293921: has joined #ruby
[18:03:49] ghr: heh, yeah gotta be _doing_ rather than just reading. I'd say instance variables are pretty fundamental though, so put it high on your list
[18:04:01] danostrowski: has joined #ruby
[18:05:07] pepee: has joined #ruby
[18:05:58] shevy: yes, programming is an active art
[18:07:03] leitz: Yeah, I've often made the mistake or reading more than coding. Trying to get back to Ruby, and be happy with the basics. Since Part 1 of "Programming Ruby" can handle 90% of what I want to do, I'm better off setting it down.
[18:07:40] leitz: "The Ruby Way" is mostly because Hal is a nice guy and I need something to read now and again.
[18:08:00] djbkd: has joined #ruby
[18:08:21] mdw: has joined #ruby
[18:09:14] chouhoulis: has joined #ruby
[18:10:20] chouhoulis: has joined #ruby
[18:11:59] helpa-bot: has joined #ruby
[18:12:50] sergey_m_: has joined #ruby
[18:14:05] kareeoleez: has joined #ruby
[18:14:14] mistermocha: has joined #ruby
[18:14:40] certainty: has joined #ruby
[18:15:06] blackmesa: has joined #ruby
[18:15:38] terrabl: Does anyone have any preferances on a ruby gem that can plot a bunch of data points?
[18:16:04] al2o3-cr: has joined #ruby
[18:16:12] vqrs: has joined #ruby
[18:16:43] mistermocha: has joined #ruby
[18:16:58] rflot: has joined #ruby
[18:17:24] norc: terrabl, how about the classic: graphviz
[18:17:24] kirun: has joined #ruby
[18:17:37] helpa: has joined #ruby
[18:17:54] kareeoleez: has joined #ruby
[18:18:32] leitz: Yeah, coding lets your great idea for getting a name come back with "Hi, I'm #<SQLite3::ResultSet:0x7fe4037b2390>".
[18:18:42] iooner: has joined #ruby
[18:18:52] leitz: Glad Ruby is so fun, otherwise I'd cry.
[18:18:58] norc: leitz, welcome to #inspect
[18:19:05] leitz: By the way, I fixed the errlr.
[18:20:19] wrkrcoop: how do i return an error and a message with that error?
[18:21:27] norc: wrkrcoop, a classic way is to simply raise an exception.
[18:22:10] norc: # fail ParseError, "unbalanced paranthesis"
[18:24:10] agit0: has joined #ruby
[18:24:23] wrkrcoop: norc so … do i just call raise with the error message?
[18:24:23] sergey_makagon: has joined #ruby
[18:24:37] toretore: {status: :error, message: "Something went wrong"}
[18:24:38] DroidBur_: has joined #ruby
[18:24:54] yqt: has joined #ruby
[18:24:54] toretore: {status: :success, value: whatever}
[18:24:58] norc: &ri Kernel#raise wrkrcoop
[18:24:59] `derpy: wrkrcoop: http://ruby-doc.org/core-2.3.0/Kernel.html#method-i-raise
[18:25:22] ramfjord: has joined #ruby
[18:25:33] norc: wrkrcoop, generally you should should either pass an exception class, or exception class and an error message.
[18:26:02] taylorrf: has joined #ruby
[18:26:38] norc: wrkrcoop, and it is useful to use your own exception class, so it can be caught specifically
[18:26:39] ule: do you guy sknow if there is a command to list all listeners?
[18:26:47] norc: ule, listeners?
[18:27:44] ule: I don't know if this is default from rails
[18:27:52] ule: or if it's something people implemented here at work
[18:27:59] ule: I'm gonna do some research here
[18:28:11] ule: they call pubsub
[18:28:43] norc: ule, you need to give us more than that. pubsub sounds like publish subscribe pattern...
[18:28:46] toretore: ule: it is definitely not something that ruby has built-in; it's a library, be it rails or something else
[18:29:00] norc: ule, are you talking about something in Ruby? Something in some library? Some application?
[18:30:15] helpa-bot: has joined #ruby
[18:30:27] droidburgundy: has joined #ruby
[18:31:03] p337rB_: has joined #ruby
[18:31:10] yfeldblum: has joined #ruby
[18:31:34] ule: yeah.. it's publish subscribe pattern
[18:31:43] ule: I thought it's a default in Rails
[18:31:54] terrabl: If there is a gem availible for rails does that mean i can use it in regular scripting ruby too?
[18:32:02] terrabl: Like I want to use the gruff graphing gem
[18:32:17] helpa: has joined #ruby
[18:32:18] toretore: terrabl: it depends; for this particular gem probably yes
[18:32:34] symm-: has joined #ruby
[18:32:42] terrabl: Awesome. Is there a way to tell?
[18:32:58] norc: ule, even Rails is a huge pile of libraries
[18:33:03] norc: ule, you have to be more specific still.
[18:33:09] norc: ule, gist some code you have.
[18:33:35] toretore: terrabl: most gems are not rails-specific
[18:33:36] norc: terrabl, like I just said, all rails is is a huge collection of different gems, most of which you can use separately.
[18:33:49] norc: (Only very few have interdependencies)
[18:35:16] diegoaguilar: has joined #ruby
[18:35:27] Dimik: has joined #ruby
[18:35:54] al2o3-cr: raz: pty, doesn't play nicely here
[18:36:27] raz: al2o3-cr: yup. i found winsize= in io/console now. but i can't figure out how to use it.
[18:36:30] Rodya_: has joined #ruby
[18:36:49] al2o3-cr: raz how'd you mean use it?
[18:37:36] raz: al2o3-cr: well, i tried all kinds of variants of creating an IO and feeding that to spawn, but nothing works. this stuff is not very well documented ;)
[18:39:19] aberen: has joined #ruby
[18:40:27] sphex: has joined #ruby
[18:41:45] shevy: ruby is so good, it does not need any documentation!!!
[18:42:27] multi_io: has joined #ruby
[18:46:36] kies: has joined #ruby
[18:48:39] wrkrcoop: has joined #ruby
[18:48:45] johnDoe111: has joined #ruby
[18:51:19] B1n4r10: has joined #ruby
[18:52:51] ben010: has joined #ruby
[18:54:48] aberen: has joined #ruby
[18:55:11] mistermocha: has joined #ruby
[18:55:18] jas02: has joined #ruby
[18:55:30] ben010: can anyone help a new ruby (on rails) convert set up his local vagrant dev env from a server? i've got 85% of it, but struggling to know how best to do the last 15%.
[18:58:52] craigp: has joined #ruby
[18:59:38] dasher00: has joined #ruby
[19:00:08] JohnBat26: has joined #ruby
[19:00:12] jhass: ?anyone ben010
[19:00:12] ruby[bot]: ben010: Just ask your question, if anyone has or can, they will respond.
[19:01:45] rikkipitt: has joined #ruby
[19:02:52] ben010: so i have the local vagrant vm going, have the db setup with the server data, but i'm not sure how to best migrate the code, which is on an amazon server and code in bitbucket. should i bitbucket clone the files to the default nginx www directory? then manually replace the necessary code files with any server settings... should i manually copy the files first then set up the bitbucket connection and see which files are different. sh
[19:02:57] ben010: elsewhere with symlinks?
[19:03:39] ben010: i think i've manually installed the server identical versions of ruby/rails/etc.
[19:05:35] mistermocha: has joined #ruby
[19:09:08] ProofTechnique: has left #ruby: ("Palaver https://palaverapp.com/")
[19:09:19] noobsu: has joined #ruby
[19:10:10] tubuliferous_: has joined #ruby
[19:10:35] djbkd: has joined #ruby
[19:11:11] danostrowski: has joined #ruby
[19:11:30] UserInneed: has joined #ruby
[19:13:10] spider-mario: has joined #ruby
[19:13:17] cdg: has joined #ruby
[19:14:19] palms: ben010: have you considered using any config mgmt software? that might be a bit excessive for your use case. Perhaps a cloud-init script is what you are looking for. As for best practices, I would create my own nginx vhost tailored for RoR and use that in lieu of the default, then clone my code to somewhere like /var/www/current
[19:15:15] palms: as for cfg mgmt, using chef, salt, and puppet would be useful because you would use the same code for vagrant as you would for AWS, potentially.
[19:15:20] ur5us: has joined #ruby
[19:15:27] certainty: has joined #ruby
[19:15:35] ben010: when you say config management is that like capistrano or something? i don't want to tamper with the server in fear that my present level of ruby/ror stupidity is dangerous.
[19:16:13] danostrowski: has joined #ruby
[19:16:30] palms: Yes, a capistrano-like deploy would handle the things like deploying rails while chef, puppet or salt would manage system users, nginx, mysql, etc.
[19:16:31] ben010: can i use those cfg management tools without changes to live server?
[19:16:50] blaxter: has joined #ruby
[19:16:57] mistermocha: has joined #ruby
[19:17:51] palms: it's more involved. i would stand it up side by side and keep instances immutable.
[19:19:08] ben010: as in on the server create a parallel application which i then set up to use config management? and then i migrate that parallel setup?
[19:19:13] palms: ansible is another option as well. i don't intend to promote any cfg mgmt over another
[19:19:56] palms: i think that's a good general practice overall, cfg mgmt or not. If you bork prod, you have no bail plan.
[19:20:28] whathappens: has joined #ruby
[19:20:55] kareeoleez: has joined #ruby
[19:21:03] ben010: i agree, but i'm just sort of stepping in to do a small job on their code, so i'm limited in what i can do. i was just trying to set up a local dev environment so i could work.
[19:22:00] nando293921: has joined #ruby
[19:23:40] terrabl: Hey guys I made this SO question if you guys could check it out maybe : http://stackoverflow.com/questions/37755515/changing-the-format-from-a-mysql-datetime-format-to-a-different-type-in-ruby
[19:23:59] Noxilex: has joined #ruby
[19:24:19] SilverKey: has joined #ruby
[19:24:47] miqlas-H: has joined #ruby
[19:26:03] dhruvasagar: has joined #ruby
[19:26:42] dhruvasagar: has left #ruby: ("WeeChat 1.5")
[19:27:09] palms: ben010: if you need to get your code onto your local vm using vagrant, you should just need to do something like `config.vm.synced_folder ".", "/vagrant", type: "nfs"` if you have the code checked out locally
[19:27:56] swills: has joined #ruby
[19:28:12] palms: then you can bash something on it like `config.vm.provision "shell", path: "config-vm.sh"` with all of your nginx, etc stuff
[19:30:14] al2o3-cr: terrabl: Time.parse ?
[19:30:16] kareeoleez: has joined #ruby
[19:30:29] jancel: has joined #ruby
[19:30:46] cajone: has joined #ruby
[19:31:46] terrabl: so time.parse.strftime?
[19:32:21] al2o3-cr: tbh, i don't quite follow your question
[19:32:46] ruby-lang129: has joined #ruby
[19:33:06] al2o3-cr: >> require 'time'; Time.parse("2016-06-09 14:29:34")
[19:33:07] ruby[bot]: al2o3-cr: # => 2016-06-09 14:29:34 +0000 (https://eval.in/586965)
[19:34:15] terrabl: Hmm, I guess I'm just trying to turn 2016-06-09 14:29:34 into 14:29_20160609
[19:34:44] jaguarmagenta: has joined #ruby
[19:34:45] jackjackdripper: has joined #ruby
[19:34:51] jackjackdripper1: has joined #ruby
[19:35:26] al2o3-cr: >> require 'time'; t = Time.parse("2016-06-09 14:29:34"); t.strftime("%H:%M_%Y%m%d")
[19:35:37] ruby[bot]: al2o3-cr: # => "14:29_20160609" (https://eval.in/586966)
[19:35:48] xlegoman: has joined #ruby
[19:36:36] adaedra: norc: I'll look at that, but is there really a huge difference between 2.3.0 and 2.3.1 docs?
[19:36:36] naftilos76: has joined #ruby
[19:36:48] al2o3-cr: adaedra: not really
[19:37:03] terrabl: Still not working... its just outputting 2016-06-09 13:28:34 +0000
[19:37:10] Rodya_: has joined #ruby
[19:38:12] al2o3-cr: terrabl: what did you try?
[19:38:35] terrabl: Exactyl what you put. It makes sense but I dont know what it isnt working
[19:38:44] terrabl: I'm looking at DateTime.parse right now
[19:39:15] sergey_makagon: has joined #ruby
[19:39:36] ljarvis: has joined #ruby
[19:40:15] al2o3-cr: >> require 'date'; dt = DateTime.parse("2016-06-09 14:29:34"); dt.strftime("%H:%M_%Y%m%d")
[19:40:16] ruby[bot]: al2o3-cr: # => "14:29_20160609" (https://eval.in/586967)
[19:40:22] al2o3-cr: terrabl: it works!
[19:41:05] blackmesa: has joined #ruby
[19:41:46] terrabl: Thanks friend!
[19:42:01] al2o3-cr: yw friend :)
[19:42:21] norc: adaedra, honestly I don't know - but I feel our bot should point to the most recent docs regardless.
[19:42:44] norc: Just looks a bit more professional.
[19:42:44] workmad3: has joined #ruby
[19:44:46] adaedra: I'll take a look later.
[19:45:06] norc: Alright, thank you. :)
[19:46:10] jackjackdripper: has joined #ruby
[19:47:01] tildes_: has joined #ruby
[19:48:21] kareeoleez: has joined #ruby
[19:49:09] johnDoe111: has joined #ruby
[19:49:48] dorje: has joined #ruby
[19:49:55] miqlas-H: has joined #ruby
[19:51:09] B1n4r10: has joined #ruby
[19:52:46] dorje_: has joined #ruby
[19:53:22] diegoviola: has joined #ruby
[19:53:51] tatsuo: has joined #ruby
[19:54:19] tatsuo: has joined #ruby
[19:55:59] danostrowski: has joined #ruby
[19:57:42] CSWookie: has joined #ruby
[19:57:55] mikeliss: has joined #ruby
[19:58:17] ItSANgo: has joined #ruby
[19:58:37] CSWookie: Hey folks, how can I get the second argument passed to my script, or a default if none was passed? ARGV[2] or "fred"?
[19:58:45] emptyflask: has joined #ruby
[19:59:21] wrkrcoop: has joined #ruby
[20:00:05] ljarvis: CSWookie: ARGV[2] || "fred"
[20:00:16] gix: has joined #ruby
[20:00:42] tvon: has joined #ruby
[20:00:51] dorje: has joined #ruby
[20:00:59] CSWookie: So in ruby, || is boolean or and && is boolean and?
[20:01:11] mikecmpbll: has joined #ruby
[20:01:30] CSWookie: I've never written any Ruby before, and I'm learning by hacking together a Vbunch of Vagrantfiles
[20:02:12] ljarvis: CSWookie: ||/&& is logical or/and
[20:02:30] ljarvis: they have higher precedance than or/and keywords
[20:02:37] troulouliou_dev: has joined #ruby
[20:03:03] hobodave_: has joined #ruby
[20:03:25] blackgoat: has joined #ruby
[20:03:36] ljarvis: precedence*
[20:03:42] ljarvis: prece dance
[20:10:10] karmatr0n: has joined #ruby
[20:11:03] norc: CSWookie, also think of "and" and "or" as control flow operators, rather than boolean logic.
[20:11:16] norc: CSWookie, so they belong into the same category as "if" or "else"
[20:14:54] terrabl: How would I use a graphing tool to graph this json data? https://gist.github.com/terrabl/1bee2ee18b3793cf3f4671e965b44080
[20:15:23] whathappens: has joined #ruby
[20:15:35] mistermocha: has joined #ruby
[20:15:50] kareeoleez: has joined #ruby
[20:16:08] certainty: has joined #ruby
[20:16:15] Silthias: has joined #ruby
[20:16:22] ljarvis: or, just think "I should never use and/or"
[20:16:34] norc: ljarvis, never say never.
[20:16:41] Stan: has joined #ruby
[20:16:42] norc: ljarvis, the general rule of thumb is:
[20:16:55] kraken: has joined #ruby
[20:16:57] moeabdol2: has joined #ruby
[20:17:01] norc: ljarvis, when you have to use parens because && or "and" have the wrong predecence, use the other operator.
[20:17:14] norc: (same goes for ||/"or")
[20:17:32] krakenr: Hey, what is the difference between :: and . ? I don't get whats happening when for instance Net::HTTP is called, what is the :: doing?
[20:17:47] ljarvis: correct, but since &&/|| are higher precedence anyway, you pretty much can't go wrong to just straight avoid and/or. When you start worrying about parens your code is probably too complex
[20:17:50] shevy: kraken_ . is shorter :)
[20:18:08] shevy: kraken_ for Net::HTTP that is different than .
[20:18:20] havenwood: kalleth: The `::` is a namespace separator, in your case between the `Net` module and `HTTP` class.
[20:18:40] ljarvis: https://en.wikipedia.org/wiki/Scope_resolution_operator
[20:18:56] krakenr: So it's bassically saying that Net is the module, HTTP is the class within it?
[20:18:58] ljarvis: you can also use it to call class methods but you shouldn't
[20:19:01] norc: kraken_, or class.
[20:19:03] havenwood: kraken_: The `.` is for calling methods.
[20:19:16] norc: kraken_, classes and modules are practically the same - in this particular example Net could also be a class.
[20:19:37] havenwood: kraken_: Nested classes within modules with modules within classes, however.
[20:19:54] krakenr: So for instances, Net::HTTP::Get.new is this: Net module, calling the HTTP class within this module calling the Get class within this class, calling the .new method within the Get class?
[20:19:59] mistermo_: has joined #ruby
[20:20:17] haraigo: has joined #ruby
[20:20:22] ljarvis: there's no "calling", you're just referring to it by resolution
[20:20:43] ljarvis: but yes, Net is a module, HTTP is a class, Get is a nested class
[20:20:49] havenwood: kraken_: The one "calling" is the `.new` class method.
[20:21:18] ljarvis: every call i be resolving classes and calling methods
[20:21:21] norc: kraken_, maybe it becomes more obvious if you use the top space name resolution
[20:21:29] norc: kraken_, for example ::Array will refer to the top level array
[20:21:35] norc: regardless of whether you have a local Array class.
[20:22:03] krakenr: So, correct me if I'm wrong, but :: is just used to access a class within a class
[20:22:11] djbkd: has joined #ruby
[20:22:14] ljarvis: https://en.wikipedia.org/wiki/Scope_resolution_operator
[20:22:15] norc: kraken_, it is used to access a namespace.
[20:22:26] ljarvis: I can paste the link again if it helps
[20:22:32] krakenr: Got i ljarvis
[20:22:36] jancel: has joined #ruby
[20:22:37] krakenr: I'm going to check that out
[20:22:40] krakenr: thanks all
[20:22:51] krakenr: I think I'm on the right track now
[20:24:05] norc: kraken_, the namespace resolution operator also gives you access to a classes singleton methods, that may be where your confusion is coming from.
[20:25:03] wrkrcoop: if i put a rescue statemnet at the end of a method, and i dont use a begin statement, do i need to include the end?
[20:25:13] ljarvis: >> ::Array::new::[](1)
[20:25:14] ruby[bot]: ljarvis: # => nil (https://eval.in/586993)
[20:25:14] norc: wrkrcoop, kind of
[20:25:18] wrkrcoop: in other words if there is not begin do i need an end?
[20:25:27] norc: wrkrcoop, well you can use it inside a def;end block
[20:25:48] norc: Possibly inside a class/module block too, but Im not sure about that.
[20:25:54] wrkrcoop: norc: yeah in my def end block i have a rescue statement … i got an error saying ‘theres an extra end’ and then i removed it and it went away ...
[20:26:00] jenrzzz: has joined #ruby
[20:26:00] norc: ljarvis, okay instance methods too.
[20:26:03] wrkrcoop: so there’s no ned for an end to a resuce?
[20:26:09] norc: wrkrcoop, there always is!
[20:26:16] norc: wrkrcoop, except you already have one from your def.
[20:26:17] Madplatypus: has joined #ruby
[20:26:20] norc: def;rescue;end
[20:26:23] norc: begin;rescue;end
[20:26:24] LiquidInsect: You need to end the block that contains the rescue
[20:26:40] norc: wrkrcoop, you can of course nest them as required. :)
[20:26:48] Akuma: has joined #ruby
[20:27:02] wrkrcoop: norc: what do u mean nest them?
[20:27:11] wrkrcoop: u mean begin rescue end inside a def end?
[20:27:12] norc: def; begin; rescue; end; end
[20:27:15] norc: wrkrcoop, yes.
[20:27:29] Sheperson: has joined #ruby
[20:27:41] norc: wrkrcoop, of course its a pointless excercise if there is no code surrounding the begin block.
[20:27:56] whathappens: has joined #ruby
[20:28:05] norc: >> class Foo; rescue NameError; end
[20:28:06] ruby[bot]: norc: # => nil (https://eval.in/586994)
[20:28:10] norc: That works too apparently. :)
[20:28:49] norc: wrkrcoop, seems like do/end blocks are exempt from this.
[20:29:26] johnmilton: has joined #ruby
[20:30:16] art-solopov: has joined #ruby
[20:31:45] eljimbo: has joined #ruby
[20:32:09] gix: has joined #ruby
[20:33:52] Sheperson: which one of these two is preferred, why?
[20:33:53] Sheperson: https://gist.github.com/anonymous/290fde5d37eb4ddcdcb5620d240cc073
[20:33:59] rikkipitt: has joined #ruby
[20:34:03] kareeoleez: has joined #ruby
[20:34:22] ljarvis: neither of them
[20:34:33] Sheperson: do you have a better solution
[20:34:47] ljarvis: what does persist! return?
[20:34:52] norc: sheperson, for style the second.
[20:35:00] Sheperson: I am looking for the style
[20:35:25] Sheperson: ljarvis: it would return the object itslef
[20:35:27] ljarvis: I would suggest stop caring about returning explicit true/false, and return truthly/falsely
[20:35:36] ljarvis: sheperson: perfect, then I'd use valid? && persist!
[20:35:48] ljarvis: or: persist! if valid? which basically do the same thing
[20:35:57] ljarvis: nil if it fails, the object if it succeeds
[20:36:00] Sheperson: def save; valid? && persist!; end
[20:36:27] ljarvis: persist! if valid? might be preferred, up to you style wise
[20:36:29] norc: Either way ljarvis. Since the question seems to have been directed as whether return early or not, the answer is still to always return early if you can.
[20:36:48] ljarvis: the question what "which of these two is preferred"
[20:36:50] havenwood: sheperson: `valid? and persist` and `persist! if valid?` are the control flow ways
[20:37:08] norc: ljarvis, if you cannot extrapolate the question from that gist then Im sorry.
[20:37:18] ljarvis: apology accepted
[20:38:03] Rodya_: has joined #ruby
[20:38:05] freerobby: has joined #ruby
[20:38:29] Sheperson: norc: I was looking for return early or not
[20:39:13] noobsu_: has joined #ruby
[20:40:21] norc: sheperson, that does not invalidate ljarvis's opinion though. But generally if the choice is to return early or not - return early.
[20:41:24] ljarvis: I concur, I was just trying to point out a better way altogether, if it was more complex I would have done what norc suggested (version 2)
[20:42:04] sleazoid: has joined #ruby
[20:43:19] kareeoleez: has joined #ruby
[20:44:16] shinnya: has joined #ruby
[20:46:36] ips|malc: has joined #ruby
[20:46:39] kies: has joined #ruby
[20:47:33] iooner: has joined #ruby
[20:48:05] spejamchr: has joined #ruby
[20:49:59] johnDoe111: has joined #ruby
[20:50:02] johnmilton: has joined #ruby
[20:50:28] iooner: has joined #ruby
[20:51:42] qasaur: has joined #ruby
[20:52:28] kareeoleez: has joined #ruby
[20:53:05] ChiefAlexander: has joined #ruby
[20:57:54] aberen: has joined #ruby
[20:57:55] whathappens: has joined #ruby
[20:59:28] whathapp_: has joined #ruby
[21:00:22] whathapp_: has joined #ruby
[21:01:17] whathapp_: has joined #ruby
[21:02:31] whathappens: has joined #ruby
[21:05:11] whathappens: has joined #ruby
[21:05:35] danostrowski: has joined #ruby
[21:07:05] postmodern: has joined #ruby
[21:07:24] ecksit: has joined #ruby
[21:09:55] ncthom91: has joined #ruby
[21:10:38] kareeoleez: has joined #ruby
[21:10:39] agent_white: >> ((self.class)..(self.class))
[21:10:41] ruby[bot]: agent_white: # => Object..Object (https://eval.in/587008)
[21:11:50] Gasher: has joined #ruby
[21:13:32] Rodya_: has joined #ruby
[21:16:56] certainty: has joined #ruby
[21:17:40] LiquidInsect: ...is that a Range of classes?
[21:17:49] ljarvis: it's two classes
[21:17:59] ljarvis: if range max == range min they can be anything
[21:18:03] ljarvis: >> nil..nil
[21:18:05] ruby[bot]: ljarvis: # => nil..nil (https://eval.in/587009)
[21:18:06] ljarvis: >> false..false
[21:18:07] ruby[bot]: ljarvis: # => false..false (https://eval.in/587010)
[21:18:14] LiquidInsect: Go home Ruby, you're drunk
[21:19:25] k3rn31: has joined #ruby
[21:25:49] johnDoe111: has joined #ruby
[21:26:43] kavanagh: has joined #ruby
[21:28:01] moeabdol2: has joined #ruby
[21:28:41] kareeoleez: has joined #ruby
[21:30:28] bruce_lee: has joined #ruby
[21:30:28] bruce_lee: has joined #ruby
[21:32:49] postmodern: when writing a data structure where certain fields default to other values or fields, what is the ruby idiom for determining if the field was omitted? present? myfield? has_field?
[21:33:08] gigetoo: has joined #ruby
[21:34:20] norc: postmodern, I cannot recall seeing this idiom anywhere. My first instinct tells me "omitted?" is the most accurate.
[21:34:55] lxsameer: has joined #ruby
[21:35:20] jaguarmagenta: has joined #ruby
[21:37:43] solars: has joined #ruby
[21:38:20] kareeoleez: has joined #ruby
[21:38:25] yfeldblum: has joined #ruby
[21:39:25] al2o3-cr: has joined #ruby
[21:39:36] hobodave: has joined #ruby
[21:40:10] maloik: has joined #ruby
[21:41:42] minimalism: has joined #ruby
[21:42:20] norc: asm>> a.b ^ a.b ^ a.b
[21:42:21] ruby[bot]: norc: I have disassembled your code, the result is at https://eval.in/587015
[21:42:40] norc: cschneid, that is an awful lot of ruby method calls.
[21:44:17] polll: has joined #ruby
[21:46:10] blackmesa: has joined #ruby
[21:48:06] B1n4r10: has joined #ruby
[21:49:14] tAn: has joined #ruby
[21:49:45] dhollinger: has joined #ruby
[21:50:06] cschneid: norc: sure. But everything is a method call in ruby :) It's still a hell of a lot faster than any other data structure I could be using.
[21:50:26] cschneid: s/any other/any other one that I reach for normally, I'm sure there's something silly out there that's better/
[21:51:19] jancel: has joined #ruby
[21:51:59] norc: cschneid, if the hash method is implemented in C directly, you get to do shortcuts. :)
[21:53:29] cschneid: yeah, sure. But then I'd have to go write a C extension for something that isn't a performance hit. I already took the big performance hit by choosing ruby in the first place :)
[21:56:19] kareeoleez: has joined #ruby
[21:58:00] aberen: has joined #ruby
[21:58:19] davedev24: has joined #ruby
[21:58:59] Noxilex: has joined #ruby
[21:59:11] al2o3-cr: has joined #ruby
[21:59:47] mikecmpbll: has joined #ruby
[22:00:14] n_blownapart: has joined #ruby
[22:03:09] d5sx43: has joined #ruby
[22:04:48] dstarh: has joined #ruby
[22:05:50] Meow-J: has joined #ruby
[22:06:56] kareeoleez: has joined #ruby
[22:07:00] jenrzzz: has joined #ruby
[22:07:00] jenrzzz: has joined #ruby
[22:07:35] m_antis: has joined #ruby
[22:07:50] zeroDi: has joined #ruby
[22:10:36] mikecmpbll: has joined #ruby
[22:13:36] postmodern: has joined #ruby
[22:13:42] SilverKey: has joined #ruby
[22:13:55] agent_white: has joined #ruby
[22:14:22] adaedra: &ri Array norc
[22:14:23] `derpy: norc: http://ruby-doc.org/core-2.3.1/Array.html
[22:15:04] norc: <3 adaedra
[22:15:24] adaedra: That was harder than I though, the URI is hardcoded _twice_
[22:16:45] PlasmaStar: has joined #ruby
[22:16:48] jhass: hopefully not any longer
[22:16:58] flashpoint9: has joined #ruby
[22:17:15] adaedra: I want my lawyer.
[22:17:29] e4xit: has joined #ruby
[22:17:36] norc: I'm present adaedra.
[22:17:42] certainty: has joined #ruby
[22:18:01] choke: has joined #ruby
[22:18:09] norc: As your lawyer I advise you to not-repeat-yourself.
[22:18:24] rikkipitt: has joined #ruby
[22:18:37] adaedra: well, there are two URIs:
[22:18:43] adaedra: &ri String Net::HTTP
[22:18:44] `derpy: http://ruby-doc.org/core-2.3.1/String.html, http://ruby-doc.org/stdlib-2.3.1/libdoc/net/http/rdoc/Net/HTTP.html
[22:19:30] norc: ACTION opens a feature request for interpolating strings into strings
[22:20:26] okdas: has joined #ruby
[22:20:26] okdas: has joined #ruby
[22:20:30] adaedra: If this was the only problem `derpy had, I would be happy :)
[22:20:58] fikse: has joined #ruby
[22:22:05] adaedra: ACTION pats `derpy anyways
[22:22:59] neanderslob: has joined #ruby
[22:23:34] allcentury: has joined #ruby
[22:24:12] choke: i hate when i'm a bonehead... having all sorts of rspec issues with an AMS and after an hour realize i forgot to add "_serializer" onto the file
[22:27:22] aries_liuxueyang: has joined #ruby
[22:31:06] asahi: has joined #ruby
[22:32:08] emptyflask: has joined #ruby
[22:32:54] asahi: hello, if I do require 'foo.rb', does a new scope get created for whatever is in foo.rb? that is, any variable definitions in foo.rb are not available from the calling scope?
[22:33:06] kavanagh: has joined #ruby
[22:33:34] lupine: well, that depends entirely on what's in foo.rb
[22:34:03] asahi: suppose it's a bunch of local variable definitions
[22:34:05] lupine: constants will end up in your scope
[22:34:06] shevy: asahi local vars won't be available, constants are
[22:34:09] lupine: local variables will not
[22:34:50] asahi: okay, thank you
[22:36:41] Tref: has joined #ruby
[22:38:33] freerobby: has joined #ruby
[22:38:54] danostrowski: has joined #ruby
[22:39:43] gigetoo: has joined #ruby
[22:41:41] lupine: of course, the required file might do weird things with TOPLEVEL_BINDING
[22:42:14] mtkd: has joined #ruby
[22:43:37] globalall0c: has joined #ruby
[22:43:51] globalall0c: has left #ruby: ()
[22:49:42] johnDoe111: has joined #ruby
[22:49:58] duncannz: has joined #ruby
[22:52:53] duckpupp1: has joined #ruby
[22:53:05] jancel: has joined #ruby
[22:53:29] lightt: has joined #ruby
[22:55:17] kavanagh: has joined #ruby
[22:57:35] jackjackdripper: has joined #ruby
[22:58:38] xlegoman: has joined #ruby
[22:59:42] ruby[bot]: heftig: # => 1 (https://eval.in/587018)
[22:59:49] heftig: >> def a(a=nil); a; end; a(**{})
[22:59:49] diegoaguilar: has joined #ruby
[22:59:50] ruby[bot]: heftig: # => nil (https://eval.in/587019)
[22:59:54] heftig: >> def a(a=nil); a; end; a(**Hash.new)
[22:59:55] ruby[bot]: heftig: # => {} (https://eval.in/587020)
[23:00:00] heftig: the heck is this ^
[23:00:24] tildes_: has joined #ruby
[23:01:09] dorje: has joined #ruby
[23:01:15] yeticry: has joined #ruby
[23:01:47] jhass: a reason to avoid Hash.new without arguments? :P
[23:02:37] jhass: >> def a(a=nil); a; end; h1 = {}; h2 = Hash.new; [a(**h1), a(**h2)]
[23:02:38] ruby[bot]: jhass: # => [{}, {}] (https://eval.in/587021)
[23:04:50] codepete: has joined #ruby
[23:05:14] jhass: asm>> def a(a=nil); a; end; a(**{})
[23:05:15] ruby[bot]: jhass: I have disassembled your code, the result is at https://eval.in/587022
[23:06:23] jenrzzz: has joined #ruby
[23:06:31] jhass: asm>> def a(a=nil); a; end; a(**Hash.new)
[23:06:32] ruby[bot]: jhass: I have disassembled your code, the result is at https://eval.in/587023
[23:07:43] xlegoman: has joined #ruby
[23:07:45] jhass: so the parser already eats it in the first case?
[23:09:04] mostlybadfly: has joined #ruby
[23:09:43] jancel: has joined #ruby
[23:09:45] moeabdol2: has joined #ruby
[23:09:59] asahi: has left #ruby: ()
[23:10:15] kappy: has joined #ruby
[23:10:48] dorje: has joined #ruby
[23:14:10] arescorpio: has joined #ruby
[23:15:40] dorje: has joined #ruby
[23:16:50] ramfjord_: has joined #ruby
[23:16:59] wrkrcoop: has joined #ruby
[23:18:19] ur5us: has joined #ruby
[23:18:24] certainty: has joined #ruby
[23:18:25] dorje_: has joined #ruby
[23:19:19] ur5us: has joined #ruby
[23:19:49] kareeoleez: has joined #ruby
[23:20:42] danostrowski: has joined #ruby
[23:23:04] robbyoconnor: has joined #ruby
[23:26:23] mikecmpbll: has joined #ruby
[23:28:24] Vile`: has joined #ruby
[23:31:18] chipotle: has joined #ruby
[23:35:40] Bugboy1028: has joined #ruby
[23:36:03] jaguarmagenta: has joined #ruby
[23:36:14] zeroDi: has joined #ruby
[23:36:35] sandstrom: has joined #ruby
[23:37:50] ur5us: has joined #ruby
[23:38:15] kareeoleez: has joined #ruby
[23:38:20] ramfjord: has joined #ruby
[23:43:13] SilverKey: has joined #ruby
[23:43:28] banister: has joined #ruby
[23:43:29] mistermocha: has joined #ruby
[23:49:53] johnDoe111: has joined #ruby
[23:50:44] RobertBirnie: has joined #ruby
[23:51:19] tildes_: has joined #ruby
[23:52:06] qasaur: has joined #ruby
[23:53:17] mistermocha: has joined #ruby
[23:53:24] Azure: has joined #ruby
[23:53:56] duckpupp1: has joined #ruby
[23:54:35] binaryplease: has joined #ruby
[23:56:59] kareeoleez: has joined #ruby
[23:58:14] aberen: has joined #ruby
[23:59:23] cdg: has joined #ruby