JSON:

short for JavaScript Object Notation, and is usually pronounced like the name “Jason”. We want to learn JSON syntax because it's used very frequently, takes 5 minutes to learn, and most of the websites store and send data in JSON format. XML is another text format used widely in websites for storing and sending data. JSON is better as it's faster and easier to read. A good link for JSON basics is here:

https://www.w3schools.com/Js/js_json_intro.asp

JSON defines a syntax, which can be used to store data in a text file for any purpose. JSON’s format is derived from JavaScript object syntax, but it is entirely text-based. It is a key-value data format that is typically rendered in curly braces. You can write a utility or pgm to extract key-value pair from this json file. Most of the web programming languages, as well as scripting/interpreted languages (as python, perl, etc) offer inbuilt support for parsing JSON files.

JSON is not just for Javascript, and has nothing to do with Javascript, exept that it's syntax is derived from Javascript, and so we have included it here right after the Javascript section. It may be helpful to read into material on Javascript.

ex: test.json => Here we have 3 keys and 3 values corresponding to those 3 keys. Key "first_name" has a value "Sammy", and so on. keys and values are separated by colon (:). Note there is a comma separating key/value pairs, but no comma for the last entry. 

{

  "first_name"  :  "Sammy",
  "last_name"   :  "Shark",
  "online"      :  true
}

Many webservers return data as JSON strings, which are JSON object literal or JSON array enclosed within single quotes. The 2 types of JSON strings are as follows:

  1. JSON object literal: The JSON object literal is enclosed in curly braces. example as shown above. This is in key-data format.
  2. JSON array: The JSON array is enclosed within square brackets. ex: ["Ford", "BMW", "Fiat"]. This is not for key-data, It's used when you have a set of data, not in key:data format.

NOTE: JSON strings can also be a combination of the 2 types above by having object literal nesten within array or vice versa, i.e ["Ford", {"make": "model1"}, "BMW, {"make":"model2"}]. Depending on whether that element is "object literal" or "array", we access it differently. Shown later.

To make these JSON strings, we would enclose them in single quotes as in ex here => ' { first_name": "sammy" ... } '

 

In JS, these json strings are parsed using JSON.parse() function which converts them into JS objects.

Even though JSON is derived from JS, there are few differences:

  1. In JS or HTML files, the json object is set as a var. i.e in above ex, we can write person = { first_name: "Sammy", ... }. Then the variable person holds this js object. We access this object various ways as:
    • Dot notation: person.first_name or assign value as person.first_name="meme"
    • Array notation: person["first_name"] or assign value as person["first_name"] = "meme"
  2. In JS, Strings always need to be in quotes( either single quotes or double quotes). But in JSON, strings always need to be in double quotes. Reason:??
  3. In JS, keys can be strings, numbers or identifier names. while in JSON keys can only be strings. So, in jS keys do not need to be in quotes (except for when the keys are strings. When they are strings, we can use either single quotes or double quotes). But in JSON files, keys can only be strings and as such always need to be in double quotes.
  4. In JSON, values may be string, number, another json object (can have more nested key value pair), array, boolean (true or false) or null. Values are in double quotes when they are also strings.
    1. Value as JSON object literal => { "employee":{"name":"John", "age":30, "city":"New York"} }
    2. Value as array => { "employees":["John", "Anna", "Peter"] } => This is in cases where you have more than 1 value. In this case, we don't have a way to represent these using "object literal" as they can only be in key:data format. So, we added this array format, so that all kinds of data can be represented using combo of { } and [ ].

 

Accessing JSON entries:

A very important concept in JSON is to know how to access various entries in this JSON object literal. When the JSON object has arrays and literals, with other JSON objects nested within each other. it becomes complicated. There's online JSON parsers and validators, which will show JSON files neatly formatted, so that you can access various values.

Here's one such validator: https://jsononline.net/json-validator

ex: var person =

{
  "data": {
     "current_condition": [{
        "cloudcover": "0",
....
},{
"cloudcover": "5", ...
}]
"past-condition": [{....}]
}
"info" { .... }
}

These elements can be accessed via array notation as shown:

person["data"]["current_condition"][1]["cloudover"] => This returns "5". Here 1st element "data" is "object literal" with key data format, so we access it in associative array style, i.e person["data"]. This returns the whole "data" content in "data". "data" itself is object literal in key:data format, as it's within { }. "current-condition" is the key, while data is an array, as it's within [ ]. So, person["data"]["current_condition"] points to "data" for key "current_condition". The data is an array as shown.

[{"cloudcover": "0",...},{"cloudcover": "5", ...}]

This array has 2 entries, so we refer it using array[0] and array[1]. person["data"]["current_condition"][1]points to 2nd index of array 
and is equal {"cloudcover": "5", ...}. Now this is an "object literal" with multiple entries in key:data format. We just provide the key of the data
we are interested in. Here we do:
person["data"]["current_condition"][1]["cloudcover"] which returns data "5" for key "cloudcover"
 

 

XML Extensible Markup Language

This is a specifies that says how you to arrange the data so that it's easeir for tools to read the data. The file is still a text file, but it's hareder for humans to read these files.

Here's a good link explaining the basics:

https://www.datacamp.com/community/tutorials/python-xml-elementtree

NOTE: If you run the examples in link above, do note that xml file has closing </collection> missing. If you don't add that, you will get an error when parsing the xml file.

XML:

XML looks very much like HTML files. XML creates a tree-like structure that is easy to interpret and supports a hierarchy

XML files are called XML documents

OpenSuse:

This is the 1 of the 2 OS that has support of major big company called SuSE. CentOS is supported by RedHat while OpenSuse is supported by SuSe.

However,it has been frustrating for me to get OpenSuse to work. Basic video do not work on Firefox. You will have to download bunch of other stuff to make it work. Also, installation gave me issues. There is very little support available online, and takes a lot of your time resolving minor issues. I wasn't able to get skype working on it. Considering all these, I've abandoned this as there's no unique advantage that OpenSuse provides, which isn't provided by others. I've provided instructions below for completeness. Follow instructions on OpenSuse website to dowload leap 15:

http://www.opensuse-guide.org/installation.php

Follow the instructions on link above. However, based on my experience, I would advise to stay away from it, since there are so many other alternatives available.

 

Arch Linux:

One of the more difficult OS distro, meant for more tech savvy people. I'll try to install it and list instructions here.

1. Download iso file from here: https://archlinux.org/download/

There are lots of US mirrors, available. Don't use torrent or magnet link (scroll down to see worldwide mirror sites).

2. Copy iso file to USB drive. Firsst format it (if never unformatted), and use linux "cp" cmd to copy file. After the copy, name of USB drive will change to ARCH_202108 (i.e ARCH_yyyymm, where yyyy=year, dd=month). There are more instructions to burning "iso to usb" here:

https://wiki.archlinux.org/title/USB_flash_installation_medium

3. Now boot your device by following instructions in common instructions above. once booted, you will be logged into command line terminal as root. You won't get a GUI. You will have to setup and download everything from this terminal. It'll be  good learnng exercise once you go thru the whole setup process. Here is a link to installation (follow each step):

https://wiki.archlinux.org/title/Installation_guide

It's not easy to install ArchLinux for a novice. I'm trying to install it, but haven't completed everything yet. Will update once I complete it.

UPDATE 09/2021: It installed, but it's text only terminal. I'll have to install everything separately by following a long list of instructions. Even installing GUI and apps is going to take a good effort. Unfortunately, I've given up as it's not worth my time dealing with all the troubles. I'm too lazy of a guy, even compared to guy's standards :(

Ubuntu:

This is among the top 3 Linux distro. It went downhill recently by switching to GNOME3 interface (which wasn't popular with old people like me), but now they allow lots of different flavors of Ubuntu, with different and better i/f. So, it provides lots of choices, and you get a system, which is almost as easy to use as Linux Mint and CentOS. Ubuntu keeps on getting newer updates, which allows latest laptops to run without any issues (i.e outdated drivers cause sound, wifi etc not to work, but this never happens for Ubuntu). As of 2023, after having so many issues with Centos 7 (as Centos 7 has no updates since 2020), , I'm recommending Ubuntu. I've installed "Ubuntu Cinnamon" and "Ubuntu Mate" with no issues on a couple of laptops. Way to go !!

Ubuntu release numbering follows the year's last 2 digits. So, Ubuntu 22.04 implies it was released in 2022. All Ubuntu releases have 5 years of support, meaning they will update it with latest drivers etc, so newer machines built until 2027 will still be able to run Ubuntu 22.04.

The default "desktop ubuntu" can be downloaded from here: https://ubuntu.com/download/desktop. Download 18.04.3 LTS (as of 2018) or latest stable version. However, this flavor of ubuntu has gnome3, so a better choice is to download some other flavor of ubuntu from here: https://ubuntu.com/download/flavours

Different flavors of Ubuntu are basically same as Ubuntu under the hood, except for the desktop Environment (DE) and some other customization.

All the flavors have attractive GUI and it depends on your personal preference on which to download. My preferred ones are the ones based on GNOME 2.Below are the various flavors:

  • Ubuntu Mate: The one I tried and liked is Ubuntu Mate, which is more like Linux mint, with Gnome2, and very clean i/f. This is what default ubuntu desktop used to look like in 2010. download from here. https://ubuntu-mate.org/download/. Download 18.04.3 LTS or latest stable version. Ubuntu Mate might be the 2nd best option after Linux Mint, and ahead of CentOS., since CentOS requires an already installed linux distro, in order to get it installed. Ubuntu Mate has separate workspaces visible.
  • Ubuntu Cinnamon: If you aren't tied to making your desktop look like Windows, you should consider Ubuntu Cinnamon over Ubuntu Mate. It has Gnome 2 DE (just like Ubuntu Mate), and looks like traditional Linux desktop. It was released in 2023, and is maintained by Linux Mint, other Linux distro. No wonder, the name and look is so similar to "Linux Mint Cinnamon".
    • Worspaces; The only issue is that it doesn't have separate workspaces shown on the bottom right corner. It does have 4 workspaces though, they are just not visible. To switch from 1 workspace to another, use "ctrl+alt+forward arrow or back arrow button". It will show wrokspace 2, workspace3, etc as you press the arrow again and again.
    • System Info: All system info shows under Menu->preferences->system info. (or just search for "system"). When I installed in 2023, the OS shows as Ubuntu-22.04 Jammy Jellyfish.
  • Kubuntu, Lubuntu, Xubuntu: These may serve well for people coming from a certain DE, and wanting to install Ubuntu which looks the same. Kubuntu is KDE based (and Mobile ready), Lubuntu has LXQt DE, while Xubuntu comes with Xfce DE.
  • Other Flavors: I haven't tried these, they just look so awkward to me with icons on the side (similar to GNOME3 or Mac style)

There is also a tutorial on ubuntu website on how to download ubuntu, burn it on DVD or USB pen drive, and then install it. One such tutorial for creating pendrive for ubuntu on windows is here: https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-windows.

You can use any of these software to burn iso image to pendrive: rufus, etcher or UUI (from linuxpendrive). For me, none of these worked for pendrive, as it kept on giving error "boot failed". However, when I burnt it on a dvd, and used that to boot ubuntu, it worked flawlessly.

UPDATE 2023: As I wrote in "Linux installation", if you already have a linux m/c, use Linux "cp" cmd to cp the iso file to usb pen drive. Then reboot the laptop from within windows to get Ubuntu installed. I installed it using this method with no issues. This way of installing is the recommended way. NO need to use the above method from ubuntu site to burn iso.

Skype: Skype installation also worked, by following same steps as in Linux Mint.

 


 

Login without password:

Other Linux distro allow us to login w/o password during setup. Ubuntu Cinnamon gave me that option, but it still didbn't work. Easiest way to make it work is to add the user to group "nopasswdlogin". This can be done by going to settings -> Administration -> users_and_groups. Select user as yourself, and in groups, select "nopasswdlogin" which adds the user to this group. Now, no passwd will be required.

 


 

Install any new software on Ubuntu:

Many different ways:

  1. apt package manager: One of the ways is by using apt package manager. See in package manager ection for more details.
  2. Synaptic package manager: This is the preferred way. It's similar to other package managers as apt, but is provided as extra convenience. It's under menu->Administration->Synaptic package manager. On new pop up, authenticate with admin password. Then it will bring the software gui. Click on bottom left, which will show all packages, what is installed, etc. Search for any package that you want to install.  i.e search for "emacs", and you will see lots of software, such as emacs, xemacs, etc. You can mark the ones you want to install, and then click "apply". Then it will install all marked software.
  3. Snap store: This is the app store for most of the Linus distro out there. Installation is so easy if you find that software on Snap store. This is also under menu->Administration.
  4. Software, Software Updater: These are other software under menu->Administration. They can be used for updating or downloading new software.