Saturday, 13 December 2014

Setting Up Path Variable windows


Setting Up Path Variables For Ruby 

Setting Up Path Variables For Python

Path variables are must need to setup whenever you are installing some developement platforms like android , java , Python , Ruby .

Today i have some task related to installation of Ruby and using the jekyll for some configuration a website so I decided to taste the task

Here is the Installation procedure for installing Python , Installing Ruby and setting up jekyll

Setting Up Jekyll , Python , Ruby

To set up your path variables you follow these steps


  1. Right on mycomputer 
  2. click on properties 
  3. click on Advanced settings
  4. Click on Environment Variables
  5. Now Search for Path System variable
  6. and hit enter on it
  7. Now in value field fill values for python and ruby installation at end of values already filled

C:\ruby\bin;C:\Python27;C:\Python27\Scripts;


These values will be filled according to where you have installed Ruby and python

Installing Python and Easy_install


Today i am going to touch the Python . I am having some task regarding configuration of a website so for that i have to use Python . I have never used it . But as a Programmer Saying - 

The More Time We have Spent on First programming language More Fastly we can do other 

Today i am going to test this saying

So Lets get started with the work --

Install Python

  • First of all Go to http://www.python.org/download/
  • Download appropriate version of Python windows installer, e.g. Python 2.7.6 Windows Installer.I prefer to install python 2 as currently python 3 is creating some problem .

Install

  • For Python Installation Set the installation directory (e.g. C:\Python27) to PATH. (How to? See Troubleshooting #1)
  • Verify Python installation

python --version


Example output:

  • If your installation is done properly then it will show message as below .

Python 2.7.6


Install ‘Easy Install’


python “C:\ez_setup.py”


  • Add ‘Python Scripts’ directory (e.g. C:\Python27\Scripts) to PATH.

Install Pygments


  • Verify easy_install is installed properly

easy_install --version

  • Example output:

setuptools 3.1


Install Pygments using “easy_install”


easy_install Pygments

Installing jekyll on windows

Install Ruby

while installation of ruby you may suffer from some errors like

bundle-command-not-found-windows-x64

Following the steps below carefully will be answer to these errors

  • Go to http://rubyinstaller.org/downloads/
  • In RubyInstallers section, click a version to download.
  • For example, Ruby 2.0.0-p451 (x64) is the Windows installer for Ruby 2.0.0 x64 on 64-bit machines. These are installers that i am going to use.
  • Complete the installtion by going through installer that you have downloaded
  • At time of installing Keep the default directory  to C:\Ruby200-x64 if possible, please note installer advises that 'Please avoid any folder name that contains spaces (e.g. My Ruby).'
  • Markt he checkbox saying "Add Ruby executables to your PATH" , so PATH will be updated automatically to avoid headaches.
  • Open up a command prompt window by pressing ctrl + r from your keyword and type in cmd and hit enter this will open command prompt and type in the following command, to see if Ruby has been install correctly or not.

Ruby installtion Setting Up jekyll
Ruby Installation - Installing jekyll
                              

ruby -v                                                                              



Example output:
If ruby is installed correctly it will give you output as -

ruby 2.0.0p451 (2014-02-24) [x64-mingw32]


Install DevKit



  • The DevKit is a toolkit that makes it easy to build and use native C/C++ extensions for Ruby on Windows. 
  • Now first Go to http://rubyinstaller.org/downloads/ again.
  • Download “DEVELOPMENT KIT” installer that matches the Windows architecture and the Ruby version just installed. For instance, DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe is for 64-bit Windows with Ruby 2.0.0 x64. These are versions that i am using

  • Here is a list about how to choose the correct DevKit version:
  1. Ruby 1.8.6 to 1.9.3: DevKit tdm-32-4.5.2
  2. Ruby 2.0.0: DevKit mingw64-32-4.7.2
  3. Ruby 2.0.0 x64: DevKit mingw64-64-4.7.2
  • Run the installer and extract it to a folder, e.g. C:\DevKit.
  • Initialize and create config.yml file. Type in the following commands in command Prompt window:


cd “C:\DevKit”
ruby dk.rb init
notepad config.yml



  • In opened notepad window, add a new line - C:\Ruby200-x64 at the end, SAVEand close.



  • Back to the Command Prompt, review (optional) and install.


ruby dk.rb review

ruby dk.rb install


Install Jekyll



  • Verify that gem has been installed properly


gem -v


Example output:

2.0.14
Install Jekyll gem
gem install jekyll


Install Python

Here is link on my blog about its installation or you can follow steps below
Installing Python and Easy_install
  • First of all Go to http://www.python.org/download/
  • Download appropriate version of Python windows installer, e.g. Python 2.7.6 Windows Installer.I prefer to install python 2 as currently python 3 is creating some problem .


Install

  • For Python Installation Set the installation directory (e.g. C:\Python27) to PATH. (How to? See Troubleshooting #1)
  • verify Python installation

python --version


Example output:

  • If your installation is done properly then it will show message as below .

Python 2.7.6


Install ‘Easy Install’

  • Visit https://pypi.python.org/pypi/setuptools#installation-instructions for detailed installation instructions.
  • For Windows 7 machines, download ez_setup.py and SAVE it, for example, to C:\. Then run it using Python in a command prompt window:

python “C:\ez_setup.py”


  • Add ‘Python Scripts’ directory (e.g. C:\Python27\Scripts) to PATH.

Install Pygments

  • Verify easy_install is installed properly

easy_install --version

  • Example output:

Install Pygments using “easy_install”


easy_install Pygments


Start Jekyll



  • Following the commands on official Jekyll Quick-start guide, a new Jekyll blog should be created and can be browsed at localhost:4000.

jekyll new myblog
cd myblog
jekyll serve


  • Now Everything is done Everytime you want to Start you already built website or new website with jekyll you just start your command prompt navigate to your website's root directory like

cd mywebsite



  • Then type in :-  'jekyll serve' and that's it yout server will be started in few seconds and after that you can navigate to your browser with url as -

http://localhost:4000/

Setting Up Path Variables For Python and Ruby




Saturday, 6 December 2014

Mind Blowing Interesting facts about Google


Google Timer

You can set a timer on Google (and get an alarm to sound when time is up) by Googling any amount of time followed by "timer."

 

 Google Sky

Google sky lets you explore the far reaches of the universe using images from NASA satellite, the Sloan Digital Sky Survey, and the Hubble Telescope.


  • Google Grams


    Google nGrams is a fun tool that lets you search for words in 5.2 million books published between 1500 and 2008 so you can see how much it's been used over time.

    Spell Huge Numbers

    Intimidated by huge numbers? Google will help you figure out how to pronounce that 12-string number if you type "=english" after it.
     
    Add +anything To email
     You can add "+anything" when typing your email address and it will still work. This can be good for filtering emails (for example, you could set up a folder for all emails sent to "youremail+datingsite@gmail.com").


    • Google SmartyPins
      Google recently released a fun new Maps game called SmartyPins that gives you geographic trivia.



      Google Getting Married

      Getting married? Google will help you plan your wedding, announce the news, locate a venue, fill in the plans, make a website, and more.


      Google Translate

      There's a "Manual" feature in Google Translate that lets you draw characters or symbols.

      Google Fonts
      Find a gorgeous font that you can use for free (Google Fonts).

      Google Art ProjectGet your culture on by using Google Art Project to check out super high-res photos of artwork from the world's greatest museums.


      Google Reverse ( ulta-pulta google )



      • Google when spelled backwards becomes 'elgooG', But the interesting fact is we can also use http://www.elgoog.im for our searches.
      • 'elgooG' is the mirror image of Google search engine; not only is all of its content a reversal of Google, the search terms must also be written in reverse order to yield the desired results.
      • Though created for fun purpose, it found practical use in the People's Republic of China after the domestic banning of Google, as it circumvented the government firewalls.


      Google Currency Converter

      Google currency converter is very smart:

  • Tuesday, 11 November 2014

    Benefits of Html Helpers in Asp.Net MVC

    So today i am going to give an overview on Html helpers in Asp.Net MVC . So first questions that stuck our mind are -

     What are Html helpers ?
     Why to use them instead of using simple Html coded controls
     What are their benefits in Asp.Net MVC

    Html helpers are very much similar to Asp.Net web controls . But Html helpers are much more lightweight as compared to Asp.net Web forms Server controls . The similarity between server controls in Asp.net webforms and Html helpers in Asp.Net MVC are Viewstate . Means they both contain the ability to hold or update the data on postbacks using ViewStates for each controls .

    Main  Benefits Of using Html Helpers in Asp.net MVC

    • MVC Html Helpers contains Overloaded Methods like IPostBackDataHandler that Pre-populate the values of html helpers means it works similar to as viewstates
    • Html Helpers is also having one more advantage It provide inbuilt Validation for html helpers textboxes 
    Available HTML Helpers 

    There following HTML helpers can be used to render (modify and output) HTML form elements:

    1. BeginForm()
    2. EndForm()
    3. TextArea()
    4. TextBox()
    5. CheckBox()
    6. RadioButton()
    7. ListBox()
    8. DropDownList()
    9. Hidden()
    10. Password()

    Sample Code To Demonstrate Use of Html Helpers


    ASPX CODE

    <%= Html.ValidationSummary("Create was unsuccessful. Please correct the errors and try again.") %>
    <% using (Html.BeginForm()){%>
    <p>
    <label for="FullName">FullName</label>
    <%= Html.TextBox("FullName") %>
    <%= Html.ValidationMessage("FullName", "*") %>
    </p>
    <p>
    <label for="Username">Username</label>
    <%= Html.TextBox("Username") %>
    <%= Html.ValidationMessage("Username", "*") %>
    </p>
    <p>
    <label for="Password">Password:</label>
    <%= Html.Password("Password") %>
    <%= Html.ValidationMessage("Password", "*") %>
    </p>
    <p>
    <label for="Password">Confirm Password:</label>
    <%= Html.Password("ConfirmPassword") %>
    <%= Html.ValidationMessage("ConfirmPassword", "*") %>
    </p>
    <p>
    <%= Html.CheckBox("ReceiveNewsletter") %>
    <label for="ReceiveNewsletter" style="display:inline">Receive Newsletter?</label>
    </p>
    <p>
    <input type="submit" value="Register" />
    </p>
    <%}%>

    RAZOR CODE

    @Html.ValidationSummary("Create was unsuccessful. Please correct the errors and try again.")
    @using (Html.BeginForm()){ 
    <p>
    <label for="FullName">FullName</label>
    @Html.TextBox("FullName")  
    @Html.ValidationMessage("FullName", "*")  
    </p>
    <p>
    <label for="Username">Username</label>
    @Html.TextBox("Username")  
    @Html.ValidationMessage("Username", "*")  
    </p>
    <p>
    <label for="Password">Password:</label>
    @Html.Password("Password")  
    @Html.ValidationMessage("Password", "*")  
    </p>
    <p>
    <label for="Password">Confirm Password:</label>
    @Html.Password("ConfirmPassword")  
    @Html.ValidationMessage("ConfirmPassword", "*")  
    </p>
    <p>
    @Html.CheckBox("ReceiveNewsletter")  
    <label for="ReceiveNewsletter" style="display:inline">Receive Newsletter?</label>
    </p>
    <p>
    <input type="submit" value="Register" />
    </p>