text:
<repo_name>jadavianett/password-generator<file_sep>/README.md
# Password Generator

## About
Welcome to my Password Generator Repository! Using the given starter code, I have created a responsive password generator that will randomly generate a password that meets the user-selected requirements and assignment acceptance criteria.

## Javascript Layout
This assignment relied heavily on Javascript. In order to meet the acceptance criteria, I utilized functions, variables, if/else statements, alerts, confirms, prompts, returns, and functions! At the end of the day, my password generator presents a series of prompts for password criteria, holds all user input and then generates a password based on that user input that is displayed on the page.

In order to achieve this, I first pseudo coded the project to include all of the steps that I would later need to write code for. After pseudo coding, I created my variables to store character information and the available characters that would be chosen from to make the final password. From there, I was able to add if/else statements and a function that executed the desired result.

I organized these elements by generally listing my variables first and then my if/else statements. Comments are throughout the code to describe what each chunk of code is executing.

## Challenges
This was a difficult assignment for me. To be completely transparent, I was quite stumped after pseudo coding and adding in my variables.Thankfully, my tutor was able to help me think through the remainder of the processes. One challenge to working through with a tutor was forgetting to commit along the way! I will definitely be sure to commit early and commit often moving forward.

## Links
Link to GitHub Repository: https://github.com/jadavianett/password-generator
Link to deployed application: https://jadavianett.github.io/password-generator/
![alt text](home.png "Password generator")

<file_sep>/script.js
var generateBtn = document.querySelector("#generate");

function writePassword() {
  var password = generatePassword();
  var passwordText = document.querySelector("#password");

  passwordText.value = password;
}

function generatePassword() {
  // variable password holds anything added from specialCharacters, numbers, uppercaseLetters, and lowercaseLetters
  var password = "";
  var passwordLength = prompt(
    "How many characters would you like your password to contain? Enter a number between 8 and 128."
  );
  //final password will be displayed at the end and pulls information from password
  var finalPassword = "";

  //first if condition must be met for the rest of the program to run - if not, an alert will prompt the user to enter a number within the specified criteria
  if (passwordLength < 8 || passwordLength > 128) {
    //initial prompt
    alert("Please select a number between 8 and 128.");
    generatePassword();
  } else {
    //secondary confirms
    var specialCharacters = "!@#$%^&*()_?<>";
    var confirmCharacters = confirm(
      "Click OK to confirm including special characters."
    );

    var numbers = "1234567890";
    var confirmNumbers = confirm("Click OK to confirm including numbers.");

    var uppercaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    var confirmUppercaseLetters = confirm(
      "Click OK to confirm including uppercase letters."
    );

    var lowercaseLetters = "abcdefghijklmnopqrstuvwxyz";
    var confirmLowercaseLetters = confirm(
      "Click OK to confirm including lowercase letters."
    );

    //the following if statements provide the information to fill the empty password string with the required information
    if (confirmCharacters == true) {
      password = password + specialCharacters;
    }
    if (confirmNumbers == true) {
      password = password + numbers;
    }

    if (confirmUppercaseLetters == true) {
      password = password + uppercaseLetters;
    }
    if (confirmLowercaseLetters == true) {
      password = password + lowercaseLetters;
    }

    // this conditional displays an alert if the user selects false for each conditional, therefore adding no information to the blank password string, returns a blank final password string to the user
    if (
      confirmCharacters == false &&
      confirmNumbers == false &&
      confirmUppercaseLetters == false &&
      confirmLowercaseLetters == false
    ) {
      alert("Please select at least one option.");
      return "";
    }
    //for loop that selects a random number and multiplies it by the password length to generate the final password
    for (var i = 0; i < passwordLength; i++) {
      var randomCharacter = Math.floor(Math.random() * password.length);
      finalPassword = <PASSWORD> + password[randomCharacter];
    }
    //finally, the finalPassword is displayed
    return finalPassword;
  }
}
// generate button
generateBtn.addEventListener("click", writePassword);

languages: Markdown JavaScript

repo_name: jadavianett/password-generator


text:
<repo_name>kanchho/diagnostics-rtos<file_sep>/README.md
Demonstrating implementation of self diagnosis on a real time system<file_sep>/src/main.c
/*
   * Author : <NAME>
   * Description : Implementing system self-diagnostics with memory checksums (flash memory)
*/
#include <avr/io.h>
#include <util/delay.h>
#include <stdio.h>
#include <avr/pgmspace.h>

#include "FreeRTOS.h"
#include "task.h"

#define LED_TASK_PRIORITY               ( tskIDLE_PRIORITY + 2 )
#define CHECKSUM_TASK_PRIORITY          ( tskIDLE_PRIORITY + 1 )

extern uint16_t __data_load_end[1];                     // Defined by the linker script.  Set to address of last byte of .text+.data section

#define FLASH_END (uint16_t) & (__data_load_end[0])     // address of last used byte in flash
#define POLYNOMIAL 0xEDB88320                           // zlib's CRC32 polynomial

uint8_t initialChecksum;

static void vLedTask( void *pvParameters );
static void vChecksumTask( void *pvParameters );
volatile uint8_t calculateChecksum(void);

int main( void ){
        initialChecksum = calculateChecksum();
        xTaskCreate( vLedTask, ( const char * ) "T1", 255, (void *)('1'), LED_TASK_PRIORITY, NULL );
        xTaskCreate( vChecksumTask, ( const char * ) "T2", 255, (void *)('2'), CHECKSUM_TASK_PRIORITY, NULL );
        vTaskStartScheduler();
        return 0;
}

// simple LED blinker with 500Hz output frequency
static void vLedTask( void *pvParameters ){
        ( void ) pvParameters;
        uint8_t pinmask = (1 << 7);         // arduino pin 7 : Atmega328p PD7
        DDRD |= pinmask;
    for( ;; ) {
           PORTD |= pinmask;
	       vTaskDelay( 1 );
           PORTD &= ~pinmask;
           vTaskDelay( 1 );
        }
}
/*
 * Calculates CRC32 checksum over full code memory space and
   compares the result to initial CRC result which is calculated at boot time.
 * Checksum failure puts the system in safe state.
 * Checksum calculation is periodic and has deadline of 10 minutes
*/
static void vChecksumTask( void *pvParameters ){
        ( void ) pvParameters;
        for( ;; ){
              uint8_t newChecksum = calculateChecksum();
	          if (newChecksum != initialChecksum){
                     PORTD &= ~( 1 << 7);                     // Pull down Pin 7 on port D to LOW state
                     DDRD &= ~(1 << 7);                       // Turn off OUTPUT mode for Pin 7 on port D.
              }
              vTaskDelay( 600000 );
        }
}

// CRC32 implementation without lookup hash table
volatile uint8_t calculateChecksum(void){
	uint8_t j, mask;
	uint8_t crc = 0xFFFFFFFF;
	uint16_t memCount;
	while (memCount <= FLASH_END){
		uint8_t byte = pgm_read_byte(memCount++);
		crc = crc ^ byte;
		for (j = 7; j >= 0; j--) {
			mask = -(crc & 1);
			crc = (crc >> 1) ^ (POLYNOMIAL & mask);
		}

		memCount++;
	}
	return ~crc;
}

branch_name: refs/heads/master

languages: Markdown C

repo_language: Markdown

repo_name: kanchho/diagnostics-rtos


text:
<file_sep># ghtest
ghtest
issue1
issue2

repo_name: GeniyX/ghtest


text:
<file_sep>/*
 type:
    3. Boron
    4. Nitrogen
*/

function hbn_hex(n, side_length, shape){
    this.n = n
    this.side_length = side_length
    this.substrate_size = 6 * n
    let w = sqrt(3) * side_length
    let h = 2 * side_length

    this.dx = 0.5 * w
    this.dy = 0.25 * h

    let tempAtoms = []
    let hexatoms = []
    this.atoms = []

    let max_x = -Infinity
    let max_y = -Infinity

    let min_x = +Infinity
    let min_y = +Infinity

    for(let i = 0; i < this.substrate_size; i++){
        if(i % 3 == 2) continue
        for(let j = 0; j < this.substrate_size; j++){
            if( (i % 6 == 0 || i % 6 == 4) && j % 2 == 0 ){
                if(i % 6 == 0){
                    temp_postype = [
                        [this.dx * tx_03[0], this.dy * ty_03[0]],
                        [this.dx * tx_03[1], this.dy * ty_03[1]],
                        [this.dx * tx_03[2], this.dy * ty_03[2]]
                    ]
                }
                if(i % 6 == 4){
                    temp_postype = [
                        [this.dx * tx_14[0], this.dy * ty_14[0]],
                        [this.dx * tx_14[1], this.dy * ty_14[1]],
                        [this.dx * tx_14[2], this.dy * ty_14[2]]
                    ]
                }

                // i % 6 = 0, 3    -> Nitrogen
                // tempAtoms.push(new molecule(i%6 == 0? 3 : 4, j * this.dx, i * this.dy, temp_postype, side_length))
                tempAtoms.push(new molecule(i%6 == 0? 3 : 4, j * this.dx, i * this.dy, [], side_length))
            }
            else if( (i % 6 == 1 || i % 6 == 3) && j % 2 == 1 ){
                if(i % 6 == 3){
                    temp_postype = [
                        [this.dx * tx_03[0], this.dy * ty_03[0]],
                        [this.dx * tx_03[1], this.dy * ty_03[1]],
                        [this.dx * tx_03[2], this.dy * ty_03[2]]
                    ]
                }
                if(i % 6 == 1){
                    temp_postype = [
                        [this.dx * tx_14[0], this.dy * ty_14[0]],
                        [this.dx * tx_14[1], this.dy * ty_14[1]],
                        [this.dx * tx_14[2], this.dy * ty_14[2]]
                    ]
                }

                // i % 6 = 1, 4    -> Boron
                // tempAtoms.push(new molecule(i%6 == 1? 4 : 3, j * this.dx, i * this.dy, temp_postype, side_length))

                tempAtoms.push(new molecule(i%6 == 1? 4 : 3, j * this.dx, i * this.dy, [], side_length))
            }

            // max_x = max(max_x, j * this.dx)
            // min_x = min(min_x, j * this.dx)

            // max_y = max(max_y, i * this.dy)
            // min_y = min(min_y, i * this.dy)
        }
    }

    let atm = (2 * n - 1) * (this.substrate_size / 2) + floor(this.substrate_size / 4)
    // console.log(atm)
    let from = [tempAtoms[atm].x - this.dx, tempAtoms[atm].y + this.dy]

    // TODO .. sync center of gravity with MoS2

    let radius = (1 + 2 * (this.n - 1)) * this.dx + this.dx * 0.2

    let radius_squared = radius * radius
    this.center = from

    isEqual = (a, b) => {
        let diff_x = abs(a.x - b.x)
        let diff_y = abs(a.y - b.y)
        // console.log(diff_x, diff_y)
        if(diff_x <= (0.5 * this.dx) && diff_y <= (0.5 * this.dy))
            return true;
        else return false;
    }
    area = (a, b, c) => {
        return Math.abs((a.x*(b.y-c.y) + b.x*(c.y-a.y) + c.x*(a.y-b.y)) / 2.0)
    }
    onSegment = (a, b, c) => {
        if(b.x <= max(a.x, c.x) && b.x >= min(a.x, c.x) &&
            b.y <= max(a.y, c.y) && b.y >= min(a.y, c.y)) return true
        else return false
    }
    checkOrientation = (a, b, c) => {
        let val = (b.y - a.y) * (c.x - b.x) - (b.x - a.x) * (c.y - b.y)
        if(abs(val) <= 1e-2) return 0
        else if(val > 0) return 1
        else return 2
    }
    doIntersect = (a, b, c, d) => {
        let o1 = checkOrientation(a, b, c)
        let o2 = checkOrientation(a, b, d)
        let o3 = checkOrientation(c, d, a)
        let o4 = checkOrientation(c, d, b)

        if(o1 != o2 && o3 != o4) return true

        if(o1 == 0 && onSegment(a, c, b)) return true
        if(o2 == 0 && onSegment(a, d, b)) return true
        if(o3 == 0 && onSegment(c, a, d)) return true
        if(o4 == 0 && onSegment(c, b, d)) return true

        return false
    }
    checkInsidePolygon = (points, p, take_corner) => {
        let len = points.length
        if(len < 3) return false
        ex = {
            x: 1e12,
            y: p.y
        }
        let cnt = 0
        for (j in points){
            if(!take_corner && isEqual(p, points[j])) return false
        }
        for (let j = 0; j < len; j++){
            // console.log("check fo intersection", points[j], points[(j + 1) % len], p, ex)
            if(doIntersect(points[j], points[(j + 1) % len], p, ex)){
                // console.log("intersect", points[j], points[(j + 1) % len], p, ex)
                if(checkOrientation(points[j], p, points[(j + 1) % len]) == 0){
                    // console.log("onSegment", points[j], p, points[(j + 1) % len])
                    return onSegment(points[j], p, points[(j + 1) % len])
                }
                cnt++
            }
        }

        if(cnt % 2 == 0) return false
        else return true
    }
    checkInsideTrinagle = (top, left, right, x) => {
        let A = area(top, left, right)
        let A1 = area(x, left, right)
        let A2 = area(top, x, right)
        let A3 = area(top, left, x)
        let AA = A - A1 - A2 - A3
        // console.log(A, AA)

        if ( abs(AA) <= 1e-1 && !isEqual(x, top) && !isEqual(x, left) && !isEqual(x, right)){
            // console.log("true")
            return true
        }
        else return false
    }
    switch (shape) {
        case 'hex':
            let updown = 2.0 + (n - 1) * 3
            let leftright = n
            let farleft = 2 * n - 1
            this.center = from
            if (n == 1 || n == 2){
                for (i in tempAtoms){
                    if((
                    (tempAtoms[i].x - from[0]) * (tempAtoms[i].x - from[0]) +
                    (tempAtoms[i].y - from[1]) * (tempAtoms[i].y - from[1])
                    ) <= radius_squared){
                        this.atoms.push(tempAtoms[i])
                    }
                }
                break;
            }
            else{
                this.poly = [
                    {x: from[0] + leftright * this.dx - 0.25 * this.dx, y: from[1] + updown * this.dy},
                    {x: from[0] + farleft * this.dx + 0.5 * this.dx, y: from[1]},
                    {x: from[0] + leftright * this.dx - 0.25 * this.dx, y: from[1] - updown * this.dy},
                    {x: from[0] - leftright * this.dx + 0.25 * this.dx, y: from[1] - updown * this.dy},
                    {x: from[0] - farleft * this.dx - 0.5 * this.dx, y: from[1]},
                    {x: from[0] - leftright * this.dx + 0.25 * this.dx, y: from[1] + updown * this.dy},
                ]
            }
            for(i in tempAtoms){
                // if((
                //     (tempAtoms[i].x - from[0]) * (tempAtoms[i].x - from[0]) +
                //     (tempAtoms[i].y - from[1]) * (tempAtoms[i].y - from[1])
                //     ) <= radius_squared){
                //     this.atoms.push(tempAtoms[i])
                // }
                // this.atoms.push(tempAtoms[i])
                if(checkInsidePolygon(this.poly, tempAtoms[i], true)){
                    hexatoms.push(tempAtoms[i])
                }
            }
            break;
        case 'tri':
            let offset_lf = n + 2
            let offset_up = 2 * offset_lf
            if(n % 3 == 1){
                from[0] += this.dx
                from[1] -= this.dy
            }
            else if(n % 3 == 2){
                from[0] += this.dx
                from[1] += this.dy
            }
            this.center = from
            this.poly = [{
                    x: from[0],
                    y: from[1] - this.dy * offset_up
                },{
                    x: from[0] - this.dx * offset_lf,
                    y: from[1] + this.dy * offset_lf
                },{
                    x: from[0] + this.dx * offset_lf,
                    y: from[1] + this.dy * offset_lf
            }]

            for (i in tempAtoms){
                // console.log(i, tempAtoms[i])
                if(checkInsidePolygon(this.poly, tempAtoms[i], false)){
                    // console.log("i " + i)
                    // console.log(i, tempAtoms[i])
                    hexatoms.push(tempAtoms[i])
                    // console.log(this.atoms)
                }
            }
            break;
        default:
            break;
    }
    tempAtoms = []
    for (i in hexatoms)
        this.atoms.push(hexatoms[i])

    // Translate evrything to its center (of Gravity)
    this.trans_center = function(){
        for(i in this.atoms){
            this.atoms[i].x -= this.center[0]
            this.atoms[i].y -= this.center[1]
            for(j in this.atoms[i].neighbours){
                this.atoms[i].neighbours[j][0] -= this.center[0]
                this.atoms[i].neighbours[j][1] -= this.center[1]
            }
        }
    }
    this.un_center = function(){
        this.center = this.center.map(x => -x)
        this.trans_center()
    }

    this.re_center = function(a, b){
        this.un_center()
        this.center = [from[0] + a * this.dx , from[1] + b * this.dy]
        this.trans_center()
    }
    this.make_circle = function(r){
        r = r * this.dx
        let id_array = []
        for(i in this.atoms){
            if(this.atoms[i].x * this.atoms[i].x + this.atoms[i].y * this.atoms[i].y > r * r)
                id_array.push(i)
        }
        for(let id = 0; id < id_array.length; id++){
            this.atoms.splice(id_array[id] - id, 1)
        }
    }
    this.reset = function(){
        this.atoms = []
        for(i in hexatoms)
            this.atoms.push(hexatoms[i])
    }

    this.show = function(){
        for(i in this.atoms){
            if(this.atoms[i].x >= -(W / 2.0) &&
                this.atoms[i].x <= (W / 2.0) &&
                this.atoms[i].y >= -(H / 2) &&
                this.atoms[i].y <= (H / 2))
                this.atoms[i].show()
        }
    }
    this.trans_center()
}<file_sep># mos2 on hbn
Simulation of MoS2 growth on HBN
Originally aimed towards finding most stable interlayer distance and stacking angle

* Find minimum interlayer distance
* Plot theta - Energy graph by pressing on the play button beside the theta silder

* all incremental precision is controlled by precision controller

# Current Default
### n = 12, h = 30 (Moderate CPU usage)
```
B 2700, N 2700 per layer
Mo 432, S 864
```

# Side length | Number of atom
```
Side Length = n * 2 * bond_length
```
### MoS2
> 1.895 Ang. -> lateral distance

|n        |side-length |Number of Mo atoms |Number of S atoms |
|:-------:|:----------:|:-----------------:|:----------------:|
|12       |45.48       |432                |864               |
|||||

### HBN
> 1.45 Ang. -> Lateral distance

|n        |side-length |Number of B atoms  |Number of N atoms |
|:-------:|:----------:|:-----------------:|:----------------:|
|30       |87          |2700               |2700              |
|||||
<file_sep>let epsilon = [
    //            Mo      S      B      N
    //            1       2      3      4
    // meV
    [0, 0, 0, 0, 0],
/*Mo*/[0, 0, 0, 58.73, 72.56],
/*S */[0, 0, 0, 15.79, 19.51],
/*B */[0, 58.73, 15.79, 0, 0],
/*N */[0, 72.56, 19.51, 0, 0]
]
let sigma = [
    //       Mo      S      B      N
    //       1       2      3      4
    // A
    [0, 0, 0, 0, 0],
/*Mo*/[0, 0, 0, 3.002, 2.958],
/*S */[0, 0, 0, 3.411, 3.367],
/*B */[0, 3.002, 3.411, 0, 0],
/*N */[0, 2.958, 3.367, 0, 0]
]

let mos2_atom_types = [1, 2];
let hbn_atom_types = [3, 4]
let HBN_bilayer_interlayer_distance = 3.34
let HBN_layers = 2
let mos2_layers = 1
let mos2_bilayer_interlayer_distance = 3
let mos2_atom_type
let hbn_atom_type
function summation_part() {
    let internalEnergy = 0
    let iter = 0
    let ext = [0, 0]
    for(let mos2_layer = 1; mos2_layer <= mos2_layers; mos2_layer++){
        for (i in amos2.atoms) {
            // AB stacking - different type for different layer
            if(mos2_layer & 1){
                if (amos2.atoms[i].type == mos2_atom_types[1]) iter = 2, ext = [1, -1], mos2_atom_type = mos2_atom_types[1]
                else iter = 1, ext = [0, 0], mos2_atom_type = mos2_atom_types[0]
            }
            else{
                if (amos2.atoms[i].type == mos2_atom_types[1]) iter = 1, ext = [0, 0], mos2_atom_type = mos2_atom_types[0]
                else iter = 2, ext = [1, -1], mos2_atom_type = mos2_atom_types[1]
            }
            while (iter--) {
                // Multilayer-HBN
                for (let layer = 1; layer <= HBN_layers; layer++) {
                    for (j in ahbn.atoms) {
                        // console.log(distance(amos2.atoms[i], ahbn.atoms[j]))
                        // console.log(sigma[amos2.atoms[i].type][ahbn.atoms[j].type], distance(amos2.atoms[i], ahbn.atoms[j], ext[iter]))
                        // AA Stacking - same type for both layer
                        if(layer & 1){
                            if(ahbn.atoms[j].type == hbn_atom_types[0]) hbn_atom_type = hbn_atom_types[0]
                            else hbn_atom_type = hbn_atom_types[1]
                        }
                        else{
                            if(ahbn.atoms[j].type == hbn_atom_types[0]) hbn_atom_type = hbn_atom_types[0]
                            else hbn_atom_type = hbn_atom_types[1]
                        }

                        internalEnergy += 4 * epsilon[mos2_atom_type][hbn_atom_type] * (
                            pow(sigma[mos2_atom_type][hbn_atom_type] / distance(
                                                                                amos2.atoms[i],
                                                                                ahbn.atoms[j],
                                                                                ext[iter],
                                                                                layer),
                                12) -
                            pow(sigma[mos2_atom_type][hbn_atom_type] / distance(
                                                                                amos2.atoms[i],
                                                                                ahbn.atoms[j],
                                                                                ext[iter],
                                                                                layer),
                                6)
                        )
                    }
                }
            }
        }
    }
    // console.log(cnt)
    return internalEnergy
}

function distance(a, b, ext = 0, layer) {
    // console.log(ext)
    let h = h_slider.value() + ext * distance_between_S / 2 + (layer - 1) * HBN_bilayer_interlayer_distance

    let linear = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)
    linear /= multiplier * multiplier
    // console.log(linear)
    return (sqrt(linear + h * h))
}
<file_sep>let silder_padding = 300
let text_padding = 10
let seperator = 25
let value_padding = 525
let min_sum_val = +Infinity
let min_sum_h = 0
let min_sum_x = -Infinity
let min_sum_y = -Infinity

let auto_trac_on = false
let auto_rotate_on = false
let auto_lateral_on = false
let input_field
function create_elements(){
    // n slider
    n_slider_text = createP("<b>n = </b>")
    n_slider_text.position(text_padding, height + 10)
    n_slider_text.style('color', 'green')
    n_slider = createSlider(1, 16, 2, 1)
    n_slider.style('width', '200px')
    n_slider.position(silder_padding, height + seperator)
    n_slider_value_text = createP("" + n_slider.value())
    n_slider_value_text.style('color', 'orange')
    n_slider_value_text.position(value_padding, height + 10)
    n_slider_value_text.mouseOver(take_n_input)

    // h slider
    h_slider = createSlider(0, 10, 4.8, 1e-5)
    h_slider_text = createP("<b>h (Inter-layer Distance) = </b>")
    h_slider.position(silder_padding, height + seperator * 2)
    h_slider_text.position(text_padding, height + 10 + seperator)
    h_slider.style('width', '200px')
    h_slider_text.style('color', 'green')
    h_slider_value_text = createP("" + h_slider.value())
    h_slider_value_text.style('color', 'orange')
    h_slider_value_text.position(value_padding, height + 10 + seperator)
    h_slider_value_text.mouseOver(take_h_input)
}

function internal_energy(){
    // Internal Energy
    internal_energy_text = createP("Internal Energy = " + summation_part())
    internal_energy_text.position(silder_padding, height + 10 + seperator * 2)
    internal_energy_text.style('color', 'orange')
    internal_energy_text.style('font-family', "Fira Code")
}
function minimum_internal_energy(){
    // Trac Minimum
    minimum_internal_energy_text = createP("Minimum = ")
    minimum_internal_energy_text.position(silder_padding, height + 10 + seperator * 3)
    minimum_internal_energy_text.style('font-family', "Fira Code")
    minimum_internal_energy_text.mousePressed(() => h_slider.value(min_sum_h))

    reset_minimum_to_current = createImg('icons/reset.png', 'Set Minimum')
    reset_minimum_to_current.position(silder_padding - 25, height + seperator * 4)
    reset_minimum_to_current.style('width', '20px')
    reset_minimum_to_current.mousePressed(() => {min_sum_val = cur_internal_energy})

    auto_trac_button = createImg('icons/play.png', 'Find Auto Start/Pause')
    auto_trac_button.style('width', '20px')
    auto_trac_button.mousePressed(auto_with_precision)
    auto_trac_button.position(silder_padding - 25, height + seperator * 2)
}
function stacking_angle(){
    // Stacking Angle Slider
    theta_slider_text = createP("<b>𝜃</b> = ")
    theta_slider_text.position(text_padding, height + 10 + seperator * 4)
    theta_slider_text.style('color', 'green')

    theta_slider = createSlider(-360, 360, 0, 0.01)
    theta_slider.position(silder_padding, height + 5*seperator)
    theta_slider.style('width', '200px')
    theta_slider_value_text = createP("" + theta_slider.value())
    theta_slider_value_text.position(value_padding, height + 10 + seperator * 4)
    theta_slider_value_text.style('color', 'orange')
    theta_slider_value_text.mouseOver(take_theta_input)

    auto_rotate_button = createImg('icons/play.png', "Auto rotate")
    auto_rotate_button.style('width', '20px')
    auto_rotate_button.mousePressed(rotate_with_precision)
    auto_rotate_button.position(silder_padding - 25, height + seperator * 5)

    neg_rotate = createCheckbox("CC", false)
    neg_rotate.changed(counter_clockwise_rotation)
    neg_rotate.position(silder_padding - 75, height + seperator * 5)
}

function precision_controller(){
    precision_slider = createSlider(-10, 10, 1, 0.01)
    precision_slider.style('width', '400px')
    precision_slider.position(width - precision_slider.width * 0.35, 20 + precision_slider.width / 2)
    precision_slider.style('transform', 'rotate(-90deg)')

    precision_slider_value_text = createP("" + precision_slider.value())
    precision_slider_value_text.position(width + 57, 25 + precision_slider.width)
    precision_slider_value_text.style('color', 'red')
    precision_slider_value_text.style('font-size', '1.5em')
    precision_slider_value_text.mouseOver(take_precition_input)
}
function lateral_x(){
    x_slider = createSlider(-10, 10, -2, 1)
    x_slider.style('width', '200px')
    x_slider.position(silder_padding, height + 6 * seperator)

    auto_lateral_button = createImg('icons/play.png', "auto Lateral")
    auto_lateral_button.style('width', '20px')
    auto_lateral_button.mousePressed(move_hbn)
    auto_lateral_button.position(silder_padding - 25, height + seperator * 6)

}
function lateral_y(){
    y_slider = createSlider(-10, 10, -2, 1)
    y_slider.style('width', '200px')
    y_slider.position(silder_padding, height + 7 * seperator)

}
function one_time_button(){
    make_circle_button = createButton('HBN circle toggle', 'one')
    make_circle_button.position(width + 40, height - 20)
    make_circle_button.mousePressed(hbn_circle)
}

function checkbox(){
    show_checkbox = createCheckbox('Show', true)
    show_checkbox.changed(changeAnimaton)
    show_checkbox.position(width + 20, height - 20)
}

function hbn_circle(){
    ahbn.make_circle(16)
    make_circle_button.mousePressed(reset_hbn)
}
function reset_hbn(){
    ahbn.reset()
    make_circle_button.mousePressed(hbn_circle)
}
function changeAnimaton(){
    if(show_checkbox.checked()) showAnim = true
    else if(!show_checkbox.checked()) showAnim = false
}
function counter_clockwise_rotation(){
    if(neg_rotate.checked()) theta_inc = -1
    else if(!neg_rotate.checked()) theta_inc = +1
}
function plotter_texts(){
    axis_x_texts = [0, 60, 120]
    axis_y_texts = [min_sum_val - 100, min_sum_val + 200]

    axis_x_text = []
    for(i in axis_x_texts){

    }
}

function take_n_input(){
    if(input_field != null) input_field.remove()
    input_field = createInput("" + n_slider.value())
    input_field.position(value_padding, height + 22.5)
    input_field.changed(()=>{
        n_slider.value(input_field.value())
        input_field.remove()
    })
    input_field.mouseOut(() => {input_field.remove()})
}
function take_h_input(){
    if(input_field != null) input_field.remove()
    input_field = createInput("" + h_slider.value())
    input_field.position(value_padding, height + 22.5 + seperator)
    input_field.changed(()=>{
        h_slider.value(input_field.value())
        input_field.remove()
    })
    input_field.mouseOut(() => {input_field.remove()})
}
function take_theta_input(){
    if(input_field != null) input_field.remove()
    input_field = createInput("" + theta_slider.value())
    input_field.position(value_padding, height + 22.5 + seperator * 4)
    input_field.changed(() => {
        theta_slider.value(input_field.value())
        input_field.remove()
    })
    input_field.mouseOut(() => {input_field.remove()})
}
function take_precition_input(){
    if(input_field != null) input_field.remove()
    input_field = createInput("" + precision_slider.value())
    input_field.position(precision_slider_value_text.x, 22.5 + precision_slider_value_text.y)
    input_field.style('font-size', '1.5em')
    input_field.changed(() => {
        precision_slider.value(input_field.value())
        input_field.remove()
    })
    input_field.mouseOut(() => {input_field.remove()})
}

function update_dom_texts(){
    let h_val = h_slider.value()
    let x_val = x_slider.value()
    let y_val = y_slider.value()
    let sum_val = summation_part()
    let theta_val = theta_slider.value()

    cur_internal_energy = sum_val
    cur_theta = theta_val

    internal_energy_text.html("Internal Energy = " + sum_val)
    if(sum_val <= min_sum_val){
        min_sum_val = sum_val
        min_sum_h = h_val
        min_sum_theta = theta_val
        min_sum_x = x_val
        min_sum_y = y_val
        minimum_internal_energy_text.style('font-weight', 'normal')
        minimum_internal_energy_text.style('color', 'red')
    }
    else{
        minimum_internal_energy_text.style('font-weight', 'bold')
        minimum_internal_energy_text.style('color', 'magenta')
    }
    if(min_sum_h == 0) minimum_internal_energy_text.html("Undefined")
    else minimum_internal_energy_text.html(`Minimum = (${min_sum_h}, ${min_sum_theta}, [${min_sum_x}, ${min_sum_y}]) -> ${min_sum_val}`)

    // Update If automated
    if(auto_trac_on)
        h_slider.value(h_slider.value() + 0.0001 * precision_slider.value() * 100)
    if(auto_rotate_on)
        theta_slider.value(theta_slider.value() + theta_inc * 0.01 * precision_slider.value() * 10)

    if(auto_lateral_on){
        if(x_slider.value() == x_slider.elt.max && y_slider.value() == y_slider.elt.max){
            h_slider.value(h_slider.value() + 0.01 * precision_slider.value())
            x_slider.value(x_slider.elt.min)
            y_slider.value(y_slider.elt.min)
        }
        else if(y_slider.value() == y_slider.elt.max){
            x_slider.value(x_slider.value() + 1 * precision_slider.value())
            y_slider.value(y_slider.elt.min)
        }
        else
            y_slider.value(y_slider.value() + 1 * precision_slider.value())
    }

    n_slider_value_text.html("" + n_slider.value())
    h_slider_value_text.html("" + h_slider.value())
    theta_slider_value_text.html("" + theta_slider.value())
    precision_slider_value_text.html("" + precision_slider.value())

}

function auto_with_precision(){
    auto_trac_on = true
    auto_trac_button.mousePressed(stop_auto)
    auto_trac_button.elt.src = "icons/pause.png"
}
function stop_auto(){
    auto_trac_on = false
    auto_trac_button.mousePressed(auto_with_precision)
    auto_trac_button.elt.src = "icons/play.png"
}

function rotate_with_precision(){
    auto_rotate_on = true
    auto_rotate_button.mousePressed(stop_auto_rotate)
    auto_rotate_button.elt.src = "icons/pause.png"
}

function stop_auto_rotate(){
    auto_rotate_on = false
    auto_rotate_button.mousePressed(rotate_with_precision)
    auto_rotate_button.elt.src = "icons/play.png"
}
function move_hbn(){
    auto_lateral_on = true
    auto_lateral_button.mousePressed(stop_moving_hbn)
    auto_lateral_button.elt.src = "icons/pause.png"
}
function stop_moving_hbn(){
    auto_lateral_on = false
    auto_lateral_button.mousePressed(move_hbn)
    auto_lateral_button.elt.src = "icons/play.png"
}<file_sep>function molecule(type, x, y, posType, side_length)
{
    let mul = side_length * 2 / 30;
    this.type = type;
    this.x = x;
    this.y = y;

    this.neighbours = []

    for(i in posType){
        this.neighbours.push(
            [
                this.x + posType[i][0],
                this.y + posType[i][1]
            ])
    }
    // console.log(this.neighbours)
    switch (this.type) {
        case 1:
            this.diameter = 7 * mul
            this.color = [73, 17, 145]
            break;
        case 2:
            this.diameter = 7 * mul
            this.color = [201, 207, 37]
            break;
        case 3:
            this.diameter = 4 * mul
            this.color = [50, 148, 15]
            break;
        case 4:
            this.diameter = 4 * mul
            this.color = [200, 200, 200]
            break;
        default:
            this.diameter = 3 * mul
            this.color = [0, 0, 0]
            break;
    }

    this.show = function(side_length){
        strokeWeight(0.2)
        fill(this.color)
        // console.log(this.type, this.x, this.y, this.diameter)
        circle(this.x, this.y, this.diameter)

        // Draw Bonds
        strokeWeight(this.diameter * 0.25)
        stroke(this.color)
        for(i in this.neighbours){
            mid_x = (this.x + this.neighbours[i][0]) / 2
            mid_y = (this.y + this.neighbours[i][1]) / 2

            line(this.x, this.y, mid_x, mid_y)
        }

    }
}<file_sep>let amos2
let distance_between_S = 3.01
let bn_bond_length = 1.45
let mos_distance = 2.42
let mos_bond_length = Math.sqrt(mos_distance * mos_distance - distance_between_S * distance_between_S / 4)
// let HBN_bilayer_interlayer_distance = 3.34
let multiplier = 15
let tx_03 = [0, 1, -1]
let ty_03 = [-2, 1, 1]

let tx_14 = [0, 1, -1]
let ty_14 = [2, -1, -1]

let temp_postype
let old_value = -1
let old_theta_value = -1
let plotCanvas
let n_pos = [0, 3, 3, 4, 3, 3, 4, 4, 3, 3, 4, 4, 3, 3, 4, 4, 3, 3, 4, 4]
let W, H
let cur_internal_energy = 0, cur_theta = 0
let showAnim = true
let theta_inc = 1
let gb_anchor = [0,0]
function setup() {
	createCanvas(600, 600);
	W = width
	H = height
	plotCanvas = new p5(plotSketch)
    angleMode(DEGREES)
    // mos2_hex(n, side_legth)
    // Mo(3n^2) S(6n^2)
    // Mo-S bond length = 2.383
    // on Mo plane .. horizontal component = sqrt(2.383^2 - 3.01^2)
    // B-N bond length = 1.45
    // taking 2.383 as 30
    create_elements()

    amos2 = new mos2_hex(n_slider.value(), multiplier * mos_bond_length, 'hex')
	console.log(amos2.atoms)
	// console.log(old_value)
    // console.log(amos2.atoms)

    // Substrate_Size = 3 * n * n
    // just to make the work flow.. like MoS2
    ahbn = new hbn_hex(10, multiplier * bn_bond_length, 'hex') // Substrate size = n -> n x n points
    // On which atom? H or N

    internal_energy()
    minimum_internal_energy()
	stacking_angle()
	precision_controller()
	lateral_x()
	lateral_y()
	checkbox()
	one_time_button()
}

function draw() {

	if(old_value != n_slider.value()){
		amos2 = new mos2_hex(n_slider.value(), multiplier * mos_bond_length, 'hex')
		old_value = n_slider.value()
		switch (n_pos[old_value]) {
		case 3:
			ahbn.re_center(-1, 1)
			break;
		case 4:
			ahbn.re_center(-1, -1)
			break;
		default:
			break;
		}

		min_sum_val = +Infinity
		min_sum_h = 0
		plotCanvas.reset()
	}
	ahbn.re_center(x_slider.value(), y_slider.value())

	if(old_theta_value != theta_slider.value()){
		amos2.rotate_with(theta_slider.value(), gb_anchor)
		old_theta_value = theta_slider.value()
	}

	update_dom_texts()
	background(255);
	translate(width / 2, height / 2)

	if(showAnim){
		ahbn.show()
		amos2.show()
	}
	fill(0,0,0)

	// amos2.drawShape()
	circle(amos2.atoms[0])
}

branch_name: refs/heads/main


text:
<file_sep>#include<cstdlib>
#include<cstring>
#include<cstdio>

char type[6][4]=
{
	"BCG","BGC","CBG",
	"CGB","GBC","GCB"
};

int table[6][9]=
{
	0,1,1, 1,1,0, 1,0,1,
	0,1,1, 1,0,1, 1,1,0,
	1,1,0, 0,1,1, 1,0,1,
	1,1,0, 1,0,1, 0,1,1,
	1,0,1, 0,1,1, 1,1,0,
	1,0,1, 1,1,0, 0,1,1
};

int data[9];

int main()
{
	while(scanf("%d",&data[0])!=EOF)
	{
		int Min=0,spa=1;
		for(int i=1;i<9;++i)
		{
			scanf("%d",&data[i]);
			Min+=data[i];
		}
		for(int i=0;i<6;++i)
		{
			int sum=0;
			for(int j=0;j<9;++j)
				sum+=data[j]*table[i][j];
			if(sum<Min)
			{
				Min=sum;
				spa=i;
			}
		}
		printf("%s %d\n",type[spa],Min);
	}
	return 0;
}


text:
<file_sep>#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

#define CE_PIN   9
#define CSN_PIN 10
#define Interrupt_pin 3
const uint64_t pipe = 0xE8E8F0F0E1LL; //0xE8E8F0F0E1LL 0xF0F0F0F0E1LL
RF24 radio(CE_PIN, CSN_PIN);
float force,fsr[4];
volatile int i;

#define Debug Serial
double load,min_load,max_load;
double prev_load;
double weightScale;
void setup() {
  // put your setup code here, to run once:
  i = 0;
  Serial.begin(9600);
  Serial.println("Starting");
  //pinMode(Interrupt_pin, INPUT);
  radio.begin();
  radio.openWritingPipe(pipe);
  //attachInterrupt(digitalPinToInterrupt(Interrupt_pin), transmit, CHANGE);
//  myCalibDebug();
}

void loop() {
  // put your main code here, to run repeatedly:
  load=8;
  Serial.print("Zaki: ");
//  calculateLoad();
  //radio.powerUp();
//  radio.begin();
//  radio.openWritingPipe(pipe);
  Serial.print("Load: ");
  Serial.println(load);
  fsr[0]=8;
  fsr[1]=4;
  fsr[2]=2;
  fsr[3]=10;
 // Serial.print(fsr[0]);
 // Serial.print(fsr[1]);
 // if (i == 1)
  //{
  radio.powerUp();
  Serial.println("Powered UP");
  delay(1000);

  bool okok = radio.write(fsr,sizeof(fsr));
  if(okok)
  {
    Serial.println("Writing Done");
  }
  else
  {
    Serial.println("Writing Failed");
  }
  radio.powerDown();
  Serial.println("Powered Down");
  //delay(1000);
  i = 0;
  //}
}

void transmit()
{
  i = 1;
}

/*void myCalibDebug() {
  char debug_response[10],debug_read;
  unsigned int i=0;
  memset(debug_response,'\0',10);

  Debug.println("Enter the minumum load.");
  i=0;
  while(1){
    if(Debug.available()){
      debug_read=Debug.read();
      if(debug_read!='\n'){
        debug_response[i]=(char)debug_read;
        i++;
      }
      else {
        break;
      }
    }
  }
  Debug.print("Minimum load set to: ");
  min_load=atof(debug_response);
  Debug.println(min_load);
  scale.power_up();
  scale.set_scale();
  scale.tare();
  memset(debug_response,'\0',10);
  Debug.println("Enter the maximum load.");
  i=0;
  while(1){
    if(Debug.available()){
      debug_read=Debug.read();
      if(debug_read!='\n'){
        debug_response[i]=(char)debug_read;
        i++;
      }
      else {
        break;
      }
    }
  }
  Debug.print("Maximum load set to: ");
  max_load=atof(debug_response);
  Debug.println(max_load);
  weightScale = scale.get_units(10)/(((max_load-min_load)*1000));
  scale.set_scale(weightScale);
  scale.power_down();
  Debug.println("Calibration done");
}*/

/*void calculateLoad(){
  scale.power_up();
  load = scale.get_units(20);
  load = load / 1000;
//  if(debug) Debug.print("Raw load: ");
//  if(debug) Debug.println(load);
  load = load + min_load;
  if(load<0) load = 0;
//  if(debug) Debug.println(load);

  scale.power_down();
}*/

/*
void calculateLoad(){
  scale.power_up();
  load = scale.get_units(20);
  load = load/1000;
  if(load<0) load = 0.00;
  scale.power_down();
}
void calibrateLoad(){
  scale.power_up();
  while(1){
    Serial.println("Kindly put 0 Kg weight, waiting for 'done'.");
    if(Serial.available()){
      if(Serial.read() == 'd'){
        break;
      }
    }
    delay(1000);
  }
  scale.set_scale();
  scale.tare();
  while(1){
    Serial.println("Kindly put a 1 Kg weight, waiting for 'done'.");
    if(Serial.available()){
      if(Serial.read() == 'd'){
        Serial.println(scale.get_units(10), 1);
        Serial.print("Scale set to: ");
        Serial.println(scale.get_units(10)/1000);
        scale.set_scale(scale.get_units(10)/1000);
        break;
      }
    }
    delay(1000);
  }
  scale.power_down();
}

*/
<file_sep># nrf24l01
Interfacing of nrf24l01 with atmega8 with arduino bootloader
<file_sep>/* YourDuinoStarter Example: nRF24L01 Receive Joystick values

 - WHAT IT DOES: Receives data from another transceiver with
   2 Analog values from a Joystick or 2 Potentiometers
   Displays received values on Serial Monitor
 - SEE the comments after "//" on each line below
 - CONNECTIONS: nRF24L01 Modules See:
 http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
   1 - GND
   2 - VCC 3.3V !!! NOT 5V
   3 - CE to Arduino pin 9
   4 - CSN to Arduino pin 10
   5 - SCK to Arduino pin 13
   6 - MOSI to Arduino pin 11
   7 - MISO to Arduino pin 12
   8 - UNUSED

 - V1.00 11/26/13
   Based on examples at http://www.bajdi.com/
   Questions: <EMAIL> */

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
/*-----( Declare Constants and Pin Numbers )-----*/
#define CE_PIN   9
#define CSN_PIN 10

const uint64_t pipe = 0xE8E8F0F0E1LL;

RF24 radio(CE_PIN, CSN_PIN); // Create a Radio

float fsr[4];
int i;
String reply;
String OK = "OK";

void setup()
{
  Serial.begin(9600);
  Serial.println(F("\n------Starting------\n"));
  //delay(1000);
  radio.begin();
  radio.openReadingPipe(1,pipe);
  radio.startListening();
}

void loop()
{
  //Serial.println("here");
  if (radio.available())
  {
    Serial.println("here");
    Serial.println(radio.available());
    delay(500);
    // Read the data payload until we've received everything
    bool done = false;
    //while (radio.available())
    //{
      // Fetch the data payload
      Serial.println("here_loop");
       radio.read(fsr, sizeof(fsr));
      for(i=0;i<4;i++){
        //if(fsr[3] == 10){
            //Serial.print("Battery = ");
            Serial.println(fsr[i]);
        //}
      }
    //}
  }
  else
  {
      Serial.println("No radio available");
      Serial.println(radio.available());
  }
}

int subStr(String reply, String OK)
{
  int i = 0;
  while(i<reply.length())
  {
    if (reply[i]==OK[0])
      {
        if (reply[i+1] = OK[1])
          return 1;
      }
     i = i+1;
  }
  return 0;
}

void giveCmd(String cmd)
{
  while(1)
  {
    Serial.println(cmd);
    delay(1500);
    reply = Serial.readString();
    if(subStr(reply,OK))
      break;
  }
}

void giveCmd_slow(String cmd)
{
  while(1)
  {
    Serial.println(cmd);
    delay(5000);
    reply = Serial.readString();
    if(subStr(reply,OK))
      break;
  }
}

void giveCmd_fast(String cmd)
{
  String DO = "DO";

  while(1)
  {
    Serial.println(cmd);
    delay(500);
    reply = Serial.readString();
    if(subStr(reply,DO))
      break;
  }
}

languages: Markdown C++


text:
<repo_name>aagreda/FriendFinder<file_sep>/README.md
# FriendFinder
Its an application that uses both frontend and backend technology to take user input and compare results to match users together. Basically a dating app. This full-stack site will take in results your users' surveys, then compare their answers with those from other users. The app will then display the name and picture of the user with the best overall match.

repo_name: aagreda/FriendFinder


text:
<repo_name>ReginaDiloyy/G3D<file_sep>/global3d/LoginForm.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using FireSharp.Config;
using FireSharp.Response;
using FireSharp.Interfaces;

namespace global3d
{
    public partial class LoginForm : Form
    {
        public LoginForm()
        {
            InitializeComponent();
        }

        IFirebaseConfig ifc = new FirebaseConfig()
        {
            AuthSecret = "<KEY>",
            BasePath = "https://g3dproj-default-rtdb.firebaseio.com/"
        };

        IFirebaseClient client;

        private void LoginForm_Load(object sender, EventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(ifc);
            }

            catch
            {
                MessageBox.Show("Connection fo Firebase Failed");
            }
        }

        private void btnRegister_Click(object sender, EventArgs e)
        {
            Register reg = new Register();
            reg.ShowDialog();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            #region Condition
            if (string.IsNullOrWhiteSpace(txtUsername.Text) && string.IsNullOrWhiteSpace(txtPassword.Text))

            {
                MessageBox.Show("Please fill all fields");
                return;
            }
            #endregion

            FirebaseResponse res = client.Get("Users/" + txtUsername.Text);
            Users ResUser = res.ResultAs<Users>();

            Users CurUser = new Users()
            {
                Username = txtUsername.Text,
                Password = <PASSWORD>
            };

            if(Users.IsEqual(ResUser,CurUser))
            {
                this.Hide();
                Home homepage = new Home();
                homepage.ShowDialog();
            }

            else
            {
                Users.ShowError();
            }
        }
    }
}
<file_sep>/g3d database (ver 1)/Registration.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FireSharp.Config;
using FireSharp.Response;
using FireSharp.Interfaces;

namespace G3Dsys_database
{
    public partial class Registration : Form
    {
        IFirebaseConfig ifc = new FirebaseConfig()
        {
            //BORIS FIREBASE
            //AuthSecret = "<KEY>",
            //BasePath = "https://g3dsys-database-default-rtdb.asia-southeast1.firebasedatabase.app/"

            //REG FIREBASE
            AuthSecret = "<KEY>",
            BasePath = "https://g3dproj-default-rtdb.firebaseio.com/"
        };

        IFirebaseClient client;

        private void Registration_Load(object sender, EventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(ifc);
            }

            catch
            {
                MessageBox.Show("No Internet Connection Problem");
            }
        }
        public Registration()
        {
            InitializeComponent();
        }

        private void regBTN_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(regUserTxt.Text) &&
                string.IsNullOrWhiteSpace(regPassTxt.Text) &&
                string.IsNullOrWhiteSpace(regNameTxt.Text) &&
                string.IsNullOrWhiteSpace(regIDTxt.Text))
            {
                MessageBox.Show("Please fill all the fields");
                return;
            }
            MyUser user = new MyUser()
            {
                Username = regUserTxt.Text,
                Password = <PASSWORD>,
                Name = regNameTxt.Text,
                numberID = regIDTxt.Text
            };

            SetResponse set = client.Set(@"Users/" +regUserTxt.Text, user);

            MessageBox.Show("Successfully register!");
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
<file_sep>/g3d database (ver 1)/Upload.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FireSharp.Config;
using FireSharp.Response;
using FireSharp.Interfaces;
using System.IO;
using Firebase.Storage;
using Firebase;

namespace G3Dsys_database
{
    public partial class Upload : Form
    {
        public Upload()
        {
            InitializeComponent();
        }

        IFirebaseConfig ifc = new FirebaseConfig()

        {
            //BORIS FIREBASE
            //AuthSecret = "<KEY>",
            //BasePath = "https://g3dsys-database-default-rtdb.asia-southeast1.firebasedatabase.app/"

            //REG FIREBASE
            AuthSecret = "<KEY>",
            BasePath = "https://g3dproj-default-rtdb.firebaseio.com/"
        };

        IFirebaseClient client;

        private async void Upload_Load(object sender, EventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(ifc);
            }

            catch
            {
                MessageBox.Show("No Internet Connection Problem");
            }

            // Get any Stream — it can be FileStream, MemoryStream or any other type of Stream
            var stream = File.Open(@"C:\file.dwg", FileMode.Open);

            // Construct FirebaseStorage with path to where you want to upload the file and put it there
            var task = new FirebaseStorage("g3dproj.appspot.com")
             .Child("DWG Files")
             .Child("file.dwg")
             .PutAsync(stream);

            // Track progress of the upload
            task.Progress.ProgressChanged += (s, a) => Console.WriteLine($"Progress: {a.Percentage} %");

            // Await the task to wait until upload is completed and get the download url
            //var downloadUrl = await task;

            var downloadUrl = await task;
            Console.WriteLine(downloadUrl);

            MessageBox.Show(downloadUrl);

        }

    }
}
<file_sep>/global3d/Home.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using FireSharp.Config;
using FireSharp.Response;
using FireSharp.Interfaces;
using Newtonsoft.Json;

namespace global3d
{
    public partial class Home : Form
    {
        IFirebaseConfig ifc = new FirebaseConfig()
        {
            AuthSecret = "<KEY>",
            BasePath = "https://g3dproj-default-rtdb.firebaseio.com/"
        };

        IFirebaseClient client;
        public Home()
        {
            InitializeComponent();
        }

        private void btnLogout_Click(object sender, EventArgs e)
        {
            this.Hide();
            LoginForm logout = new LoginForm();
            logout.ShowDialog();
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            AddProduct add = new AddProduct();
            add.ShowDialog();
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            FirebaseResponse resRef = client.Get("Information/");
            Dictionary<string, Information> data = JsonConvert.DeserializeObject<Dictionary<string, Information>>(resRef.Body.ToString());
            PopulateDataGrid(data);
        }

        void PopulateDataGrid(Dictionary<string, Information> record)
        {
            dataGridView1.Rows.Clear();
            dataGridView1.Columns.Clear();

            dataGridView1.Columns.Add("Name", "Name");
            dataGridView1.Columns.Add("PartNumber", "Part Number");
            dataGridView1.Columns.Add("Description", "Description");
            dataGridView1.Columns.Add("UnitPrice", "Unit Price");
            dataGridView1.Columns.Add("Invoice", "Invoice");
            dataGridView1.Columns.Add("UnitStock", "Unit Stock");
            dataGridView1.Columns.Add("DesignStatus", "Design Status");
            dataGridView1.Columns.Add("SpecsStatus", "Specs Status");
            dataGridView1.Columns.Add("Remarks", "Remarks");

            foreach (var item in record)
            {
                dataGridView1.Rows.Add(item.Key, item.Value.Name, item.Value.PartNumber,
                    item.Value.Description, item.Value.UnitPrice, item.Value.UnitStock,
                    item.Value.DesignStatus, item.Value.SpecsStatus, item.Value.Remarks);
            }
        }

        private void Home_Load(object sender, EventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(ifc);
            }

            catch
            {
                MessageBox.Show("Connection fo Firebase Failed");
            }
        }

       private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            View viewProduct = new View();

            viewProduct.txtName.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();
            viewProduct.txtPartNumber.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString();
            viewProduct.txtDescription.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString();
            viewProduct.txtUnitPrice.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString();
            viewProduct.txtInvoice.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString();
            viewProduct.txtUnitStock.Text = dataGridView1.CurrentRow.Cells[5].Value.ToString();
            viewProduct.txtDesignStatus.Text = dataGridView1.CurrentRow.Cells[6].Value.ToString();
            viewProduct.txtSpecsStatus.Text = dataGridView1.CurrentRow.Cells[7].Value.ToString();
            viewProduct.txtRemarks.Text = dataGridView1.CurrentRow.Cells[8].Value.ToString();

            viewProduct.ShowDialog();
        }

        private void dataGridView1_Click(object sender, EventArgs e)
        {
            /*
            AddProduct viewProduct = new AddProduct();
            viewProduct.txtName.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();
            viewProduct.txtPartNumber.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString();

            viewProduct.ShowDialog(); */
        }
    }
}
<file_sep>/g3d database (ver 1)/Files.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace G3Dsys_database
{
    class Files
    {
        public string dwgFiles { get; set; }
    }
}
<file_sep>/g3d database (NEW)-20210730T070948Z-001/g3d database (NEW)/EditItem.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FireSharp.Config;
using FireSharp.Response;
using FireSharp.Interfaces;
using System.IO;
using Firebase.Storage;

namespace G3Dsys_database
{
    public partial class EditItem : Form
    {
        public EditItem()
        {
            InitializeComponent();
        }

        IFirebaseConfig ifc = new FirebaseConfig()
        {
            //BORIS FIREBASE
            //AuthSecret = "<KEY>",
            //BasePath = "https://g3dsys-database-default-rtdb.asia-southeast1.firebasedatabase.app/"

            //REG FIREBASE
            AuthSecret = "<KEY>",
            BasePath = "https://g3dproj-default-rtdb.firebaseio.com/"
        };

        IFirebaseClient client;

        private void EditItem_Load(object sender, EventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(ifc);
            }

            catch
            {
                MessageBox.Show("No Internet Connection Problem");
            }

        }

        private void AddSaveBtn_Click(object sender, EventArgs e)
        {

            var items = new AddItem
            {
                ItemName = EditNameTxt.Text,
                Part = EditPartTxt.Text,
                Description = EditDescTxt.Text,
                Price = EditPriceTxt.Text,
                Stock = EditStockTxt.Text,
                Design = EditDesignTxt.Text,
                Specs = EditSpecsTxt.Text,
                Remarks = EditRemarksTxt.Text,
                Invoice = EditInvoiceTBox.Text //dont change
            };
           // SaveFile(AdduploadTxt.Text);

            FirebaseResponse updateResponse = client.Update("ItemList/Items/" + EditInvoiceTBox.Text, items);

            MessageBox.Show("Update Successfully!");

            this.Hide();
            mainFRM main = new mainFRM();
            main.ShowDialog();
            this.Close();
        }

        void ClearText()
        {
            EditNameTxt.Clear();
            EditPartTxt.Clear();
            EditDescTxt.Clear();
            EditPriceTxt.Clear();
            EditStockTxt.Clear();
            EditDesignTxt.Clear();
            EditSpecsTxt.Clear();
            EditRemarksTxt.Clear();
        }

        public async void SaveFile(string filepath)
        {
            AddItem add1 = new AddItem();

            // *************** NEW UPLOAD *****
            var stream = File.OpenRead(filepath);

            var task = new FirebaseStorage("g3dproj.appspot.com")
             .Child("DWG Files")
             .Child(filepath)
             .PutAsync(stream);

            task.Progress.ProgressChanged += (s, a) => Console.WriteLine($"Progress: {a.Percentage} %");

            var downloadUrl = await task;
            Console.WriteLine(downloadUrl);

            MessageBox.Show(downloadUrl);
            ClearText();

            this.Hide();
            mainFRM home = new mainFRM();
            home.ShowDialog();
            this.Close();

        }

        private void CloseLbl_Click(object sender, EventArgs e)
        {
            this.Hide();
            mainFRM main = new mainFRM();
            main.ShowDialog();
            this.Close();
        }

        private void CloseLbl_MouseMove(object sender, MouseEventArgs e)
        {
            this.Cursor = Cursors.Hand;
        }

        private void CloseLbl_MouseLeave(object sender, EventArgs e)
        {
            this.Cursor = Cursors.Arrow;
        }

        private void BrowseBtn_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg2 = new OpenFileDialog();
            dlg2.ShowDialog();
            AdduploadTxt.Text = dlg2.FileName;
        }
    }
}
<file_sep>/g3d database (NEW)-20210730T070948Z-001/g3d database (NEW)/mainFRM.cs
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FireSharp.Config;
using FireSharp.Response;
using FireSharp.Interfaces;

namespace G3Dsys_database
{
    public partial class mainFRM : Form
    {
        public mainFRM()
        {
            InitializeComponent();
        }

        IFirebaseConfig ifc = new FirebaseConfig()
        {
            //BORIS FIREBASE
            //AuthSecret = "<KEY>",
            //BasePath = "https://g3dsys-database-default-rtdb.asia-southeast1.firebasedatabase.app/"

            //REG FIREBASE
            AuthSecret = "<KEY>",
            BasePath = "https://g3dproj-default-rtdb.firebaseio.com/"
        };

        IFirebaseClient client;

        private void mainFRM_Load(object sender, EventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(ifc);
            }

            catch
            {
                MessageBox.Show("No Internet Connection Problem");
            }

            DGrid();
        }

        DataTable dt = new DataTable();

        private void pictureBox2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        private void mainFRM_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult dialog = MessageBox.Show("Do you really want to logout?", "Exit", MessageBoxButtons.YesNo);
            if (dialog == DialogResult.Yes)
            {
                Application.ExitThread();
            }

            else if (dialog == DialogResult.No)
            {
                e.Cancel = true;
            }
        }

        private void pictureBox2_MouseMove(object sender, MouseEventArgs e)
        {
           this.Cursor = Cursors.Hand;
        }
        private void pictureBox2_MouseLeave(object sender, EventArgs e)
        {
            this.Cursor = Cursors.Arrow;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            Add_Item additional = new Add_Item();
            additional.ShowDialog();
            this.Close();

        }

        public void DGrid()
        {

            try
            {

                dt.Columns.Add("Part Number");
                dt.Columns.Add("Specs Status");
                dt.Columns.Add("Design Status");
                dt.Columns.Add("Description");
                dt.Columns.Add("Name of Item");
                dt.Columns.Add("Price");
                dt.Columns.Add("Stock");
                dt.Columns.Add("Remarks");
                dt.Columns.Add("Invoice");

                //dataGridView1.Rows.Clear();
                FirebaseResponse response = client.Get("ItemList/Items");
                Dictionary<string, AddItem> getAddItem = response.ResultAs<Dictionary<string, AddItem>>();

                foreach (var get in getAddItem)
                {
                    dt.Rows.Add(
                        get.Value.Part,
                        get.Value.Specs,
                        get.Value.Design,
                        get.Value.Description,
                        get.Value.ItemName,
                        get.Value.Price,
                        get.Value.Stock,
                        get.Value.Remarks,
                        get.Value.Invoice
                        );
                }

                DataView dv = new DataView(dt);
                dataGridView1.DataSource = null;
                dataGridView1.Rows.Clear();
                dataGridView1.Columns.Clear();
                dataGridView1.DataSource = dv;
                dataGridView1.Columns[0].Width = 300; //Part Number
                dataGridView1.Columns[1].Width = 200; //Specs Status
                dataGridView1.Columns[2].Width = 100; //Design Status
                dataGridView1.Columns[3].Width = 548; //Description
                dataGridView1.Columns[4].Visible = false; //Name of Item
                dataGridView1.Columns[5].Visible = false; //Price
                dataGridView1.Columns[6].Visible = false; //Stock
                dataGridView1.Columns[7].Visible = false; //Remarks
                dataGridView1.Columns[8].Width = 548; //Invoice
            }

            catch
            {
                MessageBox.Show("No Data");
            }

        }
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {

            ItemDetails details = new ItemDetails();
            details.Namelbl.Text = this.dataGridView1.CurrentRow.Cells[4].Value.ToString(); // Name
            details.Partlbl.Text = this.dataGridView1.CurrentRow.Cells[0].Value.ToString(); //Part no
            details.Pricelbl.Text = this.dataGridView1.CurrentRow.Cells[5].Value.ToString(); //price
            details.Stocklbl.Text = this.dataGridView1.CurrentRow.Cells[6].Value.ToString(); //stock
            details.Specslbl.Text = this.dataGridView1.CurrentRow.Cells[1].Value.ToString(); //specs
            details.Designlbl.Text = this.dataGridView1.CurrentRow.Cells[2].Value.ToString(); //design
            details.DescriptionTBox.Text = this.dataGridView1.CurrentRow.Cells[3].Value.ToString(); //description
            details.RemarksTBox.Text = this.dataGridView1.CurrentRow.Cells[7].Value.ToString(); //remarks
            details.InvoiceTBox.Text = this.dataGridView1.CurrentRow.Cells[8].Value.ToString(); //invoice

            this.Hide();
            details.ShowDialog();
            this.Close();

        }

        private void SearchTxt_TextChanged(object sender, EventArgs e)
        {
            string searchValue = SearchTxt.Text;
            try
            {
                var re = from row in dt.AsEnumerable()
                         where row[0].ToString().Contains(searchValue) //Search by Part Number
                         select row;
                if (re.Count() == 0)
                {
                    MessageBox.Show("No match found");
                }
                else
                {
                    dataGridView1.DataSource = re.CopyToDataTable();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

    }
}
<file_sep>/global3d/DWG.cs
using System;
using System.Collections.Generic;
using System.Text;

namespace global3d
{
    class DWG
    {
        public string DWGFile { get; set; }
    }

}
<file_sep>/g3d database (ver 1)/AddItem.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace G3Dsys_database
{
    class AddItem
    {
        public string ItemName { get; set; }
        public string Part { get; set; }
        public string Description { get; set; }
        public string Price { get; set; }
        public string Stock { get; set; }
        public string Design { get; set; }
        public string Specs { get; set; }
        public string Remarks { get; set; }
        public string Invoice { get; set; }

    }
}
<file_sep>/g3d database (ver 1)/Add Item.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FireSharp.Config;
using FireSharp.Response;
using FireSharp.Interfaces;
using System.IO;
using Firebase.Storage;

namespace G3Dsys_database
{
    public partial class Add_Item : Form
    {
        public Add_Item()
        {
            InitializeComponent();
        }

        IFirebaseConfig ifc = new FirebaseConfig()

        {
            //BORIS FIREBASE
            //AuthSecret = "<KEY>",
            //BasePath = "https://g3dsys-database-default-rtdb.asia-southeast1.firebasedatabase.app/"

            //REG FIREBASE
             AuthSecret = "<KEY>",
             BasePath = "https://g3dproj-default-rtdb.firebaseio.com/"
        };

        IFirebaseClient client;

        private void Add_Item_Load(object sender, EventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(ifc);
            }

            catch
            {
                MessageBox.Show("No Internet Connection Problem");
            }
        }

        private void CloseLbl_MouseMove(object sender, MouseEventArgs e)
        {
            this.Cursor = Cursors.Hand;
        }

        private void CloseLbl_MouseLeave(object sender, EventArgs e)
        {
            this.Cursor = Cursors.Arrow;
        }

        private void CloseLbl_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private async void AddSaveBtn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(AddNameTxt.Text) &&
                string.IsNullOrWhiteSpace(AddPartTxt.Text) &&
                string.IsNullOrWhiteSpace(AddDescTxt.Text) &&
                string.IsNullOrWhiteSpace(AddPriceTxt.Text) &&
                string.IsNullOrWhiteSpace(AddStockTxt.Text) &&
                string.IsNullOrWhiteSpace(AddDesignTxt.Text) &&
                string.IsNullOrWhiteSpace(AddSpecsTxt.Text) &&
                string.IsNullOrWhiteSpace(AddRemarksTxt.Text))
            {
                MessageBox.Show("Please fill all the fields");
                return;
            }

// AUTO INVOICE *******************************************************
            FirebaseResponse Addresponse = client.Get("ItemList/Invoice/id");
            InvoiceID get = Addresponse.ResultAs<InvoiceID>(); //0

////////////////// ****************************************************

            AddItem add = new AddItem()
            {
                Invoice = (Convert.ToInt32(get.cnt)+1).ToString("D5"),
                ItemName = AddNameTxt.Text,
                Part = AddPartTxt.Text,
                Description = AddDescTxt.Text,
                Price = AddPriceTxt.Text,
                Stock = AddStockTxt.Text,
                Design = AddDesignTxt.Text,
                Specs = AddSpecsTxt.Text,
                Remarks = AddRemarksTxt.Text

            };

            var setter = client.Set("ItemList/Items/" + add.Invoice, add);

            //DOWNLOAD

            var downloadUrl = await SaveFile(AdduploadTxt.Text);

            Files dl = new Files()
            {
                dwgFiles = downloadUrl
            };

            var setter2 = client.Set("Files/" + add.Invoice, dl);

            // INVOICE ID
            var obj = new InvoiceID
            {
                cnt = add.Invoice
            };
            var setter1 = client.Set("ItemList/Invoice/id", obj);

            //////////////////////////////////////// upload FILE      ////////////////////////////////////////////////////////////
            //SaveFile(AdduploadTxt.Text);
            AddItem add1 = new AddItem();
            Files files1 = new Files();

            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            MessageBox.Show("     Item inserted succsessfully!" +Environment.NewLine + "                " +
                "Invoice: " + add.Invoice);
            ClearText();
        }

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public async Task<String> SaveFile(string filepath)
        {
            //AddItem add1 = new AddItem();

            // *************** NEW UPLOAD *****
            var stream = File.OpenRead(filepath);

            var task = new FirebaseStorage("g3dproj.appspot.com")
             .Child("DWG Files")
             .Child(filepath)
             .PutAsync(stream);

            task.Progress.ProgressChanged += (s, a) => Console.WriteLine($"Progress: {a.Percentage} %");

            var downloadUrl = await task;
            Console.WriteLine(downloadUrl);

            MessageBox.Show(downloadUrl);
            ClearText();

            this.Hide();
            mainFRM home = new mainFRM();
            home.ShowDialog();
            this.Close();

            return downloadUrl;

        }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        void ClearText()
        {
            AddNameTxt.Clear();
            AddPartTxt.Clear();
            AddDescTxt.Clear();
            AddPriceTxt.Clear();
            AddStockTxt.Clear();
            AddDesignTxt.Clear();
            AddSpecsTxt.Clear();
            AddRemarksTxt.Clear();
        }

// ************************ NUMBERS ONLY ACCEPTED *************************************
        private void AddPriceTxt_KeyPress(object sender, KeyPressEventArgs e)
        {
            char ch = e.KeyChar;

            if (!Char.IsDigit(ch) && ch!=8 ) //8=backspace key,
            {
                e.Handled = true;
                MessageBox.Show("Invalid Input!");
            }

        }
        private void AddStockTxt_KeyPress(object sender, KeyPressEventArgs e)
        {
            char ch = e.KeyChar;

            if (!Char.IsDigit(ch) && ch != 8) //8=backspace key,
            {
                e.Handled = true;
                MessageBox.Show("Invalid Input!");
            }
        }

        private void BrowseBtn_Click(object sender, EventArgs e)
        {

            OpenFileDialog dlg = new OpenFileDialog();
            dlg.ShowDialog();
            AdduploadTxt.Text = dlg.FileName;

        }

        private void btnFile_Click(object sender, EventArgs e)
        {
            //SaveFile(AdduploadTxt.Text);

        }
    }
}
<file_sep>/g3d database (ver 1)/ItemDetails.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FireSharp.Config;
using FireSharp.Response;
using FireSharp.Interfaces;
using System.Diagnostics;

namespace G3Dsys_database
{
    public partial class ItemDetails : Form
    {
        public ItemDetails()
        {
            InitializeComponent();
        }

        IFirebaseConfig ifc = new FirebaseConfig()
        {
            //BORIS FIREBASE
            //AuthSecret = "<KEY>",
            //BasePath = "https://g3dsys-database-default-rtdb.asia-southeast1.firebasedatabase.app/"

            //REG FIREBASE
            AuthSecret = "<KEY>",
            BasePath = "https://g3dproj-default-rtdb.firebaseio.com/"
        };

        IFirebaseClient client;

        private void ItemDetails_Load(object sender, EventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(ifc);
            }

            catch
            {
                MessageBox.Show("No Internet Connection Problem");
            }

        }

        private void label11_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void label11_MouseMove(object sender, MouseEventArgs e)
        {
            this.Cursor = Cursors.Hand;
        }

        private void label11_MouseLeave(object sender, EventArgs e)
        {
            this.Cursor = Cursors.Arrow;
        }

        private void DeleteBtn_Click(object sender, EventArgs e)
        {
            DialogResult dialog = MessageBox.Show("Do you really want to remove this item?", "Delete", MessageBoxButtons.YesNo);
            if (dialog == DialogResult.Yes)
            {
                FirebaseResponse deleteresponse = client.Delete("ItemList/Items/" + InvoiceTBox.Text);
                MessageBox.Show("Delete Successfully");
            }

            else if (dialog == DialogResult.No)
            {
                return;
            }
            this.Close();

        }

        private void EditBtn_Click(object sender, EventArgs e)
        {

            FirebaseResponse editresponse = client.Get("ItemList/Items/" + InvoiceTBox.Text);
            AddItem add = editresponse.ResultAs<AddItem>();

            EditItem editform = new EditItem();

            editform.EditNameTxt.Text = add.ItemName;
            editform.EditPartTxt.Text = add.Part;
            editform.EditDescTxt.Text = add.Description;
            editform.EditPriceTxt.Text = add.Price;
            editform.EditStockTxt.Text = add.Stock;
            editform.EditDesignTxt.Text = add.Design;
            editform.EditSpecsTxt.Text = add.Specs;
            editform.EditRemarksTxt.Text = add.Remarks;
           // editform.EditInvoiceTBox.Text = add.Invoice;

            editform.ShowDialog();
            this.Close();
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {

                FirebaseResponse dwgDL = client.Get("Files/" + InvoiceTBox.Text);
                Files dl = dwgDL.ResultAs<Files>();
                Process.Start(dl.dwgFiles);

        }

    }
}
<file_sep>/g3d database (ver 1)/loginFRM.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
using FireSharp.Config;
using FireSharp.Response;
using FireSharp.Interfaces;

namespace G3Dsys_database
{
    public partial class loginFRM : Form
    {

        public loginFRM()
        {
            InitializeComponent();
        }

        IFirebaseConfig ifc = new FirebaseConfig()
        {
            //BORIS FIREBASE
            //AuthSecret = "<KEY>",
            //BasePath = "https://g3dsys-database-default-rtdb.asia-southeast1.firebasedatabase.app/"

            //REG FIREBASE
            AuthSecret = "<KEY>",
            BasePath = "https://g3dproj-default-rtdb.firebaseio.com/",

        };

        IFirebaseClient client;

        private void loginFRM_Load(object sender, EventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(ifc);
            }

            catch
            {
                MessageBox.Show("No Internet Connection Problem");
            }
            this.AcceptButton = loginBTN;
        }

        private void loginBTN_Click(object sender, EventArgs e)
        {

            if (string.IsNullOrWhiteSpace(usernameTXT.Text) &&
                string.IsNullOrWhiteSpace(passwordTXT.Text))
             {
                MessageBox.Show("Please fill all the fields");
                return;
             }

            FirebaseResponse res = client.Get(@"Users/" + usernameTXT.Text);
            MyUser LogUser = res.ResultAs<MyUser>(); //database result

            MyUser CurUser = new MyUser()       //current user, user given info
            {
                Username = usernameTXT.Text,
                Password = <PASSWORD>
            };

            if(MyUser.IsEqual(LogUser,CurUser))
            {
                this.Hide();
                mainFRM main = new mainFRM();
                main.ShowDialog();
                this.Close();
            }
            else
            {
                MyUser.ShowError();
            }

        }

        private void RegisterBTN_Click(object sender, EventArgs e)
        {
            Registration reg = new Registration();
            reg.ShowDialog();
        }
    }
}
<file_sep>/AddProduct.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace G3D
{

    public partial class AddProduct : Form
    {
        public AddProduct()
        {
            InitializeComponent();
        }

        private void buttonLogout_Click(object sender, EventArgs e)
        {
            this.Hide();
            Login ss = new Login();
            ss.Show();
        }

        private void AddProduct_Load(object sender, EventArgs e)
        {

        }
    }
}
<file_sep>/Add Product.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using FireSharp.Config;
using FireSharp.Interfaces;
using FireSharp.Response;

namespace G3Ddatabase
{
    public partial class Form1 : Form
    {
        IFirebaseConfig config = new FirebaseConfig
        {
            AuthSecret = "<KEY>",
            BasePath = "https://g3ddatabase-default-rtdb.firebaseio.com/"
        };

        IFirebaseClient client;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            client = new FireSharp.FirebaseClient(config);

            if(client!=null)
            {
                MessageBox.Show("Connection is Established!");
            }
        }

        private async void btnSave_Click(object sender, EventArgs e)
        {
            FirebaseResponse resp = await client.GetTaskAsync("Counter/node");
            Counter_class get = resp.ResultAs<Counter_class>();
            MessageBox.Show(get.cnt);

            var data = new Data
            {
                Name = txtName.Text,
                PartNumber = (Convert.ToInt32(get.cnt)+1).ToString(),
                Description = txtDescription.Text,
                UnitPrice = txtUnitPrice.Text,
                Invoice = txtInvoice.Text,
                UnitStock = txtUnitStock.Text,
                DesignStatus = txtDesignStatus.Text,
                SpecsStatus = txtSpecsStatus.Text,
                Remarks = txtRemarks.Text

            };

            SetResponse response = await client.SetTaskAsync("Information/"+txtName.Text,data);
            Data result = response.ResultAs<Data>();

            MessageBox.Show("Data Inserted " + result.Name);

            var obj = new Counter_class
            {
                cnt = data.PartNumber
            };

            SetResponse response1 = await client.SetTaskAsync("Counter/node",obj);
        }

        private async void btnRetrieve_Click(object sender, EventArgs e)
        {
            FirebaseResponse response = await client.GetTaskAsync("Information/" + txtName.Text);
            Data obj = response.ResultAs<Data>();

            txtName.Text = obj.Name;
            txtPartNumber.Text = obj.PartNumber;
            txtDescription.Text = obj.Description;
            txtUnitPrice.Text = obj.UnitPrice;
            txtInvoice.Text = obj.Invoice;
            txtUnitStock.Text = obj.UnitStock;
            txtDesignStatus.Text = obj.UnitStock;
            txtSpecsStatus.Text = obj.SpecsStatus;
            txtRemarks.Text = obj.Remarks;

            MessageBox.Show("Data Retrieved.");
        }

        private async void btnUpdate_Click(object sender, EventArgs e)
        {
            var data = new Data
            {
                Name = txtName.Text,
                PartNumber = txtPartNumber.Text,
                Description = txtDescription.Text,
                UnitPrice = txtUnitPrice.Text,
                Invoice = txtInvoice.Text,
                UnitStock = txtUnitStock.Text,
                DesignStatus = txtDesignStatus.Text,
                SpecsStatus = txtSpecsStatus.Text,
                Remarks = txtRemarks.Text
            };

            FirebaseResponse response = await client.UpdateTaskAsync("Information/" + txtName.Text,data);
            Data result = response.ResultAs<Data>();
            MessageBox.Show("Data updated at Name: " + result.Name);
        }

        private async void btnDelete_Click(object sender, EventArgs e)
        {
            FirebaseResponse response = await client.DeleteTaskAsync("Information/" + txtName.Text);
            MessageBox.Show("Deleted Record of Name: " + txtName.Text);
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Hide();
            DataGrid dg = new DataGrid();
            dg.Show();
        }
    }
}
<file_sep>/EditItem.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FireSharp.Config;
using FireSharp.Response;
using FireSharp.Interfaces;

namespace G3Dsys_database
{
    public partial class EditItem : Form
    {
        public EditItem()
        {
            InitializeComponent();
        }

        IFirebaseConfig ifc = new FirebaseConfig()
        {
            AuthSecret = "<KEY>",
            BasePath = "https://g3dsys-database-default-rtdb.asia-southeast1.firebasedatabase.app/"
        };

        IFirebaseClient client;

        private void EditItem_Load(object sender, EventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(ifc);
            }

            catch
            {
                MessageBox.Show("No Internet Connection Problem");
            }

        }

        private void AddSaveBtn_Click(object sender, EventArgs e)
        {

            var items = new AddItem
            {
                ItemName = EditNameTxt.Text,
                Part = EditPartTxt.Text,
                Description = EditDescTxt.Text,
                Price = EditPriceTxt.Text,
                Stock = EditStockTxt.Text,
                Design = EditDesignTxt.Text,
                Specs = EditSpecsTxt.Text,
                Remarks = EditRemarksTxt.Text,
                Invoice = EditInvoiceTBox.Text
            };

            FirebaseResponse updateResponse = client.Update("ItemList/Items/" + EditInvoiceTBox.Text, items);

            MessageBox.Show("Update Successfully!");

            this.Close();
        }

        private void CloseLbl_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void CloseLbl_MouseMove(object sender, MouseEventArgs e)
        {
            this.Cursor = Cursors.Hand;
        }

        private void CloseLbl_MouseLeave(object sender, EventArgs e)
        {
            this.Cursor = Cursors.Arrow;
        }

        private void BrowseBtn_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg2 = new OpenFileDialog();
            dlg2.ShowDialog();
            AdduploadTxt.Text = dlg2.FileName;
        }
    }
}
<file_sep>/global3d/AddProduct.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using FireSharp.Config;
using FireSharp.Response;
using FireSharp.Interfaces;
using Firebase.Storage;
using System.IO;

namespace global3d
{
    public partial class AddProduct : Form
    {
        IFirebaseConfig ifc = new FirebaseConfig()
        {
            AuthSecret = "<KEY>",
            BasePath = "https://g3dproj-default-rtdb.firebaseio.com/"
        };

        IFirebaseClient client;

        public AddProduct()
        {
            InitializeComponent();
        }

        private void AddProduct_Load(object sender, EventArgs e)
        {
            try
            {
                client = new FireSharp.FirebaseClient(ifc);
            }

            catch
            {
                MessageBox.Show("Connection fo Firebase Failed");
            }
        }

        private async void btnSave_Click(object sender, EventArgs e)
        {
            var data = new Information
            {
                Name = txtName.Text,
                PartNumber = txtPartNumber.Text,
                Description = txtDescription.Text,
                UnitPrice = txtUnitPrice.Text,
                Invoice = txtInvoice.Text,
                UnitStock = txtUnitStock.Text,
                DesignStatus = txtDesignStatus.Text,
                SpecsStatus = txtSpecsStatus.Text,
                Remarks = txtRemarks.Text
            };

            SetResponse response = await client.SetAsync("Information/" + txtName.Text, data);
            Information result = response.ResultAs<Information>();

            MessageBox.Show(result.Name + " Added Successfully.");
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Hide();
            Home cancel = new Home();
            cancel.ShowDialog();
        }

        private void btnBrowse_Click(object sender, EventArgs e)
        {
            var fileContent = string.Empty;
            var filePath = string.Empty;

            using (OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                openFileDialog.InitialDirectory = "c:\\";
                //openFileDialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
                openFileDialog.Filter = "All files (*.*)|*.*";
                openFileDialog.FilterIndex = 2;
                openFileDialog.RestoreDirectory = true;

                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                   filePath = openFileDialog.FileName;

                    var fileStream = openFileDialog.OpenFile();

                    using (StreamReader reader = new StreamReader(fileStream))
                    {
                        fileContent = reader.ReadToEnd();
                    }

                    txtDWGfiles.Text = openFileDialog.FileName;
                }
            }

           // MessageBox.Show(fileContent, "File Content at path: " + filePath, MessageBoxButtons.OK);
        }

        private void btnUpload_Click(object sender, EventArgs e)
        {
            Upload(txtDWGfiles.Text);
        }

        public void Upload(string filepath)
        {
            AddProduct add = new AddProduct();
            using (Stream stream = File.OpenRead(filepath))
            {
                byte[] buffer = new byte[stream.Length];
                stream.Read(buffer, 0, buffer.Length);

                string extn = new FileInfo(filepath).Extension;
                var upload = client.Set("Files/" + txtDWGfiles.Text, add);
            }
        }
    }
}
<file_sep>/global3d/Information.cs
using System;
using System.Collections.Generic;
using System.Text;

namespace global3d
{
    class Information
    {
        public string Name { get; set; }
        public string PartNumber { get; set; }
        public string Description { get; set; }
        public string UnitPrice { get; set; }
        public string Invoice { get; set; }
        public string UnitStock { get; set; }
        public string DesignStatus { get; set; }
        public string SpecsStatus { get; set; }
        public string Remarks { get; set; }
    }
}

repo_language: C#