RubyMine : Correcting filetype association

Once I by mistake associated my file called `fresh_desk_sync.rb` to `text` type. Then what happened is my file is no more considered as `ruby` file. No code highlighting and auto suggestions.

I finally figured out how to get rid of this.. Continue reading

Advertisements

Ubuntu 14.04 : Add applications Such as RubyMine, Sublime not being Debian package with .sh file into Launcher

You just need to

1. Create your_app_name.desktop file in /usr/share/applications/ (or /usr/local/share/applications/depending upon your system) if you want the launcher shortcut to be available to all users.

# Goto your system's root
$ cd /usr/share/applications/
# change directory to 
$ cd usr/share/applications/
# create a new file your_app_name.desktop
$ sudo touch your_app_name.desktop
$ gksudo gedit your_app_name.desktop

or

$ sudo gedit your_app_name.desktop

2. Paste below text

[Desktop Entry]
Type=Application
Terminal=true
Name=unmount-mount
Icon=/path/to/icon/icon.svg
Exec=/path/to/file/mount-unmount.sh
# Example

[Desktop Entry]
Type=Application
Terminal=false
Name=Rubymine
Icon=/home/leapfrog/RubyMine-7.0/bin/RMlogo.svg
Exec=/home/leapfrog/RubyMine-7.0/bin/rubymine.sh

3. Save the file

4. Open the /usr/share/applications/ (or /usr/local/share/applications/) location with file browser (Nautilus :: default file manager of ubuntu)

$ nautilus /usr/share/applications/

5. Drag your App icon to the Launcher

Now you can search your app in ‘System Search’

To lock in launcher you need to open the application and right click its icon and click on Lock to Launcher

Note: If icon of the application is not showing properly then try restating the computer.

Ruby on Rails: Pitfall/Disadvantage of RubyMine ::UnKnown issues :: Reasons

One day I encountered an issue as following, however my app was running smoothly a minute ago and I did not make any change whatsoever.

Exiting
/home/leapfrog/.rvm/gems/ruby-2.1.2/gems/actionmailer-4.1.4/lib/action_mailer/base.rb:787:in `smtp_settings=': wrong number of arguments (1 for 0) (ArgumentError)
 from /home/leapfrog/project/bid-quote/config/initializers/setup_mail.rb:3:in `<top (required)>'
 from /home/leapfrog/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load'
 from /home/leapfrog/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `block in load'

I had this code in my /config/initializers/setup_mail.rb

ActionMailer::Base.smtp_settings = {
 :address => "smtp.gmail.com",
 :port => "587",
 :domain => CommonConstants::EMAIL_DOMAIN,
 :user_name => CommonConstants::EMAIL_UNAME,
 :password => "**********",
 :authentication => "plain",
 :enable_starttls_auto => true
}

After doing some research, I figured out the hell happened to my code.

I unknowingly CTRL + CLICKed on smtp_settings of above code. RubyMine’s navigation did its job further and a file from core of Rails got opened and unknowingly I typed ‘=’. I checked the list of files I changed from last commit to GIT in ‘Changes ‘ tab in RubyMine, But no changes were made. This is because the file I unknowingly modified, was not from my app repo.

  # = in next line was added by me unknowingly
  def self.smtp_settings=
   # code here
  end

Note: If you are facing problems that you don’t know where is it coming from in ruby on rails and you use rubyMine as IDE.


Symptoms:

  • Untraceable error 
  • Git says “no changes made to repo”

Cure / Solution:

  • Try to navigate back (Alt + Left key) and undo abnormal coding or just Re-install Rails
  • Take care what you CTRL+CLICK