« first day (423 days earlier)      last day (2832 days later) » 

11:18 AM
0
Q: Kaminari Pagination with JQuery Mobile for Mobile Device

Sonali GuptaI am having trouble implementing Kaminari Pagination for mobile devices. Somehow Kaminari is overriding the mobile.erb format of my page and rendering the html.erb format. I am trying to follow this example: https://github.com/amatsuda/kaminari_example/tree/ajax I have made index.js.erb file a...

 
 
1 hour later…
12:41 PM
morning all
 
 
1 hour later…
1:50 PM
Good morning!
 
2:26 PM
quotes from this morning's meeting: "we need to rethink our snapchat strategy"
 
Oh, of course. You have to know if you are getting effective synergy with the corporate paradigm.
 
lol
i nearly laughed
it was our CEO who said it lol
 
Guys, can tell me why the last print line gives a nil here: gist.github.com/bibstha/361960cef0c2da683e65
 
@bibstha scope is a Rails Method not a ruby method
 
2:42 PM
@Nima no no, i've created my own def self.scope there.
 
@bibstha ,
scope is this in rails: http://guides.rubyonrails.org/active_record_querying.html
when you are doing A.scope_val at that point, you are accessing the Class method you defined as "scope_val"
class methods are only available in the class level
@bibstha
if you want to make your own "scope" method then you need to also create a write for it
like
def self.scope
@scope_val
end
 
@Nima the method is there on line #3. The scope here is my own custom method. I'm just not sure why a anonymous class also accesses the value here.
 
Class instance variables aren't inherited. Try using @@ instead of @ on that variable.
 
Oh
 
lol
 
2:44 PM
Humm
 
@WayneConrad
and @WayneConrad strikes like lightening ..
 
But I read somewhere (probably eloquent ruby) that @@ is not recommended to use.
 
However, @@ variables tend to be a source of bugs and confusion, so avoid them when possible.
 
Humm yeah
 
I think there's a workaround in that article, but I don't have time to read it right now.
 
2:46 PM
Ok got it. Thanks, trying an alternate approach.
 
is it more or does that code looks really confusing
 
@Nima do you mean the code in the gist looks confusing?
 
@bibstha
if you are trying to initialize scope maybe something like this:

class A

  def self.scope(scope_val)
    @scope_val = scope_val
  end

  def self.scope_val
    @scope_val || : my_fancy_scope
  end
end
 
@bibstha If you get a good solution that doesn't involve @@, please educate us. This is an area I get confused about all the time.
 
lol
@WayneConrad im pretty horrible actually
im just curious what he is trying to accomplish
 
2:49 PM
The article recommends class_level_instance_variable instead of class_variable.
aah I'll explain in detail
We have a class that contains a name of the queue to enqueue to in RabbitMQ
 
Oh, darn. My logs are not detailed enough for me to understand how this morning's problem happened :(
 
This basically listens to the RabbitMQ particular queue, but I want to create a dummy listeners that override the main working method.
I'm not sure that made sense :)
 
You are writing tests for code that uses rabbitMQ?
 
A bit more complicated :)
Yeah kind of
We have a test that sends stuff in rabbit. But during test, we replace rabbit with our own fake implementation
the fake implementation complains when there is no registered listener but a message has been queued.
I don't want this to be silent globally, as it is actually useful to see the message. However for certain test cases, I want to disable these warnings in tests
:/
 
have you looked at VCR? i use it all the time for external services and api calls
 
2:55 PM
Isn't VCR only for http request?
 
lets find out
lol
 
3:11 PM
The approach I took is to use a real rabbit server for the tests. Rabbit is very fast, and there are just a few tests that verify that I can put messages into and get them out of rabbit, so this wasn't a problem. The tests make up unique, random queue and exchange names and configure the code to use those; after the test, the test queue and exchange are deleted. Live code uses the regular queue and exchange names.
 
3:33 PM
@bibstha
 
 
6 hours later…
9:05 PM
Hi @all. I am trying to build a web app with just ruby. No other framework. I am having a hard time posting a html form input to a rb file. Any suggestions on how to accomplish this?
 
@JoelL Hello. Have you looked at the CGI library? It comes with Ruby.
 
Hey @WayneConrad yes i have. I have also looked at the ruby NET::http library, but have not had any luck being able to post html from input to a rb file...
<form action="http://localhost:2000/create_user.rb" method="post">
<label for"user_name">Username:</label>
<input type="text" id="user_name" name="post[user_name]">
<br>
<input type="submit" value="Submit">
</form>
that is the form i would like to post
when i post to the create_user.rb it downloads a copy of the file and opens it with xcode
 
Oh, yeah. You'll need to configure your web server to run that ruby script instead of serving it.
If you're using Apache, it is done with the cgi module. Or, at least, it was done with the cgi module 10 years ago. Might have changed since.
 
Ohh ok that makes sense! Thank you! I am actually writing my own small webserver
and i am not really sure how to go about configuring it to do that
Any advice?
 
9:22 PM
You might check out the... um... Oh, there's a tiny web server that comes with Ruby. I'm trying to remember what it's called. Hold on.
webrick, I think. Let me see if that's still true.
 
Yeah that is true. webrick is a small ruby server
But i want to write my own ruby server to learn more then anything
1
Q: Ruby webserver app

JoelLI am building a web app in Ruby but without Rails. So far I just have a very basic web server. What improvements can I make to it? require 'socket' require 'uri' # Files will be served from this directory WEB_ROOT = './public' # Map extensions to their content type CONTENT_TYPE_MAPPING = { '...

that is pretty much my server right now
Any advice on what code i can add to have the server run the file i am posting to instead of serving it?
 
Why run the file? Why not skip the whole CGI thing and just have your server process the request and send the reply?
 
Yeah that sounds like a good idea. Im fairly new to web development and am not really sure how i would do that...
 
The Webrick source might be a good place to go for advice. I can't offer any advice myself because I've never been ambitious enough to write an HTTP server.
 
Ok... Ill look into it now. Thanks for the advice!
 
9:35 PM
You're welcome. Good luck, and keep us posted--it'll be fun to see how you make out.
 
Thanks. Will do!
 
@JoelL Actually, I did just get an idea. Go dig up a copy of the original RFC for HTTP. Version 1.0. It might be simple enough to implement, and modern web browsers will still talk to a version 1 HTTP server.
Wait, there's a version of HTTP that predates 1.0...
 
No, before that. Version 0.9 is what I was thinking of. Link above. I think most browsers will still work with version 0.9, and it's much simpler than modern HTTP.
 
Ok not quite sure what i should be looking for but ill check it out... Thanks
 
9:46 PM
Good luck.
 
Thanks @WayneConrad
 

« first day (423 days earlier)      last day (2832 days later) »