Monday, February 11, 2019

Open Source - AWS, Chrome and Ubuntu Linux

What is Open Source?
People often describe programs as being "open source" or "free software". But, what is Open source or free software?

If a program is an open source, its source code can be used and found online for all the users. Anyone can access the code and take this source code, edit it and develop new code base on the source code. 


Here, I want to talk about 3 open source - AWS, Chrome, and ASP .NET


AWS - Amazon Web Services


Open source software on AWS can present the opportunity for efficiency and savings in developing applications.  AWS Marketplaces makes it easy to locate, procure, and include OSS in our development and testing organizations, making it easier to run our overall business. 


Chrome


Google Chrome itself is not open source. It is based off the open-source Chromium project, however, it is powered by open source rather than being open source itself.


Ubuntu Linux


The user can download Ubuntu, create as many copies as I want, and give them to my friends. Users also can install Ubuntu on an unlimited amount of their computers.  Users can create remixes of the Ubuntu installation disc and distribute them. If users were particularly motivated, they could download the source code for a program in Ubuntu and modify it, creating their own customized version of that program – or of Ubuntu itself. 



The reason I choose these three open sources is that ASW, Chrome and Ubuntu Linux are very popular and most people will use at least one source here. It is better for us to have base idea on those open source.

Git Command

Compare with other commands, git command is much easier and simple to remember. Now, I want to discuss two git commands. Git branch and git stash.

git branch: List branches.

This command also has many different call operations. For example:


  • git branch -a
    • List all branches

  • git branch [branch name]:
    •  Create a new branch

  • git branch -d [branch name]
    • Delete a branch

  • git branch -D [branch name]
    • Force deletes the specified branch, even if it unmerged changes. This is the command to use if you want to permanently throw away all of the commits associated with a particular line of development.

  • git branch -m [branch name]
    • Rename the current branch to [branch name]





git stash: Stash changes in a dirty working directory


  • git stash clear
    • Remove all stashed entires

fs.watchFile() Vs. fs.unwatchFile()

Fs.unwatchFile() function is to stop watching for changes on filename. If the listener is specified, only that particular listener is removed. Otherwise, all listeners are removed, effectively stopping watching of the filename. Calling fs.unwatchFile() with a filename that is not being watched is a co-op, not an error.

Using fs.watch() is more efficient than fs.watchFile() and fs.unwatchFile(). fs,watch() should be used instead of fs.watchFile() and fs.unwatchFile() when possible.



Here is fs.watchFile() example.


var fs = require('fs');

fs.watchFile('./testFile.txt', function (curr, prev) {
  console.log('the current mtime is: ' + curr.mtime);
  console.log('the previous mtime was: ' + prev.mtime);
});

fs.writeFile('./testFile.txt', "changed", function (err) {
  if (err) throw err;

  console.log("file write complete");   
});


And fs.unwatchFile() stops watching for changes on the filename.


Wednesday, January 30, 2019

DPS 909 first open source contribution on github

Open Source refers to any program whose source code is made available for the user or modification as users or other developers see fit. Open Source software is usually developed as a public collaboration and made freely available. (WhatIs.com)

The purpose of this blog was how to familiar with how to use git.

The changes I made to the file in filerjs/filer/tests/spec/fs.unwatchFile.spec.js was to modernize the use of var declaration in JS. The original file was using "var" and I need to change "var" into "const" or "let" instead.

Here are issue and solution.

https://github.com/filerjs/filer/issues/682

https://github.com/filerjs/filer/pull/723