Sublime Text Keyboard Shortcut for easy use


Use these rapid keyboard shortcuts to control Linux, Mac OSX, and Windows versions of Sublime Text for all.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ↓ : Down arrow key
  • ⌥ : Option or Alt key
  • ↩ : Return or Enter key
  • ⇧ : Shift key
  • ↑ : Up arrow key

: indicates that the step after the arrow should take place after the step before the arrow

General

Command Mac OSX Windows Linux
Open Cmd Prompt ⌘ + ⇧ + P Ctrl + ⇧ + P Ctrl + ⇧ + P
Toggle Side Bar ⌘ + K, ⌘ + B Ctrl + KB Ctrl + KB
Show Scope (Status Bar) ⌃ + ⇧ + P Ctrl + ⇧ + Alt + P Ctrl + ⇧ + Alt + P

Language

Command Mac OSX Windows Linux
Select File Language ⌘ + ⇧ + P [language] Ctrl + ⇧ + P [language] Ctrl + ⇧ + P [language]

Use the “Set Syntax: [language]” selection that is automatically populated in the command menu when you type the programming language.

Editing

Command Mac OSX Windows Linux
Delete Line ⌘ + X Ctrl + X Ctrl + X
Insert Line After ⌘ + ↩ Ctrl + ↩ Ctrl + ↩
Insert Line Before ⌘ + ⇧ + ↩ Ctrl + ⇧ + ↩ Ctrl + ⇧ + ↩
Move Line Up ⌘ + ⌃ + ↑ Ctrl + ⇧ + ↑ Ctrl + ⇧ + ↑
Move Line Down ⌘ + ⌃ + ↓ Ctrl + ⇧ + ↓ Ctrl + ⇧ + ↓
Select Line ⌘ + L Ctrl + L Ctrl + L
Select Word ⌘ + D Ctrl + D Ctrl + D
Multi-Select Editing ⌃ + ⌘ + G Alt + F3 Alt + F3
Jump to Closing Parenthesis ⌃ + M Ctrl + M Ctrl + M
Select Contents of Current Parentheses ⌃ + ⇧ + M Ctrl + ⇧ + M Ctrl + ⇧ + M
Delete from Cursor to End of Line ⌘ + K,⌘ + K Ctrl + KK Ctrl + KK
Delete from Cursor to Start of Line ⌘ + K + ⌫ Ctrl + K + ⌫ Ctrl + K + ⌫
Indent Current Line(s) ⌘ + ] Ctrl + ] Ctrl + ]
Unindent Current Line(s) ⌘ + [ Ctrl + [ Ctrl + [
Duplicate Line(s) ⌘ + ⇧ + D Ctrl + ⇧ + D Ctrl + ⇧ + D
Join Line Below Current Line ⌘ + J Ctrl + J Ctrl + J
Comment/Uncomment Current Line ⌘ + / Ctrl + / Ctrl + /
Block Comment Current Selection ⌘ + ⌥ + / Ctrl + ⇧ + / Ctrl + ⇧ + /
Redo/Repeat Last Keyboard Shortcut ⌘ + Y Ctrl + Y Ctrl + Y
Paste with Proper Indenting ⌘ + ⇧ + V Ctrl + ⇧ + V Ctrl + ⇧ + V
Select Next Autocomplete Suggestion ⌃ + Space Ctrl + Space Ctrl + Space
Soft Undo ⌃ + U Ctrl + U Ctrl + U
Column Selection Up ⌃ + ⇧ + Up Ctrl + Alt + Up Alt + ⇧ + Up
Column Selection Down ⌃ + ⇧ + Down Ctrl + Alt + Down Alt + ⇧ + Down

Transform

Command Mac OSX Windows Linux
To Uppercase ⌘ + K, ⌘ + U Ctrl + KU Ctrl + KU
To Lowercase ⌘ + K, ⌘ + L Ctrl + KL Ctrl + KL
Increase Font Size ⌘ + Ctrl + Ctrl +
Decrease Font Size ⌘ – Ctrl – Ctrl –

Find & Replace

Command Mac OSX Windows Linux
Find ⌘ + F Ctrl + F Ctrl + F
Replace ⌘ + ⌥ + F Ctrl + H Ctrl + H
Find in Files ⌘ + ⇧ + F Ctrl + ⇧ + F Ctrl + ⇧ + F
Use Selection for Find ⌘ + E Ctrl + E Ctrl + E
Use Selection for Replace ⇧ + ⌘ + E ⇧ + Ctrl + E ⇧ + Ctrl + E

Navigation

Command Mac OSX Windows Linux
Quick Open File (by Name) ⌘ + P Ctrl + P Ctrl + P
Go To Symbol ⌘ + R Ctrl + R Ctrl + R
Go To Line ⌃ + G Ctrl + G Ctrl + G

Code Folding

Command Mac OSX Windows Linux
Fold Selection ⌥ + ⌘ + [ ⇧ + Ctrl + [ ⇧ + Ctrl + [
Unfold Selection ⌥ + ⌘ + ] ⇧ + Ctrl + ] ⇧ + Ctrl + ]
Unfold All ⌘ + K, ⌘ + J Ctrl +KJ Ctrl + KJ

Bookmarks

Command Mac OSX Windows Linux
Toggle Bookmark ⌘ + F2 Ctrl + F2 Ctrl + F2
Next Bookmark F2 F2 F2
Previous Bookmark ⇧ + F2 ⇧ + F2 ⇧ + F2
Clear Bookmarks ⇧ + ⌘ + F2 ⇧ + Ctrl + F2 ⇧ + Ctrl + F2

It will help you to make task easy and faster if you use shortcut.

We can see more here as a source.

 

Thanks for reading,

HAve a nice Day !!!.

Advertisements

How to resolve Rails issue- An error occurred while installing mysql2 (0.4.4), and Bundler cannot continue. Make sure that `gem install mysql2 -v ‘0.4.4’` succeeds before bundling.


Hi all,

you may get this issue while working on Rails 4.0 and above version along with Ruby 2.0 and above.

this is very common issue if you are going ahead with up gradation of Rails environment.

Steps to be follow-

For Windows System-

  1. Download the the newest mysql-connector to c:\mysql-connector folder
  2. gem install mysql2 — ‘–with-mysql-include=”C:\mysql-connector\include” –with-mysql-lib=”C:\mysql-connector\lib”
  3.  

    Hopefully it will work for you.

For Ubuntu System-

  1. open terminal (Ctrl+alt+T)
  2. $ sudo apt-get install libmysqld-dev
  3. Run bundle from your project directory $ bundle

This will resolve the issue.

Have a nice Day !!!

How To install laravel installer windows xampp or wamp


Install laravel on windows xampp or wamp

Laravel 5.1 is very easy to be install on windows. In this tutorial  we suppose that you have already installed PhP on your machine.

Basic Requirement for Laravel:-

  1. Must have install PhP with a version of 5.5.9 or above like 6.1.3 etc
  2. Windows environment or 64 or 32 bit.
  3. xampp or wamp on machine.

This is the new version and you are getting a new installation feature so guess how fast work is going on updation.

Install laravel on windows xampp/wamp steps :-

1. It’s requires Composer to manage its dependencies. so first need to downloadcomposer

1.1). just follow the process,

1.2). At some point It will ask you to choose the Php.exe file and press next.

1.3). let it be download composer and related setup.
2. Now install composer on your machine.
3. Run below command to check composer has installed successfully

# check composer working
:/> composer

Install laravel via laravel installer windows

4. Now installed successfully we need to install laravel installer via composer so open windows command prompt and run below command to install.

# installing installer
composer global require "laravel/installer=~1.1"

laravel_win4

5. Set PATH environment variable for setup PATH run below command

# setting up env path
set PATH=%PATH%;%USERPROFILE%\AppData\Roaming\Composer\vendor\bin

PATH :- path is a location where composer installed ” ~/.composer/vendor/bin” on Windows path should be used:
“C:\Users\\AppData\Roaming\Composer\vendor\bin” so in above command added “%USERPROFILE%” so this will auto get your computer name

laravel_win5

For test run command laravel to check you have path setuped correctly

# testing command 
laravel -v

Laravel command not found windows :-

This is an optional part if your above testing command not running correct. sometimes if you not setup the PATH correctly you will get Laravel command not found error on windows. for resolve laravel command not found error you need to setup your path environment variable correctly. many times we stuck this error so i am adding this part also. if you have setuped path variable right run command and you will get output success then keep continue with next step to successful installation.

6. Now We need to change directory where we want to install laravel so first change and go to your preferred location to install then run below command to install.

# installing 
laravel new laranew

Now you have done with Install laravel via laravel installer windows(xampp/wamp). and open url on http://localhost/laranew and bam.

laravel_win2

Now Enjoy coding with laravel.

Have a nice day!

Ruby on Rails full setup on windows-7


here is the steps involve in the rails installation.

1). Download rails installer form here.

2). Install the setup in c drive.

For more detail you can see a video here.

and follow the steps.

3). Choose or create a new directory to keep rails app.

4). Run command  rails new MyApp

To create new app.

5). You may get error like

F:\Rails_Projects\myapp>bundle install

DL is deprecated, please use Fiddle

Fetching gem metadata from https://rubygems.org/…………

Fetching additional metadata from https://rubygems.org/..

Resolving dependencies…

Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read

server certificate B: certificate verify failed (https://rubygems.org/gems/rake-

10.4.2.gem)

An error occurred while installing rake (10.4.2), and Bundler cannot continue.

Make sure that `gem install rake -v ‘10.4.2’` succeeds before bundling.

6). No need to worry about,

Open ProjectFile/AppDirectory/Gemfile

And change https to http like this-

source ‘https://rubygems.org’

to

source ‘http://rubygems.org’

 

7). now run bundle, hope it will work fine.

8). Run rails server to start rails server.

9). You can view the app by hitting

http://localhost:3000/

 

How To Build Forms With Laravel 5.1


Before creating form fields, We need to create two routes. One for our form view and another for form submittion and validation.

Route::get('form', function(){
 //render app/views/form.blade.php
 return View::make('form');
});
Route::post('form-submit', array('before'=>'csrf',function(){
 //form validation come here
}));

Then let’s create our form, Just create new file app/views/form.blade.phpand write the following.

<!--app/views/form.blade.php-->
<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <title>
   Laravel
  </title>
 </head>
 <body>
  {{ Form::open(array('url'=>'form-submit')) }}
  
  {{ Form::close() }}
 </body>
</html>

Well. Let’s explore resulting source file.

<!--app/views/form.blade.php-->
<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <title>
   Laravel
  </title>
 </head>
 <body>
  <form method="POST" action="http://localhost/<laravel dir>/public/form-submit" accept-charset="UTF-8">
   <input name="_token" type="hidden" value="h7xNdTaJXwLz5v0lkBolVPelpxldoiDR5gcKWkku">  
  </form>
 </body>
</html>

Perhaps you don’t like laravel defaults so let’s provide our options.

{{ Form::open(array(
         'url'=>'form-submit',
          <!--POST or GET or DELETE-->
          'method'=>'POST',
          'accept-charset'=>'UTF-8',
          <!--IF form contain file upload input-->
          'files'=>true
            )) }}

Now we are ready to submit fields to our form.

Text Inputs

Text inputs used to collect string data, Here’s how to create text inputs.

{{ Form::open(array('url'=>'form-submit')) }}

<!-- text input field -->
{{ Form::label('username','Username',array('id'=>'','class'=>'')) }}
{{ Form::text('username','clivern',array('id'=>'','class'=>'')) }}
  
{{ Form::close() }}

Textarea Inputs

Similar to text inputs except that we will use textarea() method. Here’s an example.

{{ Form::open(array('url'=>'form-submit')) }}
  
<!-- textarea field -->
{{ Form::label('biog','Biog.',array('id'=>'','class'=>'')) }}
{{ Form::textarea('biog','biog here',array('id'=>'','class'=>'')) }}
  
{{ Form::close() }}

Password Inputs

You know, Password inputs used to hide data and here’s how to create them.

{{ Form::open(array('url'=>'form-submit')) }}

<!-- password inputs -->
{{ Form::label('password','Password',array('id'=>'','class'=>'')) }}
{{ Form::password('password','',array('id'=>'','class'=>'')) }}
  
{{ Form::close() }}

Well. I summarized all inputs that we created through article in the following snippet and then source file result.

<!--app/views/form.blade.php-->
<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <title>
   Laravel
  </title>
 </head>
 <body>
  {{ Form::open(array('url'=>'form-submit')) }}
  
  <!-- text input field -->
  {{ Form::label('username','Username',array('id'=>'','class'=>'')) }}
  {{ Form::text('username','clivern',array('id'=>'','class'=>'')) }}
  
  <!-- textarea field -->
  {{ Form::label('biog','Biog.',array('id'=>'','class'=>'')) }}
  {{ Form::textarea('biog','biog here',array('id'=>'','class'=>'')) }}
  
  <!-- password inputs -->
  {{ Form::label('password','Password',array('id'=>'','class'=>'')) }}
  {{ Form::password('password','',array('id'=>'','class'=>'')) }}
  
  <!-- email input -->
  {{ Form::label('email','Email',array('id'=>'','class'=>'')) }}
  {{ Form::email('email','hello@clivern.com',array('id'=>'','class'=>'')) }}
  
  <!-- select box -->
  {{ Form::label('status','Status',array('id'=>'','class'=>'')) }}
  {{ Form::select('status',array('enabled'=>'Enabled','disabled'=>'Disabled'),'enabled') }}
  
  <!-- radio buttons -->
  {{ Form::label('status','Status',array('id'=>'','class'=>'')) }}
  {{ Form::radio('status','enabled',true) }} Enabled
  {{ Form::radio('status','disabled') }} Disabled
  
  <!-- checkbox -->
  {{ Form::label('status','Status',array('id'=>'','class'=>'')) }}
  {{ Form::checkbox('status','1',true) }} Enabled

  <!-- hidden field -->
  {{ Form::hidden('record_to_update','1') }}
  
  <!-- submit buttons -->
  {{ Form::submit('Save') }}
  
  <!-- reset buttons -->
  {{ Form::reset('Reset') }}
  
  <!-- normal buttons -->
  {{ Form::button('Normal') }}
  
  {{ Form::close() }}
 </body>
</html>
 

Creating Static Pages (one or more) in Laravel


Today we will learn to create static pages using Laravel in this Creating Static Pages in Laravel tutorial.

    • If we see the architecture of laravel, it follows the Model-View-Controller(MVC) architecture similar to CodeIgniter. So the work is fully organized separating the database and user interface and controlling them with the controller.
    • When we install the Laravel, we get a set of folder packages inside its folder.
    • Main among these folders are /app/, /public/ and /vendor/.
    • The app folder contains the controllers, models, views and assets for our application. This is where the majority of the code of our application will reside.
    • The public folder is visible to public. It contains the index.php page that is visible to public. You can even store the CSS files, images and other files which will be required to display on the webpage.
    • The vendor folder is where all the third party code resides. In a typical laravel application this consists of Laravel source code and its dependencies, and plugins containing additional prepackaged functionality.
    • The components of laravel with their working are displayed in the figure below:
laravel-mvc-components

fig 1

  • Here when the browser sends a request, it is received by a web server and passed on to the laravel routing engine.
  • Now the routing engine receives the request and redirects it to the appropriate controller class according to the routing URL pattern.
  • Now the controller will interact with the model for retrieving database information and invoke results in view file, or else directly send the view file in HTML format if no database data is required.
  • This view file is then sent to the browser requesting for it.
    • Creating Static pages:
      • Let us create static pages in Laravel step by step.
      • STEP 1: Open your app/views folder and create static pages in it.
        • Open the views folder which is placed in app folder in your laravel folder which is inturn inside your xampp servers htdocs folder (it can be any server).
        • We will create one static page:
        • Open a new notepad++ document and save it as home.php inside the app/views folder.
        • Write the following code inside it:
        • Now we have our static page of home ready in our app/views folder.
      • STEP 2:Create a new controller file inside the app/controllers folder.
        • To create a controller file open a new notepad++ file and save it as firstcontroller.php in the app/controllers folder.
        • Now write the following code inside the firstcontroller.php file:
        • This will call the static page home.php which is inside the app/views folder.
      • STEP 3: Route the static page by opening the file routes.php which is inside the app folder.
        • Open the routes.php file from the app folder with notepad++.
        • We will route our static home.php page. The code is shown below:
        • Closure is used to route the page.
        • This thing can also be written as shown below:
        • Or it can also be written as shown below:
        • This third type of routing is known as named routing. Named routing is very useful in case when location of the route is changed, the link will still work as long as the name remains the same.
      • STEP 4: Displaying the page in browser.
        • Now after routing, it’s time to run the static page or show it in browser.
        • To do this open your browser and write the following address shown below in the browsers address bar:
        • http://localhost/laravel-4.2.11/public/home
        • The output is shown below:
output