various tech ramblings

Windows 7, Rails 3.2 and Mysql2 0.3.11

Permalink Apr 29, 2012 00:40, by admin, Categories: Programming, Rails

Its a bitch getting Windows, Rails and Mysql2 to play nice. Here are the steps that worked for me.

  1. Download from rubyinstaller, Ruby 1.9.2-p290 and DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe
  2. Install Ruby into C:\Ruby192
  3. Install DevKit into C:\Devkit
  4. Change dir to devkit and run

    Code:

    ruby dk.rb init
    ruby dk.rb install
  5. Install Mysql2 (v.0.3.11) gem:

    Code:

    gem install mysql2 -- '--with-mysql-lib="C:\mysql\mysql-connector-c-noinstall-6.0.2-win32\lib" --with-mysql-include="C:\mysql\mysql-connector-c-noinstall-6.0.2-win32\include"'
  6. Copy libmysql.dll into C:\Ruby192\bin

  7. Test by running

    Code:

    rails new sometest  # cd to sometest
    rails g scaffold Libation name:string weight:integer
    rake db:create
    rake db:migrate
    rails s   # surf to localhost:3000/Libations

Realized that I am running Mysql server 5.5, so if there are mysql problems, I may install the gem again using "lib=C:\mysql\sqlserver55" etc.

YALU - Yet another left update

Permalink Apr 29, 2012 00:02, by admin, Categories: Science, Left

Severely strained my left shoulder playing ultimate. Very sore and cannot use my left arm without pain. So for the past 2 days have shaved and brushed my teeth with the right arm/hand. It feels strange but familiar to use the right arm, actually enjoyed the feeling.
This past month I have been thinking that I am using my left arm/hand for such things automatically. It happens without thought, in fact if either brush or razor end up in the right hand, it feels wrong. It took some time for it to come natural, I don't remember when but its natural to use the left arm/hand. I am thinking its about time to learn to spike a VB and throw a frisbee and toss a ball with the left, but that will wait a few weeks.

Next morning update: woke up with left shoulder in lots of pain, but as the day progressed I noticed it was more mobile. I went for a late day shave and 1/4 way thru I noticed that I was using the left hand to shave without having thought about it! I was using it a wee gingerly, but nevertheless it was completely natural feeling. So cool. Smiled while I finished shaving.

Rails 3.1 Error Messages and Solutions

Permalink Dec 06, 2011 01:30, by admin, Categories: Programming, Rails

Sometimes the errors are obvious but you don't see them right away, so these are here to remind me and see if I get many more. Here goes:

  1. 'merge' error

'merge' error
Was getting this:

ActionView::Template::Error (undefined method `merge' for "Convert Cap":String)

This was in a _form.html.erb view file and I had mistakenly added a label heading to the field tag instead of the label tag. Rails was trying to figure out what I was doing. Me too.

Code:

# Error causing code
<dt><%= f.label :cap %></dt>
<dd><%= f.number_field :cap, "Convert Cap" %></dd>

Code:

# Correct code
<dt><%= f.label :cap, "Convert Cap" %></dt>
<dd><%= f.number_field :cap %></dd>

Git: local, remote, Github, fast-forward, master, origin... oh my!

Permalink Nov 19, 2011 00:14, by admin, Categories: Programming

Git is distributed, so typically you have both a local and remote branch. Here is the terminology:

  • origin - the remote repository (ie like github)
  • local - the repository on your pc
  • master - the branch name on both origin & local
  • origin/master - branch name on local pc pointing to remote (origin) master

The local repository will have many pointers to it. Your local development will have a

  • master pointer to where you are locally
  • origin/master where the origin master points to.
  • heroku/master where heroku is pointing (if you use that)

Again, these all point to the same code base on your local machine. There is the same code base also on Github, because Git is distributed.

When a change is done remotely, you bring that code to your local repository by issuing the command:

Code:

$ git fetch origin


Now on your local machine your master branch still points to the original location (in local repository), but the origin/master branch now points to the updated code (also in your repository). When you issue a "git status" you will see a message like:

Your branch is behind 'origin/master' by 1 commit,
and can be fast-forwarded.

You don't need to commit anything to the repository, but you need to get the local master branch pointing to the updated code that origin/master is pointing to. Do this by:

Code:

$ git merge origin/master


This in essence is doing a "fast-forward".

If you had made changes that were committed but had not pushed to origin and you had grabbed from origin, after the above merge (and resolved conflicts, if any) then you would need to issue:

Code:

$ git push origin


to copy your changes to origin so that all is in sync again.
Tada!

New Rails Installation on Ubuntu and First Project Errors - Errno::EACCES & Rails "help" on "new" command

Permalink Jul 02, 2011 19:25, by admin, Categories: Programming, Rails

Have a new VirtualBox ubuntu image and needed to get RoR up and running. A few problems to overcome, maybe this will help someone. Probably me.

rob:~$ gem install rails
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /home/rob/.gem/specs

rob~$ sudo mkdir ~/.gem/specs
rob~$ gem install rails
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /home/rob/.gem/specs/rubygems.org%80

rob~$ sudo chmod 777 ~/.gem/specs
rob~$ gem install rails
...goodness happens...

Now to create a test application, but the "rails new sometest" command not working I continually get the "--help" displayed. This has bit me a few times earlier, so had to figure this out. I'd recently added and removed a number of gems and simply issuing:

gem cleanup

did the trick. Onward.

:: Next >>

May 2012
Mon Tue Wed Thu Fri Sat Sun
 << <   > >>
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
things that are of a technical nature that i find interesting and find time to write about

Search

Robs Fav Links

Places I like to visit:
powered by b2evolution free blog software