Wednesday, February 24, 2010

select class not applied

<span style="font-size:130%;">Hi, previously my code was like this,

I tried much using, html_options, options, but class is not applied for select.

<%= f.select 'difficulty', options_for_select({ "Easy" => "1", "Medium" => "3", "Hard" => "5"}, get_difficulty(@tour).to_s), :class =>'input_text' %>

& not other way i could find, i did by this way & it works fine now

<%= select :tour, :difficulty, { "Easy" => "1", "Medium" => "3", "Hard" => "5"}, {:selected=>get_difficulty(@tour).to_s}, :class=>"input_text" %>

Now class is applied!!!

Any other better way pls tel me,,.</span>

Tuesday, February 9, 2010

Getting a DB dump in local machine from server

Getting a DB dump in local machine from server..

1. Login into the server - ssh
username@server
2. mysqldump dbname -u dbusername -p > filename.sql
3. Logout of server

set path in local machine: Example - /home/Desktop

4. scp username@server:server_path/filename.sql
dumpfile.sql

Thts it, now db dump is in local machine Desktop

Getting dump to local db,

mysql -u root -p
password: root
mysql> create database dbname
exit
mysql -u user -p dbname <
dumpfile.sql


Monday, February 1, 2010

You’re in the middle of a conflicted merge (git)

Problem
Trying to update (pull) in git causes the error ‘you’re in the middle of a conflicted merge’.

Solution
To be able to get out of this error try the followng:

  1. git reset –hard HEAD
  2. git fetch origin
  3. git reset –hard origin

to reset the state, and then you should be able to use git pull as normal.


This site helped me when i faced this problem - http://www.42.mach7x.com/2009/11/24/youre-in-the-middle-of-a-conflicted-merge-git/