Showing posts with label vscode. Show all posts
Showing posts with label vscode. Show all posts

Monday, June 20, 2016

Python for .Net Developers

Hi All,

I have been working with Python recently and i would like to share a quick and easy tutorial to learn Python for developers with OOP experience such as: C#, JAVA or .Net experience.

This is a mini course, gets you up to speed to start developing in Python with no prior knowledge because it covers what every developers wants to know for Python programming language basics.

http://ai.berkeley.edu/tutorial.html#PythonBasics

Here is my takeaways of this tutorial:

1) Python uses indentation for code execution, Python doesn't use curly brackets for opening and closing functions, classes..etc as in C# or Java. So it is preferred to use tabs than spaces while coding.

2) You can use lists ([]), dictionaries ({key:value}), tuples (()), and sets (set([list])) for storing collections in code. Use an appropriate option as in your code case. Sets items has no duplicates. Tuples are immutable (Once it is created, you can't change it).

3) You can create main function as we do in Java or C# console apps as an entry point for your program.

# Main Function
if __name__ == '__main__':        
    // YOUR CODE HERE  

4) You can include other files in your python file by adding import statement: import myotherfile, note do not include .py in the name of your python file.

5) You can define classes and functions in Python. also, you can create instance and static variables for class members.

class Person:
    population = 0
    def __init__(self, myAge):
        self.age = myAge        --> Instance Variable
        Person.population += 1  --> Static Variable 

6) You can use Visual Studio Code as a development IDE to code in Python. Download & install VS Code for free and then install Python & Python VS Code extension. Here is the steps:

a) Download Visual Studio Code for free: https://code.visualstudio.com/Download
b) Install Python on your machine: https://www.python.org/downloads/
c) Open VS Code, Press F1 and then type install extension and hit enter and then type: python. VS Code provides intellisense & debugging capabilities for Python.



Enjoy!


More useful links:

1) Python Tutorial:
https://docs.python.org/2/tutorial/ 

Monday, November 02, 2015

npm ERR! while installing Ionic on OSX

Hi All,

While I was trying to install Ionic framework to start develop cross mobile apps using Ionic, I was getting errors while running the following command:

$ npm install -g cordova ionic

I have El Capitan version 10.11.1 with Node.js version 5.0.0 and npm version 3.3.6.

I tried to uninstall cordova first, then re-install cordova. After that, I tried to install ionic by itself but i was getting the following errors in the terminal window:

npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "ionic"
npm ERR! node v5.0.0
npm ERR! npm  v3.3.6
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! syscall read

I tried to read more if i am missing any requirements for Cordova CLI in OSX. I found out that XCode contains all OSX SDK tools and dependencies for Cordova apps development in OSX.

Cordova CLI Requirements url for OSX: 
http://cordova.apache.org/docs/en/5.1.1/guide/platforms/ios/index.html


So i have decided to install XCode first, and the i re-ran the installation command for Ionic and i was able to create Ionic apps on my OSX dev machine.

So installing XCode on my machine did the trick!

Hope this helps.

Thanks a lot.

Wednesday, October 14, 2015

Ionic framework must to know tips

Hi All,

I am writing this blog post to cover essential Ionic framework commands that every developer should be aware of specially if you are new to Ionic Development using Cordova platform.

Here is my tips that must to know when working with Ionic framework:

1) Ionic is a front-end SDK that is used to create incredible mobile apps based on Cordova framework.

2) To start using Ionic to create mobile apps, Ionic uses npm which uses node.js. So you need to install Node.js to start using npm commands.

3) To install Node.js, here is the installation link: https://nodejs.org/en/

4) Creating Ionic mobile apps project is a folder based, So before executing the following command you need to make sure that you are in the right directory path structure where Ionic framework creates a folder for the newly created application "app1" :

     ionic start app1

The above command creates a folder named "app1" under the current directory path.

5) All Ionic Framework commands starts with ionic either to create, build or run Ionic mobile apps.

6) You can open Ionic projects using Visual Studio Code by executing the following steps:
     a) From File menu, Click on Open Folder.
     b) Select your Ionic project folder and click on Ok.
You will be able to use Visual Studio as your Development Environment.

7) If you want to run your Cordova project into the browser, Follow these steps:
    a) Open the terminal window, navigate to the project folder.
    b) Type the following:
         ionic serve
    c) A new browser will run for your Ionic Cordova project.

8) How to add Git integration to an existing project in VS Code, check out this reference:
https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/

Update [11/2/2015]: Updates for Git integration and how to run Cordova apps in the browser.

Hope this helps.

References:
1) Ionic Framework website: http://ionicframework.com/