Wednesday, January 4, 2017

Creating an Electron app using Visual Studio

Electron is an open source library developed by GitHub for building cross-platform desktop applications with HTML, CSS, and JavaScript. Electron accomplishes this by combining Chromium and Node.js into a single run time and apps can be packaged for Mac, Windows, and Linux. - "Electron Docs"

When I was searching for electron on web I found that in all most all the articles and video tutorials the authors are using text editors such as Atom, Visual Studio Code, etc, to develop electron applications.
So I was curious in finding out a way to develop electron apps using Visual Studio. (Not Visual Studio Code).

Getting started ...

"This post is suitable for those who have a some basic knowledge in Electron"

If you are using Visual Studio 2015 or below first you have to download and install Node.js Tools for Visual Studio.

After installing Node.js Tools for Visual Studio, you get the ability to create a new Node.js project.


(Unfortunately for me I can't run electron application using Visual Studio 2015. So I'm using Visual Studio 2017. When we are installing Visual Studio 2017 we can set Node.js Tools to install as well. So there is no need to install Node.js Tools separately for Visual Studio 2017)

Let's Start ☺

Create a Blank Node.js Console Application.

Your project structure will be like this.


When the project gets created you will get a app.js file and package.json file. In the package.json file you can see some fields such as name, version, main, etc. app.js is assigned to the main field. So app.js is the entry point of your electron app.
So now we have to install electron to our app. To install electron you have to add electron module to the "dependencies" section of the package.json file.
So now your package.json file will look like this,

{
  "name": "nodejs-console-app1",
  "version": "0.0.0",
  "description": "NodejsConsoleApp1",
  "main": "app.js",
  "author": {
    "name": "User"
  },
  "dependencies": {
    "electron": "^1.4.13"
  }
}

So now you have to save the package.json file in-order to install electron. Once you press ctrl+s electron module starts downloading.

After the electron module gets downloaded you can see the electron package under npm in the solution explorer. If it shows a Exclamation mark with a yellow background indicating missing, you have to right click on the electron package and select Install Missing npm Package(s). It will take some time. After it's done you can see node_modules folder in Solution Explorer. (If it is not displaying check whether you have clicked Show All Files button in Solution Explorer.)

Now you have only one more step to be done. Right click on the project name (not the solution name) and select properties.

You will get a window like this...


Now you have to set the Node.exe path to electron.exe which is installed under the folder node_modules/electron/dist/.

So now your Node.exe path will look something like this.
D:\MyWorks\Samples\NodejsConsoleApp1\NodejsConsoleApp1\node_modules\electron\dist\electron.exe

(Path changes according to the project's location)

So now you can add the code to the app.js file and add a index.html file (file having the name which you define in the app.js).

Finally you can Press F5 or Start the app. ;)

Saturday, April 9, 2016

Project Compression / Crashing

Simply crashing is reducing an activity. A project is composed of several activities. Each activity has a duration. So the total time for the project depends on the durations of each activity. Therefore is we can reduce the duration of activities, we can finish the project quickly. Inorder to reduce the duration of an activity we have to put more resources to that activity. It means we have to put more money.

So the main advantage of crashing is the reduction of the project duration which ultimately reduce the indirect cost of the project.

The following presentation gives a brief introduction to crashing and it also contains a simple example on finding the cheapest activity to crash.

Below the presentation you can find a video which describes what is in the presentation.


Thursday, April 7, 2016

Quality Assurance Vs. Quality Control


What is Quality Assurance ?

Quality assurance (QA) is a way of preventing mistakes or defects in manufactured products and avoiding problems when delivering solutions or services to customers.
(Source: https://en.wikipedia.org/wiki/Quality_assurance)




What is Quality Control ?


Quality control (QC), is a process by which entities review the quality of all factors involved in production.
(Source: https://en.wikipedia.org/wiki/Quality_control)







Quality Assurance (QA) Vs. Quality Control (QC)



  • QA is a Proactive activity and done before the product is manufactured or services are delivered.
    But QC is a Reactive activity and done during or after the manufacturing process.
  • QA is process oriented.
    But QC is product oriented.
  • QA focuses on prevention of defects to improve quality.
    But QC focuses on detection of defects to improve quality.

QA vs. QC facts are extracted from the following video
(https://www.youtube.com/watch?v=gxwIfiQTPBw)

Tuesday, October 21, 2014

IEEE Xtreme 8.0 - 2014

This was a new experience to me. 24 hours coding, at UCSC with two group members.
Actually this competition was very difficult to me and I learnt many things from this. My two group members were very talented and they scored really well. This competition started on 18th October at 5.30 am in Sri Lankan time and ended in 19th October at 5.30 am. For 24 hours we had to keep us awake and solve the problems that they are giving.