|
Already have the .ruby-version and .ruby-gemset files with proper versions inside and this is the relevant line in my .bash_profile:code:
EDIT: Ran the command, nothing changed. Gmaz fucked around with this message at 15:29 on May 11, 2015 |
# ? May 11, 2015 15:26 |
|
|
# ? Apr 24, 2024 00:40 |
|
Gmaz posted:Already have the .ruby-version and .ruby-gemset files with proper versions inside and this is the relevant line in my .bash_profile: is RVM in your PATH ? code:
I switched to doing it that way since that how Heroku looks for the version, and I just like having fewer dotfiles in a project
|
# ? May 11, 2015 16:53 |
|
Yeah I have all those things. I just ran bundle install again when it was complaining and now everything works. I guess it didn't install the gems for my gemset, but globally (into the rvm@globals folder, not globally on my system) instead the first time. Weird stuff, but it's resolved now. Appreciate everyone's effort in trying to help me.
|
# ? May 11, 2015 17:11 |
|
If I wanted to spawn a process from my app that runs continuously, how would I do that and make sure it' stays running, or gets started again if its not? My rough draft is that I would spawn a SuckerPunch job that would just continuously run with a do while(true) loop, and sleep when it didn't have stuff to do.
|
# ? May 12, 2015 03:30 |
|
KoRMaK posted:If I wanted to spawn a process from my app that runs continuously, how would I do that and make sure it' stays running, or gets started again if its not? My rough draft is that I would spawn a SuckerPunch job that would just continuously run with a do while(true) loop, and sleep when it didn't have stuff to do. What are you trying to do with this? If it's something that's going to be queuing, then use a queue system like resque. If it's something that's triggered to be a background task, use suckerpunch. If it's something timed, use whenever+chron.
|
# ? May 12, 2015 03:58 |
|
KoRMaK posted:If I wanted to spawn a process from my app that runs continuously, how would I do that and make sure it' stays running, or gets started again if its not? My rough draft is that I would spawn a SuckerPunch job that would just continuously run with a do while(true) loop, and sleep when it didn't have stuff to do. You'll also want something like god/monit/whatever the new hotness is if you want to ensure that the process is constantly running.
|
# ? May 12, 2015 05:06 |
|
Thanks for the suggestions guys. Yes, it's a queue that I'm building. So I'm checking out delayed job, resque etc. I started getting serious about delayed job, but I think I may have an issue with it. I need to limit how many of these things run per second. It doesn't seem like their is a way to manage that in delayed job. Is there a way I can tell it to only run X number of jobs per second? If not, then I'd have to figure out a way to limit that.
|
# ? May 13, 2015 20:46 |
|
KoRMaK posted:Thanks for the suggestions guys. Most queue systems give you a way to limit the number of workers, not a strict per/s limit. Once you figure out how long the task takes you can kind of limit the work per/s by lowering/raising the number of workers, but it won't be perfect. I'm not sure about Delayed Job or Resque, but our job system lets you change queue reading strategies which would let you create a strategy that throttles when receiving messages. This would limit you to one process with an option for multiple threads, though you could do multi-process support with some work.
|
# ? May 13, 2015 22:01 |
|
It looks like I can hook into the reschedule method, or changing the run_at time. This means that the worker processes will have to know a little bit more than I wanted. Initially, I wanted the workers to know nothing about scheduling, and if they were spawned then it means they should just work. I designed a Manager to handle the worker spawning, and the manager would create a new worker if the limiter criteria was not exceeded. Instead, I'll now upgrade the workers to check how many have run in the last second and last 24 hours, and if the limit has been reached then schedule them to run later. It looks like I can use the enqueue and before methods to help out with this. necrotic, how do you write your strategies? What gem are you using?
|
# ? May 14, 2015 16:52 |
|
We use Chore, which we wrote internally and recently open sourced. Documentation is a little lacking, but the interface for the different types of strategies is pretty straight forward. We don't have anything that needs throttling internally so there's no mechanism built-in to handle it, but adding it to a custom Queue consumer wouldn't be all that difficult.
|
# ? May 14, 2015 19:01 |
|
Reminder that ActiveJob was promoted to a first class citizen in the most recent Rails, so if you pick a gem to go with, you should probably pick one that integrates with activejob
|
# ? May 14, 2015 21:31 |
|
kayakyakr posted:Reminder that ActiveJob was promoted to a first class citizen in the most recent Rails, so if you pick a gem to go with, you should probably pick one that integrates with activejob Yeah, we should make an adapter for chore. Not a priority for us as we're still on 3.x
|
# ? May 14, 2015 21:55 |
|
I'm just about to use Resque, is there anything I should know about it or should I jump to something else before I'm in too deep?
|
# ? May 14, 2015 22:04 |
|
MasterSlowPoke posted:I'm just about to use Resque, is there anything I should know about it or should I jump to something else before I'm in too deep? Resque should be fine. I wouldn't use it at scale from past experiences, but if you go the ActiveJob route switching out backends is dead simple.
|
# ? May 14, 2015 22:11 |
|
I'm trying to wrap my head around the best solutions for multiple attachment from one form. Is input file multiple (html5) + paperclip best/easiest way to go?
|
# ? May 15, 2015 02:16 |
|
necrotic posted:Resque should be fine. I wouldn't use it at scale from past experiences, but if you go the ActiveJob route switching out backends is dead simple. Yeah definitely use ActiveJob if you can, the abstraction is well worth it. xenilk posted:I'm trying to wrap my head around the best solutions for multiple attachment from one form. That will work well enough if you don't need IE < v10. You'll need an attachment model that's has_many'd to your main model. The cleanest way would be something like this that just uses accepts_nested_attributes_for http://www.tkalin.com/blog_posts/multiple-file-upload-with-rails-3-2-paperclip-html5-and-no-javascript/
|
# ? May 15, 2015 03:11 |
|
MasterSlowPoke posted:I'm just about to use Resque, is there anything I should know about it or should I jump to something else before I'm in too deep? My understanding is that Sidekiq is a better Resque. I've been using Sucker Punch on a project because it doesn't require a separate worker process and the app is stable enough to not crash and lose pumas..
|
# ? May 15, 2015 05:04 |
|
Cocoa Crispies posted:My understanding is that Sidekiq is a better Resque. I've been using Sucker Punch on a project because it doesn't require a separate worker process and the app is stable enough to not crash and lose pumas.. Sucker Punch is the best for asynchronous tasks. Not the best for scheduling or a true queue. For scheduled stuff, I'd roll with whenever and put that in chron.
|
# ? May 15, 2015 06:05 |
|
kayakyakr posted:Sucker Punch is the best for asynchronous tasks. Not the best for scheduling or a true queue. For scheduled stuff, I'd roll with whenever and put that in chron. Right; the queue isn't persisted to disk anywhere, just held in the server process. If your server crashes, *poof* there goes your queue.
|
# ? May 15, 2015 11:55 |
|
You're really missing out if you write Ruby without contracts.ruby. (Duck-)type safety and multimethods are very welcome additions to the language. If you agree, also check out Crystal.
|
# ? May 18, 2015 22:56 |
|
xtal posted:check out Crystal. This is awesome! Exactly what I've been thinking over the last few days should exist. And it does, and it's actually pretty complete and good. Already got my first PR in
|
# ? May 20, 2015 05:08 |
|
I've been using crystal for the last month or so, and it's really fantastic.
|
# ? May 20, 2015 19:03 |
|
I don't get it. But I didn't get Rails either. Why is Crystal eye popping good?
|
# ? May 20, 2015 19:07 |
|
KoRMaK posted:I don't get it. But I didn't get Rails either. Why is Crystal eye popping good? If you like Ruby but want an actual type system, I guess. I wish the homepage had more info, and that the manual wasn't split into a million small sections. Seriously, what the gently caress: http://crystal-lang.org/docs/syntax_and_semantics/comments.html
|
# ? May 20, 2015 19:37 |
|
necrotic posted:If you like Ruby but want an actual type system, I guess. I wish the homepage had more info, and that the manual wasn't split into a million small sections. Also, lol.
|
# ? May 20, 2015 19:44 |
|
http://en.wikipedia.org/wiki/Type_inference
|
# ? May 20, 2015 20:42 |
|
Yeah, there is global type inference so while everything is typed, you don't need to say types almost ever, except for empty arrays or hashes. The upside here is that you can easily track down branches that can potentially give you a nil at compile time. Because it's all complied and can use all the optimization advances llvm has made, it is very fast. My postgres driver can decode 1MM date strings as postgres represents them, and create a Time object in 0.05s on my macbook air. Also because it's all compiled (and not built on a pile of plan9 garbage) the lldb debugger works, but even more fun profiling tools work great. You can get source level heatmaps using the built-in os x instruments app. When you try that with an interpreted language like ruby, all you get is the VM. It's almost impossible to tell where your code is. The C linking is super easy. This is literally all you need to have a minimal postgres driver that can execute queries code:
Yeah it's super new and the docs aren't great yet. A lot of the time I'm going through the source, but since that's all in
|
# ? May 20, 2015 21:27 |
|
Never mind. I finally got it to work.
The Dreamer fucked around with this message at 19:29 on May 22, 2015 |
# ? May 21, 2015 23:10 |
|
This is everything I never knew I needed.
|
# ? May 22, 2015 15:33 |
|
I ran a couple of migrations to add fields to two models on our existing app. So far, so good. Now when I write test cases, the new fields aren't recognized in the test environment. This is new - we've had this app for a couple of years now, and never have had this problem. I'm assuming I now need to specify that the test environment should be included in rake db:migrate, but I don't know why this changed, and I'd like to know if this is a setting I can toggle somewhere. The only way I can think that this could have changed is that I added a new gem to the end of the Gemfile and ran bundle install this morning, and maybe it updated some other gem that forced this setting, but I'm grasping at straws on that one.
|
# ? May 28, 2015 19:45 |
|
Is the schema that you are loading in test the right one?
|
# ? May 28, 2015 20:12 |
|
KoRMaK posted:Is the schema that you are loading in test the right one? I'm not sure what you mean. How would I load a different one?
|
# ? May 28, 2015 20:14 |
|
I'm not sure how you would load a different one, but have you verified that the columns exist in test? Sorry if this has already been covered.
|
# ? May 28, 2015 20:19 |
|
KoRMaK posted:I'm not sure how you would load a different one, but have you verified that the columns exist in test? The new columns didn't exist in test - that's why I was getting the error. I fixed it by running code:
|
# ? May 28, 2015 20:25 |
|
The proper way to make sure your test database is correct is rake db:test:prepare. Not sure why it stopped happening on db:migrate for you, but use the test:prepare version instead.
|
# ? May 28, 2015 21:35 |
|
I've gotten that occasionally ever since they made the switch to keep test in-line with development.
|
# ? May 28, 2015 21:55 |
|
necrotic posted:The proper way to make sure your test database is correct is rake db:test:prepare. Not sure why it stopped happening on db:migrate for you, but use the test:prepare version instead. The Milkman posted:I've gotten that occasionally ever since they made the switch to keep test in-line with development. Okay, thanks. Here's another (unrelated) question. I've made a user screen to enter login data which I then use to ssh to another computer and invoke a process there. I'm using the net-ssh gem, and having the user enter a login name in a text field, and a password in a password field. If everything is perfect, it works. But, if I use the wrong password on the form and then submit, then the rails server stops and asks me to try again. Obviously, that isn't going to work in production. The server message says I should try HighLine or Termios libraries to suppress echoed text, and HighLine is suggested by the net-ssh gem documentation for automating terminal input, but it looks more like a library of commands to make CLI interaction easier, than something that prevents (or suppresses) being asked for a password. That is, it looks more applicable to a strict Ruby program than to a Rails app. Does anyone have experience with this? I see three general approaches to this: 1) Find a way to make Rails deal automatically with the prompts that are coming up 2) Find a way to tell the ssh gem not to try again if the password is bad the first time 3) Maybe set a very short timeout param so that it's not a long wait, even if the password is wrong and the system wants to try it again For now, I'm okay with an ugly hack, too. This is just a proof-of-concept that may or may not get past our IT group. (It seems they have some concerns about my code logging itself into random servers. Weirdos.) Peristalsis fucked around with this message at 22:14 on May 28, 2015 |
# ? May 28, 2015 22:12 |
|
What are you trying to do that you need something automating shell input? There's got to be a better way.
|
# ? May 29, 2015 03:25 |
|
I'm trying to randomly grab a field from a randomly selected record that is associated with another record. I see that I can do this by ordering and calling a Random function for whichever database I'm using. This is still a prototype app so I'll probably actually do this before I go to production. I found a different way to do this though and was wondering if it was actually a terrible idea. It works now but I'm not sure how it would scale over time with larger database tables. I have 3 tables, Business, Types, and BusinessTypes. I'm doing a Business has_many Types though BusinessTypes association. What I'm trying to do right now is grab a random Business of a certain Type and grab an image url that is stored in the Business object. my current way of doing this is: code:
|
# ? May 29, 2015 04:04 |
|
|
# ? Apr 24, 2024 00:40 |
|
A quick look got me this article http://easyactiverecord.com/blog/2014/03/27/efficiently-getting-random-records-in-active-record/ and as you said the mysql rand method is pretty bad compared to picking a random id as he does, but that obviously doesn't work for you. Now I'm curious too as to which queries your way would run, but don't have a rails setup on this computer. If I were you I would check the logs to see the actual queries. I would have probably picked a random from 0 to type.businesses.count and then do type.businesses.offset(rand) to get the business.
|
# ? May 29, 2015 06:15 |