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
Pardot
Jul 25, 2001




BUGS OF SPRING posted:

I asked recently about getting RoR setup on windows for some development.
Well since Instant Rails is boat loads behind, and one can assume version 3 wont be ported to it anytime soon, Im thinking of setting up a VM with Linux to do my work.

So any suggestions on what to use? A friend told me to try Ubuntu, this a good idea?
Also any good guides for setting up RoR after that's all setup?

You're right in doing a linux VM for Ruby, windows support is poo poo.

Ubuntu is very popular so there'll be a ton of resources. The big downside is the ubuntu ( or debian, I don't know ) packagers have really really hosed up the ruby for really inane reasons.

So you'll either want to build your own ruby from source, or just really quickly install rvm, and then make the rvm ruby default, or choose some other distro. i don't have any recommendations, though, since I usually go with ubuntu server and just build my own ruby, when I have to.

Adbot
ADBOT LOVES YOU

Sharrow
Aug 20, 2007

So... mediocre.
rvm is utterly fantastic. As long as you have git installed, you can have a non-braindead ruby installation on almost any platform in minutes.

I am probably missing something obvious, but it shouldn't be much harder than:

code:
rvm install 1.9.1
rvm 1.9.1 --default
gem install rails
rails testapp
cd testapp
script/server
and then visiting http://localhost:3000/ with your browser.

keep it down up there!
Jun 22, 2006

How's it goin' eh?

I'll give this a try tonight. Thanks!

NotShadowStar
Sep 20, 2000
Yes, rvm will fix the terrible Ruby on Ubuntu since you'll be completely independent of the system Ruby. rvm would probably work decently in Cygwin but I don't even want to think about Cygwin anymore.

Also, don't even touch Rails 3 yet. I've been doing Rails for like 5 something years and it's very different and I keep running into stuff I don't have a clue about, so if you're just learning you're going to be completely confused and there isn't a lot of documentation out there for Rails 3 yet, and nothing at all for new people.

Pardot
Jul 25, 2001




NotShadowStar posted:

Yes, rvm will fix the terrible Ruby on Ubuntu since you'll be completely independent of the system Ruby. rvm would probably work decently in Cygwin but I don't even want to think about Cygwin anymore.

Also, don't even touch Rails 3 yet. I've been doing Rails for like 5 something years and it's very different and I keep running into stuff I don't have a clue about, so if you're just learning you're going to be completely confused and there isn't a lot of documentation out there for Rails 3 yet, and nothing at all for new people.

Bundler 0.8 was great, bundler 0.9 just keeps loving me :smith:

bitprophet
Jul 22, 2004
Taco Defender
Re: Ruby on Ubuntu: I've gotten along just fine with the stock Ruby/RI/RDoc/IRb, but do install RubyGems from source, since (AFAICT) that's the component that clashes with how the OS maintainers want to organize things.

That said, RVM is pretty nice and would obviate any need to backport newer core Ruby packages on the LTS releases, and I'm planning on investigating it more. Its support for mini-environments with distinct gem installations (gemsets) is something Ruby sorely needs, but when I tried it about a month ago, the actual UI for manipulating them was extremely flaky. Here's hoping it improves or Rip version 2 gets going sometime.

trinary
Jul 21, 2003

College Slice

NotShadowStar posted:

Also, don't even touch Rails 3 yet. I've been doing Rails for like 5 something years and it's very different and I keep running into stuff I don't have a clue about, so if you're just learning you're going to be completely confused and there isn't a lot of documentation out there for Rails 3 yet, and nothing at all for new people.

Seconding this. The webservices guy on my team and I have been playing around with it (him mostly) for an app we started a little while ago. We figured we'd learn Rails3 early and not obsolete our app out of the gate, plus he was a big Merb guy and contributed a lot to DataMapper, so we had high hopes for the merger. It's been a giant pain in the rear end.

We've been fighting the bundler, fighting nested form helpers and error handling, fighting our own specs breaking all the time, and all of a sudden with the latest beta gems it started taking twenty goddamn seconds to load rails+our app. This might not sound like much, but that means when we want to do really rapid refreshes of model code and run the specs and whatnot whenever we save a file...we can't. Running specs becomes incredibly slow and frustrating, and we have been pushing TDD as hard as we can, and now even when we want to run a single spec we have to wait.

We monkey-wrapped Kernel#require to profile nested loads and see what was taking so long: rails was 16 seconds, our app was 4. We cut out crap we don't need like ActionMailer or whatever it's called now, and chopped it back a few seconds, but we're out of easy wins now.

Really disappointing, actually.

LordNova
Apr 17, 2005
If you learn RubyMine which is a pretty wonderful cross platform IDE, you can have pretty much the same development environment on OS X, Windows, and Linux.

I develop RoR in OS X at work and develop my hobby RoR apps in Windows 7 at home just fine. These are the additional caveats I have found with windows:

-use the program Console2 so you can have a tabbed shell because the default cmd.exe is really dated.

-don't use the OneClick installer, it is outdated. Use the RubyInstaller instead at http://rubyinstaller.org/ since it has the latest Ruby binaries.

-until the mysql gem for windows gets updated, it seems you need to use mysql 5.0 32 bit (I believe the latest is 5.1 right now)

-google code has a version of git for windows so you don't have to install cygwin or mingw

LordNova fucked around with this message at 05:13 on Feb 26, 2010

NotShadowStar
Sep 20, 2000
What's your guys' issue with Bundler presently? At first I was fighting it because I didn't understand it, but once I understood how it works it's amazing and I use it for non-Rails stuff as well.

Also RSpec/Cucumber aren't working for Rails 3. I'm surprised your current specs even work. In so much that he's rewriting RSpec from scratch for RSpec 2 http://github.com/rspec/rspec-core. Cucumber uses the old style generators while Rails 3 uses Thor, thank goodness. The old generators were... hosed up to put it nicely. I'm building a new app in Rails 3 from scratch without testing (can't stand Test::Unit) but have a high priority list of stuff in my project management to add specs once RSpec 2 is feature complete.

plasticbugs
Dec 13, 2006

Special Batman and Robin

LordNova posted:

Anyone else going to the LA Ruby conference this weekend?
http://www.larubyconf.com/

drat, I wish I saw this sooner - spent a day by myself not talking to anyone.

I went for the class day on Friday, but not for the Saturday talks. Did you end up going?

I took the Nokogiri/Mechanize class and the Rubygames/Gamebox class. Both were well worth the extremely cheap $60 per course fee. The guy who created Nokogiri gave a nice primer on Xpath and CSS selectors which was a great foundation to learn from.

LordNova
Apr 17, 2005

plasticbugs posted:

drat, I wish I saw this sooner - spent a day by myself not talking to anyone.

I went for the class day on Friday, but not for the Saturday talks. Did you end up going?

I took the Nokogiri/Mechanize class and the Rubygames/Gamebox class. Both were well worth the extremely cheap $60 per course fee. The guy who created Nokogiri gave a nice primer on Xpath and CSS selectors which was a great foundation to learn from.

I was actually there for the Saturday talks and not the Friday classes. There were a few interesting lectures on the lower level threading and garbage collecting mechanisms of the ruby interpreter, unusual data structures, and ways to bring a Rails site down. It was interesting, but definitely not anything revolutionary or amazing. Half the people in attendance elected to spend the lectures browsing Twitter and Facebook on their macbooks.

Sym
Feb 22, 2006
Where am I?

LordNova posted:

-until the mysql gem for windows gets updated, it seems you need to use mysql 5.0 32 bit (I believe the latest is 5.1 right now)

I'm using MySql 5.1.41 64 bit on my Windows 7, you just need the 32 bit version of the dll file that the gem uses. Once you have the mysql gem installed grab the libmySQL.dll from InstantRails.

http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/

Then copy over the libmySQL.dll to your MySQL bin folder. (I just renamed the existing one incase I had a problem later)

smug forum asshole
Jan 15, 2005
I have a blog in rails and it makes use of the truncate helper to add a "read more" link to posts. Any post that is over 2000 characters is given the treatment. I was wondering if anyone had any suggestions for a more flexible way to implement an "after the jump" link?

jetviper21
Jan 29, 2005

smug forum rear end in a top hat posted:

I have a blog in rails and it makes use of the truncate helper to add a "read more" link to posts. Any post that is over 2000 characters is given the treatment. I was wondering if anyone had any suggestions for a more flexible way to implement an "after the jump" link?

This would be pretty simple using rjs templates if you want some help let me know

hmm yes
Dec 2, 2000
College Slice
Radiant does this by checking for an 'extended' attribute for a page. For example, you can set your above the fold content into @post.body and the rest of the content in @post.extended. When displaying posts, check the value of @post.extended, if it contains text, output the read more link.

Seawaffle
Jun 21, 2007
making a career of misquoting
This might be a dumb question, but I'm having some issues with Rails. I'm just starting out with it, and am running everything off my Dreamhost account (since I prefer to have it available anywhere I go). I'm following this tutorial (which is one of the better programming tutorials I've seen in a long time). It advocates using rspec for testing. When I try to run it, I get errors like this:
code:
Mysql::Error in '/pages/home should tell you where to find the file'
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I've set up MySQL databases for production and development through the Dreamhost panel, and my database.yml looks like the following:
code:
development:
  adapter: mysql
  encoding: utf8
  database: testapp_dev
  username: <username>
  password: <password>
  hostname: mysql.<domain>.com

production:
  adapter: mysql
  encoding: utf8
  database: testapp_prod
  username: <username>
  password: <password>
  hostname: mysql.<domain>.com
/var/run/mysqld/mysqld.sock doesn't exist as far as I can see.

I've been digging around on the interwebs, and it looks like a load of people have this problem, but I've not been able to find a concrete solution. Everything else seems to work (though I haven't really gotten so far as to start using the database for anything yet), so far I've only noticed it when trying to run spec.

Any ideas? It's not a big deal (yet), but it's making it a somewhat frustrating learning experience.

Sharrow
Aug 20, 2007

So... mediocre.
Does /tmp/mysql.sock or /tmp/mysqld.sock exist? That's another common location.

You can add socket: /path/to/whatever.sock when you find it.

Edit: Oh I'm retarded and don't read. Tests run under the "test" environment, and you only have development and production specified.

Seawaffle
Jun 21, 2007
making a career of misquoting

quote:

Edit: Oh I'm retarded and don't read. Tests run under the "test" environment, and you only have development and production specified.
Oh, that's simple. Well, at least it was something easy to fix. Thanks~

keep it down up there!
Jun 22, 2006

How's it goin' eh?

Nevermind I figured it out, needed to install curl.

keep it down up there! fucked around with this message at 07:47 on Mar 3, 2010

Pardot
Jul 25, 2001




You probably need to install curl

Have you opened a new terminal window to make sure that your new .bashrc has been run? Also I use zsh, and I know non-snow leopard ships with a zsh that is too old for rvm. Perhaps your bash is old? Other than that I don't see anything wrong.

keep it down up there!
Jun 22, 2006

How's it goin' eh?

Okay I'm all setup and rails seems to be running on ubuntu, finally :D
Thanks everyone for the help, it's gonna be nice to be out of windows.

One final setup question, does anyone know a good editor to use? Preferably something that will show my file directory so I can swap around easier. I was using netbeans for RoR in Windows and really liked the way it worked.
Syntax highlighting would be a bonus too.

smug forum asshole
Jan 15, 2005
gedit is pretty drat good -- best when you figure out what features you want, and discover that people have already written plugins for most of them. in one of the official ubuntu repositories there's a gedit plugins package that has a file browser plugin, which i think is what you want.

keep it down up there!
Jun 22, 2006

How's it goin' eh?

Awesome, thanks. I've been using gedit so far but didn't realize there were plugins.

smug forum asshole
Jan 15, 2005
:)

i use:

i think my syntax highlighting is "better" than the default too. google around and see if you're getting the most out of gedit :)

FinkieMcGee
May 23, 2001

Look, I have to go identify our dead father's body. I'm sorry you're having a bad drug experience, but deal with it.
I switched over to Vim and it rules if you're willing to sink time into learning it.

Also this guy has a decent setup:
http://akitaonrails.com/2009/01/04/rails-on-vim-in-english

Splinter
Jul 4, 2003
Cowabunga!

BUGS OF SPRING posted:

One final setup question, does anyone know a good editor to use? Preferably something that will show my file directory so I can swap around easier. I was using netbeans for RoR in Windows and really liked the way it worked.
Syntax highlighting would be a bonus too.
Why not stick with Netbeans since you like it and know it already?

keep it down up there!
Jun 22, 2006

How's it goin' eh?

Splinter posted:

Why not stick with Netbeans since you like it and know it already?

I wasn't even aware it's available for ubuntu, and didn't think to look.
Wow, thanks a ton :D

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"
After a few more instances of having to deal with things breaking on the shared hosting that the Rails site I built my dad is hosted on, I've decided to bite the bullet and get some VPS hosting instead. gently caress mongrel.

To make the cost increase palatable to him, I plan to host both our websites on the same VPS and split the cost. Each site is pretty low traffic and low space usage; his is an art gallery running on RoR and MySQL, mine is a Wordpress site for personal research and software that gets updated maybe a couple times a year. I don't have figures for number of hits a day off the top of my head, but neither of us even approach anywhere near our monthly bandwidth quotas.

What's the bare or near-bare minimum requirements for RAM on a VPS that I can probably get by with? I'm asking here because I figure the Rails app is the primary cause for concern when it comes to resource usage. It uses RMagick for image manipulation when something is uploaded to the gallery, but I would switch to MiniMagick if I made this change. I'd also plan on running Nginx and Passenger, and I've read that using MyISAM in my database instead of InnoDB will also improve my resource usage. Any other recommendations for things I can do to pare things down?

I'm looking at ramhost.us -- they have some very nicely priced plans that I can convince him are a worthwhile upgrade from his $20/year shared plan, but I want to make sure I don't get something too small for what we need.

bitprophet
Jul 22, 2004
Taco Defender
512MB is probably sufficient, especially if you give Ruby Enterprise Edition (terrible name, apparently solid kit though) a try, when paired with Passenger you're supposed to get a very decent reduction in total memory footprint.

For reference I run two Redmine instances, a couple tiny Django sites, a couple instances of a Python-based wiki engine, and various other odds and ends, all on a VPS with ~512 MB -- and I'm not even using Ruby EE -- and it generally works fine.

The nice thing about VPS plans is you can often upgrade when necessary without a reinstall/reformat. Any VPS host that says "no we cannot up your ram allotment easily with just one quick reboot" is not a host you should be considering anyway :)

jonnii
Dec 29, 2002
god dances in the face of the jews

Flobbster posted:

... stuff about hosting ...

Have you considered using heroku? It's pretty awesome.

For your wordpress you can get a 6 dollar a month account on bluehost.

Operation Atlas
Dec 17, 2003

Bliss Can Be Bought

Flobbster posted:

I'm looking at ramhost.us -- they have some very nicely priced plans that I can convince him are a worthwhile upgrade from his $20/year shared plan, but I want to make sure I don't get something too small for what we need.

I'd recommend Linode. I've been a Slicehost customer for years and they've been great, but if I were to make the decision again I'd go with Linode. They always kill on load tests and their prices are the best I've seen among the major VPS guys.

asveepay
Jul 7, 2005
internobody

jonnii posted:

Have you considered using heroku? It's pretty awesome.

For your wordpress you can get a 6 dollar a month account on bluehost.

I did a lot of early rails development with Heroku, and while I was incredibly happy with the hosting and web-based editor, i did come across a number of really weird artifacts with record sorting that seemed to only happen on Heroku, and not on any other hosts.

As such, I moved over to RailsPlayground for testing and have been pretty happy with my developer account there. Its certainly not a full site, but it runs well for my purposes.

jonnii
Dec 29, 2002
god dances in the face of the jews

asveepay posted:

I did a lot of early rails development with Heroku, and while I was incredibly happy with the hosting and web-based editor, i did come across a number of really weird artifacts with record sorting that seemed to only happen on Heroku, and not on any other hosts.

Heroku has likely changed significantly since you last tried it, they don't have any of that web based editor anymore. I think you'll be pleasantly surprised...

skidooer
Aug 6, 2001

bitprophet posted:

512MB is probably sufficient
I'm running a few low-traffic Rails apps on a 256MB VPS with standard Ruby and memory to spare. The system doesn't do anything else though.

hmm yes
Dec 2, 2000
College Slice
I started hosting on RailsPlayground in '06, abandoned it for RailsMachine in March '07 (they had an awesome deployment gem full of easy rake tasks), moved on to slicehost in Feb '08 (way cheaper, full vps), and am now moving a bunch of sites over to Heroku. So much hopping around!

Heroku is just a pleasure to work with. Yes it strips out lots of choice (S3 for files, sqlite3 for db, no dedicated IP/SSL is very expensive) but it is fast, reliable, and by far the easiest hosting I've developed for. Databases under 5MB being free is pretty sweet too, since that covers a lot of small websites.

If you need the full control of a VPS, I would recommend slicehost, but it is so much effort for just a few websites. I've also heard good things about Linode, but I've never used them myself. Unless you're a total nerd who loves server maintenance, I would stay away from VPS.

Pardot
Jul 25, 2001




Heroku is loving awesome now. That web editor was weird, and I have no idea why they thought people would want that. Now that they've completely transitioned in to hosing, they've really done a lot of great things.

Just yesterday I deployed a toy sinatra app to them, which will be free for a long time since it's really just for me and my friends.

I'm planning on using them for my startup's hosting too. Heroku is just so sexy. The only downside is that they don't support couchdb, though, but it's not that much of a problem since coloudant.com and heroku are both on ec2, so

asveepay
Jul 7, 2005
internobody

jonnii posted:

Heroku has likely changed significantly since you last tried it, they don't have any of that web based editor anymore. I think you'll be pleasantly surprised...

I've run on it since they switched to all hosting, and my projects still suffered from the same sorting issue, which was significant since they both placed high value on the position of returned objects. I ended up writing a lot of code for the first one (a forum) that would pull out the first post from a thread and display it separately since it often ended up (especially if it was edited) near the bottom. When a similar issue happened to another, totally unrelated project, but only on Heroku, is when i became suspicious.

I still have my account there but I haven't used it lately.

The web editor was pretty keen for people who were developing on Windows, assuming it didn't crash, which it did on a regular basis. Now that I run off ubuntu that is a non-issue, however it was useful at the time.

BrokenDynasty
Dec 25, 2003

I'm using this in one of my views:

<%= link_to_function(image_tag("expand.png"), visual_effect(:toggle_blind, :registration_box)) %>

The goal is to slide out the contents of a div on click. Is there an easy way to either:

A) Have the image change to collapse.png after being clicked (toggling with the visibility state).

or

B) Have both an expand.png and a collapse.png icon visible and only have each icon work for one functionality. As in the expand icon will expand the div, and on second click won't do anything, and the collapse icon will collapse the div, and on second click won't do anything.

Operation Atlas
Dec 17, 2003

Bliss Can Be Bought

BrokenDynasty posted:

I'm using this in one of my views:

<%= link_to_function(image_tag("expand.png"), visual_effect(:toggle_blind, :registration_box)) %>

The goal is to slide out the contents of a div on click. Is there an easy way to either:

A) Have the image change to collapse.png after being clicked (toggling with the visibility state).

or

B) Have both an expand.png and a collapse.png icon visible and only have each icon work for one functionality. As in the expand icon will expand the div, and on second click won't do anything, and the collapse icon will collapse the div, and on second click won't do anything.

Sorry for the snark, but it's the right answer:

Write javascript.

Adbot
ADBOT LOVES YOU

skidooer
Aug 6, 2001

asveepay posted:

I've run on it since they switched to all hosting, and my projects still suffered from the same sorting issue, which was significant since they both placed high value on the position of returned objects.
Were you actually specifying a sort order, or relying on specific implementation details of an RDBMS to provide a default sorting order? The reason I ask is because Heroku uses Postgresql which can return records in seemingly random order unless you define an ORDER BY clause. Technically you should not rely on any RDBMS to return the records in any meaningful order unless you specify an order, but certain implementations like MySQL are fairly predictable in this regard.

skidooer fucked around with this message at 18:08 on Mar 6, 2010

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