Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

OpenCV Basics Part I - How to read Image with OpenCV

  OpenCV (Open Source computer vision library) is one of the popular library for machine learning, image processing and computer vision. It is available for different platforms like Windows, Linux, Mac OS, iOS and Android and it is also available with  C, C++, Python and Java interfaces. Clearly, we are not here to discuss What OpenCV is? and why it used? and if you still insisting me to tell what exactly it is then,  I will recommend you to read and understand this (nvidia guide) or this (Intel guide) or this (a blog).


Background:
The aim of this tutorial series is to teach and learn some basics of the OpenCV as I am not an expert of OpenCV, learning it myself and sharing my learning so that I can grasp this skill. This tutorial assumes you have basic knowledge of python. Remember, I am not a regular or experienced python programmer. My primary language is C# and Unity Game-engine while occasionally I code in JS, PHP, and python. The reason to mention my background is that a beginner python developer can follow this tutorial  (as I am a beginner) and expert of python and OpenCV can correct/imporve this tutorial.
So without further ado, we jump to the code and in this tutorial, we simply learn that how can we read and display an image in OpenCV.

Why did Python become so popular?

             As a programmer, my first experience with python was miserable due to the bracket less syntax of the program , indention based code, lack of knowledge about the Good Python IDE and QGIS environment where I have to code in python and I was already confused with the dozen of features of QGIS and working mechanism (still I don't know about it). Although enjoyed my time and work because I love to work on new technologies and specially on Python due to its growing popularity and acceptance in data science field.
Python is a general purpose language. Recently, Python has become so popular as:


Source: octoverse github



Source: Stackoverflow survey 2017



source: IEEE spectrum


The success of python not only stop here, StackOverflow recent trends are also depicted the  popularity of Python as you can see below graph, Python has already surpassed Java and close to JavaScript.
source: stackoverflow trends
So, in number game python heading towards more popularity but what make him so popular while its first release happened in 1991? This urge me to know the reason of Python popularity and without particular order I have found these facts about python:

Readability:

It resembles with English language and mostly use common English words like in, None, not, def for definition, import etc. It not use curly bracket or special keywords to delimit code blocks instead use white-space indention (but I personally prefer curly brackets). Additionally, it use fewer code to program, like if you want to print Salam World you can write simply
print("Salam World")
But what will happen if you want to write same code  in C# or Java or C/C++?? Developers are  better know about #Include, or System namespace, or Main function etc etc, that are necessary to run single line of code.

Library:

One of my colleague asked me that how to install a package/Library/Framework in python? I told him to write this (pip install yourDesiredPacakgeName) in command line. Then, it took hardly one minutes to complete and my friend yell! This is very simple!. Yes, it simple and there are huge numbers of libraries framework available you can install in a minute. Python provide large number of third party libraries related to data science, web development game dev etc and these libs are super easy to install.

Data-Science Support:

Python has become no 1 choice in data science and recently surpassed it close contender "R". It has great support of libraries including sciPy, NumPy and Pandas.

Other reasons includes:

  1. Mostly use in scientific domain, academic research and most schools/university are adopting it as first place language.
  2. Python has strong, active and huge community and Giant Sponsors.
  3. Python Success in different areas
  4. Great documentation by third party.
  5. Python extensively using in most platform and fields like embedded devices(RaspberryPi App), Web, Desktop, Data science, game (pygame), server configuration etc.
  6. Easy for newcomers, with little efforts they can write working piece of code.
  7. Able to run on Cross platform (windows, Linux, Mac OS)
  8. Google, the corporate backer of the language.

Conclusively, I can say that python is popular due to its simplicity, huge library support, acceptance in research and universities/schools, and finally its immense support and use in data science field.

If I have forget any important aspect of python popularity please inform met, i will be happy to learn and share it.

Coding Forums for Programmers - Programmers should Join

As a programmer you defineatly google to solve your coding issues and did you ever notice that you mostly find your solution on coding forums. Yes, coding forums like stack overflow, code project or game dev etc. For me, joining a programming forum is essential therefore, I mostly recommend programmers to stick with at least one programming forums as it has significant advantages like:
  1. You can instantly get answer of your programming issues (but before posting the question on forum, you must do some research otherwise, the forum can close your duplicate question)
  2. You find new perspectives to solve a problem
  3. Opportunity to learn from other codes
  4. Sometime you talk with world class develoeprs
  5. Maybe you can find new business partners or friends
  6. Beside getting answer of your question, you can help others and can strong your coding skills

I am an active member of stack overflow and I have also joined different other programming forums like game dev, code project, software engineering stack exchange etc. profile for Mohammad Faizan Khan on Stack Exchange, a network of free, community-driven Q&A sites

For programmers, I have combined several programmiing forums link in this post. Without a particular order, here is the list:

C or HTML - What should i choose? A guide for beginners.

         You are newbie in programming field and interesting to start learning but confuse with language like C and html. A lots of newbie confused that how to start with programming or which language I should select either C or html? In this post, i will try to clear all your confusion about c and html.

         First thing I want to tell you that don't mix both things (C & html). They are separate : How ? You need to understand that if you are willing to learn programming then you should choose C And If you are willing learn to learn rendering language then, its HTML. Still confusing? No problem! You need to understand the difference between programming language and rendering language. Programming language allow you to do mathematical and logical operations.

For example, you provide two numbers to C language (programming language) 4 , 3 with positive (+) operator then, C will perform a mathematical operation and it will return 7. The statement should be like this 4+3 and the answer will be 7. It simply add both numbers and return the result but if you try to perform same operation with HTML then the result will 4+3. What? 4+3? This is exactly the same what we provide! Yes, it is same that's why we called it rendering language. It simply render the content you provide. It didn't apply mathematical operation. while in programming language you are able to perform mathematical and Logical operator (we are not going deep in logical operator like "AND", "OR").

How to solve "npm not recognized as internal or external command"

You have downloaded and installed npm and then, typed npm command but getting the error
"npm not recognized as internal or external command"
OR You want to know how to download and use npm? Then, you are at the right place! This short post will teach you the simple steps in order to successfully install and run npm. So, here are the steps.
First, download and install npm from here [chose Windows Installer(.msi)]. If you have tried npm command after installation, you will get this error "npm not recognized as internal or external command". In order to solve this problem, follow below steps:
  1. Go to MyComputer Properties.
  2. Click Advanced System Settings from the Left bar of Window.
  3. Now you have System Properties window. Click Advanced
  4. Then, Click Environment Variable... button
  5. Now you have Environment variable window: From User Variable, Select Path
  6. Click Edit
  7. Now in Variable Value, add the path of where you have installed npm. Like I have installed it in C drive (C:\Program Files\nodejs\). If you have installed in other drives then please act accordingly.
  8. OK all open dialogue
  9. Now the final step, Restart your computer.
  10. Congrats you have done, now you can use npm commands

Drones - Next Common thing you will see everyday

Postal delivery with drone. . . Crime scene film with drone. . First-aid with drones . . Agriculture with drones . . Its all about drone, drone and drone. Yes, the next big and common thing you will see everyday around you, will be the Drone or Unmanned Aerial Vehicles (UAVs) technology. Drones are actually flying robots that can fly autonomously or they can be control remotely. According to Dictionary.com drone :
"an unmanned aircraft or ship that can navigate autonomously, without human control or beyond line of sight ".
Drones usually have embedded systems that work in conjunction with on-baord sensor and GPS.

I am here again (after AI tweets collection),  collected some of the cool tweets that will educate us about the different perspectives of drone technology including its adoption and development and latest progress. Actually drone technology is one of the leading trend that is quickly evolving with AI.

What is Drone

Drone Technology Latest Progress

Drone is Mega Trend

Drone Industry Getting Large

Drone Prices Getting Small

Drone's Problems/Issues 

Drone Applications


Drone Aerial View is Important

Unity Tips and Tricks (Unity Coding Tips and Tricks) Part III

 In our previous article we presented different unity tips and tricks related to Unity scene organization, managmgent and inspector etc. In this article we have gather differnt coding tips and tricks form twitter.

Unity3d Coding Tips and Tricks






Data Saving Techniques for Unity3d Application

Data is one of the integral element in modern applications of Games, VR/AR or gamification. Unity3d, the most famous and most widely use game-engine provide you different options to save your game data in different ways. Once on a forum, a programmer asks the question that how to save data in unity3d?? and I  answered him with different options. I guess it is necessary to share the detail of the answer for future users. So, here is the list of different options for saving data for unity application. (we will like to update this article to add more techniques if you know anyone).



1. Platform-independent:

One way of saving data in Unity3D in a Platform-independent way is to use the PlayerPrefs class.


Here is the example to set a string and later get it through PlayerPrefs class.


Where the Data Store? Here is the chart:
Platform
Data stored at
Windows
Registry under HKCU\Software\[company name]\[product name] key
macOS
~/Library/Preferences folder, in a file named unity.[company name].[product name].plist, 
Win Phone 8
 application's local folder
WebGL
browser's IndexedDB
Linux
~/.config/unity3d/[CompanyName]/[ProductName]
Android
/data/data/pkg-name/shared_prefs/pkg-name.xml



* company and product names are the names set up in Project Settings

Reference Links:

·         PlayerPrefas Documentation

·   Tutorial PERSISTENCE - SAVING AND LOADING DATA using DontDestroyOnLoad, PlayerPrefs, and data serialization Video Tutorial by unity.

2. Server Side:

You can also use a Server for saving data (like a combination of PHP and MySQL Database). You can use it to save Score Data, user profile, etc., Learn More From Unity Wiki
You can also use third party solution like back4App and firebase.



3. Embedded Database:

SQLite (an embedded database for your app) is another great option for you get the Free Package, it is simple and easy (and my favorite) if you know SQL.

Free Web & Mobile App Development Training in Karachi


Want to be a world-class Software developer? But
  • You are a novice in programming and want to enter in the arena of software development?
  • You want to be the master of state of the art web technologies?
  • Want to be a master in Software, Web, and Mobile App Development?
  • Searching for well qualified and loyal faculty (skilled teachers in their respective development fields)?
  • Willing to earn the best training and Free. Yes, its Free, Free, Free?
  • You want your own choice of class/practice timing?
  • You have inspired with mobiles and web applications that you are using?
  • You want to be the part of billion-dollar ($,$$$,$$$,$$$) industry?

Important Announcement! Stay at Home but get online admission in PIAIC now - No fee for first quarter

Visit Saylani Mass IT Training Offical Web for Latest News

Unity3d Training and Certification in Pakistan

 Unity3d, the amazing cross platform game-engine developed by Unity Technologies, helping thousands of users to develop games, simulations, architecture, gamification, VR, Mobile and Console applications. In April 2016, Unity announced it own certification program with this objective and background:

In talking with members in the Unity community, one of the common, recurring themes we have encountered is a need for a way to reliably assess an individual’s Unity knowledge and skills against a benchmark of proficiency.

In an effort to respond to all of these needs, we developed the Unity Certification Program, and at GDC 2016 we were thrilled to announce that the first level, Unity Certified Developer, is now available!


In order to make accessible its certifications in different countries,  Unity Technologies has partner with different training institutes. You can find its partner list here. Initially there was no affiliated partner exists in Pakistan but yesterday, i received an email from unity and I am pleased to share with you that, CETA has become the first and only Unity authorized institute in Pakistan.

"We are proud to announce our first Authorized Training Center in Pakistan: Center for Enterprise and Technology Advancement (CETA). You can now learn and get certified all at the same place!"

Now congrats for all Unity fans in Pakistan, CETA is giving Game Development Training in collaboration with Unity for the first time in Pakistan. Remember, its certification valid only for 2 years but  it is expected that it will teach you a lot as its course-ware seems comprehensive.


Unity3d Interview questions

Unity3d one of the famous and most amazing cross-platform game-engines that provides a great environment for game development. It is widely used and there are significant opportunities available for game development using this technology. If you want to avail these opportunities then, you must have to prepare yourself for technical questions and this is the reason for this post.

      After making some initial search and an interview experience, we have gathered some of the questions for you that you can consider before conducting or giving an interview as these questions addressing different aspects of unity game engine including programing, unity features and shaders etc. Remember this list does not include all the necessary questions. We will try to update this article in order to make a valuable resource. You can comment to share your interview question so that we can improve this source for our reader. In the future, we have also a plan to write the answer of these questions:

Advice for Junior Programmer

            Neither I am an expert programmer nor I have too much experience but I love to code and want to improve my skills. One of the way to achieve my this objective is, sharing my knowledge and experience with others. Therefore, here are some of the rules which I have adopted and it can be helpful for Junior or new Programmers. Honestly writing, I am still struggling to act on my own rules :). In my opinion! these rules are difficult but it will finally help you to become a good programmer:

  1. Don’t copy-paste code ever, even you know the Syntax/Logic. Write Yourself Always.
  2. Develop or Contribute to Open Source Projects.
  3. Join Programming Forums Stack overflow, Codeproject, etc. Spend some time there to solve problems.
  4. Start Building Robust Portfolio (preferably research-based)
  5. Write a Blog, share your hard-work and experience (You even can make money online through it)
  6. Prefer Good Mentor over Big Company. A good mentor will develop your skills.
  7. At first, don’t ask everything from a senior, try yourself first.
  8. Don’t allow seniors to write code for you, get instruction but write yourself.
  9. Code for other developers. I mean code in a way that other programmer can understand it easily.
  10. Use comments always. You will forget your own code next month. 
  11. Always welcome new technologies. Don't hesitate to work on new techs.
  12. Aim every day, love your work.
  13. If you don’t like the working environment or find a good opportunity then, Quit. Don’t waste your time.

Is Programming for everyone?

From my personal experience of teaching and as a programmer and lead (for particular time period), I found that programming is not for everyone. but this is usual and common, as

  • Not everyone can be a Doctor
  • Not everyone can be a Mathematician (this is 100% true for myself :)
  • Not everyone can be an Architect
  • Not everyone can be a Lawyer
  • Not everyone can be a Leader etc., etc.,

        Therefore, no exception for programming field. It is a skill that require motivation, hardworking, dedication along with Good Mentor/Teacher and will. There are significant programmer who are self-taught and there are also significant programmer who don;t know how to program despite good teaching and mentoring. Some people learn programming syntax easily but become fail to provide/think solution of a particular problem. Some people even fail to learn syntax and afraid with the syntax.

Most demanding Programming Language

Which is the most demanding programming language?
Or Which language is so popular?
Or Which programming language should I learn in order to start make money quickly? And so on ..
These are the questions which novice programmers usually ask on different forums everyday. Certainly, experience programmers are also interested to know which language is demanding but actually they are well aware of the fact that most demanding programming language is Javascript. [Remember: you should not confuse with Javascript and Java, Java is a separate language (which is also popular), although names are almost similar but comparison of Java and JavaScript is like comparison of car and carpet].  Clearly, we are not here to discuss what is Javascript? you can find the details here.
Now the question is Why Javascript is so demanding? Lets ask this question from the world largest, and most trusted online programming community Stack Overflow.
It found No. 1 at Stackoverflow 2017 Survey actually from last 5 years, JavaScript on Top.
Most popular programming language (source: stackoverflow)

As Stackoverlfow 2017 stated: