instruction stringlengths 71 71.9k |
|---|
I have found two ways in which I can generate the Collatz sequence given a start number. I have looked briefly into their performance, but I'd like a more in depth/solid review into the difference in the two methods.
The main difference really is, one of them doesn't have if statements. But the down side to this method... |
I'm working on an exercise that counts the number of even digits, odd digits, or zeros in a user-input integer (I made it a long so the user could put in more numbers). However I have a bunch of repetitive code when I'm building my output, especially about the pluralization of "[s]". Really, the entire thing feels redu... |
I'm a beginner in programming and made a pretty simple heads or tails type game. I would like to know if I have done this efficiently. If not, please let me know what you would have done differently.
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
void headsOrTails();
int randomNumber();
... |
I have program that uses a Money class which has several constructors for different methods of input and overloaded operators to add, subtract, and compare values.
I am having difficulty defining my int asCents(const Money& amount) const; method so that it can be used in other functions. Used correctly, is it best pra... |
This code that I wrote for a lab works perfectly and gives the desired output. That said, it's over 200 lines of code to reach the result. This seems ridiculous, even when you consider that there is a restriction to only using the for loop to do it.
What are some ways I could have written this program better? Have I do... |
I've written this a few days back, which is not too big. Do you see anywhere I can improve my logic?
<?php
class Upload
{
/*
TODO: Allow multiple mime groups
Usage:
Simplest:
----------------------------------------------------------------
$upload = new Upload();
... |
Does this script look well-written and formulated?
'''
This is for a practice
Get the last letter from first_name, 2nd and 3rd letters from last name
First 5 numbers from index number.
And generate a a unique code.
'''
import sys
first_name = 'first_name'
last_name = 'last_name'
index_number = str('02001201525') # Co... |
I have a class:
public class ProductInvoice {
//Some other properties.
private List<ProductEntry> productEntries = newArrayList();
//otherMethods
}
And:
public class ProductEntry {
//other properties
private Long quantity;
private Long productId;
}
Now I need to prepare a map of productId vs quantit... |
I have these classes for my Tic-Tac-Toe game project. I am very new to object oriented analysis and design. Can anyone help determine if SOLID principles are preserved in this code or if it is violating some of them?
public class InputReader {
private BufferedReader inputReader;
public InputReader() {
... |
Ask user to input 10 integers and then print the largest odd number that was entered. If no odd number was entered, print a message to that effect.
I've written this code as my solution to the above exercise from chapter 2 of Computation and Programming Using Python by John Guttag. The book is meant to be used with Pyt... |
I have written some code to encrypt XML and then store it on the disk. I want to be sure that the encryption code is secure, so here is the code:
package com.application;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.security.Key;
import java.security.MessageDigest;
import ja... |
I am trying to learn Java by doing some (easy) ACM TCPC problems. The problem is finding number of overlapping times intervals. If there a one, a fight will happen between the two games connected to those intervals.
Example
Input
1 // this is the number of cases.
3 // the number of time intervals
1 5 // The fir... |
I'm learning Python and Gtk so I decided to write a simple application that will take some image let user annotate with a pen and send results through email or save to a file.
So far I have the skeleton of the interface:
from gi.repository import Gtk
import os, sys
class GUI:
image = 0;
def __init__(self):
se... |
This project is my learning place for a few things:
MVP (model view presenter)
XML (parsing, editing and leveraging)
deeper swing functionality
Concerning the XML part I have already recieved a very nice review by rolfl on my previous question. Since then quite a lot of things have changed and the current state of t... |
Edit for posterity: The library you're looking for is Hspec.
I recently started writing Haskell tests with HUnit.
My general setup looks something like this:
import Test.HUnit
import Widget (foo, bar)
tests = TestList [ "foo" ~: testFoo
, "bar" ~: testBar
]
testFoo :: Test
testFoo... |
In light of our current community-challenge I decided to build an Elevator Management System.
Initially I intended to program the EMS like a real-time operating system and the elevators as finite-state machine threads with each their own handler. It didn't go according to plan, but it works. For some values of works, s... |
I'm a beginner programmer and decided to try some coding challenges. I found CodeEval and attempted the first challenge, FizzBuzz. However upon submitting my code I found that my submission only partially solved the problem.
Link to the challenge
Challenge Description:
Players generally sit in a circle. The first play... |
Is there a better way to create Form Controls for properties of a class? Right now, I iterate through all properties of a class and have a method to create the Form Control for that property based on the type of the property.
private void AddControl(PropertyInfo p, string name = null, Color? c = null, int count = 0)
{
... |
Ask user to input 10 integers and then print the largest odd number that was entered. If no odd number was entered, print a message to that effect.
The above exercise is from chapter 2 of Computation and Programming Using Python by John Guttag. So far, the book has covered variable assignment, print function, condition... |
I'm often applying to jobs just to test out my skills. I have recently applied to one, had to submit a Java problem, but got rejected. Could someone please review my application briefly and tell me what was the worst mistake in my code? I am interested in improving myself but it's hard for me to figure out what I need ... |
I am working through UPenn CIS 194: Introduction to Haskell (Spring 2013). Since I am not able to take the course for real I am asking for CR (feedback) as it could be from teacher in that course.
HW4 - Higher-order programming - Full description
import Data.List
-- Exercise 1
-- Reimplement each of the following func... |
I'm attempting this question on HackerRank, which states the follows:
You are given a list of \$N\$ people who are attending ACM-ICPC World
Finals. Each of them are either well versed in a topic or they are
not. Find out the maximum number of topics a 2-person team can know.
And also find out how many teams can ... |
I stumbled on this SO question which was asking about a way to convert larger hex values to a positive numeric value:
?Val("&H8000")
-32768
Val("&HFFFF")
-1
My answer involved iterating the string digits one by one, and computing their respective value into the result:
Function ConvertHex(ByVal value As String) A... |
Inspired by my merge sort in Scheme, I thought I'd try my hand at implementing other sorting algorithms, starting with simple ones (like insertion sort) and working my way up. So, here we go:
(define (insertion-sort lst (lt? <))
(fold-right (lambda (item sorted)
(let-values (((lhs rhs) (span! (cut lt?... |
I've been doing a lot of programs for classes that require a prompt from the program. I thought it would be much faster for me to rapidly test inputs if I didn't have to execute the program and then type the input once inside the program (as opposed to just hitting ↑ and adjusting the input that way).
My concern is thi... |
I wrote the following to generate short database identifier names (e.g. parameters). This isn't a terribly practical requirement and could be fulfilled nearly as well by using base-26, but what seemed like a simple problem became an interesting challenge.
My result doesn't feel very clean, and it has some collisions. I... |
I've heard about the binary search in an intro class I took a couple months ago, remembered how it worked and read this article, so I attempted to write my first binary search in Python. It works, but when I look at other people's attempts in the article, their code looks cleaner and a bit different.
My two main questi... |
I just started with Elixir and this is what I have now. Is there an easier or better way to write this?
defmodule GroupBySum do
def sum(col), do: sum(%{}, col)
defp sum(r, [h|t]) do
{k, v} = h
r = r |> Dict.update(k, v, fn(val) -> val + v end)
sum(r, t)
end
defp sum(r, []), do: r
end
list = [a: 1, ... |
I suspect there might be a much more efficient way to accomplish this task. I would appreciate a more clever hint for performance increase. I am also looking for feedback on style and simplification where appropriate.
I assume that the set of what counts as English words is a given and that I don't need to do somet... |
Ask user to input 10 integers and then print the largest odd number that was entered. If no odd number was entered, print a message to that effect.
This is a follow-up code on feedback from Find the largest odd number
This time I've taken care of a bug related to the number of integers entered and tried to handle inval... |
Given
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
Solution
import time
def reverse(num):
dreverse = 0
while (num > 0):
dreverse = drevers... |
Wrote this an hour or so after learning some basics.
Took me a while because I had to write it in a way to fit the previous structure of my page. Basically, there are three rows of data. There has to be three row classes in bootstrap because otherwise the columns would basically stack on top of each other and I did not... |
Ask user to input 10 integers and then print the largest odd number that was entered. If no odd number was entered, print a message to that effect.
This is my follow-up code on feedback from Find the largest odd number (follow-up code)
This time I'm trying to achieve the same result with nested functions. I need your c... |
I would like to improve my functions and work properly on enums without all of those IFs as well as make it more consistent (for example Backgrounds::displayQualifingBackgroundNames()). How should I go around it properly?
The file I'm reading from looks like this: http://ideone.com/cQ4M3g
I know I'm missing few things... |
Create hash generator with configurable hash algorithm. Also need method to create salt. Implemented in visual studio 2015. Must work in DNX Core 5.0.
public class HashGenerator : IHashGenerator
{
// Algorithm has to inherit from HashAlgorithm base class.
// For example, another algorithm that can ... |
def floor_log(num, base):
if num < 0:
raise ValueError("Non-negative number only.")
exponent = 0
while num > 1:
num >>= 1
exponent += 1
return base << (exponent - 1)
print floor_log(3, 2) #2
print floor_log(4, 2) #4
print floor_log(5, 2) #4
print floor_log(6, 2) #4
I frequently... |
This is an automation code written in Python, code is initiated with robotscript. This function validates that my input list matches the list that the program provides me with. I need to do typecasting because robotframework only allows my to insert parameters as unicode strings, typecast is also needed so I can check ... |
This is the third iteration of my reCAPTCHA validator. Iteration II can be found at: Google reCAPTCHA Validator: Iteration II
It does almost everything required to do reCAPTCHA validation on anything .NET.
I removed all the XML docs to shorten it up a bit.
GitHub commit of the version in this thread (with all the docs ... |
I have a CSV file which looks like this:
ID | Name | Date
"1","Foo1","2013-08-03 21:00:08"
"1","Foo2","2013-08-03 21:00:08"
"2","Foo3","2013-08-03 21:00:08"
...
I need to write a method which returns a list of the lines with same ID and date, for reading the CSV file I am using OpenCSV. My question is whether or not... |
I am learning D. I'm trying to implement Haskell's intersperse in D. I want to use ranges. I feel that the intermediate "interspersed" value is wrong. Additionally, I suspect the concatenation character by character is inefficient. What is a more idiomatic way to implement this function, please?
string translateToSwed... |
I am starting to learn Rust and it seems pretty awesome but it's way different than any C based language. I want to know how can I make this code more idiomatic and also how can I improve my solution itself.
Euler problem 5.
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without an... |
I'm trying to wrap my head around F#. I'd like your honest opinion about this simple game source code that I wrote. Rules are simple:
Every player has soldiers and territory
Player can recruit soldiers, gain territory or attack another player
Player loses when he has no territory, wins when everybody else loses
My ma... |
This is part of a project to explore the Mandelbrot set. The code to graphically navigate the complex plane and allow the user to adjust the colormap and number of iterations is all written in Python, because that sort of user interface work is easiest in a scripting language. However, Python is not very good at inner ... |
I was interesting in having a way to convert between dollars and cents without getting into floating point numbers and losing type safety. It's very easy to get confused when you're mixing numbers with concepts. Right now what I've built allows the following:
dollars d{1};
cents c{100};
dollars d2{c};
dollars d3{2};
... |
I have been trying out AngularJS and developing a mobile application to test out its features and I wanted to see if I could somehow refactor to make my JSON response hopefully quicker in fetching the data. At the moment I have a search functionality that can display from 10 to 30.000 results and usually the applicatio... |
I've created a small command-line 'Mastermind' game using Ruby. The intent of the project (aside from having fun in the build!) was to learn and emphasize OOP concepts and principles.
The game has some simple AI in place. If the computer is the player making guesses, when they get the correct color in the correct inde... |
This is a question about Project Euler number 2, a relatively easy one. The question is:
Each new term in the Fibonacci sequence is generated by adding the
previous two terms. By starting with 1 and 2, the first 10 terms will
be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci seq... |
I was attempting to remove items from an ArrayList while iterating through it, only to find out that Java doesn't like that. So I quickly wrote up a Delay that I could pass operations to so I could run them later.
import java.util.HashSet;
import java.util.Set;
public class Delay {
private Set<Runnable> tasks = n... |
The following implementation of a lock-free fixed-size allocator is a follow-up of:
Implementation of a lock-free fixed-sized allocator
§1 - Introduction
The purpose is self-learning of atomic types and synchronization. I would appreciate a review that does any of the following (from most important to least):
Verific... |
Recently, I added this class to my Spiky engine: its basic purpose is to allocate OpenGL-based objects (such as Textures, Shader, Fonts, ...) and then manage them by giving them an ID so the user can pull objects in and out. Any remarks, suggestions or other comments are welcome.
Resourcemanager.h:
#pragma once
#inclu... |
I am currently taking a compilers course where we are designing a compiler for C- (which is a subset of C). Our first step was the lexer and I have written that but I believe that it is not very "pythonic" and I was hoping someone could help me make it more "pythonic" as I believe doing this would make the future parts... |
I was at CppCon last week and watched a clever talk about using ranges and calendars. This is just me trying to play around with the new technology.
Step 1: dump out a calendar.
Usage:
cal <year>
Output:
January
Sun Mon Tue Wed Thu Fri Sat
01 02 03 04
05 06 07 08 09 10 11
... |
This is a token generating library for Go that runs on top of Redis. I'm using it as part of a larger projects. The library needs to be able to generate and validate tokens and return the associated user IDs.
If you see any bugs or obvious glaring issues, please let me know.
// auth project auth.go
package token
impor... |
I have a small gem that I've been maintaining. This gem provides a simple way to do translation using an alternative Google API.
I've been working with Java last year and recently did some refactoring on that gem, but I don't think it's Rubyist enough.
require_relative 'extractor'
require_relative 'requester'
require_r... |
I have a function that compares bits from a binary representation string and a chunk of memory and returns true if they are equal.
This is the function (which works as expected): I'll explain with comments what some external methods are supposed to do, accept that they work as expected for the sake of this question.
si... |
I'm trying to implement an Hmac in T-SQL using this question as an guide. Please critique this:
create function dbo.Hmac (
@key varbinary(8000)
, @message varbinary(7936)
)
returns table
with schemabinding as
return (
select HashBytes('SHA2_256', Pads.o + HashBytes('SHA2_256', Pads.i + @message)) as [Hash]... |
This converts from a number to a Spanish word for example :
100 => cien
200 => doscientos
I used a divide-and-conquer approach:
Constants:
package numberTranslator;
import java.util.Arrays;
import java.util.Comparator;
public enum ExSpanishSufix {
ciento("s",2),
mil("",3),
millon("es",6),
bill... |
Here is some code which loops through an area in a spreadsheet and executes the code based on the condition that the source cells do not contain the value "(blank)".
The code works, but it's very inefficient to run nested if statements in this manner. I've tried to have a go at making it more efficient in the long run... |
I've just set up a bit of code to try and make things neater, but all I've really done, is add a whole bunch of nested if statements:
public void Copy(Copy copyType)
{
FrmProjectChooser frm = null;
if (copyType.HasFlag(Copy.Single))
{
if (copyType.HasFlag(Copy.Estimations) && copyType.HasFlag(Co... |
I have two classes in this project;
Category: This will be responsible to hold the latest information.
public class Om_Category
{
public Int32 CategoryID { get; set; }
public String CategoryName { get; set; }
public String CategorySanitized { get; set; }
public Boolean IsActive { get; set; }
public ... |
See the next iteration.
I have this C++ implementation of bottom-up mergesort (mergesort using iteration instead of recursion):
bottom_up_mergesort.h:
#ifndef BOTTOM_UP_MERGESORT_H
#define BOTTOM_UP_MERGESORT_H
#include <algorithm>
#include <iterator>
template <class RandomIt, class Compare>
class BottomUpMergesort {... |
For example, if I have the following data table layout:
dt.Columns.Add("ticketid", typeof(Int32));
dt.Columns.Add("createtime", typeof(DateTime));
dt.Columns.Add("creator", typeof(string));
dt.Columns.Add("ticketText", typeof(string));
If I want to add a new entry I need to make sure that there exists none already tha... |
I wrote the following code using jQuery to create a WebAlert instead of using the alert() function from jQuery:
(function($){
$.fn.WebAlert = function(msg) {
// If WebAlert is Availble -> First Remove this-> callback = Yes -> Now Create New WebAlert
if ($('.WebAlert_Area').length) {
$(t... |
What changes do you recommend from the perspective of structure, logic, etc?
# Checks if, for example, "2" is an integer "in disguise".
class String
def is_integer?
to_i.to_s == self
end
end
# Main TicTacToe game class
class Game
def initialize
@board = (1..9).to_a
@running = true
end
def displa... |
I have some data that needs to bind to my view depending on the user selection.
Example: changing the list of states in a dropdown depending on the selected country.
My understanding is, there are two ways to do this:
Have a global JS variable, say,
var model, which has a property, "states". This contains all the rele... |
Problem Statement
You are given a tree (a simple connected graph with no cycles). You have to remove as many edges from the tree as possible to obtain a forest with the condition that : Each connected component of the forest should contain an even number of vertices.
To accomplish this, you will remove some edges from... |
I started to learn data structures. How can I improve my implementation? For example, I don't now how to push 0 or how to realize my own resize.
public class Stack: IStack
{
private int[] s;
public Stack(int N)
{
s = new int[N];
}
public void push(int x)
{
int i = 0;
wh... |
This is the working code snippet to download file from a URL. I want to know if there is any optimization I can do to download the file faster.
File localFile = new File(localUrl)
localFile.withOutputStream { out ->
URLConnection url = new URL(remoteUrl).openConnection()
def remoteAuth = "Basic " + "${username}... |
I have drawn a box within my JPanel so that it resizes appropriately when the JFrame is resized.
This is how I implement it:
public void drawBox(Graphics g){
int num1 = getWidth()/4, num2 = getHeight()/4, num3 = getWidth() - num1,
num4 = getHeight() - num2;
g.drawLine(num1, num2, num3, num2);
... |
I'm building a template [Process-Tracker] spreadsheet.
The idea is that, for any process where we can define what steps should occur in what order (and preferably, how far apart), there will be a spreadsheet with buttons for:
Adding a new [Item] to be tracked
Updating the List of [Items] and their progress
and a li... |
I am implementing a modal dialog in my Android application, allowing the user to either pick a player from a list, or create one with predefined traits.
PlayerPickerListener
public interface PlayerPickerListener {
Activity getActivity();
void playerCreated();
}
PlayerPicker (extends Dialog)
public PlayerPicke... |
I am writing code that reads data from a DB, where boolean values are stored as 0/1 nullable integers.
I decided to write a simple function to encapsulate the logic which converts the integer values to boolean. Thing is, I sometimes need to regard the db null value as boolean false, and sometimes just as null.
So I've ... |
I wrote a little code for outputting to csv. It takes a list object named outtext and saves multiple .csv files. Each csv file contains cutoff elements of the list (except for the last), where cutoff is a specified number of elements/lines. This is useful when the user has to avoid writing to too large files (i.e. GitH... |
This class is the first of an open source project I just (a couple of days ago) started. The projects is meant to simulate circuits (logic gates and stuff) and this class is meant to manage pins. I'm developing everything following the Observer design pattern.
Could you take a look at the code and tell me anything you ... |
Three days ago I wrote about a Java Dice Roller I wrote. I've now added a GUI to that program. Here it is:
DiceRollerGUI.java:
package com.egroegnosbig.dicerollergui;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class DiceRollerGUI {
static JFrame frameOne = new JFrame("Dice Roller");
... |
Context Info
I coded up a program that maps an executable file(.exe .dll mainly) to the program's memory space which allows for easier extraction of the PE header info. I extract the information by simply casting a structure of a certain header to a memory location of the mapped file.
What I'm asking for
Readability an... |
I am developing a network application and therefor need to specify the packets I want to send. I have a basic interfaces class and one for the packets that implement them.
public interface IPacket
{
}
public interface IServerPacket : IPacket
{
}
public interface IServerChatPacket : IServerPacket
{
ServerChatPacke... |
I have created a simple component in Swing that lets me place other components such as buttons on top of each other.
They fill their parent horizontally but not vertically, which is exactly as I want it. I called this parent component VerticalPanel and this is how it looks:
I can't shake the feeling though that there ... |
I am adding classes to some legacy code and wondering if there is a more appropriate way to be setting the properties. I am also trying to understand the trade offs, if there is another way to do this.
I'm trying to find out if there is a better way to do this? If there is, why? If there isn't, why is this better than ... |
I'm studying MOOC in HTML, CSS and Javascript. And did weekly assignment task which was reviewed by 5 random course learners (I reviewed 5 other student's assignments as well). Unfortunately, I received like mere 3-5 words-long reviews, though all are positive.
Could anybody, please have a look at my code and point out... |
This runs as is, but I'm looking for an alternative way to write it.
import java.util.Scanner;
public class StateBirdAndFlowerProgram {
public static void main(String args[]) {
// Begin Scanner for user input later on
Scanner input = new Scanner( System.in );
//Begin array of information
... |
As part of a larger project to generate a website with a personal list of publications, I implemented a parser for BibTeX files.
The entry point is the parseFile method in PublicationListParser. This method scans the file for entries (and tags - a custom extension specific to my project). Each entry is read into a Stri... |
Lindenmayer Systems or L-systems are fractals that can be constructed by applying replacement rules to a string for a certain amount of iterations. For example:
Axiom (start): "FX"
Rules:
X -> "X+YF+"
Y -> "-FX-Y"
Iteration 0: FX
Iteration 1: FX+YF+
Iteration 2: FX+YF++-FX-YF+
Iteration 3: FX+YF++-FX-YF++-FX+YF... |
I am trying to convert this velocity into another 2 dimensional vector at some specified angle:
float maximumVelocity = 1.5f;
float angleInDegrees = 23f;
Vector2 actualVelocityAs2DimensionalVector = {?,?}
At first, I was going to take 1.5, and rotate it after converting the degrees to radians, like so:
double radians ... |
Search in a 2D array to check if there is a column or a row in the 2D Array thats contains all the word “error”, if yes return the index of that row or column else return 0;
Exception: if the row index equals the column index then it does not matter if contains the word "error" or not. FYI, n is the size of 2D array (... |
I'm a student learning Python, I made this calculator that will tell you the tuition for the next 5 years at an increase of 3% per year. How can I improve on this and did I do anything that isn't best practice?
To revise my new version, Python tuition calculator 2.0
inState = 10000
outState = 24000
profGrad = 40000
ye... |
Being a C++ developer, but also having been influenced by functional languages, I strongly believe that const should be the default for the vast majority of all variables when they are created and passed as arguments.
C++ does provide a const keyword, but it is not "by default". Many people have asked questions about t... |
I have written this function to perform a binary search on an array, given begin/end indices and a value to look for in the supplied array:
def binarySearch(array, beginIndex, endIndex, value):
while (beginIndex < endIndex):
mid = (beginIndex + endIndex) / 2
if array[mid] < value:
beginI... |
I'm working on a program to handle simplifying square roots (radicals). My biggest issue is, in order to stay precise, I can't have input any longer than 15 digits. Whenever a number is longer than 15 digits, it loses precision when converted to double when I try to determine if the square is actually a factor. I reali... |
You're a blind adventurer (bad luck eh). To go through the maze that'll lead you to freedom, you must first find the maze's wall, then follow this wall to find the maze's entry. Then, to get an idea about the size of the maze, you want to see how large is the said entry, so you walk until you touch another wall, which ... |
I have written a simple binary tree using structures and a couple of functions in order to add, search, find the minimum and maximum values, remove a node as well as destroy the node, the problem is that I have been using recursion and dealing with it in the same way and I am having a hard time trying to comprehend if ... |
I have converted some code in Python into its Haskell equivalent.
Python implementation:
def final_codes( bit_lengths, next_code ):
tree_code = []
for i in range(len(bit_lengths)):
tree_code.append( next_code[ bit_lengths[i] ] )
next_code[bit_lengths[i]] += 1
return tree_code
#Inputs:
bit... |
Please let me know if there is any other optimal way of doing this.
public class StringDistance {
public static void main(String[] args) {
int i, j, m, n, temp, tracker;
int[][] d = new int[100][100];
String s = "kittenede";
String t = "sitting";
char u[] = s.toCharArray();
char v[] = t.toCh... |
How can I improve the speed of this path finder A* implementation?
#include "stdafx.h"
#include <Windows.h>
#include <vector>
#include <algorithm>
struct PathFinderNode
{
public:
short X, Y;
int H;
bool IsNull = true;
PathFinderNode(short x, short y, int h)
: X(x), Y(y), H(h)
{
IsN... |
I create a data collection system that has a tree-like structure built on the similarity to the pattern of the factory, and I have the difficulty in working with this structure, more stingrays lot of code to find the element opredelnie.
public interface ITag : IRegister
{
string Name { get; set; }
string Sy... |
Problem Statement
You are given time in AM/PM format. Convert this into a 24 hour format.
Note Midnight is \$ 12:00:00AM \$ or \$ 00:00:00 \$ and 12 Noon is \$ 12:00:00PM. \$
Input Format
Input consists of time in the AM/PM format i.e. hh:mm:ssAM or hh:mm:ssPM
where
\$ 01 \le hh \le 12 \$,
\$ 00 \le mm \le 5... |
I've written a simple lock-free multi-consumer/-producer FIFO queue.
It's supposed to work like this:
At any time many consumers may read from it
At any time multiple producers can write to it, added elements will
be made available later
After write modification is finished, we call makePushedElementsAvailable(), so t... |
For speed we sometimes return response to consumer before state is saved in DB. Sometimes (Mostly for our automated consumers) this can break because the want to make actions on the saved data before it is saved. I wrote this little helper
public async Task<TEntity> GetWithRetry<TEntity>(Expression<Func<TEntity, bool>>... |
I created this code while solving the Euler Project problem 83.
In the 5 by 5 matrix below, the minimal path sum from the top left to
the bottom right, by moving left, right, up, and down, is indicated in
bold red and is equal to 2297.
Find the minimal path sum, in matrix.txt (right click and "Save
Link/Targe... |
Introduction
I have a spreadsheet in Excel, looking like this:
I collect and sort the values in the column labelled "Antal dagar venting", based on the values in the columns "Nivå 1" and "Nivå 2".
My current code for collecting this data is:
In a class-module:
Option Explicit
Private pAntalDagar As Long
Private pDelå... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.