Tuesday, December 15, 2009

Starting from scratch: Ubuntu

Work in progress.

  • cd ~
  • git init
  • git remote add unfuddle git@guidingcancer.unfuddle.com:guidingcancer/gc.git
  • git config remote.unfuddle.push refs/heads/master:refs/heads/master
  • ssh-keygen -C "dagan@navigatingcancer.com" -t rsa
  • cat .ssh/id_rsa.pub
  • copy the public key into unfuddle profile settings
  • git clone git@guidingcancer.unfuddle.com:guidingcancer/gc.git DO NOT SUDO
  • cd gc
  • install rvm (ruby version manager). follow the instructions about updating .bash_profile with the rvm load script
  • quit the terminal
  • open terminal again and cd into gc. do whatever rvm tells you
  • cd config/
  • cp database.yml.example database.yml
  • open database.yml, change the adapters from mysql to mysql2 for both dev and test
  • cd ~/gc
  • http://cjohansen.no/en/ruby/ruby_version_manager_ubuntu_and_openssl
  • bundle install
  • create the database
    (using SQL Pro's gui for OS X)
  • script/server - everything should work!
  • For fixing sound: sudo apt-get install linux-backports-modules-alsa-[distro]-generic. [distro] was lucid
  • open /etc/modprobe.d/alsa-base.conf, add to the end: options snd-hda-intel model=hp-dv5
  • restart
  • For IDE: Install RubyMine.
  • sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
  • sudo apt-get update
  • sudo apt-get install sun-java6-jdk
  • add 'export JDK_HOME=/usr/lib/jvm/java-6-sun' to the top of RubyMine/bin/rubymine.sh

Create a database from a DB dump

  1. Get into the directory where you want the DB.
  2. mysqladmin -uroot create DB_NAME_HERE
  3. mysql -uroot DB_NAME_HERE < DUMP_NAME_HERE.yml
  4. If you get "No such file" referring to database.yml, copy database.example.yml and rename the copy database.yml
  5. rake db:migrate

Monday, December 7, 2009

Setting up MySQL on Windows 7 for temporary use

  1. Download MySQL. You want the MSI Installer for the current version.
  2. Run the installer. Stick to all of the defaults. Let it figure out what to install, where to install it, let it set up the installation for you, etc. The one thing you want to edit (towards the end) is...
  3. Don't let it install mysqld as a service. We can start and stop it manually. Leave the PATH stuff unchecked, it won't work on Windows 7 anyways.
  4. Write a batch file to start the MySQL server. The exe we'll be using is mysqld. --console gives us echoes of what's going on in mysqld. By default it runs silently. This is my batch file:
    cd C:/Program Files/MySQL/MySQL Server 5.1/bin/
    mysqld --console
  5. Start the server.
  6. Start the MySQL Command Line Client from the Start Menu. This is some kind of magical shortcut that doesn't actually point to an exe. Weird...
  7. Leave the server's cmd window open while you're working. When you're ready to close it, focus the window and press Ctrl + C.

Execute a command from cmd in a batch file

cmd /C

Including the /C switch on the cmd invocation feeds the rest of the batch file as commands to be executed in the new prompt.

New project with Unfuddle: Setting up SSH on Windows

From msyswin:

ssh-keygen -C "username@email.com" -t rsa

The -C adds our e-mail as a comment to the key. The -t sets the key type to rsa. The key itself will be stored at $HOME/.ssh/id_rsa.pub. Copy and paste the contents of that file into your Unfuddle public key.

Source