Tech_Dev

Tech_Dev this page is going to be about web technologies where people can share technology and also learn web technologies.

24/10/2024

🚀 Excited to announce my latest web app: Mister Faster Repairs, built specifically for device repair shops using the MERN stack! 🎉

Say goodbye to sticky notes and hello to streamlined task management. Here’s what Mister Faster Repairs offers:

🔧 Key Features: 1️⃣ Replaces sticky note systems with a modern, digital solution. 2️⃣ Public-facing page with essential contact info. 3️⃣ Secure employee login with a personalized welcome page. 4️⃣ Easy-to-use navigation, displaying the logged-in user and role. 5️⃣ Weekly login requirement and a quick logout option for security. 6️⃣ Manage user access in real-time when necessary. 7️⃣ Ticketing system for notes with statuses: OPEN or COMPLETED. 8️⃣ Role-based permissions: Employees, Managers, Admins. 9️⃣ Employees can only view/edit their assigned notes, while Managers and Admins can manage all. 🔟 Only Managers/Admins can create new users and modify settings. 1️⃣1️⃣ Fully responsive for access on any device.

Whether it's creating new tasks, assigning notes, or managing staff access, Mister Faster Repairs simplifies it all! 💼🔑

Built using the MERN stack (MongoDB, Express, React, Node.js), this app provides a robust solution to improve workflow and organization in device repair shops.

Check it out and let me know what you think! 💻⚡

https://misterfasterrepairs.onrender.com
for testing purposes use the following usernames and passwords:
username: password
employee employee1234
manager manager1234
admin admin1234

This is my initial post. Thank you.
06/07/2023

This is my initial post. Thank you.

23/05/2023

Symmetry difference Algorithm

function sym() {
const args = [];

for (let i=0; i< arguments.length; i+=1) {
args.push(arguments[i]);
}

return args.reduce((acc, curArr) => {
let ac = [...acc];
const result = [];
for (let i=0; i< ac.length; i+=1) {
if(curArr.indexOf(ac[i])== -1 && result.indexOf(ac[i]) == -1){
result.push(ac[i]);
}
}
for (let i=0; i< curArr.length; i+=1) {
if(ac.indexOf(curArr[i]) == -1 && result.indexOf(curArr[i])==-1) {
result.push(curArr[i]);
}
}
return [...result];
});
}

console.log(sym([1, 2, 3], [5, 2, 1, 4]));

Output: [ 3, 5, 4 ];

26/01/2023

JavaScript Intermediate Algorithm Scripting
Algorithm: Convert HTML Entities

function convertHTML(str) {
let singleQuote = /'/;
let doubleQuote = /"/;
for (let i=0; i< str.length; i+=1) {
if (str[i] === "&") {
str = str.indexOf(str[i]) != -1
? str.replace(str[i], "&"): str;
} else if (str[i] === "") {
str = str.indexOf(str[i]) != -1
?str.replace(str[i], ">"): str;
} else if (singleQuote.test(str[i])===true) {
str = str.replace(singleQuote, "'");
} else if (doubleQuote.test(str[i])===true) {
str = str.replace(doubleQuote, """);
}
}
return str;
}
console.log(convertHTML("Dolce & Gabbana"));
Tests :
Passed:
convertHTML("Dolce & Gabbana");
should return the string Dolce & Gabbana.
Passed:
convertHTML("Hamburgers < Pizza < Tacos");
should return the string Hamburgers < Pizza < Tacos.
Passed:
convertHTML("Sixty > twelve");
should return the string Sixty > twelve.
Passed:
convertHTML('Stuff in "quotation marks"');
should return the string Stuff in "quotation marks".
Passed:
convertHTML("Schindler's List");
should return the string Schindler's List.
Passed:
convertHTML("");
should return the string <>.
Passed:
convertHTML("abc");
should return the string abc.

24/01/2023

Sorted Union JavaScript Algorithem

Write a function that takes two or more arrays and returns a new array of unique values in the order of the original provided arrays.

In other words, all values present from all arrays should be included in their original order, but with no duplicates in the final array.

The unique numbers should be sorted by their original order, but the final array should not be sorted in numerical order.

Check the assertion tests for examples.

function uniteUnique(arr) {
let array = [];
for (let i=0; i< arguments.length; i+=1) {
for (let j=0; j< arguments[i].length; j+=1) {
if (array.indexOf(arguments[i][j])== -1) {
array.push(arguments[i][j]);
}
}
}
return array;
}

Tests that needs to be passed are in the following.

Passed:
uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]);
should return [1, 3, 2, 5, 4].

Passed:
uniteUnique([1, 2, 3], [5, 2, 1]) ;
should return [1, 2, 3, 5]

Passed:
uniteUnique([1, 2, 3], [5, 2, 1, 4], [2, 1], [6, 7, 8]);
should return [1, 2, 3, 5, 4, 6, 7, 8].

Passed:
uniteUnique([1, 3, 2], [5, 4], [5, 6]);
should return [1, 3, 2, 5, 4, 6].

Passed:
uniteUnique([1, 3, 2, 3], [5, 2, 1, 4], [2, 1]);
should return [1, 3, 2, 5, 4].

15/01/2023

DNA Pairing

Pairs of DNA strands consist of nucleobase pairs. Base pairs are represented by the characters AT and CG, which form building blocks of the DNA double helix.

The DNA strand is missing the pairing element. Write a function to match the missing base pairs for the provided DNA strand. For each character in the provided string, find the base pair character. Return the results as a 2d array.

For example, for the input GCG, return [["G", "C"], ["C","G"], ["G", "C"]]

The character and its pair are paired up in an array, and all the arrays are grouped into one encapsulating array.

This is my own solution.

function pairElement(str) {
let singleDNa = str.split("");
let dNAPair = [];
for (let i=0; i< singleDNa.length; i+=1) {
if (singleDNa[i]=== "A") {
dNAPair.push(["A", "T"]);
} else if (singleDNa[i] === "T") {
dNAPair.push(["T", "A"]);
} else if (singleDNa[i] === "C") {
dNAPair.push(["C", "G"]);
} else if (singleDNa[i] === "G") {
dNAPair.push(["G", "C"]);
}
}

return dNAPair;
}

These tests should pass:

Passed:
pairElement("ATCGA");
should return [["A","T"],["T","A"],["C","G"],["G","C"],["A","T"]].

Passed:
pairElement("TTGAG");
should return [["T","A"],["T","A"],["G","C"],["A","T"],["G","C"]].

Passed:
pairElement("CTCTA");
should return [["C","G"],["T","A"],["C","G"],["T","A"],["A","T"]].

14/01/2023

Search and Replace
---------------------
Perform a search and replace on the sentence using the arguments provided and return the new sentence.

First argument is the sentence to perform the search and replace on.

Second argument is the word that you will be replacing (before).

Third argument is what you will be replacing the second argument with (after).

Note: Preserve the case of the first character in the original word when you are replacing it. For example if you mean to replace the word Book with the word dog, it should be replaced as Dog

This is my own solution😉.

function myReplace(str, before, after) {
let restOfAfter = after.slice(1);
let newStr= "";

if (str.charAt(str.indexOf(before)) === before[0].toUpperCase()) {
newStr = str.replace(before, after[0].toUpperCase().concat(restOfAfter));
} else if (str.charAt(str.indexOf(before)) === before[0].toLowerCase()) {
newStr = str.replace(before, after.toLowerCase());
}
return newStr;
}

Tests in the following should pass:

1-> ✅:
myReplace("Let us go to the store", "store", "mall");
should return the string Let us go to the mall.

2-> ✅:
myReplace("He is Sleeping on the couch", "Sleeping", "sitting"); should return the string He is Sitting on the couch.

3-> ✅:
myReplace("I think we should look up there", "up", "Down");
should return the string I think we should look down there.

4-> ✅:
myReplace("This has a spellngi error", "spellngi", "spelling");
should return the string This has a spelling error.

5-> ✅:
myReplace("His name is Tom", "Tom", "john");
should return the string His name is John.

6-> ✅:
myReplace("Let us get back to more Coding", "Coding", "algorithms");
should return the string Let us get back to more Algorithms.

08/01/2023

Make a function that looks through an array of objects (first argument) and returns an array of all objects that have matching name and value pairs (second argument). Each name and value pair of the source object has to be present in the object from the collection if it is to be included in the returned array.

This is my own solution of, Wherefore art thou.

function whatIsInAName (collection, source) {
let keys = Object.keys(source);
let arr = [];

for (let i=0; i< collection.length; i+=1) {
let found = true;
let obj = collection[i];
for (let j=0; j< keys.length; j+=1) {
if (obj[keys[j]] !== source[keys[j]]) {
found = false;
}
}
if (found) arr.push(collection[i]);
}

return arr;
}

console.log(whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" }));

The tests below should pass.
1->
whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" }) ;
should return [{ first: "Tybalt", last: "Capulet" }]

2->
whatIsInAName([{ "apple": 1 }, { "apple": 1 }, { "apple": 1, "bat": 2 }], { "apple": 1 }) ;
should return [{ "apple": 1 }, { "apple": 1 }, { "apple": 1, "bat": 2 }]

3->
whatIsInAName([{ "apple": 1, "bat": 2 }, { "bat": 2 }, { "apple": 1, "bat": 2, "cookie": 2 }], { "apple": 1, "bat": 2 }) ;
should return [{ "apple": 1, "bat": 2 }, { "apple": 1, "bat": 2, "cookie": 2 }]

4->
whatIsInAName([{ "apple": 1, "bat": 2 }, { "apple": 1 }, { "apple": 1, "bat": 2, "cookie": 2 }], { "apple": 1, "cookie": 2 });
should return [{ "apple": 1, "bat": 2, "cookie": 2 }]

5->
whatIsInAName([{ "apple": 1, "bat": 2 }, { "apple": 1 }, { "apple": 1, "bat": 2, "cookie": 2 }, { "bat":2 }], { "apple": 1, "bat": 2 }) should return [{ "apple": 1, "bat": 2 }, { "apple": 1, "bat": 2, "cookie":2 }]

6->
whatIsInAName([{"a": 1, "b": 2, "c": 3}], {"a": 1, "b": 9999, "c": 3});
should return []

7->
whatIsInAName([{"a": 1, "b": 2, "c": 3, "d": 9999}], {"a": 1, "b": 9999, "c": 3});

should return [];

02/05/2022

Hello, everyone hope you all are doing really great. First of all Eid ul Fitr Mubarak to you and your entire family. Today on the occasion of Eid let's learn how to implement the custom Array.map method in JavaScript programming. So, today I will implement map method in three different ways although JavaScript provides map method, it's good to know how it works under the hood. The more someone works with code the more they learn and can become confident in coding. Without further due let's dive into code😁.
solution 1:I will create an array of integers for the sake of simplicity.
const array = [1, 2, 3, 4, 5];
Array.prototype.myMap = function(callback) {
const newArray = [ ];
for(let i = 0; i< this.length; i+=1) {
newArray.push(callback(this[i], this.length, this));
}
return newArray;
}
const returnMapedArray = array.myMap((item)=>{
return item*2;
});
console.log(returnMapedArray);
This would return the square of each integer/element in an array on the console.
--------------------------------------------------------------------------
solution 2:
const array = [1, 2, 3, 4, 5];
Array.prototype.myMap = function(callback) {
const newArray = [];
this.forEach((eachElement, index, array) => {
newArray.push(callback(eachElement));
});
return newArray;
}
const returnedMap = array.myMap((value)=> {
return value*2;
});
console.log(returnedMap);
// this will return the square of each element/integer in an array
--------------------------------------------------------------------------
solution 3:
const array = [1, 2, 3, 4, 5];
Array.prototype.myMap = function(callback, arr= [ ], i=0) {
return i < this.length ?
this.myMap(callback, arr.concat(callback(this[i])), i+1) : arr;
}
const returnedMap = array.myMap((value)=> {
return value*2;
});
console.log(returnedMap);
// this will return the square of each element/integer in an array
--------------------------------------------------------------------------

19/02/2022

Append to an element
//first get the element from HTML DOM which would be the parent element.
let parent = document.querySelector('parent');

//create the child element with JavaScript as shown below
let child = document.createElement('div');

//append the child element as shown below
JS code-->: parent.appendChild(ele);

19/02/2022

Add class to an element in JavaScript

ele.classList.add('class-name');

// Add multiple classes (Not supported in IE 11)


let ele = document.querySelector('.element');
code -->: ele.classList.add('another', 'class', 'name');
----------------------------------------------------------

Remove a class from an element in JavaScript
//Note that multiple parameters for the remove() aren't
//supported in IE 11.

// Remove multiple classes (Not supported in IE 11)
code -->: ele.classList.remove('another', 'class', 'name');

Address

Gurugram
Gurugram
122505

Alerts

Be the first to know and let us send you an email when Tech_Dev posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Contact The Business

Send a message to Tech_Dev:

Share

Category