Skip to content

Instantly share code, notes, and snippets.

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 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;
@harshityadav95
harshityadav95 / urls.py
Created August 13, 2017 16:58
urls.py in django project
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.home, name='home'),
from django.shortcuts import render
# Create your views here.
def home(request):
return render(request,'webapp/home.html',{})
using ClassLibrary1;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
//metroLabel16.Text = "Running";
System.Net.WebClient wc = new System.Net.WebClient();
//DateTime Variable To Store Download Start Time.
DateTime dt1 = DateTime.Now;
//Number Of Bytes Downloaded Are Stored In ‘data’
byte[] data = wc.DownloadData("https://github.com/harshityadav95/static-file-storage/blob/master/text.txt");
//DateTime Variable To Store Download End Time.
@harshityadav95
harshityadav95 / code.java
Last active December 9, 2017 08:17
Differnce between the smallest and largest element in the array
int maxDiff(int arr[])
{
int arr_size = arr.length;
int max_diff = arr[1] - arr[0];
int i, j;
for (i = 0; i < arr_size; i++)
{
for (j = i + 1; j < arr_size; j++)
{
@harshityadav95
harshityadav95 / file.java
Created December 9, 2017 10:41
Character having Highest Frequencey in string "aaabbabsssssssssssss" will give output "s"
static String findHighestFreqChar(String inputStr) {
// Create array to keep the count of individual
// characters and initialize the array as 0
int count[] = new int[256];
// Construct character count array from the input
// string.
int len = inputStr.length();
for (int i=0; i<len; i++)
@harshityadav95
harshityadav95 / code.java
Created December 9, 2017 10:52
/* Return the "centered" average of an array of ints, which we'll say is the * mean average of the values, except ignoring the largest and smallest * values in the array. If there are multiple copies of the smallest value, * ignore just one copy, and likewise for the largest value. Use int division * to produce the final average. You may assume …
/* Return the "centered" average of an array of ints, which we'll say is the
* mean average of the values, except ignoring the largest and smallest
* values in the array. If there are multiple copies of the smallest value,
* ignore just one copy, and likewise for the largest value. Use int division
* to produce the final average. You may assume that the array is length 3
* or more.
*/
static int centeredAverage(int[] inputIntArray) {
Arrays.sort(inputIntArray);
@harshityadav95
harshityadav95 / code
Created December 9, 2017 11:10
Sandwhich String
/* A sandwich is two pieces of bread with something in between. Return the string that is between the first and last appearance of "bread" in the given string, or return the empty string "" if there are not two pieces of bread.
getSandwich("breadjambread") → "jam"
getSandwich("xxbreadjambreadyy") → "jam"
getSandwich("xxbreadyy") → ""
link: http://www.javaproblems.com/2013/11/java-string-2-getsandwich-codingbat.html
*/
static String getSandwich(String inputString) {