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
Trabisnikof
Dec 24, 2005

Argue posted:

I guess I'm being paranoid, but if the two of you are saying it's an acceptable solution, then I'll gladly stick with that; it's much easier to implement after all.

That's what I use for a similar requirement.
code:
def hash_email
    d = Digest::SHA1
    salt = "salt salt salt?"
    d.hexdigest( self.email + salt)
  end
Shouldn't have to really worry about collisions and since I'm not using MD5 it will be unlikely someone will rainbow table it.

Adbot
ADBOT LOVES YOU

Trabisnikof
Dec 24, 2005

Anal Wink posted:

If you're worried even in the slightest, just store a new random salt for each email address. That would prevent any sort of rainbow tables and isn't hard to do at all.

Actually, that is a good idea. Although, isn't that still weak to Rainbow Tables, just each hash requires a new lookup? I may not have my concept of Rainbow Tables right though.

Trabisnikof
Dec 24, 2005

Al Azif posted:

What's the usual way of setting a page's title? All my pages use the same layout, I'm assuming I should put something like this in my layout:

code:
<head>
  <title><%= @title %></title>
</head>
but should I set @title in each controller or each view?

I do it in the view. Sure I may be just going <% @title = "You own " + @dog.name + "!" %>. But that's one less thing to have to make sure I do if I do screwy things with renders.

Trabisnikof
Dec 24, 2005

MrSaturn posted:

I suppose this is more of a linux question, but anyhow, I recently started running ubuntu on my laptop. Is there a way to run script/server in the background while I'm using the terminal? I'd like to be able to easily kill the process, too, but I'm not sure how to do that.

Wait till you guys see my next little project -- I'm kinda proud of it. It's for a friend, and it looks spectacular.

mongrel_rails start -d will start it in the background, then mongrel_rails stop will stop the server. Or mongrel_rails restart will reload it. This is of course with mongrel_rails, but that's cause its awesome.

Trabisnikof
Dec 24, 2005

SpaceNinja posted:

I've got an SQL question as it pertains to RoR. I'm reading Ruby for Rails, and this particular set of instructions has left me somewhat :psyduck:. It says:

The trouble is, I'm not quite sure what exactly he means. I've created my development, test, and production databases, but none of them are store_, and I'm also uncertain what he means by "music". Here's the relevant SQL, though I'm not entirely sure it matters:
code:
INSERT INTO composers
	VALUES (1,"Johannes", "Brahams");
INSERT INTO composers VALUES
	VALUES (2,"Claude","Debussy");

INSERT INTO works
	VALUES (1,1,"Sonata for Cello and Piano in F Major");
INSERT INTO works
	VALUES (2,2,"String Quartet");

INSERT INTO editions
	VALUES (1,1,"Facsimilie", "D. Black Music House", 1998, 21.95);
INSERT INTO editions
	VALUES (2,1,"Urtext","RubyTunes, Inc.", 1977, 23.50);
INSERT INTO editions
	VALUES (3,1,"ed. Y.Matsumoto","RubyTunes, Inc.", 2001, 22.95);
INSERT INTO editions
	VALUES (4,2,"","D. Black Music House", 1995, 39.95);
INSERT INTO editions
	VALUES (5,2,"Reprint of 1894 ed.","RubyTunes Inc.", 2003, 35.95);
I'm a little stuck, and can't really progress any further in the book until I've figured out what this means. Any suggestions?

I'm guessing the store_ is just the naming scheme he is assuming you are using, e.g. your app is store, so your dbs would be store_dev, store_test, store_production or w/e. Those sql statements are just adding test data to play with.

Trabisnikof
Dec 24, 2005

Rocko Bonaparte posted:

IDE Stuff

Most of the coders I know who do Rails don't use an IDE. Rails has some decent error messages, and with unit testing (if you are so inclined) that should provide strong tools to debug. I know I've never really looked at using an IDE because it never seemed necessary for a scripting language like ruby.

Trabisnikof
Dec 24, 2005

phazer posted:

Question about adding Restful Authentication to a Rails 2.2 app:


I followed the tutorial here http://www.avnetlabs.com/rails/restful-authentication-with-rails-2

But the guy doesn't say how to actually protect the controllers you want to require login for.

Anyone know how?

I'd guess a :before_filter in your application controller, but I'm not at work so that name might be wrong.

Trabisnikof
Dec 24, 2005

edit: Dang, I have never seen that error before.


In other news Passenger is awesome, but first load is slow. Sports at 11.

Trabisnikof fucked around with this message at 01:02 on Feb 19, 2009

Trabisnikof
Dec 24, 2005

Nolgthorn posted:

It still doesn't get us past using god drat horrible awful terrible capistrano though, which is my biggest grief, so it's useless to me until that day which I'm dreaming of.

We don't use capistrano with our Passenger deployment at all.

Trabisnikof
Dec 24, 2005

atastypie posted:

Can you expand on this? When you say 'hack' do you mean only that a user would be able to post any office_id, or is it something entirely more devious?

It is very easy for a hacker to fake hidden_field data since it is just a normal form element.

Trabisnikof
Dec 24, 2005

Operation Atlas posted:

It is never too early to start writing tests. Learning rails without testing is kind of a guessing game and what works seems to be magic or an incomprehensible collection of mystery settings. Using rspec (or another testing framework) will take the guesswork out and will let you know exactly what broke when so that you can fix things more quickly, more easily, and with less magic.

Just saying, although I agree testing is awesome, debugging rails isn't magical at all without it.

Trabisnikof
Dec 24, 2005

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

Trabisnikof
Dec 24, 2005

Physical posted:

Why is Vi worth using?

Because if you know how to use it, it can be very powerful. Obviously no longer the easiest system to learn, but why re-invent the wheel for those of us who already know how to do complex things with it.

Trabisnikof
Dec 24, 2005

Evil Trout posted:

I personally think it's a good idea to make any process easier for beginners.

I'm all about lowering barriers to entry and letting as many people through the door as possible.

Also I don't think it's fair to call Yehuda the originator of the difficulty installing Rails on a mac. Stuff like setting up rvm / rbenv / xcode never had anything to do with Rails.

He's only really responsible for the "bundle install" step, and after dealing with freezing gems and such in the past, that's a welcome change.

I still don't understand how installing Rails on OS X is hard anymore. I mean, I remember the days that the ruby install was broken, but how is it difficult anymore?

Trabisnikof
Dec 24, 2005

FamDav posted:

The updated list for 10.7 and beyond looks more like:

[list]
[*] Starting with the system ruby until someone screams at them about how that's a horrible idea.
[*] Downloading XCode for hours unless they were lucky enough to find something on the developer tools that don't require a full XCode install because command line tools are now a separate download within xcode.
[*] Realize that the version of GCC it installs doesn't work with Ruby.

In short doing anything with Ruby is a pain in the rear end for beginners because Apple hasn't updated to 1.9.3 and Ruby doesn't support Clang yet.

Wait, how come I did't have any of these issues when I just did an install from scratch, besides the Xcode nonsense which is very dumb. But other than that, I was able to install macports etc and start working away on Ruby poo poo, including imagemagik.

Someone should just make an installer that installs all the good parts of Xcode without installing Xcode.

Adbot
ADBOT LOVES YOU

Trabisnikof
Dec 24, 2005

prom candy posted:

Did you install postgres with macports and then again via another method? I would delete the macports version (backing up your data) and then wipe your gems folder for your project and bundle install again. It seems like your pg gem was compiled against one version of Postgres that's no longer available.

By googling "libpq" I noticed one of the first results dealt with an issue with the default installation options of Homebrew. So, I think a "which psql" might be useful.

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