« first day (453 days earlier)      last day (2802 days later) » 

00:37
@Nima Any guesses?
Is O(mn) valid?
Good Morning
Good #{time_of_day}
Ah Sorry.. It's morning in the Philippines
01:16
It's a different time for everyone here, so no worries. This chat is for the world.
Thanks
 
1 hour later…
02:19
Good morning @ping. (From Singapore.) :-)
02:43
@Drenmi: Hello
 
2 hours later…
04:26
Hi Guys! :)
From Philippines here!
Hello @BartSabayton! :-)
 
9 hours later…
13:14
Good morning, awesome Ruby programmers
(or evening, or afternoon...)
morning wayne
+)
morning
This is fun. I think that Emacs has the focus, so I type a bunch of control-N's to move the cursor down. Only it's Firefox that has the focus, so every control-N makes a new browser tab. Weeee!
i cant use anything other than sublime and rubymine
lol
the terminal editors are too hard for me to learn
I've got 20 years of using Emacs burnt into my brain. I don't have to think about what keys to press--I just think "let's move that block of code" and my fingers do stuff pretty much automatically.
13:23
hah nice
Which makes using anything else pretty painful.
I think, I suffer, from overuse, of commas. I gotta kick that bad habit.
be glad you didn't press CTRL+W
No kidding!
i love this podcast commonplacebooks.com
I don't generally do podcasts... They're too slooooooow compared to reading.
13:26
i listen to them when i work
lol
I've tried that. It turns out that my simple brain can either listen, or write code. Doing both, not so much.
lol oh
i guess you dont listen to music either?
I do, because nothing is lost if I stop paying attention to the music.
@WayneConrad you could misteach your music streaming service
@JanDvorak I don't follow you...
13:44
Cool. I got an upvote on what is probably my favorite question that I ever asked.
9
Q: How does BASIC locate an out-of-order NEXT statement when the loop body is skipped

Wayne ConradSet the WABAC machine, Sherman. This question is about BASIC in general, and Microsoft's BASIC-80 in particular. Old school basic. With line numbers. How do (or, rather, did) old-school BASIC interpreters handle FOR...NEXT loops when the loop body was not executed, and the NEXT statement appe...

ewww basic... brings me back to Programming Language Concepts... that, and LISP
Brings me back to my first computer. I could write in basic, or assembly language. That was pretty much it.
How I wish it had a lisp.
at least you first didn't have to have punch cards hehe
:) I did those, too, at my first job. Well, sorta. My job was to program a minicomputer. I had a terminal with keyboard and CRT, the usual stuff. But my boss made me go down to the mainframe room and write a program on punch cards and submit it as a batch job.
When I asked him why, he said "Because this stuff is going away soon, and you need to be able to say you've used it. For bragging rights."
He was a cool boss.
And now is your moment to shine!
13:57
Yes. Bask in my glory.
Nonono. Everyone should be basking in their own glory
But that's not evil.
Fine. I'll be good, if I have to.
 
1 hour later…
15:08
Oh dang. The Rails magic has broken, and I don't know why.
15:53
Yea, though I pass through the valley of circular dependencies...
It gets fun when gem A requires V1 and gem B requires V2 then you have to make sacrafices
Especially when there are version conflicts.
This morning's fun is "Circular dependency detected while autoloading constant".
I wish that change logs would include dates.
16:27
It looks like apipie-rails and Rails concerns are having a sissy fight. If I make the concern just be a regular module, life is good.
Too much magic in Rails. Always too much magic.
Oh, it gets even better. It can be a concern. It just can't be in the "concerns" directory. Hmmf.
I feel like random stuff that shouldn't happen is a larger amount of what programmers do than it should be :P
Oh, heck yeah.
16:40
Hello everyone.
afternoon
I am a student @ www.bloc.io taking the Full Stack program with Ruby on Rails. I am new and just learning the Ruby syntax at the moment.
Very cool. I hope you enjoy Ruby as much as we do.
Thanks Wayne! I have to say it is looking great so far. I really enjoy the way it reads.
At the moment I have just done an introduction to Classes, so I will work through the exercises some more.
16:46
@JonathanMusso welcome to the community ! :)
feel free to ask questions here and someone.. most likely wayne will answer lol
Thanks @Nima, will do :D
I'll answer it... but 50% chance its offtopic or wrong :3
@Nima Now stop that! :D
hehe
16:56
Making stupid mistakes with attr_accessor: model - had to stare at this for a bit....
make sure to read the ruby gotchas.. especially things like division: 3/2 = 1
Thanks @Nima I just found a good post on Stack about it. Will bookmark.
hi
oh np john
17:22
ola Taco
afternoon
Hello, Chris. Looks like we have a quorum. Too bad we don't have anything to decide.
ohhh your deciding upon which tacos to get?
We can decide if we want to chew on glass or get swarmed by bees!
@Jared That's about how I feel when it comes time to vote.
17:28
lol
@Chris The best tacos, the tacos worth getting, are those made by a street vendor in Mexico. Pure heaven.
Mexican street food is muy bueno.
Had tacos in San Diego, their other restaurant was in Tijuana . Glorious... Lengua tacos, was skeptical but oh boy were they awesome sauce
Oh, yeah. That tacos served in most of the "Mexican" restaurants here in the states are... not so bueno.
would you like that taco greasy and covered in cheese?
You remind me of the funniest thing I ever read about Mexican food in the U.S. A Canadian was visiting L.A., so went to two different restaurants to try the Mexican food. One night, she wen to a fancy restaurant and had authentic Mexican food served by Anglos. The next night, she went to Taco bell and fake Mexican food served by real Mexicans.
@Jared Haha! That's exactly what I'm saying.
17:37
@WayneConrad ..
@WayneConrad you have no idea what just happened
lol
I PASSED THE TECH INTERVIEW!!!
Woohoo!
meeting the CEO tomorrow
lol
puts('congrats!') if this.is_a_good_thing?
17:45
lol
At the very least it's an all-caps thing
its a very good thing
i think all i have now is to meet the CEO and get the job
do you have the job and this is onboarding or do they get a final say? :o
i already spoke with him initially on the phone, he is flying back here tomorrow to meet me
:)
@WayneConrad if i get the job, it will be YOUR FAULT
lol
I hope you get it and it's a good job
17:52
and hopefully they give you good tacos as compensation
i really hope so lol
how do you guys go about restarting puma?
just kill the process? and then launch another one?
I don't use puma but that is the principle i use all rails servers
at least locally hehe
you would think there would be a way to restart the process :l
@Chris It's pretty normal in unix to restart processes by killing it and restarting it
Usually the actual job of stopping/starting/restarting a process isn't handled by the process itself, it's handled by the OS via something like init.d scripts
18:06
Just use normal kill. I had a coworker that used "kill -9" by default. It took me a long time to break him of the habit.
Yes, that is not normal
@meagar im used to do touch tmp/restart.tx to restart a rails app
Any process that is built to run as a demon will gracefully handle sigint/ctrl-c
Hey guys, I am having some difficulty with writing my first Calculator script with Classes and Instance Methods. Can I describe the problem in here for assistance or do I need to make a formal question on SA?
@WayneConrad yeah i was using kill -9 last night :P
18:07
@Chris Sometimes you need it. But it's the "nuclear" option.
@JonathanMusso Sock it to us.
just hold the power and whisper to the computer as it shuts down.
@WayneConrad Here is my code and instructions: pastebin.com/umM4mdX9
RSpec is throwing me this error for all my mathematical functions, "wrong number of arguments (0 for 2)". It seems I am not using the in stance variables correctly?
@JonathanMusso you don't need to declare attr_accessor at all
the instance variables @x, @y will be shared accross methods
and they're locked in from the Calc.new correct?
yup
18:13
Ahhh, my mistake. The add - divide are methods, right. Thanks
attr_accessor is for creating getters and setters
if you know java that sounds familiar
Yes, only x and y should be that. No I do not unfortunately.
Mostly HTML and CSS I have experience with, and a tiny bit of jQuery.
I'm not sure that's actually an unfortunate circumstance :)
It's a great language if you like typing a lot. And if you like XML.
I mean, if you like XML in an "I want to marry you and have your babies" kind of way, Java is the language for you.
that depends on your design, if you want the outside world to do this:
calc = Calculator.new(2, 3)
calc.x = 4
calc.add

then have the attr_accessor
otherwsie if you want
calc = Calculator.new(2, 3)
calc.add
then remove the attr_accessor :x, :y
18:16
Java and SOAP... those were great times :P
@Jared :)
makes me appreciate Rails & JSON lol
lol
@JonathanMusso You probably don't need accessors for x and y, since they are set by the constructor. It'd be a better class without the accessors, anyhow. Immutable objects are often easier to make correct.
thank you wayne for explaining that better than i lol
18:18
Besides, the garbage collector gets fat and lazy if we don't exercise it.
Ah yes it is supposed to work like this : Calculator.description
# => "Performs basic mathematical operations"
calc = Calculator.new(5, 2)
#=> #<Calculator:0x007fa843e25200 @x=5, @y=2>
calc.add
#=> 7
calc.divide
#=> 2.5
Well then you just have to remove params on your methods and you're golden :D
@WayneConrad ... totally don't know what you're talking about... nope... :P
Hmm I haven't learned about immutable objects yet Wayne.
@JonathanMusso See, you're ahead of the game. An immutable object is one which state cannot change after it's made. It has no method that will change any of its instance variables.
That's kind of a half-baked definition... but it's good enough to start with.
18:24
does ruby really have immutable objects?
Ah, ok. Thanks @WayneConrad.
Yes, in two ways. The conventional way is that you don't define any methods that mutate the object's state. Another way, not commonly used, is to freeze an object. I don't know much about that way because I've seldom needed it.
"you don't define any methods that mutate the object's state" .. can you give an example?
yea. object.freeze just saves it as it and I think throws errors when modification happens
Yeah. But freezing an object does not freeze the objects it holds references to, if I recall. So it's not an automagic solution.
@Nima attr_writer :x or attr_accessor :x define methods that mutate the objects state by setting the member variable @x
18:26
ooh
Now I have to go read about what freeze really does in Ruby.
Whew. What I said before was actually correct. Lucky me!
@WayneConrad I am confused mate. In the previous article before this exercise it told me that the only way to initiate non hard-coded values into a new instance of a class was to create instance variables with the attr_accessor
18:42
An instance variable may be set (created it if doesn't exist, modified if it does) by any method. The code @a = 1 sets instance variable @a.
367
A: Why use Ruby's attr_accessor, attr_reader and attr_writer?

Wayne ConradYou may use the different accessors to communicate your intent to someone reading your code, and make it easier to write classes which will work correctly no matter how their public API is called. class Person attr_accessor :age ... end Here, I can see that I may both read and write the ag...

^ an accessor is just a sort of macro that defines a reader method and a writer method for you.
(I'm not trying to brush you off with the link, so if that doesn't help, let me know.)
Ok thanks I will go through this now.
well apparently puma has a restart option :D
just have to create a config file and put the appropiate options in it
topics that i need to be better at: concurrency, thread safe, immutable / mutable objects, big O
lol
yeah thread safe is key if your value is puma :P
27
A: Official Ruby Inspector

Chris Jester-YoungRuby 2.0, 69 bytes #!ruby -Kn0rdigest p'×ñF<ìX‚ɲŸ_'.index Digest::MD5.digest(gets)[0] Hexdump (to faithfully show the binary data in the string): 00000000 23 21 72 75 62 79 20 2d 4b 6e 30 72 64 69 67 65 |#!ruby -Kn0rdige| 00000010 73 74 0a 70 27 d7 f1 46 3c 1f ec 58 82 c9 b2 9f |st.p...

^ Creative code golf solution
19:05
Hmm nice explanation @WayneConrad, thank you.
You're welcome.
I might be wrong, but I think for the context of the exercise I am not supposed to use another way to work the instance variables..
The gist shows that the class has two ways: the accessors, and the initialize method.
The initialize method is the only one called for by the exercise. The accessors are not.
Er, apology Wayne. So this means that I am allowed to use non instance variables in the methods then?
I don't see an explicit prohibition against it. However, to solve this problem, you only need the instance variables.
19:18
So why does it tell me I am not passing the required amount of arguments when I create the instance method with two parameters and the math is done with the instance variables?
I thought that by creating instance variables they can be used throughout multiple methods. I guess I am not accessing them correctly?
Ah. This is what someone mentioned to you earlier. Only #initialize needs parameters. The other methods do not. Remove the parameters from the other methods.
Oh crap....I missed that and removed the wrong section. Thank you so much!
@jared Thank you, I completely misunderstood.
It's working?
Yes, passed all the RSpec tests.
Woohoo!
19:23
So this is because initialization of the class instance assumes the desired parameters, and only needs to be specified once.
The instance methods just pull those values, and do not require to be re-entered, am I understanding this right?
:D
@JonathanMusso That's right.
Thank you so much.
You're welcome
Hey guys
19:31
Im trying to replace a named scope with arel. But i got some trouble because im fairly new to rails and ruby. Is there a way to get a relation out of a Arel::SelectManager?
Can we please see the named scope?
sure https://github.com/ENSL/ensl.org/blob/master/app/models/forum.rb available_to
Hello @schlicht!
I wanted to do a drop in replacement because that one is just wrong
Hey Jonathan!
@WayneConrad I updated my code on a Github Gist and tried to explain what I did incorrectly - gist.github.com/jonathanmusso/080437a994f60362c589
19:34
@schlicht I see what you mean! No, you're going to have to recode that by hand, I'm afraid. But +1 for doing it.
What do you mean "record by hand"?
Rewrite by hand. There's no way to automatically turn that into a nice arel.
Yeah I rewrote it by hand with arel! But I don't how I can make sure the resulting object is from the same type
Ruby doesn't worry too much about "same type". Especially in Rails, there's a lot of duck typing going on. Does it run?
It does not.
Somewhere it gets a ordered
call
which is not supported by arel or mysql-result
19:39
@JonathanMusso That looks good. You can kill the entire attr_accessor line.
@schlicht I think you might be best served by a regular SO question. Show the relation, show what you've done, and the error message you're getting.
okay, thanks :)
@schlicht And please paste a link to the question in here
19:51
Will do, when I post it :)
ok thanks
You guys read the SO developer survey results?
20:08
yeah i read the slashdot article about it
good evening
vim for the win
@Jared Link please?
Was that a "why doesn't he google it himself" kind of "Okaaay?"
20:14
lol no. More of a 'huh, that would have been nice to include in my question'
Either way is a fair interpretation :)
although that might have been hard to pull out of an 'okaaaay' :P
"Developers increasingly prefer spaces as they gain experience. Stack Overflow reputation correlates with a preference for spaces, too: users who have 10,000 rep or more prefer spaces to tabs at a ratio of 3 to 1."
Down with tabs!
set tab to be 2 spaces instead of tab character
thats how i roll :P
The tab key, I have no beef with. Actually inserting tabs into a file? Beef.
20:19
are you suggesting that you won't always look at a file in the same viewer and on the same OS? :P
1.3% I don't really use Stack Overflow. I just take surveys.
thats my fav
Describe the Big O complexity of the following function as the array size grows:

def my_index(array, value)
  low = 0
  high = array.length - 1
  while low <= high
    mid = (low + high) / 2
    if array[mid] > value
      high = mid - 1
    elsif array[mid] < value
      low = mid + 1
    else
      return mid
    end
  end
  nil
end
That's binary search.
Do you know how binary search works?
we have a winner
Is there a prize?
20:23
lol
Yea, if you stop by my desk you can claim your lindt truffle
Woohoo!
@Nima Do you know the basic principle of binary search?
yea it tries to pinpoint the value
How does it do that?
half interval search
20:25
Right. So when you're trying to find the big-O, what you really need to know is "how many times can this be halved"
Fortunately, the 2's log of the size is a great approximation of how many times that thing can be halved.
oo
So that makes binary search an O(log2) algorithm.
Which is why binary search is one of our close personal friends.
I'm glad you picked an easy one. A lot of these big-O questions throw me for a loop.
Ah, geez. I just realized how... rude... I sounded right there. Sorry.
huh
you didnt sound rude
:)
I thought, where I said "you picked an easy one"... what if you're thinking, "man, this stuff is hard." In that case, me saying how easy it is is thoughtless.
its not easy... its just burned into the minds of people who learned BigO... I know searching and sorting algorithms way too intimately >.>
20:39
Exactly
Do you get why it's O(log2)? Did the explanation make sense?
i only only understand O(n) and O(1)
lol
now im even more nervous about my interview tomorrow
i bet they are gonna ask me to implement a hash table or something else again
with the same company as last week or another? :)
Good afternoon, pearly programmers :)
the one i did 2 weeks before
20:44
nice!
@Kneel-Before-ZOD Howdy, KbZ
don't be afraid.....the custodian is with you :)
@WayneConrad how's Ruby treating you, buddy? :)
the question i was asked was this:
An application logs an infinite amount of queries constantly
write a function that can find the top hottest queries in the log file
@Kneel-Before-ZOD Not bad. She's easy company.
@WayneConrad that's good
@Nima are you supposed to write a pseudocode or an actual code?
20:47
@Nima The main thing, when you get that kind of question, is to think out loud. There's often a part of the question that's absurd, or some assumption that's not stated, and they want to know how you think about that kind of problem.
they didnt say but i just opened a ruby file and started writing my specs and then my own code along
Yea... thinking out loud is key. They want to see you're analytical. I once got asked "How many tiny shampoo bottles are made in a year?" got caught off guard by that one hehe
lol what???
I kinda agree with @WayneConrad. Many of these questions have inherent assumptions one needs to clarify first
seriously
20:49
@Jared That's a fun one. Assume that most tiny bottles are sold to travelers, so do a back-of-the-envelope calculation to estimate how many trips people take in a year.
how would you actually do that in real life?
I figured hotel use. And guestimated 5% of the population is staying abroad in hotels for work or pleasure and went from there :P
like a log file that contains a lot of strings
lol
@Jared to a question like that, I'll start by mentioning that there are many variables to consider....and list some of them :)
if they asked me those kinda question im gonna freak out @Jared
20:50
Jared I like your answer more. But you have to restrict it to OECD population. I bet other countries don't do the tiny bottle thing as much.
:-D
@Nima For the log thing, I'd use a sliding window. You obviously can't keep track of all log entries forever. So you're going to, let's say, keep track of the last 10,000 of them.
I think it was limited to the US in the question. but yea... just had to think outloud of all the things that could impact it and how I was considering it
i guess the main thing is how to work with a very large set of data efficiently in ruby
how to search, loop, modify, large arrays, hashes, etc
can you use ruby to call grep and count? If you can use those to do heavy lifting
like regex stuff?
20:53
I'm going to use a bounded queue and a hash. The hash will keep track of counts. The bounded queue is what I use for the sliding window. Get new log entry, add it to the queue. If that pushes an entry off of the queue, decrement that entry's count (and remove it if now zero). Now increment the new entry's count in the hash.
@Jared I love making unix tools do the work.
@WayneConrad Yup people much smarter than me can do the heavy lifting lol
bounded queue ?
A queue which will not grow past a certain size.
oh
Oh, and it should be a FIFO queue. I forgot to say.
20:56
What other kind of queue is there?
FILO (first in last out), which we also know as a stack.
@Nima Nice.
great stuff
21:12
what is the difference between shift/unshift and append/prepend ?
append puts elements at the nth index of an array and prepend puts it at the 0
lol
thanks jared
thats all i got :P
21:26
im getting the following error,

`LoadError (Unable to autoload constant ApiKey, ...`

could this be related to the fact the class file is named APIKey?
nm figured it out
What was it?
I had ApiKey in the private method of the controller instead of APIKey
 
2 hours later…
23:45
is it time to go home yet?
already :)
Been home, took a nap. Now it's almost dinnertime.
I resolved the argument that the apipie-rails gem was having with a concern. I moved the concern from the app/controllers/concerns directory to the app/modules directory, and the circular dependency problem went away. I didn't change a single line of code. Go figure!
last person should lock the door :)
awesome when solutions come this easy :)
I left a README in the concerns directory to warn me, six months from now after I've forgotten all this, that putting a concern in the concerns directory might be bad.
a time machine would have been better. Or an electroshock apparatus set to 6 months from now :)

« first day (453 days earlier)      last day (2802 days later) »