Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

If you guys had put this book on the first page, I wouldn't have bought it today, since I found it is free online after I came home! Oh well, the author gets a sale and a couple bucks, and I really needed a book this weekend.

http://railstutorial.org/ruby-on-rails-tutorial-book

Adbot
ADBOT LOVES YOU

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Sub Par posted:

Ok, so I'm on Windows (Vista) on my laptop, and everything I read says that it is best to develop on Linux. So I've read about using Linux via Virtual PC 2007, and gotten that working, but I can't seem to get Ubuntu 10.10 to install all the way - it hangs halfway through. It's starting to piss me off, so now I'm about to try Gentoo, but is it really a bad idea to develop on Windows? Is all the trouble I'm going through to get this going gonna be worth it?

Just use Windows for a while. So far it seems like everyone who uses Ruby has a Mac... I am up and running on Fedora 14, haven't tried my MacBook Pro yet.

VirtualPC is windows-only but apparently this will let you run Ubuntu:

http://www.sysprobs.com/install-ubuntu-1010-virtual-pc-2007-windows-7-host

Alternatively, try VirtualBox.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

I started making a message forum, and I wonder what the 'Rails-way' would be to handle new posts, versus replies and replies with quotes.

In php I would just have the options in the url

new post, resulting in new topic:
code:
post.php&type=new&forum=15
reply to existing topic:
code:
post.php&type=reply&topic=20
reply to existing topic, quoting a post:
code:
post.php&type=reply&topic=20&quoted_post=68
Ideally I'd like one new post controller and have it decide things based on what I pass to it, I guess I just don't know how to pass it.

Bob Morales fucked around with this message at 19:18 on Mar 6, 2011

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

A MIRACLE posted:

I'm a rails noob working through a tutorial. I added a CSS layout to my template and now the method buttons like "Show", "Edit" etc include a path, like "Show /bugs/field_samples/3".

I was wondering if there was something in the CSS that could cause it to change like that. The CSS is "Blueprint" if that matters.

That code is on the button itself? Do a pastebin or put the code in your post so we can see, and maybe a screenshot of the actual app.

This tutorial does a few things like buttons with Blueprint - http://ruby.railstutorial.org/ruby-on-rails-tutorial-book

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Is anyone using Pow?

http://pow.cx/

With Pow, there are no preference panes to install. No Apache configuration files to update. And Pow eliminates the need to edit /etc/hosts. To get a Rack app running, just type a single command.

Looks like it's Rails 3 only, though.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Anyone being affected by the Heroku outage? Don't we have a goon or two that work there?

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

So, is Ruby missing a 'case' construct or what?

code:
score == -1 ? [-1,"Score will be calculated next time you make an entry.",@labels[counter]] 
: score == -2 ? [-1,"You have not joined a team.",@labels[counter]] 
: score == -3 ? [-1,"Scores will be calculated when competition begins.",@labels[counter]] 
: [(score/@scores.max.to_f)*maximum_bar_width, score, counter >= @labels.size ? "" 
: @labels[counter]]
(originally all on one line, split for table breakage)

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Just :psyduck: code from work. I don't know why they wrote it that way.

There's also tons of IF NOT/UNLESS FALSE instead of 'if' as well.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Pardot posted:

My guess is that it was written by C programmers used to using magic negative return values for errors.

Used to be a .NET/ASP shop, I guess.


What are you guys using to find errors in your production apps?

Here's what we have now:
  • exceptions, New Relic notifications, nice_passenger notifications, daily task logs, and Campaign Enterprise logs are sent to developer@ourcompany.com
  • developers have email filters to ignore most or all such messages
  • there are too many meaningless ones to wade through, so we ignore most or all of them, and this is the problem
  • customers bring problems to the CSRs
  • CSRs bring those problems to the developers
  • developers find the ignored email related to the problem and fix the problem
Here's what we need:
  • developers discover problems without relying on the client to report the problem to us.
We'd also be interested in tools that might find things of interest in our Apache/mySQL logs.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

NotShadowStar posted:

Try Hoptoad. It's really popular with iOS devs and they have Rails components.

We're basically using gmail+filters based on the app causing them, and the type (javascript, etc). I think we're just hoping for something magical that will identify 'real' errors before the users do. I think what we really want is other sources of errors.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

NotShadowStar posted:

The fact you say that developers are ignoring errors getting sent to them is telling me there's a systemic development problem.

The problem is there's a few hundred a day so they get ignored, unless they start repeating. And they're probably things that should be fixed anyway. But they might as well be 'warnings'.



Like I said, until a user contacts a CSR with something like "Hey, this page is showing up wrong" or "This button doesn't work on the site", we don't know about the problem.

The bad thing is that when you have a CSR come up to you 5 times a day, you can't get other stuff done. Some stuff is application problems but other stuff is things like issues with certain browsers and/or general web stuff, that the devs don't need to be bothered with and I, or an intern can fix. CSS changes and crap like that.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Obsurveyor posted:

My guess: No tests.

:golfclap:

We're going to have a meeting about this tomorrow, I think. I'll bring up the goal of 'zero exceptions'.

I think the biggest problem is that we have ~15 apps, and they are all basically copies of the first app. The core application is the same but the 'gimmick' of each one is different. You're basically entering in information, but in one program you might be using a Javascript basketball court, one uses a Javascript 'blender' that you put vegetables in, etc. You have 'teams' of people and you record progress of eating vegetables/fruits, recording steps, exercise minutes, whatever the gimmick is for that app.

So basically we'll have poo poo left over from one that doesn't belong in another. Or we'll update/fix stuff in one, but the other doesn't get the updates. I'd say that's often due to laziness, but some of the changes are specific to that app for whatever reason.

For instance, yesterday a CSR couldn't remove a user from a program because the user model was trying to remove 'locations' from an exercise table, but this app doesn't use locations to track exercise, just minutes.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Trabisnikof posted:

Yeah, I have no idea how to get my shop to use tests.

I've mentioned it before and there really is no interest in it. The one guy actually told me to not bother learning them because they don't use them, back when I first interviewed.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

NotShadowStar posted:

Just looking at those exception titles, that doesn't look at all like stuff that should be 'just warnings' but serious application errors that need to be drat well fixed. I had pretty big Rails apps that went for a good long while without a single exception thrown, and lots of other people do as well.

Actually looking at the quality of the code you put up before I'm getting a better picture. There's some seriously wrong things happening at your outfit that need to change.

Latest update:

quote:

I love that zero-tolerance idea. But "you have to fix this" conflicts with "you have to build that" where "this" is yesterday's app and "that" is tomorrow's.

We have a problem at XYZ corp: we're so focused on getting the present app sold and the next one built that we only go back and fix really hot items. That mindset worked great until, as I see it, early 2010. For many reasons, in early 2010 problems became more frequent. We really, really needed to start fixing problems -- and, just as importantly, merge changes between similar apps (even if users haven't yet experienced the problem). But we didn't, we just kept on building. And that's why we keep having problems -- the kind that require us to hand out big refunds and lose big $ customers.

Anyway, just letting you know that there's a reason why we ignore problems. I'm not saying it's a valid reason -- I hate it. It's like taking the governor off an engine to make it run a little faster.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

BonzoESC posted:

I worked in a shop like that, where the pressure to deploy anything at all was interfering with my ability to make quality software.

I went to the management and said, "my last day is in two weeks," and haven't looked back. If they won't let you make quality software, they deserve what they get, and you don't deserve to get stuck with it.

I came here from being a sysadmin at a place where I had zero to do (and took a pay+benefits cut to come here). This is my first actual programming job even though I've been toying around with various languages etc for the last 15 years. I'm also in the mid-west where there aren't any tech jobs that don't suck, so I have to either build some experience here for a while and then move, or go back to sysadmining po-dunk networks.

They also hired me with 5 days RoR experience

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

What's the 'main' page of my app called, or does it have a file name?

Basically what I want to do is allow Googlebot to index https://www.myapp.com as well as stuff like https://www.myapp.com/info or https://www.myapp.com/about

But nothing else. I can allow the other pages but if I disallow / in the robots.txt, it can't hit https://www.myapp.com. Which is expected.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!


We have :welcome routed like that, but for some reason it doesn't work the way I want it to. They're just visiting / which goes through, and not /welcome

I'm just going to block all the ones we don't want in the robots.txt. Basically what happens is we get Exceptions from GoogleBot hitting random pages in our site that it shouldn't be. Or at least, we don't expect it to be.

customer-subdomain.ourapp.com/register/demo-password/ and stuff like that (which is actually done in AJAX)

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Pardot posted:

Unrelated to your problem, but I'd strongly advise against subdomains. They make full stack integration testing much harder than it has to be. And there's not much business value in subodmains. Most people don't know what browser they're using let alone care what the url looks like.

Everything I've read agrees with you, but they're 100's of customers and ~ 20 products in.

I put the robots.txt in yesterday, and Googlebot is still hitting us.

code:
User-agent: *
Disallow: /welcome/
Disallow: /register/
Disallow: /store/
Disallow: /toolkit/
Disallow: /content/
Disallow: /home/
But the bot is crawling /welcome/pilot and /home/register still

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Our web server puked this morning. Rackspace kept blaming Passenger/Rails, they couldn't get Apache restarted. What was wrong? /tmp was full! We have an image upload in a couple of our apps (company logos and poo poo like that, not image barn), and the programmer who wrote it didn't delete the temp files created. Ooops.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Linux guys, what are you using for a development setup? Are you choosing a distribution that has a current version of Ruby and then just installing rubygems, or are you compiling your own stuff?

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

What are some ways of issuing a shell command from a rails app and showing the user the output?

For example, I'd have a list of network interfaces on the server, and you could click on button to turn the interface on/off, send a ping, or release/renew the DHCP address. These would just issue commands or run scripts I have written.

There's be some sort of indicator icon in the same row as the interface icon that told the status, but I'd like some sort of box that displays the output from that script or command for more information.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Plastic Jesus posted:

You really, really, really don't want to execute shell commands from a script that accepts user-supplied data. I also doubt that you'd want to be able up/down a network interface or change its IP address via a web application.

It would be for a couple internal people to use, instead of ssh'ing into the server and running commands. It'd actually be for 'clone database', 'sync database' and 'dump database'

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

This is almost a cross-post from the SQL, thread, but how do you guys balance your hardware resources between your web and DB server? We're running Ruby with Apache/Passenger (should we look into nginx or something else?)

My main question is should our web server have 12GB of vRAM, would it better used for our DB server?

The server is has 3 vCPU's, Xeon L5520 @ 2.27GHz. The Ruby/Apache server has 5, and also has 12GB. Wouldn't it make more sense to give the DB server more RAM and maybe equal out the CPU's? Not sure if it's a single quad with HT enabled, or a dual-quad with HT disabled. Maybe we should enable HT and give each server 8 vCPU?

Any tips on my.cnf settings for InnoDB?

Going from this site:

http://www.mysqlperformanceblog.com...b-memory-usage/

I've decided to change the following settings on our server.
code:

innodb_buffer_pool_size=8096M
innodb_flush_method=O_DIRECT
innodb_thread_concurrency=6
innodb_flush_log_at_trx_commit=2
innodb_log_buffer_size=4M

cat /proc/meminfo on the server shows:

MemTotal: 12299960 kB
MemFree: 2467744 kB

Our ibdata1 file is 16G

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Pardot posted:

Is there a reason you're using mysql instead of postgres?

No clue, I've only been here a few months. Their database originates back to when they were an ASP shop.

I changed the DB stuff around this morning, don't notice any difference but I'll get a better idea on Monday since we're really only busy M-F 8am-8pm.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Abel Wingnut posted:

I'm looking to further my skills and develop some database intensive sites. I'm new to Ruby, PHP, and SQL but have significant experience with HTML and CSS. How should I proceed? Will learning Ruby teach me what I need to know about PHP and SQL, or should I learn the basics of PHP and SQL and then transition smoothly to Ruby?

Sorry for the amateurish question but I'm just looking for some expert opinions.

PHP has really nothing to do with Ruby other than the fact that they are both programming languages. PHP is similar to C, if you've ever used that. Ruby on Rails is a framework for Ruby for making web applications.

SQL is another ball of wax. You should probably learn the basics of it, but it's possible to do an application in Ruby without any SQL at all.

Play around with Ruby here, it's fun!

http://tryruby.org/

If you like that, I'd get started with Rails here:

http://ruby.railstutorial.org/ruby-on-rails-tutorial-book

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Stup posted:

Make sure you're using the 4th edition of Agile Web Development with Rails if you're working in Rails 3.x, and the 3rd edition if you're working with 2.2 or 2.3

You should see how many notes I have written in our copy of the 2nd edition.



Any tips on reducing the amount of memory our Ruby and httpd processes take?

code:
top - 13:36:17 up 168 days,  5:15,  2 users,  load average: 2.25, 2.27, 2.27
Tasks: 264 total,   3 running, 261 sleeping,   0 stopped,   0 zombie
Cpu(s): 33.4%us,  0.6%sy,  0.0%ni, 65.3%id,  0.0%wa,  0.1%hi,  0.6%si,  0.0%st
Mem:  12299892k total, 11152972k used,  1146920k free,   330216k buffers
Swap:  2096472k total,   106312k used,  1990160k free,  2321344k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                  
 5618 deploy    17   0  250m 140m 2796 R 60.1  1.2   0:27.73 ruby                                                      
 5431 deploy    16   0  250m 139m 2800 S 32.9  1.2   0:09.88 ruby                                                      
 5636 deploy    16   0  250m 140m 3268 R 32.2  1.2   0:34.68 ruby                                                      
  522 deploy    15   0  229m  79m 4036 S 12.0  0.7   0:04.15 ruby                                                      
 3501 deploy    15   0  266m 156m 2816 S  8.0  1.3   2:35.90 ruby                                                      
 5590 deploy    15   0  250m 140m 2796 S  8.0  1.2   0:28.68 ruby                                                      
 6720 deploy    16   0  358m 204m 5396 S  5.0  1.7   0:19.58 ruby                                                      
 5474 deploy    15   0  247m 137m 2728 S  3.3  1.1   0:01.53 ruby                                                      
 5512 deploy    16   0  250m 140m 2816 S  1.0  1.2   1:08.79 ruby                                                      
 5596 deploy    15   0  261m 151m 2804 S  1.0  1.3   0:38.41 ruby                                                      
 3491 deploy    15   0  258m 148m 2804 S  0.7  1.2   0:33.16 ruby                                                      
 5588 deploy    15   0  185m  77m 2600 S  0.7  0.6   0:00.69 ruby                                                      
 5624 deploy    15   0  299m 143m 4608 S  0.7  1.2   0:22.68 ruby                                                      
 6751 apache    15   0  302m  15m 2948 S  0.7  0.1   0:00.24 httpd                                                     
 7156 apache    15   0  302m  14m 2488 S  0.7  0.1   0:00.04 httpd                                                     
 1813 deploy    15   0  246m 136m 2804 S  0.3  1.1   1:00.86 ruby                                                      
 4940 apache    15   0  304m  16m 3692 S  0.3  0.1   0:00.88 httpd                                                     
 5476 apache    15   0  304m  16m 3616 S  0.3  0.1   0:00.51 httpd                                                     
 5592 deploy    15   0  250m 140m 2620 S  0.3  1.2   0:00.60 ruby                                                      
 5594 deploy    15   0  250m 140m 2628 S  0.3  1.2   0:00.47 ruby                                                      
 5607 apache    15   0  307m  22m 4788 S  0.3  0.2   0:00.60 httpd                                                     
 5852 apache    15   0  304m  16m 3756 S  0.3  0.1   0:00.48 httpd                                                     
 6639 apache    15   0  302m  14m 2892 S  0.3  0.1   0:00.30 httpd                                                     
 6697 apache    15   0  307m  22m 4640 S  0.3  0.2   0:00.38 httpd                                                     
 6709 apache    15   0  302m  15m 2924 S  0.3  0.1   0:00.19 httpd                                                     
 6746 apache    15   0  302m  15m 2908 S  0.3  0.1   0:00.20 httpd                                                     
 6749 apache    15   0  302m  15m 2996 S  0.3  0.1   0:00.25 httpd

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

NotShadowStar posted:

1.8 or 1.9?
If you're using 1.8 you want to use REE

Ruby Enterprise Edition version 1.8.7-2010.01

The server isn't busy right now and it's down to just under 8GB memory used

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

NotShadowStar posted:

I think you're reading angry blogs from 2006 because everything you said is completely not true. Twitter runs on Rails. Groupon runs on Rails. Amazon has lots of Rails internally. People are actively identifying performance issues in Rails and attacking them head on. Rails 3 is way faster than anything ever. The Ruby language is not deliberately gimped by a single entity like Zend so you have to go and buy the 'enterprise' from Zend to un-gently caress the interpreter.

It seems like I've read a bunch of blog articles about replacing this part and that part of Twitter with Java (or something else) in place of Rails.

On a side note, our first 'Rails 3' app does something goofy and freezes our server up a couple times a day. The server also runs Rails 2 apps so we are going to throw up another virtual server or something just for that app, and future apps. 3.09, I'm not sure exactly what's going on with it but another of our developers said it's a problem plenty of others are having.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

revmoo posted:

I'm definitely handicapped. I read Agile web development basically cover to cover last week and didn't really get anything out of it. I'm just used to PHP, which while it is a very messy, ugly language, works very well for web app development and is actually documented.

Did you read it, or are you actually working through it?

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Turns out we have Passenger 2.2.x which doesn't have smart spawning, and we need to upgrade our production server to Passenger 3.0, which our staging server has been running.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

What's going on here?

code:
@promotion.evaluations[1..99].each do |subsequent_evaluation|
 ...
 ...
 ...
end
Why wouldn't you just do @promotion.evaluations.each? Coming from a C background, that would be an array of evaluations (which could be arrays themselves)

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Plastic Jesus posted:

It means 'loop through indexes 1 to 99 in the array @promotion.evaluations'. for the c folk this would be
code:
for(int i = 1; i <= 99; ++i){
   subsequent_valuation = promotion->evaluations[i];
   ...
}

Gotcha. In this particular case they'd want ALL the evaluations for the promotion so I'm not sure why they would put 0-99. Ugh.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

What would be a good (or bad) way to add users to a system service (say email, that uses a plaintext config file for user info) from a Rails web interface? So if someone signs up, they get added to /etc/passwd and have an shell account? Is there something really, really wrong with just doing 'exec adduser -whatever username'?

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Any suggestions for a captcha setup that works well with Ruby?

Basically looking to slow down a brute-force login attempt by adding it as a requirement after say, 4 failed logins. Ideas other than a captcha would be entertained as well, account lockout for a period of time, and making each login take longer to process than the previous one have been ruled out.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!


Thanks. https://github.com/kiskolabs/humanizer was suggested, but it only works with Rails 3. Our newest app is on Rails 3 but the rest are on 2, and it'd be nice to use the same thing in the older apps if that need arises.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

We now have two Rails 3 apps. When we deployed the first one, it ate all our memory and crashed the server. The second one did the same thing the other day.

code:
top - 09:59:10 up 2 days, 23:47,  2 users,  load average: 3.37, 3.10, 2.74
Tasks: 275 total,   4 running, 271 sleeping,   0 stopped,   0 zombie
Cpu(s): 60.6%us,  1.7%sy,  0.5%ni, 37.0%id,  0.0%wa,  0.1%hi,  0.2%si,  0.0%st
Mem:  12299892k total, 11967104k used,   332788k free,   259992k buffers
Swap:  2096472k total,    40036k used,  2056436k free,  3296240k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
15116 deploy    19   0  241m 136m 4108 R 89.8  1.1   0:05.96 ruby                                                 
14611 deploy    15   0  434m 280m 5084 R 47.9  2.3   0:21.82 ruby 
14709 deploy    17   0  379m 268m 3004 S 39.2  2.2   0:17.67 ruby                                                                            
14346 deploy    16   0  251m 141m 2796 S 37.6  1.2   0:27.93 ruby                                                                            
15053 deploy    16   0  252m 140m 2744 S 33.2  1.2   0:08.40 ruby                                                                            
13044 deploy    16   0  308m 197m 2800 S 24.6  1.6   0:37.59 ruby                                                                            
13089 deploy    19   0  328m 155m 4976 S 16.6  1.3   0:25.35 ruby                                                                            
14867 deploy    16   0  247m 136m 2788 S  9.3  1.1   0:24.02 ruby                                                                            
13047 deploy    16   0  251m 140m 2808 R  4.3  1.2   0:49.01 ruby                                                                            
 1734 deploy    20   5  267m 132m 4180 S  2.7  1.1   4:17.45 ruby                                                                            
14603 deploy    16   0  397m 247m 4844 S  2.7  2.1   0:18.23 ruby                                                                            
 7765 deploy    16   0  244m  94m 6524 S  1.0  0.8   0:09.54 ruby                                                                            
15845 deploy    15   0  298m 147m 4356 S  1.0  1.2   3:17.53 ruby                                                                            
14349 deploy    15   0  257m 146m 3296 S  0.7  1.2   1:04.06 ruby                                                                            
   12 root      10  -5     0    0    0 S  0.3  0.0   1:02.58 events/0                                                                        
 3353 deploy    15   0  234m  85m 4644 S  0.3  0.7   0:13.14 ruby                                                                            
 4145 root      23   0  119m 1052  896 S  0.3  0.0   0:00.66 automount                                                                       
 8467 deploy    15   0  196m  91m 3204 S  0.3  0.8   0:09.55 ruby                                                                            
13179 apache    15   0  302m  14m 3372 S  0.3  0.1   0:01.39 httpd                                                                           
13983 apache    15   0  313m  15m 4408 S  0.3  0.1   0:01.05 httpd                                                                           
14063 apache    15   0  302m  14m 3980 S  0.3  0.1   0:00.79 httpd                                                                           
14608 apache    15   0  302m  14m 3812 S  0.3  0.1   0:00.38 httpd                                                                           
14619 apache    15   0  362m  21m 5164 S  0.3  0.2   0:00.45 httpd                                                                           
14621 apache    15   0  305m  17m 3796 S  0.3  0.1   0:00.50 httpd                                                                           
14647 apache    15   0  302m  14m 3696 S  0.3  0.1   0:00.31 httpd                                                                           
14933 deploy    15   0 12880 1244  824 R  0.3  0.0   0:00.31 top                                                                             
14981 apache    15   0  302m  14m 3576 S  0.3  0.1   0:00.09 httpd                                                                           
14990 apache    15   0  302m  13m 2968 S  0.3  0.1   0:00.11 httpd                                                                           
    1 root      15   0 10356  596  560 S  0.0  0.0   0:01.72 init                                                                            
    2 root      RT  -5     0    0    0 S  0.0  0.0   0:01.98 migration
This is from another dev who I've been trying to troubleshoot the issue with:

Rails 3.0.7 (new app 1) uses considerably more memory than Rails 3.0.9 (new app 2) -- but neither is as good as Rails 2.x or 1.x in terms of memory usage.

For example, after serving 333 requests, one <old app> process (a Rails 2.x app) is using 69MB of RAM. On the other hand, after serving 64 requests, one <new app 1> orocess (a Rails 3.0.7 app) is using 207MB of RAM. I chose those two apps because they have so much in common that it seems like the only difference is the Rails framework.

I set passenger to kill (new app 1) processes after 75 requests. It looks like a bunch of memory is eaten on each request and it's not released. But if you kill the process, then the OS will reclaim the memory.

No idea what's causing it though. It's (new app 1)-specific because (new app 2) is a Rails-3 app that does not have any problems.

Memory leak of some sort? Garbage collection??

Rackspace wants a good-sized amount of money to add another 24GB to our server (split into 12gb app, 12gb db VM's)

But if we signed up another big customer or deploy a third rails 3 app, we'll just be eating up a ton more memory anyway.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Ruby 1.8.7 (2009-12-24 patchlevel 248) Ruby Enterprise Edition 2010.01
Passenger 3.0.7

I am looking at setting up memprof right now, I'm just not sure what could I should be checking (or what the easiest way to check all of it is)

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

code:
[deploy@www-prod-test] $ memprof --pid 26502 --key ASDFQWERT --name 470M -t --put-my-data-on-the-internet
Memprof Uploader
[url]http://www.memprof.com[/url]
======================

Signaled process 26502 with SIGURG
Waiting 30 seconds for process 26502 to create a new dump...
Usage:
    -p, --pid <pid>                  PID of the process to dump       (required)
    -n, --name <name>                Name for your dump               (required)
    -k, --key <key>                  Memprof.com API key              (required)
    -d, --[no-]delete                Delete dump file after uploading (default true)
    -s, --seconds <seconds>          Seconds to wait for the dump     (default 300)
    -t, --[no-]test                  Test run (don't actually upload) (default false)
    -f, --file <path>                Upload specific json dump        (optional)
        --put-my-data-on-the-internet
                                     Confirm that you understand
                                     memprof.com will show all your            
                                     internal data on the internet    (required)
        --info

Timed out after waiting 30 seconds. Make sure you added require '/usr/local/lib/ruby/gems/1.8/gems/memprof-0.3.10/lib/memprof/signal' to your application.
I put the 'require memprof' line (like it is in the error message) as the very first line in my environment.rb - is there something else I have to do other than a touch tmp/restart.txt?

Also memprof.com isn't working so I don't know if that's part of the error, I'm trying to just get it to dump to a file by giving a made-up key and using the -f option

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

BonzoESC posted:

https://github.com/ice799/memprof seems to make it look like you want the Rack Middleware doing the dirty work, but you might want its output to go somewhere other than your production log.

At some point though, the time you spend on optimizing memory will cost more than a better deployment strategy (more smaller app servers). For me, it's always been cheaper to throw hardware (read: VPSes) at scaling once you get the app to not crash.

Also, you should at least update Rails; 3.0.8 and 3.0.9 fix some security and SafeBuffer issues. If your test suite is good, you shouldn't worry about minor versions.

My boss was spergin' out on me earlier for spending time working on this. Then he showed me stuff in New Relic for 2 hours "This is where you will find the problem", after I kept asking him how it was going to tell us what was making the processes grow and grow, the longer they ran. It doesn't have anything to do with how long a page loads or how long a SQL query takes!

He also said if we throw hardware at it now, we'll just have to throw hardware at it in the future. There's no interest in adding additional web servers and a load balancer.

Test suite? ahahaah

We moved the offending app to 3.0.9 so we'll see what happens today.

Adbot
ADBOT LOVES YOU

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

What are some good blogs/articles about setting up multiple front-end web servers with a load balancer (an all free-software Linux solution is preferred)?

Right now we have a single web server running Apache/Passenger and a MySQL database server. We'd like to have 2+ web servers due to traffic, and for redundancy. Our database is 20GB and grows about a gig a month, but a lot of that data is 2+ years old and not used anymore.

My boss was playing with the sliders on the Rackspace Cloud configuration page and basically said "We can get 4 8GB cloud servers for what we pay for our 1 server now..." but I tried to explain to him it's not quite that simple.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply