Tuesday, June 26, 2018

Setting up Django Project: Part 1

Environment:

  • Visual Studio Code
  • MAC OSX

Frameworks:

  • Django
  • Bootstrap (UI)
  • Python 3.6
  • CondaMini for Virtual Environment
  • Github for version control


Preset:

  • Visual Studio Code already installed


Step 1: Create a new folder

Step 2: Install miniconda for setting up the virtual environment

  • https://conda.io/miniconda.html

Step 3: Install and Test Conda

  • Open Terminal in VS Code and run conda --version
  • Re-start Terminal by typing exit whether you are using builtin VS Code terminal or regular terminal window
  • Type conda --version to verify conda installed 
  • If you see conda 4.5.4 or something similar, conda is working
  • Getting started guide with conda https://conda.io/docs/user-guide/getting-started.html 


Step 4 : Create a virtual environment with Django

  • conda create --name [envName] django
  • Select yes to download and create the virtual environment


Step 5: Activate / Deactivate virtual environment

  • Once the virtual environment is created use
  • source activate [envName]
  • to deactivate: source deactivate
  • the keyword source is required on MAC OS
Step 5(a): Checking for existing virtual environments [Edited]

  • conda info --env
  • You can see which virtual environments have been created using the above command. We can see two
  • The one with the * is the active one

base                  *  /Users/shamyl/miniconda3
SLS                      /Users/shamyl/miniconda3/envs/SLS
                         /anaconda3/envs/myEnv

Step 6: Create first Django Project
  • django-admin startproject [projectName]


Step 7: Create an app within your django project
  • python mange.py stratapp [appName]

Step 8: Run your server and test it out

  • python manage.py runserver



Step 9: Create GIT Repository and commit to Master
  • I'm using GitHub Desktop
  • Created a new repository
  • Gave it a name and pointed it to the local directory where the project is saved
  • Gave a summary and description and pressed the commit to master button to create the first master

Thursday, June 14, 2018

Flying DJI Tello with GO Programming Language


I recently bought DJI Tello which is essentially a DJI technology based drone developed by Ryze Tech a Schenzen based Company. The idea behind buying this drone was to explore how to use it in LearnOBots sessions where I teach kids about coding and technology. One of the first things I did was to fly the drone using it's android app. The second thing I did was to fly it by writing a program in the Go programming language.

According to its website Go is an open source programming language that makes it easy to build simple, reliable and efficient software. I chose it as GoBot can be used to easily program the DJI Tello. GoBot is a framework for robotics, physical computing and IoT writing in the Go programming language. GoBot supports a wide variety of devices including Arduino, BeagleBone, CHIP, DJI Spark and Tello, ESP8266, OpenCV, Raspberry PO, Sphero BB-8 and many many more. 

So let's get started with this blog post about programming my DJI Tello with GoBot. 

Step 1: Install Go:
You first need to install Go from the following link


Step 2: Installing GoBot
Then open up a command prompt or Terminal and type the following command to install GoBot tools

$ go get -d -u gobot.io/x/gobot/

Step 3: Connect to Tello
Turn on your Tello and connect to its WiFi. The WiFi will be named like TELLO-XXXX. 

Step 4: Write your program
You can run the following example taken from the GoBot site. I use the Atom editor and save the file as tello.go. You can give it any name or extension. As long as you have Go installed, you should be able to run the Go program from the command line Terminal.
package main

import (
        "time"

        "gobot.io/x/gobot"
        "gobot.io/x/gobot/platforms/dji/tello"
)

func main() {
        drone := tello.NewDriver("8888")

        work := func() {
                drone.TakeOff()

                gobot.After(5*time.Second, func() {
                        drone.Land()
                })
        }

        robot := gobot.NewRobot("tello",
                []gobot.Connection{},
                []gobot.Device{drone},
                work,
        )

        robot.Start()
}

Step 5: Run your program and fly the drone

Then go back to your Terminal (command prompt on windows) and run your Go Program by typing 

Go run tello.py


Here is a video of the Test Flight


For full API reference you can visit
Hope you can buy and enjoy programming and flying your own Drone!

References:

Tuesday, June 12, 2018

Full Stack Developer in a couple of weeks


Image source: http://www.sparity.com/services/full-stack-engineering/

Recently I've shifted from full time teaching to full time at my company. One of the differences that I've felt is that I have more time for my own learning. In my previous role as a University teacher, I needed to learn things and then figure out a way to explain them as well. Whereas in my new role as CTO, I can spend more time on learning for myself and not worry about figuring out the best way to teach others. Since my early days in CS, I've never felt comfortable as a web programmer or a designer. I've been mostly involved in embedded programming. Therefore, this was one area that I always felt uncomfortable in. However in my new role, I had to be up to speed with web application development, in order to work on some new products. Just like I always do, I tried to find the shortest way possible to get up to speed with full stack development. I searched around a bit for MOOCs on CourseraUdacity, Udemy read some tutorials, downloaded a few free ebooks. 


After searching around for a few weeks, I finally landed on this udemy course Python and Django full stack Web developer bootcamp which I felt met my requirements of getting started with Full Stack development. The course is pretty well organized and there are a number of components, that I'm already pretty good at, however the organization of the course makes it a very good reference to get started with Full stack web development. It covers, both front end and back end frameworks and also teaches the basics of code maintenance, deployment and some great sample projects. In the course, you can also very easily follow the author's way of setting up your PC for working on different web projects. For example, he makes great use Atom, GitHub, Chrome as well as other tools like the virtual environment. The course covers basics of HTML, CSS, Javascript, Bootsrap, jQuery for front end; Python and  Django for back end. The full curriculum can be seen here

The best part is I purchased it for a mere $10 which is a little more than Rs 1000 and I believe that it has turned out to be great value for money. I would highly recommend this course for someone who is a beginner or would like to quickly get up to speed with Full Stack web development. 

Friday, June 1, 2018

Reviewing my DJI Mavic Pro!

Made a short review and unboxing of my DJI Mavic Pro! The quality is not so great, but then again, I'm a totally noob video editor!