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

Tuesday, November 24, 2009

git on Windows - files marked as changed because of CLRF? (XP)

Here's something I hope nobody else has to go through: If you're using msysgit to run git on a Windows machine, it defaults to to using CLRF line endings, rather than LF. Left to its own devices, git will "helpfully" convert LFs in files you download to CLRFs. The problem comes when you try to commit back to your *nix repository, and a bunch of files you didn't touch are marked as changed -- or worse, in conflict! Fortunately, there's an easy change. From the msysgit command line, do:

git config --global core.autoclrf false

The discussion I read this from said that's all I'd need to do, but when I did git config --list afterwards to browse my config file, I had two entries for core.autoclrf. One was set to "input" and the other to "false." I went to C:\Program Files\Git\etc, opened gitconfig, and erased the entry set to "input." That fixed it for future cases, but to get rid of all my existing conflicts I had to delete my project and re-clone it.

Start a command-line prompt in a specific directory (XP)

I got tired of doing "cmd, cd" over and over, so I experimented and found a way to open a cmd in a specific directory. Put the following into a batch file:

cd "C:/path/to/dir"
cmd

Throw the batch into C:\WINDOWS\system32 and give it a name. Now you can do Win + R, name, and your cmd will launch, already in the proper directory.