instruction stringlengths 71 71.9k |
|---|
I have started a project on my free time were I'm writing a 2D game engine in Java. One of the more challenging and interesting aspects of such a project is collision detection between sprites on the screen. I have previously written a game engine in C++ were the more naive approach (O(n2)) of using a list of all sprit... |
I wrote a jQuery function to show a popup that can be draggable have multiple buttons etc.
Demo
How can I improve this code? I want to try keeping it light and simple but at the same time make it as versatile as possible for all the sorts of popups I might need in future projects.
/*Popup function*/
function popup(conf... |
Node's HTTP library provides a handy shorthand function for GET requests. Something similar doesn't exist for POST requests. I'm trying to write one in ClojureScript that compiles to node-readable JavaScript.
In JavaScript (+ underscore.js) it would look like so:
var _ = require("underscore");
var url = require("url")... |
I am beginning to use generics and would like feedback on the following set of classes that will serve as the basis for an app that contains a large number of basic CRUD-y entities.
I have used Car and Person classes as examples, but there will be a whole bunch of basic classes like these, perhaps 50 +.
My aim is to ... |
I've just started out writing an app that will visualize genomic data for anybody to understand.
When you get your genome sequenced the raw data usually comes in the form of a VCF file. I started out by drafting parser below that essentially creates a JavaScript object out of a VCF text file. Next I think want to write... |
I'm looking to add a module to one of my utility classes that functions as a countdown timer for tools that execute tasks after a certain amount of time. The code below is what I have working for PoC, but when I went to make this and check out existing examples, none really seemed this slim/simple without going all-out... |
I have completed an exercise where there are 4 different color boxes and 1 main box below them that is blank, when you click on one of the colored boxes, the main box changes to the color of the box you just clicked on. Also there should be working undo and redo buttons.
Am I doing this the "Angular" way by using $even... |
On Linux, the file /proc/cpuinfo returns a set of key-value pairs, where the key and value are separated by a colon and each pair has its own line. It's a bit more complicated than that in reality, but for my needs that's as complicated as it needs to be. (I have only one processor core.)
My goal is to write a function... |
I wrote this script in order to generate a hosts.txt file with the IP addresses of the laptops in my school.
Each laptop is assigned a number, and their IP addresses are assigned to them with the template "192.168.0.x". X being the computer's number + 10. All these computers are running Arch Linux with XFCE4, custom ta... |
This is regards to one of my answers: Linq Expression Calling Combines. The question wasn't very well received, but it proved to be an interesting task that I enjoyed working on.
I ended up with the following:
public static class ExpressionHelpers
{
public static TExpressionType InlineInvokes<TExpressionType>(this ... |
I'm learning Ruby and I would like to know if I have used the good syntax.
My script works, but can I simplify it and make it more elegant.
puts "Hello, what is youre name?"
name = gets.chomp
puts "Are you a boy? (yes/no)"
genre = gets.chomp
if genre == ("yes")
puts "Do you like soccer #{name}? (yes/no)"
foot... |
I've asked a question receiving excessive (in a good sense) feedback. After I've incorporated it into the code, it changed substantially and I felt that I'd need opinion on the new version. Posting revised code is against the rules, so I'm asking a new, follow-up question.
Choice of exception names. Are those informat... |
Let's consider a method like this:
public bool IsWordABeforeWordB(string Text, string WordA, string WordB)
{
...
}
By Word I mean a string composed of more than one character.
Test cases:
[TestMethod]
public void IsWordABeforeWordB_ShouldBeTrue()
{
string Text = "CONSTRAINT [PK_Test] PRIMARY KEY CLUSTERED ([IDT... |
I'm currently working on a Tic Tac Toe project to improve my programming skills, and I'm simultaneously learning Git.
This is my GitHub page for my Tic Tac Toe project. I will post the code below so you don't have to go to GitHub. But if you could give me some small feedback whether I have pushed/committed things in th... |
The following code snippet is causing me a performance problem in my application. The first 5 db queries are not high time consuming, the real problem lays on the foreach loop. I considered to use Dictionary structures instead of List to improve the lookups, but improving the loop will make the real difference.
public ... |
As of now, instead of the previous 4 or 5 out of 10 (relative to my C# programming skill), I'd say I'm a solid 6, and some of that is thanks to the advice I got from the last revision.
I realize the code is very long, and I tried to condense it all down to what was necessary (referenced in these main files). The full p... |
I have a script which I use to delete rows from a Excel Sheet, dependent on the Column C cell of that row being blank.
I believe deleting a range might be quicker than deleting individual rows, but I'm unsure.
Sub Shorter()
'47ms to remove blanks rows of 80 rows
'Searches the designated Column and checks for a Blank ... |
Introduction:
I have a website where customers can configure and checkout glass products like for example: Shower doors, Mirrors, Kitchen splashbacks, Table tops etc.
What I am trying to do:
I am trying to create a class for calculating the price of this kind of configurable products. All the products have in common th... |
I have been an Angular developer for more than 5-6 months and mostly I learned with my experience. However, recently after submitting code to some competition, I got a feedback that AgularJS best practices were not followed. I need some help understanding irregularities in my code.
Controller
crossover.controller("roo... |
I recently found myself in need of an IDictionary<TKey,TValue> implementation that was observable from a WPF UI. Since the .Net framework does not provide one, I rolled my own, but borrowed very heavily from what ObservableCollection<T> does on its own.
And since there is not generic implementation of OrderedDictionar... |
I am doing a lot of stuff with JavaScript and jQuery lately, but am not heading for clean code too much, as I am usually writing userscripts or small applications for myself.
Recently, a community I am part of announced that it will change their supported BB-Codes, as the tabmenu BB-Code had a possible safety issue. By... |
I'm creating a Q&A website, Something like SO. Now I need to print a "check" icon (to specify accepted answer) next to every answer. Now there are some conditions:
Is the current user logged?
Is the current user the author of the question?
Is there any accepted answer?
And some other cases.
Actually, I implemented th... |
The following code calls Parse. And uses its API to create two functions: post.create and post.find. As the names imply, one is for creating posts and the other for fetching them.
Example:
import Parse from 'parse'
Parse.initialize('APP_ID', 'CLIENT_KEY')
const post = {}
post.create = json => {
const Post = Parse.... |
On my way to learn OOP, I am developing a little CMS using the MVC pattern. I would like to have some feedback about my router class, mostly about if I am correctly using OOP.
Right now, I have a .htaccess file redirecting requests to an index.php file, both of them in the root directory of the project.
.htaccess
<IfMo... |
I have completed a coding challenge from Free Code Camp. The challenge's user stories are as follows:
I can create recipes that have names and ingredients.
I can see an index view where the names of all the recipes are visible.
I can click into any of those recipes to view it.
I can edit these recipes.
I can delete t... |
I'm learning some Python with my kids, and we're making a program to generate D & D characters from user input.
One portion of the code is to generate stats, which are a set of six numbers where each number is the sum of three random values from 1-6. We're total softies, though, so for each value, we're generating four... |
I have a function that returns size of an image IO (Maybe (Int, Int))
It would be nice to convert it to float tuple beautifully.
I am sure there must be a better way than what I currently have:
data Vec2D = Vec2D Float Float
getImageSize :: FilePath -> IO (Maybe (Int, Int))
getImageSize path = do
img <- readImage ... |
I am trying to optimize my code when downloading around 50 pdf files from a website. All of the pdf are big in size (average 25mb). Is there any way to optimize further to download the pdf faster?
for (String pdfUrl : pdfUrls) {
URLConnection request;
request = new URL(pdfUrl).openConnection();
InputStream ... |
The Rubberduck code inspections have just seen yet another structural change, hopefully for the better.
The IInspectionModel interface was originally named IInspection; it only exposes the bare-bones inspection properties, those needed by the CodeInspectionSetting class:
public interface IInspectionModel
{
/// <sum... |
I'm actually doing my whole shell in C from scratch from a Linux computer.
The thing is that I think we all do our best from creating the simplest things that can be explained easily. And I'm not sure my shell has these qualities.
All command I tried worked but command 1 | command 2 | command 3 or command 1 | command 2... |
I am learning to code by making a todo app in pure javascript. My first attempt can be seen here.
It's all cosmetic, meaning it stores no information, generates no objects or arrays, though it was sure fun to learn how to manipulate DOM elements in pure JavaScript and building my first "program"!
I am rebuilding it in ... |
If one enters, say, "2, j" then it prints:
j
jj
If there is no second it should be *, so if it's just 2, it's * **.
#include <iostream>
#include <string>
#include <vector>
using std::string; using std::cin; using std::cout; using std::endl; using std::ostream; using std::vector;
class tree {
public:
friend ostre... |
I have a subroutine which re-formats cells after a heading is inserted into the document.
Most cells are 12.75 points high, whereas the headings are 15 points high.
When a heading (single line) is inserted, it pushes all of the other cells down, however the formatting does not move with them, so any headings below the ... |
I've started learning Clojure, after many years of Java. As one of a series of exercises, I'm writing a simple card game, and the overhand-shuffle function is shown below.
My main concerns are:
Most of my code appears inside the let, and to me it looks more procedural than functional, is this the best way to do this? ... |
Here's my implementation of sorting a stack in ascending order. The problem statement is as follows :
Write a program to sort a stack in ascending order (with biggest items on top).
You may use at most one additional stack to hold items, but you may not copy
the elements into any other data structure (such as an a... |
This code was created for a game project in which 10 houses need to be populated with 16 people. I wanted the distribution to be random, with no more than 3 and no less than 1 person per house and no remaining people or houses.
JSbin link
function getRandomPartitionsFromNumber(number, parts, min, max) {
var result = ... |
I have a large function that performs a search over a data set given a set of parameters. This function goes through multiple databases which all hold data that would comprise one final entry from the search.
def perform(self):
#Go through each year and each DB in that year
for year, yearInfo in data["preproces... |
For ease of Reference, Sample Data Set which needs to be pasted into Column C from row 20. You can paste the text below into word and then copy from word into Excel with the Cell format set to Custom: yyyy/mm/dd hh:mm:ss.000
2015/08/01 12:53:03.000
2015/08/01 12:56:31.101
2015/08/01 12:56:37.499
2015/08/01 13:0... |
In my project I need to send emails. Emails will have different credentials and senders. I'm thinking about "abstract factory", but will it be good solution?
public abstract class Mail
{
public string Body { get; protected set; }
public string Subject { get; private set; }
public string Emai... |
This is of one the interesting problems I've solved:
An animal shelter holds only dogs and cats, and operates on a strictly "first in, first out" basis. People must adopt either the "oldest" (based on arrival time) of all animals at the shelter, or they can select whether they would prefer a dog or a cat (and will re... |
This small utility class is my solution for a more convenient way for checking against null. I also wanted to have more informative NullReferenceExceptions but I didn't want to pollute my code with null checks everywhere.
static class NullGuard
{
public static T Check<T>(Expression<Func<T>> expr) where T : class
... |
I am implementing a smart pointer class template and I want to overload operator ->* (even if it’s rarely done). I came across Scott Meyer’s article Implementing operator ->* for Smart Pointers. The article is from 1999 so I decided to try to adapt the code for C++ 14 (using parameter packs and perfect forwarding) and ... |
Given a complex object (with nested objects at any depth) I need to be able to quickly retrieve a value for a given property name.
I have designed the following code, I would like to know:
How to tune my code for maximum performance considering passing a big object?
Am I missing some case in data.a.x?
Any other improv... |
I have the following enum extension method:
public static IList<SelectListItem> SelectListFor<T>()
{
Type enumType = typeof(T);
if (enumType.IsEnum)
{
return Enum.GetValues(enumType)
.Cast<int>()
.Where(i => !i.Equals(0))
.Select(e => new SelectListItem()
{
Value = e.ToStr... |
How can I Pythonize/Djangoize/DRY my Django code?
views.py
class AccountDetail(DetailView):
model = BankAccount
template_name = 'bank/account_detail.html'
def get(self, *args, **kwargs):
self.object = self.get_object()
if self.object.is_owner(self.request.user.citizen):
return ... |
This takes in an array of data built from a source workbook, builds a set of "flags" based on the data in each row of the array. Then it creates a new finalRng array that will, based on a set of logic from the business, create new rows based on the data.
I think there are a ton of ways to accomplish what I am looking ... |
Wallace the Weightlifting Walrus is training for a contest where it will have to lift 1000 kg. Wallace has some weight plates lying around, possibly of different weights, and its goal is to add some of the plates to a bar so that it can train with a weight as close as possible to 1000 kg.
In case there exist two such ... |
I got inspired by Doorknob's blog post What’s the largest MD5 hash you can find? to get my hands dirty and learn some Python. After playing around with the code from that post, I decided to rewrite the whole thing and to make it more flexible (to get some practice).
This is what the code does:
It generates a random st... |
Hey so I have written some code out in jQuery, but it seems to violate DRY. I'm not too familiar with JavaScript or jQuery, so I was just asking for some advice on how to optimize this code:
$("#twitter").rotate({
bind:
{
mouseover : function() {
$(this).rotate({animateTo:360});
$("#twitter").fadeTo(fu... |
I am learning Node.js and I would like to see if I'm using it correctly:
var mysql = require('mysql');
var fs = require('fs');
var connectionProps = JSON.parse(fs.readFileSync('connection.json', 'utf8'));
var connection = mysql.createConnection({
host: connectionProps.host,
user: connectionProps.user,
password:... |
A very long time ago, I started development of a code generator for HTML. And some time ago I rewrote it and published it under LGPL v3.0 on Sourceforge.net.
It is very universal because one of its classes ([ElementListSetting][1]) reads DTD files and extracts elements from them.
Currently, this class creates only a si... |
I wanted to write a function that would take a long long int argument as well as a base and it would convert that number into an equivalent number in a different base, and return the result as a string (er, char array). For example, the call,
convertBase(9, 5)
should return "14\0". For negative values, the returned st... |
Motivation
I do a lot of graph-theoretic code, and, by now, I feel substantial need for data structures that can represent weighted graphs, both directed and undirected. Up till now, I was in a habit of writing a graph node type along with the weight function (in my prior posts, something like DirectedGraphNode and Dir... |
The reason I'm posting this piece of code is because I want to know how I'm supposed to properly handle the change in requirements/specifications and how I should accommodate it in unit testing.
/**
* Create an Affiliate
*/
public function createUser($username, $password, $email, $firstName, $lastName, $ip, $notifica... |
Given a string and an array of words, return all indexes in string for which a concatenation of all words in the array,
in any order (so ["eensie", "weensy", "spider"] has six orderings) can be matched. All words will be the same length.
I am new to programming so please tell me where my big slow down points are. I... |
I am using a <form> to send various input parameters as a GET to retrieve data from a very simple two table MySQL db.
After filtering the inputs (resulting in $inputs), I'm using the following code to build the WHERE clause which I've adapted from a MATLAB function we use to build XQueries.
It works fine, but I'm just... |
I want to nest a for loop to cycle through the Range.Value but ("B4") throws me off and this can't be avoided. I was considering using an array to do this but can't seem to get the format correct. "Q3" is a spreadsheet and "Bac Form" is the attached table imported from a PDF that must be kept. This code works wonder... |
I was having a discussion with my coworker about a function that returns either an empty string, or a string of a css class. The function is passed an object which has an HTTP status code, and then depending on that statusCode, it returns a value. We couldn't agree which is cleaner.
He wanted the function written as so... |
I have class with some basic string operations. Any suggestion to improve the class
class StringHelpers
{
function replace_between($str, $needle_start, $needle_end, $replacement) {
$pos = strpos($str, $needle_start);
$start = $pos === false ? 0 : $pos + strlen($needle_start);
... |
I completed Assignment 2 for MIT OpenCourseWare 6.092, titled "Foo Corp". The code I wrote below calculates a an employee's total pay:
package fooCorp;
class Employee{
private double payPerHour; //regular hourly wage
private double overTimePayPerHour; //regular hourly wage * 1.5
private double basePayHour... |
I find that I am often writing files where the names either:
Need to be incremented (rather than overwriting a file that already exists in the directory with the same name)
Need to be timestamped
And, so, I've created the following methods to do so:
public static string CreateDatedFileName(string directory, string fi... |
I am just picking up C++11 and decided to try some algorithmic problems to get better at it. One such problem is the fractional knapsack problem which can be solved by a greedy approach. The idea is to find the most valuable item and fill it in and move on to the next one till the knapsack is filled. Partial items are ... |
Given an array a, check to see if z numbers inside a total up to n.
If a = [1,2,3], n=3 and z=2, then this function should return true, since z numbers in that array combine to equal n.
I recently took a test for a job to fill out this function, and this was my answer. It was presumably rejected by the robots for bei... |
I'm getting started with Docker, and I've set up a very simple image built from a Dockerfile. It's based FROM the ubuntu image, and I'm downloading and building apache from source.
I'm just curious if I'm on the right tracks, if there's a more "Docker" way of doing what I'm doing, or any other things that I could be do... |
In this exercise, I'm supposed to sum up elements from 2 arrays, then display the answer on one line with spaces in between. I did it and my answer got accepted as correct, but I'm wondering if there is a better way to do this since I feel my way was more complicated than it needed to be.
import java.util.ArrayList;
im... |
Whilst scanning my C programming textbook, I saw this practice problem from a very early chapter:
I got to thinking that the problem probably wants you to draw each shape separately, which would be very easy.
But to do literally what the question asks (print them on the same line), I couldn't see any easy way! The rec... |
After reading way too much into what fizzbuzz was I though PowerShell could easily have its way with this.
Function Get-FizzBuzz{
param(
[Parameter(Position=0,ValueFromPipeline=$true)]
[int]$Number
)
process{
$result = switch($Number){
{$_ % 3 -eq 0}{"Fizz"}
{... |
I'm just starting to learn C++ (not my first language), and started with working on a program to simulate the classic "Guess My Number" game, and am mostly looking for feedback on optimization and/or general tips. I wanted to write it to allow the player to either guess like normal, but also allow the player to choose ... |
I made this temperature converter when I first started getting into Python. After a year of regular programming on my own I decide it was time to revisit my old program. Now that I finished my first semester of computer science I took my old code and made it more efficient.
New:
# Declares the variables need for the co... |
This script makes it possible for badges to onebox in Chat.
The install requires Tamper/GreaseMonkey. Click here to install,
and it's on GitHub and StackApps!
// ==UserScript==
// @name Badge Oneboxer
// @description Converts tag-like badge comments to badges
// @version 0.24
// @match *://chat.stackexchange.com/room... |
As a solution to the B. Wet Boxes problem :
B. Wet Boxes
Bob works in a warehouse which contains a large pile of boxes. The
position of a box can be described with a pair of integers (x, y).
Each box either stands on the ground (y = 0) or stands on top of two
boxes with positions (x, y - 1) and (x + 1, y - 1) (s... |
Can you help me to review my "mailto:"-parsing function ?
Since I'm trying to write less code, that is as simple as possible.
I'm not sure there if there is some bug or better solution.
var href = 'mailto:hello@world.com?subject=My+Subject&body=My+Body';
function getMailto(s) {
var r = {};
var email = s.match(... |
How can I improve this code? I wanted to know if there's a possibility to remove the for loop, and UPDATE a different uniqueID for each ID in my database.
<?php
$reponse = $bdd->prepare("SELECT MAX(ID) FROM tuto WHERE title=''");
$reponse->execute();
$IDnow = $reponse->fetch(PDO::FETCH_ASSOC);
$IDnow = $IDnow... |
This code pings 1 time every IP while using TTL to identify if it's a Windows PC. If so, it outputs it. It's very slow, so is there any way to make it go faster (1-255 in 12 min)?
@echo off
echo running, it will take a long time to scan
(
FOR /L %%N in (1 1 254) DO (
FOR /f "tokens=1,3 delims=: " %%A IN ('ping ... |
I have written a simple script for managing our Tomcat and Apache instances for deployment. What this script basically does is, when called, it copies the ROOT.war from its pwd and pushes them to two Tomcat instances. Before that, it removes the old ROOT.war file and ROOT folder, restarts them, cleans the log files, re... |
I am writing a portable library function, which is a generic "remove characters" function. Language standards used are C11 and MISRA-C:2012.
TL;DR: it should either remove all occurrences of a specific character in the beginning of a string, or it should remove all occurrences of the specific character no matter where ... |
I made this IRC client ages ago in Python, and thought I'd revisit it for Python 3.5 (I'd like to play with asyncio). Before I start, I'd like to have an overall design review about this.
Known issues, although feel free to comment on them:
I do too much in one class
There is a fair bit of repetition that could proba... |
This is my "naive" implementation of a convex hull algorithm. By naive I mean that I am not using any of the advanced algorithms that exist to solve this problem.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
namespace SO
{
static class Extension... |
This question is kinda similar to mine. However, I am using C++ with Qt instead of C#.
How would I efficiently and easily remove all accents and special characters like !"§$%&/()=? etc. from a QString?
So "áche" should turn into "ache" or "über dir" to "ueber dir" (in german ü,ä,ö can be changed into the normalized ch... |
This is the (hopefully) final version of my script for my file comparison problem mentioned previously in two posts on Stack Overflow (here and here).
I have come up with the code shown below, which does what I need it to do, but I'm wondering if it can be written in a more pythonic (read elegant) way, especially the ... |
I decided to learn generic programming in C (and take a break from templates in C++) by implementing my first simple data structure in C: the singly linked list.
What I'm looking to gain out of reviews is:
Clarity/quality
Algorithmic correctness
Code style for C
Structure and design
Any bugs or issues you can find
I'... |
Lets say I have a string like this:
string s = "A }{ B { C } }{"
//Indexes: 0123456789ABCDE
Just consider the indexes beyond #9 are 10,11,12,13, and 14 respectively.
My code turns s to "A ", because whatever is inside matching curly braces gets removed.
How the matching works:
When you find a closing brace (}), ... |
I would like to receive review on my code. It has only depth first search (DFS) and bidirected graph is the only member of the hierarchy. I added name member for the BiGraph to make it easier to debug in the future, because there might be several BiGraph instances. Also, I would like the review to primarily focus on n... |
I've made a card flip with CSS keyframes but instead of flipping clockwise and then flip counterclockwise to it's original position, I've two separate keyframes that will cause it to rotate in the same direction each time I rotate.
I have jQuery checking if either class exists and adding the first one if neither exists... |
The application's aim is to transfer drawings from the client canvas to the admin canvas using web sockets, as smoothly as possible. At every mousemove event, the client canvas is compressed to .png and sent to the server through a websocket to finally arrive in the admin window where the image is drawn into the admin ... |
Basically I need to order a list, so that an element is not the same as the element that comes after or before it.
For example [1,2,2,3,1,3,3] should come out as [3,1,2,3,1,2,3], [3,2,3,1,2,3,1] or [2,1,3,1,3,2,3] and so on.
I searched for a solution but couldn't find one so I wrote this function myself.
def unorder(al... |
In the past I posted a question that tried to implement a nice API to support RBAC authorization to resources. And due to the epoch and probably to the bount it was moderatly well received by the community. Althought even I myself can now spot how fundamentally flawed was that question due to the following reasons:
Th... |
Problem statement
After 10 sec of execution of a program, start reading the property descriptors of each property of an object and continue reading all remaining properties each, every 3 seconds until done.
Solution
function Timer(obj, startTime, interval) {
var PDO ={
obj:{value: obj, enumerable: true, w... |
I've implemented a Tic Tac Toe game with a public method checkWin() to check if the game has a winner. This is my code.
public class TicTacToe {
int size;
int [][] board;
public TicTacToe(int size){
this.size = size;
board = new int[size][size];
for (int i = 0; i <size ; i++) {
... |
In a toy language I wrote (very LISP-like), the most inelegant part is the parsing.
The language is organized as one class per programming construct, each class with its own parsing method. If the parsing method returns nil (meaning it could not parse that block in the current position of the token stream) the next par... |
I have three checboxes in my form. I have to check which one is checked and start the action. What do you think? Is this the easiest way of doing it?
Checkbox 1 = cat
Checkbox 2 = dog
Checkbox 3 = dog
Only cat -> form action
Cat & any of dogs -> play music
Dog & dog -> play music
Nothing -> ... |
I try keep an eye on any questions or answers that I have posted here within the StackExchange network and I like to prioritize my updates and improvements based on ones that get frequent visits.
I previously used a paper sticky note attached to the side of my monitor with question titles and view counts scribbled on t... |
I want to know what do you think about the structure of this code. If you think that there is some structural improvement to be made, tell me!
Here is a github link: https://github.com/LucianoPolit/LPDropdownMenu
Here is the code:
//
// LPDropdownMenu.swift
// Created by Luciano Polit on 1/8/16.
// Copyright (c) 201... |
I've been working on learning about irregular arrays and thought making a generator such as this one would be a good exercise in applying what I have learned.
The following class generates an array containing \$n\$ arrays which themselves contain arrays of integers of decreasing length, of which the maximum length is \... |
I have a Web API 2 using Dapper.net, and it's accessed by various client with their own database. Currently, I'm using custom header called Client-Id to identify the client.
This Client-Id contains a ConnectionString name and I passed this connection string into my constructor.
Here's my project structure:
Api.Persent... |
I just started programming, and something is telling me that this working function looks to big for what it does. Can you give a better version of the code so I can understand how to code faster, shorter code ?
import os, rarfile
xpath= "/root/tree/def/"
dpath="/root/tree/down"
def unrar():
for rf in os.list... |
I need to divide scoreResult into pages (which is already ordered by score column from highest to lowest), and each page cannot contain too many records (e.g. 12 is a limitation in my example), and each page cannot contain duplicate id1, and each page needs to be ordered by score from highest to lowest.
Here is my work... |
I'm using BFS to see if a given path exists in a graph:
static class Node{
int data;
Node next;
public Node(int data){
this.data = data;
}
}
//Adjency List to store the reference to head of each Node/Vertice
static class AdjList implements Iterable<Integer>{
Node head;
public void add(... |
I would like to know how can improve my solution.
import java.util.*;
public class prog{
public Map<Integer, Integer> findList(int[] array1)
{
Map<Integer, Integer> list= new HashMap<Integer, Integer>();
int start_index= 0;
int end_index = 0;
int length = array1.lengt... |
I wrote this entire program earlier today, and would like to get it reviewed.
It is an arcade style math game, where you are presented with two expressions on the left and right side. You will determine whether or not the first expression is less than, equal to or greater than the second expression.
If you get the ques... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.