Skip to content

Instantly share code, notes, and snippets.

View quickgrid's full-sized avatar

Asif Ahmed quickgrid

View GitHub Profile
@quickgrid
quickgrid / uva-821-page-hopping-floyd-warshall-stl-set.cpp
Last active December 13, 2016 13:25
C++ Solution UVA 821 - Page Hopping Floyd Warshall Simulation Explanation and stl set https://quickgrid.blogspot.com
/**
* Author: Asif Ahmed
* Site: https://quickgrid.blogspot.com
* Problem: UVA 821 - Page Hopping
* Technique: Floyd warshall algorithm unweighted directed graph
* C++ stl set
*/
#include<bits/stdc++.h>
using namespace std;
<%@ page import="java.io.*,java.util.*,java.sql.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<html>
<head>
<title>SELECT Operation</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.5/css/bootstrap.min.css">
@quickgrid
quickgrid / fixed ddl table.sql
Created October 19, 2016 18:48
mysql tables for a database
create table classroom
(building varchar(15),
room_number varchar(7),
capacity numeric(4,0),
primary key (building, room_number)
);
create table department
(dept_name varchar(20),
building varchar(15),
@quickgrid
quickgrid / mysql database to bootstrap table.php
Last active September 3, 2024 07:08
Pulls data from mysql database and show in beautiful bootstrap table.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Sample PHP Database Application</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.5/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.5/js/bootstrap.min.js"></script>
</head>
@quickgrid
quickgrid / NQueenBacktrackingVisualization.java
Created September 16, 2016 07:23
Simple NQueen Visualizer in JAVA to Visualize Backtracking.
/**
* Author: Asif Ahmed
* Site: https://quickgrid.wordpress.com
* Description: N Queen visualizer Sample.
*/
import javax.swing.*;
import java.awt.*;
/**
@quickgrid
quickgrid / LinearRegressionGradientDescentRandomTrainingSet.cpp
Last active December 21, 2016 15:36
Simple c++ program to fit a line though given points in 2-space. This implementation is made following the machine learning course on coursera by Andrew NG, linear regression gradient descent. It uses iteration count to terminate execution.
/**
* Author: Asif Ahmed
* Site: https://quickgrid.blogspot.com
* Problem: Linear Regression gradient descent curve fitting though points in 2-space.
* Details: Please remove windows.h header if any trouble with compilation.
*/
#include<bits/stdc++.h>
#include<windows.h>
#define M 5
@quickgrid
quickgrid / GradientDescentLinearRegressionPrimeNumbers.cpp
Last active December 21, 2016 15:36
Simple c++ program to fit a line though given points in 2-space. This implementation is made following the machine learning course on coursera by Andrew NG, linear regression gradient descent. It uses fixed iteration to terminate execution. Cpp program to try to fit a line though prime numbers. The goal is to minimize the error since, it is impo…
/**
* Author: Asif Ahmed
* Site: https://quickgrid.blogspot.com
* Problem: Linear Regression gradient descent curve fitting though points in 2-space.
* Details: Please remove windows.h header if any trouble with compilation.
*/
#include<bits/stdc++.h>
#include<windows.h>
#define M 10
@quickgrid
quickgrid / SeriesSumNumeratorPlusTwoOdd.cpp
Created August 30, 2016 16:08
Code to calculate sum $ \frac{3^2+1}{3^2-1} + \frac{5^2+1}{5^2-1} + \frac{7^2+1}{7^2-1} + ..... + \frac{99^2+1}{99^2-1} $ which is exactly 49.49
#include<stdio.h>
int main(){
double sum = 0;
for(int i = 3; i <= 99; i = i + 2){
sum = sum + ((double) (i*i + 1) /(i*i - 1) );
}
printf("%lf\n", sum);
@quickgrid
quickgrid / out.txt
Created August 24, 2016 23:05
Sample output file, produced after running the flex lexical analyzer code for the given sample input file.
MULTILINE COMMENT:
/*
This is a comment
*/
Line Count:1
Line Count:2
Pascal Comment:{Another}
@quickgrid
quickgrid / cs.sh
Created August 24, 2016 23:03
sample bash script file to run the flex code.
#!/bin/bash
flex -t assignment2.l > test.c
g++ -c -o test.o test.c
g++ -o samp test.o -ll
./samp
#./samp < in.txt > out.txt