EntropySink
Technical & Scientific => Programming => Topic started by: Steve on October 22, 2008, 11:09:20 AM
-
anyone use this? I'm creating a website that, wthout too much detail, is mainly one big database with new entries coming and being presented constantly. I know of a website that did something sorta kinda similar on a slightly different and much much smaller scale and they designed it with Ruby on Rails.
I have never used RoR and i dont know much about it. I just know its supposedly easier and makes projects go 10x as fast.
-
I used it briefly, but we use Grails (the Java equivalent) since we're a Java shop. It makes development very quick. The advantage of Rails is that more hosts are starting to support it, so it works well with the LAMP providers.
It's pretty easy to pickup and there's quite a bit of help out there.
-
I'm installing it all to ubuntu now with a guide. I'm going to try and find as much data to compile onto the laptop today, since i wont have net access after tonight but ill need to be working on it.
-
Never used it but I hear fairly good things about it. Since you already know some PHP, it might be more beneficial to learn a PHP framework like Zend that would speed your development time.
-
Never heard of it. Man dont tell me i have been writing all this php from scratch for nothing :rofl2:
I downloaded a shitload of RoR ebooks and even archived a bunch of online walktrhoughs, intros, etc. Trying to whore all the resources i can. The power allowing me to do all this isnt exactly.....well it just not.
-
I'm following along with Agile Web Development with Rails and so far, it has me excited. RoR seems to have alot of potential. Not only will is, im assuming, make this project alot easier and solid, but will save me worlds of time in the future on other projects.
-
Anyone know how to install RadRails on Ubuntu without going through the long drawn out like 80 steps? You need to install studio, then install something else, then install this wtf man.
-
Dunno. I use Python & Django
-
I'm using Cream right now, but after i get done these examples and i start the actual project i would like to use RadRails. I'll just do it the long way, fuck it.
-
Ok first error, and im not sure what the issue seems to be. Heres the error page (running a hello world test via the book im reading):
Mysql::Error in SayController#hello
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
RAILS_ROOT: /home/steve/Desktop/test/demo
Application Trace | Framework Trace | Full Trace
Request
Parameters:
None
Show session dump
---
flash: !map:ActionController::Flash::FlashHash {}
Response
Headers:
{"cookie"=>[],
"Cache-Control"=>"no-cache"}
The mysql server is running, i can see that from both the terminal and from the xampp status page. Also the demo application's database file has been modified to reflect mysql instead of sqllite. Not sure where the issue is...
Server Console (xampp):
steve@CM-Laptop:/$ sudo /opt/lampp/lampp start
[sudo] password for steve:
Starting XAMPP for Linux 1.6.8a...
XAMPP: XAMPP-Apache is already running.
XAMPP: XAMPP-MySQL is already running.
XAMPP: XAMPP-ProFTPD is already running.
XAMPP for Linux started.
steve@CM-Laptop:/$
Ruby Console (for project):
steve@CM-Laptop:~$ cd ~/Desktop/test/demo
steve@CM-Laptop:~/Desktop/test/demo$ ruby script/server
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails 2.1.1 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart).
** Rails signals registered. HUP => reload (without restart). It might not work well.
** Mongrel 1.1.5 available at 0.0.0.0:3000
** Use CTRL-C to stop.
-
what's in database.yml? why xammp? it's extremely easy to setup lamp on ubuntu. the xammp mysql config might be setup in a slightly less "standard" way
-
Isn't there an embedded DB with Rails? Why not use that for your development?
-
RoR uses SQLite out of the box, why install and use that when the project will use MySQL?
And i used Xampp because it was suggested, and it was a painless install with a nice control panel and security script.
database.yml (i have tried all kinds of different settings. User is correct, pw doesnt exist, host is localhost, and dbname, afaik, can be whatever i put there. I dont see anywhere in xampp to make one and it seems RoR creates it on the first launch....
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: mysql
database: demo__development
username: lampp
password:
host: localhost
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql
database: demo__development
username: lampp
password:
host: localhost
timeout: 5000
production:
adapter: mysql
database: demo__development
username: lampp
password:
host: localhost
timeout: 5000
-
RoR uses SQLite out of the box, why install and use that when the project will use MySQL?
if you're using migrations to build you database, which you should be using. Rails is largely database independent.
can you connect to mysql using the command line client? look in you mysql.cnf to determine how xampp has setup mysql for tcp connections...is it bound to an ip...is skip-networking enabled? this file should also tell you the location of the mysql unix socket for non tcp connections. it might be in another location. you can point rails to another socket location using the socket parameter in the yaml file.
development:
adapter: mysql
database: demo_development
username: lampp
password:
socket: /path/to/xampp/socket
what does netstat tell you?
$netstat --tcp --listening
is mysql listed in the output?
-
also...you have to create the database..either through the mysql tools (mysql, mysqladmin) or through a rake task (ruby build tool). The rake task doesn't work if the user rails uses to connect to the database doesn't have a the proper privileges...
mysqladmin -u lampp create demo_development
in the project folder
rake db:create
-
I'll give that a try tomm and let you know, seems like i screwed up lol.
RoR uses SQLite out of the box, why install and use that when the project will use MySQL?
if you're using migrations to build you database, which you should be using. Rails is largely database independent.
What do you mean by migrations? Also Rails may be mostly db independent but the actual site will be extremely db dependent. Infact the DB is really the only reason to be on the site. Am i overthinking it? In other words i havent been looking at Ruby or RoR for even 24 hours. So am i overthinking in the sense that RoR will handle every aspect of the website?
As i view it now, RoR is the site, and the DB is just holding and providing the data. And in that case, SQLite is not fit to handle such a massive amount of data (imo, anyway) whereas MySQL is. If im on the wrong path please slap me off it before i loose myself lol.
Appreciate the help. Been a while since i learned a completely new language.
-
http://www.google.com/search?hl=en&q=rails+migrations&btnG=Google+Search&aq=f&oq=
depends on the requirements of the site. rails wants to abstract the database away...which in a lot of cases is a very good thing...there are also situations where i wouldn't use mysql; it lacks features found in db2, oracle and postgres that are necessary to make certain applications scale properly....proper transaction isolation, locking, etc
-
MySQL is the only DB i know, really. I'll write up a basic idea of what im doing with the db and pm it to you in the morning and see what you think.
Thnx for the link
-
Glancing at one of those search results i think im already doing it. I'm the only developer so i dont have a system in place for preventing me from making changes after others have, but i did install Subversion for tracking the project.
-
There was no hits for mysql.cnf anywhere on the laptop...
netstat:
steve@CM-Laptop:~$ sudo /opt/lampp/lampp start
[sudo] password for steve:
Starting XAMPP for Linux 1.6.8a...
XAMPP: Starting Apache with SSL (and PHP5)...
XAMPP: Starting MySQL...
XAMPP: Starting ProFTPD...
XAMPP for Linux started.
steve@CM-Laptop:~$ netstat --tcp --listening
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:mysql *:* LISTEN
tcp 0 0 *:45771 *:* LISTEN
tcp 0 0 *:netbios-ssn *:* LISTEN
tcp 0 0 *:ftp *:* LISTEN
tcp 0 0 localhost:ipp *:* LISTEN
tcp 0 0 *:microsoft-ds *:* LISTEN
steve@CM-Laptop:~$
mysqladmin:
steve@CM-Laptop:/$ mysqladmin -u lampp create demo_development
The program 'mysqladmin' is currently not installed. You can install it by typing:
sudo apt-get install mysql-client-5.0
bash: mysqladmin: command not found
steve@CM-Laptop:/$
rake db:create (lampp is the root mysql user, no pw):
steve@CM-Laptop:~$ cd ~/Desktop/test/demo
steve@CM-Laptop:~/Desktop/test/demo$ rake db:create
(in /home/steve/Desktop/test/demo)
Couldn't create database for {"username"=>"lampp", "adapter"=>"mysql", "timeout"=>5000, "host"=>"localhost", "password"=>nil, "database"=>"demo__development"}, charset: utf8, collation: utf8_general_ci (if you set the charset manually, make sure you have a matching collation)
steve@CM-Laptop:~/Desktop/test/demo$
-
There was no hits for mysql.cnf anywhere on the laptop...
Sorry, can't help you with xampp...mysql is accepting TCP connections though...change the host directive to an ip address...(e.g. host: 127.0.0.1)
-
you mean instead of localhost in the project db file right? I can try that.
Will my life, iyo, be easier if i scrap xampp completely for something else? Think you said lampp, which seems to be what xampp has built in or something (sudo /opt/xampp/lampp/lampp).
-
127.0.0.1 offered the same result.
-
i don't know if ditching xampp will help you...it will help me help you since i don't use xampp/lampp...whatever it is...
can you connect using mysql?
$mysql -u lampp -D demo_development
-
Xampp stores the mysql config in the mysql/bin folder of the xampp install. It's just called "my" at least on my windows install.
-
It's just called "my" at least on my windows install
that's the name of the file...my.cnf, not mysql.cnf...i was mistaken in my earlier post
-
Nope dont have it. I dont have a xampp folder, either. All i have is /opt/lampp per the install instructions. No my.cnf......
steve@CM-Laptop:~$ cd /opt/lampp
steve@CM-Laptop:/opt/lampp$ ls
backup error icons libexec modules RELEASENOTES tmp
bin etc lampp licenses phpmyadmin sbin var
cgi-bin htdocs lib logs phpsqliteadmin share
steve@CM-Laptop:/opt/lampp$ cd bin
steve@CM-Laptop:/opt/lampp/bin$ ls
a2p ldappasswd ora_explain
ab ldapsearch pack_isam
apachectl ldapwhoami pear
apr-1-config libmcrypt-config peardev
apreq2-config libnetcfg pearize
apu-1-config libpng12-config pecl
apxs libpng-config perl
autopoint listaction perl5.10.0
bdftogd listaction_d perl5.8.7
bsqldb listfdb perlbug
bunzip2 listjpeg perlcc
bzcat listmp3 perldoc
bzdiff listswf perlivp
bzgrep listswf_d perror
bzip2 logresolve php
bzip2recover lwp-download php-4.4.9
bzmore lwp-mirror php-5.2.6
c2ph lwp-request php-config
CA lwp-rget php-config-4.4.9
CA.pl makefdb php-config-5.2.6
captoinfo Makefile.in phpize
CA.sh makeswf phpize-4.4.9
c_hash make_win_binary_distribution phpize-5.2.6
checkgid make_win_src_distribution phptar
c_info ming-config piconv
c_issuer mp2bug pl2pm
clear mp2doc pngtogd
c_name msgattrib pngtogd2
comp_err msgcat pod2html
config_data msgcmp pod2latex
config.m4 msgcomm pod2man
corelist msgconv pod2text
cpan msgen pod2usage
cpan2dist msgexec podchecker
cpanp msgfilter podselect
cpanp-run-perl msgfmt POST
crc32 msggrep prove
c_rehash msginit psed
curl msgmerge pstruct
curl-config msgunfmt ptar
dbilogstrip msguniq ptardiff
dbiprof msql2mysql pwhich
dbiproxy myisamchk raw2adpcm
dbish myisam_ftdump replace
dbl2png myisamlog reset
dbmmanage myisampack resolveip
defncopy my_print_defaults resolve_stack_dump
der_chop mysql rotatelogs
dprofpp mysqlaccess s2p
enc2xs mysqladmin sabcmd
envvars mysqlbinlog sablot-config
envvars-std mysqlbug shasum
find2perl mysqlcheck showtable
freebcp mysql_client_test splain
freetype-config mysql_config sqlite
ftpcount mysql_convert_table_format sqlite3
ftpdctl mysql_create_system_tables suexec
ftptop mysqld_multi swftoperl
ftpwho mysqld_safe swftophp
gd2copypal mysqldump swftopython
gd2topng mysqldumpslow tack
gdparttopng mysql_explain_log tdspool
gdtopng mysql_find_rows tic
GET mysql_fix_extensions toe
gettext mysql_fix_privilege_tables tput
gettextize mysqlhotcopy tset
h2ph mysqlimport tsql
h2xs mysql_install unzzip
HEAD mysql_install_db webalizer
htcacheclean mysql_secure_installation webazolver
htdbm mysql.server webpng
htdigest mysql_setpermission xgettext
htpasswd mysqlshow xml2-config
httpd mysql_tableinfo xmlcatalog
httxt2dbm mysqltest xmllint
infocmp mysqltestmanager xrpcomp
infotocap mysqltestmanagerc xslt-config
innochecksum mysqltestmanager-pwgen xsltproc
instmodsh mysql_tzinfo_to_sql xsubpp
isamchk mysql_upgrade ysh
isamlog mysql_upgrade_shell zzcat
ldapadd mysql_waitpid zzdir
ldapcompare mysql_zap zzxorcat
ldapdelete ngettext zzxorcopy
ldapmodify openssl zzxordir
ldapmodrdn openssl_fips_fingerprint
steve@CM-Laptop:/opt/lampp/bin$
-
the mysql config file is under
lampp/etc/
maybe make sure you don't already have mysql as part of your OS installation, they will compete with each other unless you change the ports in the Xampp/lampp install
-
AHHHH....found it. And no mysql from ubuntu i declined all server apps initially.
.....
........
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /opt/lampp/var/mysql/mysql.sock
skip-locking
...
......
So based on the sock error i was getting i should try specifying the socket for rails in the project db file, right?
-
ok i added the socket line for the project db, and the error changed:
"access denied for user ''@'localhost' to database 'demo__development'"
Betting its because rake still wont work:
steve@CM-Laptop:~/Desktop/test/demo$ rake db:create
(in /home/steve/Desktop/test/demo)
Couldn't create database for {"socket"=>"/opt/lampp/var/mysql/mysql.sock", "username"=>"lampp", "adapter"=>"mysql", "timeout"=>5000, "host"=>"localhost", "password"=>nil, "database"=>"demo__development"}, charset: utf8, collation: utf8_general_ci (if you set the charset manually, make sure you have a matching collation)
steve@CM-Laptop:~/Desktop/test/demo$
-
you need to do a "grant" command in the database for your user (assuming it's not root).
something like
grant all on dbname.* to user@host identified by 'password'
-
im pretty sure the user (lampp) is the full privlage user but ill look into it after lunch. Thnx for all the help guys, configuring the server under linux is a first time for me.
-
next time you're looking for a file try "locate <filename>" (you may have to run "updatedb" as root first, and occasionally there after).
-
yea i have been using the search from the menu but i remember a few really good search commands from my old learn linux 24hr book i had started to read. i should pick that back up for the shell commands.
-
Got it working. I left username blank in the database file. Then it worked. I created the db in phpmyadmin first and that didnt work so im not sure if it was a combo or the username, but im happy.
-
Are you guys creating the templates of the site in html and just incorporating the ruby code? Or is it all donew ith RoR? dammit im going back to the book skipping ahead is f'n me up
-
god dammit my book is outdated. Can anyone help me find a torrent for "Agile Web Development with Rails, Third Edition"? I have 2nd and its using scaffold which is apparently now just a plugin and isnt working right with rails 2. i dont want to downgrade to follow an old material