« first day (825 days earlier)      last day (2430 days later) » 

3:51 AM
!!cooperate or defect
 
@JanDvorak cooperate
 
4:04 AM
@CapricaSix Good roll, thanks
 
 
7 hours later…
10:49 AM
Hello everyone!
Do you maybe know a way to detect when I user visits a page that's not in a certain resource?
Apart from implementing the same thing in all other controllers
Or better yet; if you know a good way to send a parameter between two pages that's either the same page after a reload or a page in the same controller
(That's not sending it as a parameter)
 
session?
 
That's what I'm using, but I don't want those session variables to persist when I leave the controller pages
 
11:26 AM
You might have to use a front controller for that
 
12:23 PM
So a comp-1 field is clearly defined as taking 4 bytes of storage.

The data I'm reading in lines up in such a way that these two comp-1 fields have the value \x00\x00. Which is notably not 4 bytes
 
12:38 PM
A front controller?
Interesting...
 
12:59 PM
" The size of the data item is always two bytes, and the high-order half of the data is stored in the leftmost byte. "

What does "The higher order half of the data is stored in the leftmost byte" mean?
 
[here][here][][] [][][][] <--- so?
 
1:12 PM
@Cereal It means the data is stored or transmitted in big-endian order
@Gemtastic Good morning.
 
meaning like
 
"leftmost" in this context means "the lowest memory address (of those addresses being used to store the data)"
 
Okay, I'm slow.

So `01000000 00000000` would be 16384 in this case?
or would it be 4
I'm understanding it would be the first one
 
@Cereal 16384, correct.
 
So decoding \x00\x12 would be "\x00\x12".reverse.unpack 's'
Ookie dokie. Stumbled upon the documentation for the actual version of cobol we use here and it's doing some things differently than everything else
mainly comp-1 being a signed short, rather than a float
 
1:20 PM
@WayneConrad Morning! :)
 
@Cereal Check the list of unpack codes... there are codes for big-endian vs little-endian. You shouldn't need to do the reverse if you use the correct code.
 
All of the integers just say 'use native endian'
 
I'll tell you which code. Is it a signed integer or unsigned?
 
Oh nevermind
 
OK, you saw it.
 
1:26 PM
Not enough coffee;;
 
1:48 PM
hi all
+D
 
Hello @Nima
To continue my spree of questions
irb(main):144:0> [1,2,3].inject &:+
=> 6
irb(main):145:0> [1,2,3].inject :+
=> 6
irb(main):146:0> [1,2,3].inject *:+
=> 6
What's the difference here?
 
& is the operator that calls to_proc on its argument and passes the result as a block. inject is special because it will do that itself without the & operator... the & operator is usually required, but not for inject.
 
Ah
 
As for the splat operator, that's interesting. It's usually used to expand an array into individual arguments. I think that splat is calling to_a or to_ary on its operand to turn it into an array, and then expanding it.
 
2:12 PM
@Nima Howdy!
 
2:31 PM
morning
dudes
 
2:43 PM
@WayneConrad The behavior of * is a little more complex
... I'm not sure how, but it is :p
 
@meagar I believe it.
@AlfredoGallegos Good morning
 
def something(x)
  p x
end

# this works fine, and outputs ":a"
something(*:a)

# this works fine, and outputs ":a"
something(*[:a])

# this works fine, and outputs ":a"
x = :a
something(*x)

# And then...

class Thing
  def to_a; puts "Thing#to_a"; 'a'; end
end

# This outputs #<Thing:0x007f9fa404c158>, as expected
something(*[Thing.new])

# This outputs "Thing#to_a" and then "a", so it's invoking `to_a` on the non-array argument
something(*Thing.new)

# So... can we assume that x(*y) will invoke `to_a` on `y` if `y` is not an array?
 
You're right about it being a little more complex.
 
Similarly something(*3) and something(*"blah") work, but I have no idea what mechanism allows this
I have to assume it's syntax.
 
What if it's using the Array() function?
 
2:50 PM
Except it can't be pure syntax rules, because at runtime it works with things like x(*y) where y is a string/number/symbol or an array
@WayneConrad That might be what's happening
x = *3 #=> [3]
That's pretty weird.
 
x, = *3
But yuck.
 
No, doesn't appear to be invoking Array
$ irb
irb(main):001:0> x = Array('blah')
=> ["blah"]
irb(main):002:0> module Kernel; def Array(y); 99; end; end
=> :Array
irb(main):003:0> x = Array('blah')
=> 99
irb(main):004:0> x = *3
=> [3]
 
 
2 hours later…
Anonymous
5:05 PM
:wave: hello all
 
Anonymous
Today's assignment for work is to write a blog post :-)
 
Anonymous
About something I've learned or did over the past couple weeks (for work)
 
5:25 PM
@onebree Where do you blog?
 
Anonymous
5:37 PM
onebree.github.io and copy to medium
 
can anyone give me a favor?
I can't download the RubyInstaller (for Windows) in the company I work for because of an arbitrary proxy rule
can anyone put it in a public Dropbox folder so I can download from Dropbox?
 
@YuriAlbuquerque What version?
 
if anyone familiar with the send_file command? I have some basic questions
also hi
 
Pretty sure 2.0 is the only usable version for windows, due to gem compatability
I'm familiar with send_file in sinatra
 
this might be a bit different the version rails has
 
5:48 PM
Hey everyone!
 
@michaelpri Hello, welcome back!
 
Haven't been in here for a while :P
 
@meagar latest stable
x64
 
2.3.0 x64 then?
 
yes
thanks
 
5:53 PM
Ignore the rootkit installer
That comes with the original binary
You can trust me, because I'm very trust worthy.
 
@meagar I... know how to use checksums
 
... come on guy, where's the trust?
(Seriously though checksum away)
 
I can access the RubyInstaller website, I just can't download the executable, so I can checksum it. I wouldn't randomly ask a stranger if I didn't have ways to verify the integrity of the file :P
 
I'm curious, you can download from dropbox, but your corporate proxy blocks downloads from that specific site or...?
 
I don't understand the proxy rules the company enforces, it seems pretty much arbitrary
 
5:56 PM
Would anyone be able to help me with something I'm having trouble with in Rails?
 
for instance, I can install some packages from Emacs' package manager, others are blocked
@meagar haha, while searching for the checksums I discovered I can download brom bintray
@michaelpri don't ask to ask, just ask!
 
@YuriAlbuquerque if rand > 0.95 then block end
Guaranteed to annoy all employees
 
@Cereal block if rand > 0.95. Come on buddy.
We're Rubyists here.
 
well, I'm trying to create a blog (just for practice) where people can sign up to leave comments and stuff. Only users with a true admin attribute should be able to create posts. I have a before filter in the Posts controller that works when I'm actually using the application in my browser, but when I run the tests I've made to check it, users with a false admin attribute can still make posts.
I've tried using where in the Post model when I declare that a Post belongs to a User, but that still doesn't work. Any ideas on what could be the problem?
 
6:13 PM
not without seeing the code
 
(so nothing re:Send_file
? )
 
@YuriAlbuquerque one sec, I'll put it in a gist
 
@michaelpri well, you applied the filter on the controller, but you're testing the model
there's no filter in the model at all, surely they are considered valid
what you actually want is an ActiveModel validation
 
6:31 PM
@YuriAlbuquerque Ah, so I have to validate that admin is true in the Post model
 
@michaelpri yes. The usual approach is for the controller to be dumb about the model validation, actually. The controller only asks whether the model validated (with is_valid?), the validation work is performed by the model
nevertheless, also testing the controller is a nice thing
 
How should I go about testing the admin attribute in the Post model?
 
@michaelpri
you mean how do you validate its value?
 
well I have validates :{something here}, inclusion: { in: [true] }, but I don't know exactly what attribute to validate
I tried :user_admin, but that didn't work
 
I'd create a custom validator
 
6:47 PM
@YuriAlbuquerque That worked! Thanks do much :D
 
@michaelpri you're welcome
 
well, I gotta head out now, thanks again
 
@michaelpri Good to see you.
 
 
3 hours later…
9:28 PM
stackoverflow.com/questions/13164063/… offhand, does anyone know what changes to do to the second answer if I want to impliment for multiple files
that I want to loop out into a list in my view
 

« first day (825 days earlier)      last day (2430 days later) »