Wednesday, August 26, 2015

Python Fundamentals | Importing Python Library

Introduction

        In previous post we have made our first step into the world of python.In this short post we will see how to import external libraries into python file.
The Keyword "Import"

        if you want to import external libraries into your python code is simply use "import" keyword. like in Java.

Here's a simple example of import keyword that shows how to import library call "Math" in Python code.
  • import math
 Lets just flashback to our previous post. We didn't need a semicolon or any other delimiter to end the statement. That's the one of feature of python language that distinguish python from other languages like C# or c or c++ etc.

You can also import single component from library. Following statement show how you can import single component from python library.
  • from math import sqrt
the "sqrt()" method become available to your python source file. you can also give an alias name to imported component.
  •  from math import sqrt as st
 you can then call sqrt() method as "st(args)".
 In the next post we will look at role of white space in python.

Sunday, June 7, 2015

Python Fundamentals | Introduction

Welcome All!! In this post i will talk about python language. So lets begin.
     Python is very huge language and not possible to cover all thing within single article. In this post i have cover high level overview of python language What it is and what so great about it. Also gives you the birds eye view during this post so you get an idea whats to come.

       First few question that come in every developer's mind that " what so great about python? " or " Why one should learn python? " and there are lots of good answers to those question, one is python is powerful language. It is expressive and productive and also comes with great standard libraries and allow to use third party libraries. Using python you can built anything from simple scripts to complex applications. you can do it quickly, you can do it safely and you can do with fewer lines of code you might possible. But that's just only part upon python is great. Another wonderful thing about python is its open. Its open source so you can get to know every aspect of python language when you want to know. Another benefit is that python is widely popular and has great community to support you when you ran into problem. this combination of openness and large user base means almost anyone from casual programmer to professional developer can engage with python at the level what they need.

     Another benefit is the large use base is that python is showing up in more and more places. you may be wanting to learn python because its some technology or some language that you want use scientific packages in world written in python But for many people these reasons take back sits something more important. python is fun. python's expressive  readable style quick editing and run development cycle and better is include philosophy. Mean it you can sit down and enjoy writing code rather then fighting with compiler and bad syntax. And python will grow with you as your experience become prototype and prototype become product.Python makes you experience in writing software not just easier but truly enjoyable.

History

     Python is develop by the Guido van Rossum  in the late of 1980's. He is best known as the author of the python language. In the python community, Van Rossum is known as a " Benevolet Dictator For Life (BDFL)", meaning is that he continues to oversee the python development process and improvement of language, making decisions where necessary.

      Python is develop as open-source project as free to download and use it as you wish. the non profit python software foundation manages pythons as property and introduce strong rules to promote the language.

   On Technical level python is strongly type language in the sense every object in the language has definite type. at the same time python us dynamic language means no type checking of code while running it. This is in contrast statically defined language which is like c++ and JAVA where compiler does lots of type checking for you rejecting programs which misuse the object. Ultimately the best description of python type system is that uses duck type system for object suitability for context that only determinated at run time.

    Python is general programming language it is not intended to use any particular domain or environment but instead it is fruitfully used in the wide variety of tasks for example an extremely time sensitive and memory constraint environments. In the most part python us  flexible and adaptable language as other modern programming languages.  Python is an interpreted language which is big mistake technically because python is normally compiled in byte code before the execution. however this accomplish the experience of using python is one of the immediate executing code , this lake between editing and running is great joy while working with python.

    Lets talk about the syntax of python is designed to be clear, readable and expressive.Unlike many popular  language python uses white space to delimit code blocks and the process does a way the rings of unnecessary parenthesis forces universal layout this means all python looks like an important ways and you can read and learn very quickly. At the same time python has expressive syntax means the single line of code can contains lot of meaning, this expressive and highly readable code means python made  it easy.

   Python has many implementation. The original and still by far most common implementation is written in c.this version commonly refer as c python. other implementations are as follows,

  • Jython - it is written to target the Java Virtual Machine.
  • IronPython - it is written to target .NET run time.
  • Pypy - it is written for specialized subset of python called Rpython.
These implementations generally trails behind the cpython which is consider to be the standard for the language.


There are two important version of python "Python2" and "Python3". These two versions represents changes in the key element in the python language. For these reason the code written in "Python2" will not generally work in "Python3" unless you take precautions. But python2 is more older and well established then the python3. python3 advance to the known short coming the older version. it is the definite the future of python and you should use it at all possible.

 Lets configure the development environment.
To install python on windows system you need to visit the https://www.python.org/downloads/windows/  from this page choose the msi installer for your windows environment like 32bit or 64bit platform then download and run the installer and follow the steps. once python is installed on your system you need to configure the environment path for the python. mine is "c:\python33 and c:\python33\scripts" you can change it at your own comfort. now open the command prompt to check whether python is installer or not run the command python.

if python is not installed property then command will give you as not recognized command.if it is successfully configured then you will get python environment running as follows.

welcome to the python development environment.

To install python on Linux following steps (steps are based on consideration of Ubuntu linux operating System)

  • Go to Ubuntu software center > search python 3.3 or latest version
  • Select appropriate entry and click on install button. (you may need to enter password to begin installation)
  • open terminal run "python" command as on windows.
and your are done with python installation on Linux operating system.

In next part we will learn the basic syntax of python and datatypes.






Friday, January 16, 2015

Beginner guide to build "Hybrid Mobile Application" Using "Ionic Framework"

Welcome!,

  This is my first post so sorry for the "English" but suggestions are highly accepted. Today i am going to show how you can develop mobile application without knowledge of  Android and objective c that is IOS.

  The prerequisites for this post is that you need to know two most popular JavaScript angular and nodejs. Also you need following tools



  • Node Js
  • Any Text Editor that you prefer for javascript development ( I prefer WebStorm)
     
      Before we begin it is important to know what is ionic.

  • What is the IONIC?
                  IONIC is open-source Framework built on the top of angularjs. it  helps you to build native feeling mobile apps all with web technologies like HTML, css and JavaScript. its specifically built for cordova native apps. 
    
        The main focus of ionic is look and feel, and UI integration of your app. it doesn't replace hybrid mobile development framework like Phonegap but it simply fit with this kind of framework. more you can find on ionic documentation.



Lets get started with the development. i assume that you have pre-installed node js. now i will show you how to install ionic framework using node. For this open command prompt and run following command.
  • npm install ionic -g



this command will install ionic framework for you and '-g' indicates that it will install globally so you don't need to install again and again for each of your project.

now install the cordova to do this run following command.
  • npm install cordova -g


now we are ready with ionic and cordova, now lets start new project with the help of following command.
  • ionic start ProjectName blank

 This command create blank project for you. Here start is command line feature provided by ionic framework, there are many other command line feature available like
  • serve - this will start local development server
  • platform - this will set the target platform for your app (android/ios)
  • build - this will locally build your app
  • emulate - this will emulate your app in simulator 
  • run - to run your app

i am going to create HelloWorld using the above command, when you run the command it will start downloading of master template from git repository as shown in following screenshot.




 and create new folder "HelloWorld" in your given path. Find directory and you will find some folder and configuration files in it like 


this is the default pattern for developing app using ionic framework. so if your are planning to develop your customized app then you have to follow this pattern.
  • hooks - this contains information related to the platform of your app
  • plugins - this contains plugins that were used in your app like "ionic keyboard" etc.
  • scss - this contains style sheet "ionic.app.scss" is the styler provided by the ionic framework.
  • www - this will contains main application files.

ionic provide three ways to test your application
  • serve - using this command you can test your application in local browser
  • emulate - using this you can test your app in local simulator (android-sdk must be installed)
  • device - it means you can test your app on device by the help of the run command.

now go into "www" directory you will find start page of your app that is "index.html" add following snippet in to body tag



 <ion-pane>


      <ion-header-bar class="bar-stable">
        <h1 class="title">Ionic Blank Starter</h1>
      </ion-header-bar>
      <ion-content>
 <label>Hello World!</label>
      </ion-content>
    </ion-pane>

to run your app in local browser use following steps
  • go to the project directory my is "c:\workspace\Helloworld"
  • run ionic serve command
for example : c:\workspace\Helloworld > ionic serve

this command will start local development server for your app and you will see the output in your local browser as shown in below image.



i hope this is help full to you for quick start up with ionic framework.