Skip to content

Instantly share code, notes, and snippets.

View tjkhara's full-sized avatar

tjkhara

View GitHub Profile
@tjkhara
tjkhara / 1TestEnterProblem.cpp
Created September 28, 2018 09:57
Validating against newline returns
#include <iostream>
#include <iomanip>
#include <string>
using std::cout;
using std::cin;
using std::endl;
using std::string;
void checkEmpty(string inputString)
@tjkhara
tjkhara / functions.cpp
Created October 22, 2018 11:42
2D Dynamic array of strings
/****************************************************************************
** Author: Tajeshwar Singh Khara
** Date: 25-09-2018
** Description: Function called createArray
** Creates and returns an initialized 2D array
******************************************************************************/
// Create a 2D dynamic array
string** Functions::createArray(int rowSize, int colSize)
{
// Create an array of pointers
/*********************************************************************
** Program name: DoublyLinkedList.h
** Author: Tajeshwar Singh Khara
** Date: 30-10-2018
** Description: Specification file for list class.
*********************************************************************/
#ifndef LAB6_DOUBLYLINKEDLIST_DOUBLYLINKEDLIST_H
#define LAB6_DOUBLYLINKEDLIST_DOUBLYLINKEDLIST_H
@tjkhara
tjkhara / php.ini
Created December 10, 2018 19:18
for debugging
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
<?php
// if($_SERVER["REQUEST_METHOD"] == "POST"){
// var_dump($_POST);
// }
$num1 = $_POST['num1'];
$num2 = $_POST['num2'];
$total = $num1 + $num2;
@tjkhara
tjkhara / bootstrap-template.html
Created August 11, 2019 16:46
bootstrap4 template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.0.13/css/all.css"
integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp"
@tjkhara
tjkhara / main.cpp
Created August 12, 2019 07:14
sorting an array of structs
#include <iostream>
#include <string>
using namespace std;
struct employee
{
string name;
int age;
};
@tjkhara
tjkhara / Duplicates1.java
Created August 12, 2019 09:18
Generating random numbers in java and finding duplicates
import java.util.Scanner;
import java.util.concurrent.ThreadLocalRandom;
//function which prints all the duplicate id's
public class Duplicates1 {
public void findDuplicates(int[] id) {
System.out.println("Duplicate student id : ");
for (int i = 0; i < id.length; i++) {
for (int j = i+1; j < id.length; j++) {
if (id[i] == id[j]) {
@tjkhara
tjkhara / FindDuplicates2.java
Created August 12, 2019 09:29
Radix sort type method of finding duplicates
public class FindDuplicates2 {
public static void main(String args[]) {
int intArray[] = { 1, 2, 3, 4, 1 };
findDuplicates(intArray);
}
public static void findDuplicates(int[] id) {
System.out.println("Duplicate data: ");
int count[] = new int[10];
@tjkhara
tjkhara / index.html
Created August 13, 2019 14:29
Bootstrap 4 simple navbar code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"