Wednesday, December 10, 2008

Find via Terminal

So you need to find a file quickly on your machine. If you are in the terminal do :
mdfind file_name
It's like using Spotlight but within the terminal. It's really fast and a nice way to find files that you need quickly.

Friday, December 5, 2008

Oh...You're Using RSpec and not TestUnit?!?!

Oh no.....but then when you do
script/generate controller NewController
you generate tests in the test unit folder and not the spec folder and it's a pain in the bottom as doing the generate thing is suppose to save you time and not waste it.

But it's a simple fix and because it's Friday my tip isn't going to be that awesome. But now I remember it and that's all that matters...and thus it is awesome.
script/generate rspec_controller NewController
This will then generate everything correctly for you and your bottom won't be in pain.

Thursday, December 4, 2008

Git Stashes

You know you like your stash, who doesn't? But when you stash, the simple way git stash it gives you these ridiculous titles so if you had more than one when you do git stash list you would see things like:
stash@{0}: WIP on branchname: 9cb5fe9... Merge branch 'branch' of git@github.com.....
What the hell is that? What is on that stash?

If instead you did git stash save "comments describing this stash"

then when you did git stash list you would see
stash@{0}: On branchname: comments describing this stash
To get the stash off, and you do git stash apply, it pulls off those changes but it leaves the stash in place so you would still see it if you did git stash list. To get the stash off AND delete it do git stash pop instead (think of it poping off the list of stashes).

LeahC hasn't had to use mulitple stashes yet....so no word on how to take advantage of that.

Wednesday, December 3, 2008

Importing SQL Databases

I was working on merging in a branch to our master branch and did rake db:migrate like you do when people have added in some migrations. My pair and I realized that the branch was not ready for merging as there were still a lot of failing tests and so decided to leave it to the person working on that branch to fix.

So there's the pre-story. Now my database was all screwed up and so all the tests back in master were failing because things like "user_name" was changed to "user_firstname" and so on. So I did
rake db:migrate:reset
This is a pretty strong reset and deletes everything....so know, "With great power comes great responsibility"

To get my system back on track we did a sql dump of all the data that had been added and to add it back you do the following (one of many ways):
  1. Download the sql dump file
  2. Go to the folder where the file is
  3. Go into mysql
  4. show databases;
  5. use database_name; (where "database_name" is the one you want to repopulate)
  6. source filename.sql; (where "filename.sql" is the sql dump)
That's all there is to it.

Obligatory "Welcome" Post

I am a software apprentice at Obtiva.

I tend to not remember things unless I do them 800 times and thus need to keep going back to the master programmers to ask how to do the little things or spin my wheels for too long to do some little task.

Hence

"Tips From a Software Apprentice"

...more like,

"LeahC's notes to Self"