Skip to content

Instantly share code, notes, and snippets.

View HammadMaqbool's full-sized avatar
🏠
Working from home

HammadMaqbool HammadMaqbool

🏠
Working from home
View GitHub Profile
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
namespace Connection_Class
{
public class Connection_Query
@HammadMaqbool
HammadMaqbool / Delete_String.cpp
Created August 3, 2016 13:27
Turbo C++ Code to Delete String
class Temp{
public:
Delete()
{
char a[100],st1[100];
int r=0,i=0;
cout<<"Enter a String"<<endl;
cin>>a;
int loc;
cout<<"Enter initial position";
#include<iostream.h>
#include<conio.h>
class Temp{
public:
Length(char a[])
{ int len=0;
for(int i=0; a[i]!='\0'; i++)
{
len=len+1;
}
#include<iostream.h>
#include<conio.h>
void main()
{
int location=-1,item;
int arr[9];
cout<<"Enter the Data";
for(int i=0; i<=9;i++)
{
cin>>arr[i];
@HammadMaqbool
HammadMaqbool / Random Question Generator
Last active April 18, 2022 18:33
A C++ based program to produce random questions
a console-based application for school teachers.
This application will auto generate questions for Grades 1, 2, 3, 4 and 5.
Using this application teacher will be able to give different paper to each student
@HammadMaqbool
HammadMaqbool / Number_Guess_Game.py
Created February 22, 2020 08:32
This gist contain python based number guess game
import random
Comp_guess_number = random.randint(1,5)
total_number_of_Attempts = 3
cuurent_attempt =1
while(cuurent_attempt<=total_number_of_Attempts):
if cuurent_attempt == total_number_of_Attempts:
print("This is last attempt")
@HammadMaqbool
HammadMaqbool / DataDictionaryQueries.sql
Last active April 5, 2020 07:54
Attribute name availablity checking
/*Check Attribute name availablity*/
SELECT TABLE_NAME FROM   DataBaseName_Here.INFORMATION_SCHEMA.COLUMNS WHERE  COLUMN_NAME = ‘Name'
--To check all the tables available in the Database
SELECT TABLE_NAME, TABLE_TYPE FROM DataBaseName_Here.INFORMATION_SCHEMA.TABLES ORDER BY TABLE_NAME
--To Get the list of columns
SELECT COLUMN_NAME FROM DataBaseName_Here.INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Table Name here'
/*Queries to get all the data*/
String[] requestedColumns = { CallLog.Calls.CACHED_NUMBER_LABEL, CallLog.Calls.DURATION };
Cursor calls = managedQuery( CallLog.Calls.CONTENT_URI, requestedColumns,
CallLog.Calls.CACHED_NUMBER_LABEL+ " = ?", new String[] { "HourlyClient123" } , null);
Log.d(DEBUG_TAG, "Call count: " + calls.getCount());
int durIdx = calls.getColumnIndex(CallLog.Calls.DURATION);
int totalDuration = 0;
calls.moveToFirst();
while (!calls.isAfterLast())
{
Log.d(DEBUG_TAG, "Duration: " + calls.getInt(durIdx));
@HammadMaqbool
HammadMaqbool / PaginationAspCoreMVC6.md
Created April 24, 2022 16:45
This is the complete code of how to implement the pagination in the AspNetCore MVC (.NET6) all portions are defined.

Make a class PaginatedList in Model folder 📂

public class PaginatedList<T> : List<T>
    {
        public int PageIndex { get; private set; }
        public int TotalPages { get; private set; }

        public PaginatedList(List<T> items, int count, int pageIndex, int pageSize)
        {
@HammadMaqbool
HammadMaqbool / polymorphism-virtual-function.cpp
Created October 24, 2023 16:07
C++ Example code to understand the concept of Polymorphish using Virtual Function
#include<iostream>
using namespace std;
class Animal
{
public:
virtual void Sound()
{
//No code. . .
}