havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.3, 2.5.5, 2.7.0-preview1: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
chalkmonster has quit [Quit: WeeChat 2.5]
armyriad has quit [Read error: Connection reset by peer]
armyriad has joined #ruby
bga57 has quit [Ping timeout: 248 seconds]
ghormoon has quit [Ping timeout: 258 seconds]
chalkmonster has joined #ruby
AJA4350 has quit [Remote host closed the connection]
AJA4351 has joined #ruby
AJA4351 is now known as AJA4350
fphilipe has joined #ruby
violentE has joined #ruby
violentE has quit [Client Quit]
code_zombie has joined #ruby
fphilipe has quit [Ping timeout: 272 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
comet23 has quit [Quit: Connection closed for inactivity]
DTZUZO has quit [Ping timeout: 268 seconds]
zer0x has joined #ruby
bga57 has joined #ruby
<zer0x> is anyone here possibly an expert with net/http and knows up to upload a file via post (multipart/form-data)? specifically, when using set_form from Net::NetHeader, I can't find a way to set the Content-Type of the file itself.
<zer0x> s/knows up/knows how/
shirak has quit [Ping timeout: 268 seconds]
<havenwood> zer0x: Do you nead to set the Accept header?
<havenwood> zer0x: ah, no, reread your question
<zer0x> no worries, I'm not sure I worded my question super clear, but really my problem is that multipart/form-data seems to default to application/octet-stream but I need application/zip
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 258 seconds]
AJA4351 is now known as AJA4350
jtperreault has quit [Quit: WeeChat 1.4]
Esa_ has quit []
brool has joined #ruby
Technodrome has joined #ruby
aither has quit [Quit: ZNC 1.7.1 - https://znc.in]
pabs3 has joined #ruby
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
duderonomy has joined #ruby
yokel has quit [Remote host closed the connection]
yokel has joined #ruby
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
[spoiler] has quit [Quit: Cheers!]
EvilJStoker has quit [Remote host closed the connection]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
EvilJStoker has joined #ruby
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
<pabs3> hi folks. is there an equivalent to backticks that doesn't run the command in a shell? like system('echo', '*') but that captures the stdout into a variable?
<chalkmonster> zer0x: HTTPHeader is what you need.
<chalkmonster> not NetHeader
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
<chalkmonster> pabs3: what do you mean
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
<chalkmonster> dead channel :(
fphilipe has joined #ruby
<pabs3> chalkmonster: "system('echo', '*')" doesn't run /bin/sh but "`echo *`" does run /bin/sh. "foo = system('echo', '*')" doesn't save the stdout of echo to foo but "foo = `echo foo`" does. I want something that doesn't run /bin/sh and does save the output
<chalkmonster> pabs3: Kernel#spawn()
<chalkmonster> you can get it to write the output to whatever descriptor you want
<chalkmonster> and then read it subsequently
<pabs3> hmm, I was hoping for something one-liner like backticks :)
sagax has quit [Ping timeout: 244 seconds]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
fphilipe has quit [Ping timeout: 272 seconds]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
<zer0x> chalkmonster: sorry, NetHeader was a typo on my part, doesn't matter anymore tho, net/http kinda sucks, switched to Typhoeus, appreciate the help tho
<chalkmonster> zer0x: yeah, the built in libraries are kinda basic. https://www.ruby-toolbox.com/ is your friend!
galaxie has quit [Ping timeout: 260 seconds]
galaxie has joined #ruby
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
<chalkmonster> pabs3: you can put it all on one line if you're psychopathic
<chalkmonster> lol
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
chalkmonster has quit [Quit: WeeChat 2.5]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
braincrash has quit [Quit: bye bye]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
braincrash has joined #ruby
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
gix has joined #ruby
doodlebug has joined #ruby
chalkmonster has joined #ruby
<pabs3> er
pabs3 has left #ruby ["Don't rest until the streets are paved in poems."]
zer0x has left #ruby [".)(."]
brool has quit [Ping timeout: 252 seconds]
chalkmonster has quit [Quit: WeeChat 2.5]
orbyt_ has quit [Quit: Textual IRC Client: www.textualapp.com]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fphilipe has joined #ruby
fphilipe has quit [Ping timeout: 258 seconds]
AJA4350 has quit [Remote host closed the connection]
gix has quit [Ping timeout: 258 seconds]
SuperLag has quit [Quit: reboot]
SuperLag has joined #ruby
houhoulis has quit [Remote host closed the connection]
dellavg_ has joined #ruby
queip has quit [Ping timeout: 246 seconds]
_whitelogger has joined #ruby
queip has joined #ruby
cd has joined #ruby
chalkmonster has joined #ruby
n13z has quit [Ping timeout: 252 seconds]
sauvin has joined #ruby
sauvin has quit [Max SendQ exceeded]
sauvin has joined #ruby
bga57 has quit [Quit: Leaving.]
xco has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.5]
aither has joined #ruby
buckworst has joined #ruby
kyrylo has joined #ruby
rolandasb has joined #ruby
m_antis has joined #ruby
Technodrome has joined #ruby
rippa has joined #ruby
plujon has quit [Remote host closed the connection]
n13z has joined #ruby
j416 has quit [Ping timeout: 268 seconds]
buckworst has quit [Quit: Leaving]
rolandasb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kyrylo_ has joined #ruby
kyrylo has quit [Ping timeout: 248 seconds]
j416 has joined #ruby
queip has quit [Ping timeout: 258 seconds]
doodlebug has quit [Remote host closed the connection]
sandstrom has joined #ruby
queip has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
planigan has quit [Ping timeout: 272 seconds]
planigan has joined #ruby
fphilipe has joined #ruby
yokel has quit [Remote host closed the connection]
yokel has joined #ruby
miskatonic has joined #ruby
schne1der has joined #ruby
miskatonic has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
schne1der has quit [Ping timeout: 244 seconds]
DTZUZO has joined #ruby
code_zombie has quit [Quit: Leaving]
DTZUZO has quit [Ping timeout: 272 seconds]
fphilipe has quit [Ping timeout: 276 seconds]
queip has quit [Ping timeout: 244 seconds]
doodlebug has joined #ruby
queip has joined #ruby
matheusmoreira has quit [Ping timeout: 245 seconds]
matheusmoreira has joined #ruby
fphilipe has joined #ruby
^ is now known as uplime
xco has quit [Quit: xco]
fphilipe has quit [Ping timeout: 252 seconds]
moei has joined #ruby
fphilipe has joined #ruby
masticass has joined #ruby
leitz has joined #ruby
Fernando-Basso has joined #ruby
<leitz> Why does this dump the json file to the console and not create a data object? data = JSON.load(file)
<ytti> it does not
<ytti> you're doing something else than what you're claiming to do
<leitz> ytti, it does on my screen. Let me put the entire thing up.
<ytti> i assume file is I/O object, not stringname of an file
<ytti> if you are using irb/pry, it always outputs returns value
<ytti> and the assingment is expression which returns the value
<ytti> foo1 = foo2 = 'foo'
<ytti> works, because of that
<leitz> I assume there's operator error, I'm still an Apprentice. :) https://gist.github.com/LeamHall/cf7846919e50e8d26f5ec40be17d6654
<leitz> Added a comment with a sample of the file.
<ytti> prints 'Hash' for me
<leitz> Weird...
<ytti> is the pd.json complete or head of the file?
<leitz> Just the head, it's a long file.
<ytti> aye
<ytti> what if the file is just {}
<leitz> Like, 40K lines.
<ytti> what does 'which ruby' say
<leitz> Interesting. With your suggestion it puts Hash.
<ytti> could it be it's outputting traceback
<ytti> with json in it
<ytti> complaining about its format
<leitz> I *think* the format is valid, it came from another project. Let me go check.
<ytti> do you have exact output when you run the command
<ytti> i'm hoping to see something ile json/common.rb 'parse'
<ytti> the json library complaining where it fails to parse
fphilipe has quit [Ping timeout: 252 seconds]
<leitz> Yup, found it. Redirected 2>&1 to fred.
sagax has joined #ruby
<leitz> So the issue is the json file.
<ytti> did you find the specific complaint
<ytti> where parser encountered error and do you think you will be able to deal with it?
<leitz> Yes, found the actual complaint, and also grabbed a different json file that parsed correctly.
<ytti> very good
<leitz> A question, though. The output seems to mention line 785, but that looks good in the file.
<leitz> The error: /usr/lib/ruby/gems/2.6.0/gems/json-2.2.0/lib/json/common.rb:156:in `parse': 785: unexpected token at ', (JSON::ParserError)
<ytti> it seems to complain comma placement
<ytti> i'm not sure 785 is linenumber
<ytti> or error number
<ytti> would have to cheat and read up somewhere
<ytti> perhaps some list as trailing comman at last element
<ytti> which is not valid json, but some parsers accept it
yokel has quit [Read error: Connection reset by peer]
DTZUZO has joined #ruby
yokel has joined #ruby
<leitz> I removed the comma on line 784, to no effect. So it may be something else.
<ytti> moment
<ytti> i see the problem
<leitz> My coding? :)
<ytti> no
<ytti> if you look at the trace back
<ytti> it complains immediately
<ytti> leitz, the error json throws is really bad
<ytti> leitz, the number is like error number not line where parser found error
<ytti> leitz, really misleading
<ytti> leitz, your problem is you're actually using array, but you're rendering hash
<ytti> you can't do this
<ytti> {
<ytti> ...
<ytti> },
<ytti> {
<ytti> ....
<ytti> },
<ytti> that's actually array
<ytti> so you gotta use [ ]
<ytti> you have array of hashes
<ytti> so only the first object is actually valid
<ytti> leitz, add [ to top and ] to bottom
<ytti> leitz, and you're good to go
<ytti> leitz, puts object.size maybe even more interesting than .class
<ytti> to confirm it is fine after adding those two lines
<leitz> Yup. Adding the [] makes the class Array, with 1180 elements.
shirak has joined #ruby
<ytti> i.e. 1180 of hashes in an array
<ytti> so you can do
<ytti> object.each do |hash|
<ytti> ...
<ytti> end
<ytti> to do something for each of the hashes
<leitz> Stepping back for a moment, is the file actual JSON? Adding [] suggests not.
neveroptimized has joined #ruby
<ytti> adding [ to top and ] bottom makes it valid JSON, yes
<leitz> Works in jsonlint.org, too. I thought json required {}
<ytti> {} == object
<ytti> [] == list
<ytti> object needs key
<ytti> list is keyless, ordered list
<ytti> if you want to wrap it with {}
<ytti> you'd need to do like maybe your oid as a key?
<ytti> you could have jsut {} at parent level, but then you'd need some identity for the indivdiual 'records'
<ytti> like perhaps your '$oid' could be it
<ytti> so parent object has key $oid which has rest of the record
<ytti> but the way you're doing now, you have list of objects
<ytti> and list is identified by []
<ytti> like you can't do in programming language either
neveroptimized has quit [Remote host closed the connection]
<ytti> list = {1, 2, 3, 4, 5}
<ytti> you must do
<ytti> list = [1, 2, 3, 4, 5]
<ytti> right
fphilipe has joined #ruby
<ytti> non-sensical: {}, {}, {}
<ytti> sensical: [{}, {}, {}]
<leitz> Understood. The learning was that json can include an array, I had misunderstood that bit.
<ytti> sensical also {"item1": {}, "item2": {}, "item3": {}}
<ytti> you could do either, it seems like just parent object with keys of '$oid's value, might be reasonable approach
<ytti> so
<ytti> {"59edbea7b2d95837d165fa88": {"terms": 3, "llp": "Responder" ... }, ...}
<ytti> this might make sense, depending on what you're doing
<ytti> parent object with $oid as keys
<leitz> Mostly just storing the individual objects for parsing later. The oid came from when they were stored in MongoDB.
<ytti> aye, list seems fine then
<leitz> Thanks!
<ytti> you're welcome
schne1der has joined #ruby
fphilipe has quit [Ping timeout: 252 seconds]
haxx0r has quit [Ping timeout: 245 seconds]
_ikke_ has quit [Quit: WeeChat 2.3]
_ikke_ has joined #ruby
haxx0r has joined #ruby
AJA4350 has joined #ruby
reber has joined #ruby
sandstrom has quit [Quit: My computer has gone to sleep.]
chalkmonster has joined #ruby
doodlebug has quit [Ping timeout: 244 seconds]
matled- has joined #ruby
matled has quit [Read error: Connection reset by peer]
matled- is now known as matled
reber has quit [Remote host closed the connection]
lucasb has joined #ruby
Inline has quit [Ping timeout: 250 seconds]
Inline has joined #ruby
bvdw has joined #ruby
bvdw has quit [Killed (livingstone.freenode.net (Nickname regained by services))]
bvdw8 has joined #ruby
bvdw8 is now known as bvdw
fphilipe has joined #ruby
bvdw has quit [Quit: bvdw]
bvdw has joined #ruby
Meanirelli has quit [Ping timeout: 244 seconds]
yokel has quit [Read error: Connection reset by peer]
yokel has joined #ruby
Meanirelli has joined #ruby
cd has quit [Ping timeout: 260 seconds]
Esa_ has joined #ruby
fphilipe has quit [Ping timeout: 250 seconds]
Technodrome has joined #ruby
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
bga57 has joined #ruby
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
cd has joined #ruby
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
Esa_ has quit []
thodoris has quit [Quit: Connection closed for inactivity]
AJA4350 has quit [Remote host closed the connection]
fphilipe has joined #ruby
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
jefffrails35 has joined #ruby
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
doodlebug has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
crankharder has quit [Ping timeout: 258 seconds]
xco has joined #ruby
xco has quit [Quit: xco]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
nowhere_man has joined #ruby
kyrylo_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Inline has quit [Ping timeout: 252 seconds]
fphilipe_ has joined #ruby
queip has quit [Ping timeout: 258 seconds]
yokel has quit [Read error: Connection reset by peer]
fphilipe has quit [Ping timeout: 276 seconds]
yokel has joined #ruby
queip has joined #ruby
Inline has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.5]
violentE has joined #ruby
hutch has quit [Quit: WeeChat 2.5]
chalkmonster has joined #ruby
hutch has joined #ruby
sandstrom has joined #ruby
Technodrome has joined #ruby
jefffrails35 has quit [Quit: Leaving]
hutch has quit [Read error: Connection reset by peer]
hutch has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Meanirelli has quit [Ping timeout: 245 seconds]
Swyper has joined #ruby
BTRE has quit [Read error: Connection reset by peer]
shirak has quit [Ping timeout: 272 seconds]
Swyper has quit [Ping timeout: 248 seconds]
chalkmonster has quit [Quit: WeeChat 2.5]
Meanirelli has joined #ruby
* baweaver wanders in
<leitz> Hey baweaver.
* baweaver is on vacation
* leitz googles "vacation".
BTRE has joined #ruby
<leitz> baweaver, when you get back, lemme know if you're taking recommendations on Ruby books. I have a few and most of them are pretty good. :)
<leitz> For newbies it might help to add some to the books page, in the order like you have it.
fphilipe_ has quit [Ping timeout: 252 seconds]
fphilipe_ has joined #ruby
BTRE has quit [Remote host closed the connection]
BTRE has joined #ruby
fphilipe_ has quit [Ping timeout: 250 seconds]
chalkmonster has joined #ruby
<chalkmonster> make IRC great again
kyrylo has joined #ruby
cd has quit [Quit: cd]
chalkmonster has quit [Quit: WeeChat 2.5]
chalkmonster has joined #ruby
<chalkmonster> baweaver: I'm watching your RubyHack2019 talk and its hilarious. Good stuff!
fphilipe_ has joined #ruby
Technodrome has joined #ruby
queip has quit [Ping timeout: 248 seconds]
Technodrome has quit [Remote host closed the connection]
Fusl has quit [Excess Flood]
Mrgoose has quit [Quit: Ping timeout (120 seconds)]
Fusl has joined #ruby
Mrgoose has joined #ruby
queip has joined #ruby
fphilipe_ has quit [Ping timeout: 264 seconds]
queip has quit [Ping timeout: 245 seconds]
n13z_ has joined #ruby
queip has joined #ruby
blackthor has joined #ruby
Fernando-Basso has quit [Remote host closed the connection]
doodlebug has quit [Ping timeout: 258 seconds]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
n13z_ has quit [Quit: Reconnecting]
n13z_ has joined #ruby
Swyper has joined #ruby
n13z_ has quit [Client Quit]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
Swyper has quit [Ping timeout: 246 seconds]
Fernando-Basso has joined #ruby
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
fphilipe_ has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
moei has quit [Ping timeout: 245 seconds]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
sauvin has quit [Read error: Connection reset by peer]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
leitz has quit [Quit: Leaving]
doodlebug has joined #ruby
<baweaver> chalkmonster: Have you seen the RailsConf one yet?
<baweaver> That one is an equal measure of chaos
<baweaver> The same talk was given at RubyConf (as rubyHack) so not much point in doubling back to that one
code_zombie has joined #ruby
chalkmon1 has joined #ruby
chalkmonster has quit [Ping timeout: 245 seconds]
blackthor has quit []
chalkmonster has joined #ruby
orbyt_ has joined #ruby
chalkmon1 has quit [Ping timeout: 246 seconds]
doodlebug has quit [Ping timeout: 258 seconds]
code_zombie has quit [Quit: Leaving]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
<chalkmonster> baweaver: I'll take a look at it m8
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
yokel has quit [Read error: Connection reset by peer]
yokel has joined #ruby
dellavg_ has quit [Ping timeout: 245 seconds]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
nolanv has quit [Quit: WeeChat 2.4]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
AJA4350 has joined #ruby
sandstrom has quit [Quit: My computer has gone to sleep.]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
schne1der has quit [Ping timeout: 258 seconds]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
vjacob has joined #ruby
lord4163 has quit [Excess Flood]
lord4163 has joined #ruby
lord4163 has quit [Excess Flood]
brool has joined #ruby
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
lord4163 has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
doodlebug has joined #ruby
doodlebug has quit [Max SendQ exceeded]
doodlebug has joined #ruby
doodlebug has quit [Max SendQ exceeded]
lord4163 has quit [Excess Flood]
lord4163 has joined #ruby
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
orbyt_ has joined #ruby
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
bambanx has joined #ruby
shirak has joined #ruby
Fernando-Basso has quit [Remote host closed the connection]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
fphilipe_ has quit [Ping timeout: 264 seconds]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
shirak has quit [Ping timeout: 245 seconds]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]
fphilipe_ has joined #ruby
dviola has quit [Ping timeout: 245 seconds]
doodlebug has joined #ruby
doodlebug has quit [Excess Flood]