instruction stringlengths 71 71.9k |
|---|
I have a to write a simple utility function that given a time in CST and a date in PST, tells if the date is today and if the current time is less than the cutoff (post converting cutoff to PST).
This is my attempt (highly childish but I seriously don't get Java date-time at all). If anyone could help me improve this c... |
I have a program which finds, well, a magic square of squares. The problem is, it's quite slow - it processes around 50 numbers in half a second when the number range is above 40,000.
Is there any way to improve this code?
from math import floor
# checksquare checks for the possibility of a set being a magic square.
... |
Sorry if it's a bit long... I tried to make it modular with methods, not sure if I overcomplicated it
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Learning
{
class Program
{
public static decimal principal;
public ... |
My teammate and I have a small discussion about the responsibility of a method. He thinks next method has two responsibilities and I think that only one.
private boolean validateUsername(String username) {
AccountValidationResult validationResult =
mAccountValidator.validate(username, new int[]{Account... |
Originally created for this answer on SO, I thought there was still room for improvement on the initial basic idea.
Also thought about using an extension method to make using syntax simpler.
Here is an updated version of the dynamic object wrapper. refined for this answer
public static class DynamicObjectWrapperExtensi... |
I'm trying to learn how to write better, more efficient JavaScript code and wanted to run this function I'd written by you and see if people can suggest an improved method.
It's basically a people filter based upon two variables.
Demo.
It works fine, but if additional categories come in (so far there are three) then th... |
I have a program that:
Takes a user specified string
Creates password from the string and previous, current, and next day
Encrypts the strings
Chops some middle characters from the strings (needed to be shorter password)
Returns a JSON object with 3 passwords
My main concern is that everything is almost repeated 3 ti... |
Inspired by my question
Simulating a random packet routing algorithm and printing packet statistics in Java
I decided to implement two more packet routing algorithms:
one that computes all the shortest paths in the network and routes each packet via a shortest path between the packet and its destination. The second al... |
I'm solving easy CodeEval challenges in Python 2.7. Usually my solutions use around 256 bytes of memory according to CodeEval. With Road Trip however while time used is still low (30-40ms), memory is >5881866 bytes. As I'm somewhat of a beginner, is there an easy way to decrease memory usage?
For each test case, which... |
After reading this old article from 2001 I have tried to implement the class from it using unique_pointer.
An author's claim is that C++ is not appropriate for large software projects because
My primary complaint against C++ is that the language is so complicated, and has enough booby-traps, that average and above-a... |
I made a simple assembly program to count the number of ones in a register. Since this is basically my first ever, I would like to hear what I can improve or if there are some major flaws in this one:
#PURPOSE: Simple program which counts the number of ones in the edx register and returns them as a status code
#INPUT... |
I wrote the code below to generate Code 128 barcodes, based on the specs.
Public Class UcBarCode 'Inherits UserControl
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
PictureBox1.Image = C128bmp("Teste123")
WebBrowser1.DocumentText = String.Format("<html><body><i... |
I recently started learning C++ about a week ago, and I made a bit of progress. In honor of Pokemon Go releasing, I decided to make a Pokedex with the original 151 Pokemon. So far I have 120 or so of them in there and it works PERFECTLY! (Thank goodness). I believe my code could be much more efficient and work better. ... |
Recently I have been busy with nodejs and I thought to create something like this Java input library, so I started with some rough code like below:
'use strict';
const readline = require('readline');
const fs = require('fs');
class StdIn {
constructor(opt_name) {
this.name = opt_name;
this.rs = this.name ? f... |
I'm working with an open-source library for processing and parsing genetic data in VCF and Tabix formats. It contains functions and classes that make it easy to read an index file (a Tabix) and load corresponding data from a compressed VCF.
It works asynchronously (unsurprisingly), however, and I'm not sure of the bes... |
This program is a practise exercise in using instance methods, and also in recursion which I struggle to get my head around. I want to know how my technique for the recursion could be improved, and if there's anything else which could be made more efficient.
The program creates a Rational object type (a fraction) which... |
This takes a field delimited by commas, and splits on the comma. The newly divided information is put in another field (created at the start of the program) called lob. Each part of the split is put in the lob field in a duplicate record of the original record from before the split. The primary key is ID which is au... |
This is the first version of my first HTML5 game. Beyond the standard features, I've added a high scores board which uses local storage to keep track of the scores.
You can move the snake with the arrow keys. Unlike the normal game, running into the wall doesn't kill the snake, only when it runs into itself. This will... |
As part of a (slightly) larger program, I needed to write a function that could take an arbitrarily large number and divide it by a small number. In this program, I will be dividing this number specifically by 2 or 5, but from my (rudimentary) testing, my function seems to work for larger divisors as well. All of the i... |
I'm creating a town plugin for the game Minecraft using the Bukkit API. It works fine and all, however I'm not satisfied with the quality of the code and I'd like to know how I can improve. I've been programming in Java for about a year and a half now, any advice is appreciated.
I have a few concerns
I'm not sure if I... |
I have the following function, and I have a hunch it can be written more concisely in Ruby.
def template_params
filtered_params = params[:template].permit!
filtered_params[:published] ||= false
filtered_params
end
The end result is that filtered_params has published: false if the params hash doesn't have publish... |
Would the following be the right way to do it in your opinion? Can you suggest a better alternative or, if not, is there something that can be done to make the existing version better?
ps -e | grep skype | cut -d" " -f1 | xargs kill -s term
|
Consider a .csv file that contains a set of video names like so:
"There are happy days","1204923"
"Beware of ignorance","589636"
"Bloody Halls MV","258933"
"Dream Theater - As I Am - Live in...","89526"
The intent of the code I built is to filter items in the csv depending on the list of excluded items. Therefore, if ... |
I'm looking for some improvements for my generic Roulette class. More information on how the class works is better described, here: https://en.m.wikipedia.org/wiki/Fitness_proportionate_selection
public class Roulette<T>
{
public string Name;
private Dictionary<T, double> _items;
/// <summary>
/// Cal... |
There are a lot similar questions out there. However, I wanted to get comments on my code. My implementation (as I believe) is simpler than the other complex ones as mine is \$O(n^2)\$.
My approach is simple:
Start with the biggest size of string
Check that string if its palindrome
Reduce the string size by 1 and chec... |
I want to upload a user's location to a server to send them a location-sensitive alert, so the location needs to be fairly accurate:
import Foundation
import CoreLocation
protocol LocationServiceDelegate {
func tracingLocation(currentLocation: CLLocation)
func tracingLocationDidFailWithError(error: NSError)
} ... |
This trait is meant to be a simple interface for tabular data from different file types, such as csv, excel, open office etc. Right now I'm only asking about some of the top level code for now and not the implementations. I'm worried that I might have made some poor design choices. But first let's get some type alia... |
I have created a utility to create scrolling parallax backgrounds.
// Backgrounds as array of objects. canvas id, speed, image url
var bgs = [{
id: 'sky',
speed: 1,
src: 'https://upload.wikimedia.org/wikipedia/commons/9/9f/Sky_back_layer.png'
}, {
id: 'middle',
speed: 3,
src: 'https://upload.wikimedia.org/w... |
Using Java 1.8, I created the following implementation to concat two int arrays:
public static int[] concat(int[] array1, int[] array2) {
return IntStream.concat(Arrays.stream(array1), Arrays.stream(array2)).toArray();
}
The unit test I created to test this looks like this:
int[] numbers1 = new int[] {1, 4, 3, 10,... |
Created the following method:
public static int max(int[] array) {
int max = Integer.MIN_VALUE;
for (int value : array) {
if (value > max) {
max = value;
}
}
return max;
}
Question(s):
I believe the Big O Notation for this implementation is O(n), am I right?
Since this is ... |
I solved bubble sort in an exam, but the examiner wasn't satisfied with the solution. Please tell me why my solution is unsatisfactory.
function bubbleSort(myArray){
var temp = undefined,isSwap = false;
for(var x = 0; x < myArray.length; x++){
if(((x+1) <= (myArray.length - 1)) && myArray[x] > myArray[x+1]){
... |
I have some code that filters an array with type (Suggestion|undefined)[] into an array with type Suggestion[], but I feel it does so very inelegantly:
const optionsProvider: AutocompletionProvider = () => {
const results: (Suggestion|undefined)[] = flagDescriptions.map(descriptions => {
let shortFlagWithAr... |
I wrote a simple Python IBAN validator, which I'd like some reviews on.
INTRO
Quoting from wikipedia, we know that:
The International Bank Account Number (IBAN) is an internationally
agreed system of identifying bank accounts across national borders to
facilitate the communication and processing of cross border
... |
I've created this function that looks for sequences in a list. If [1,2,3] exists, it will print True. I've tested the code and it works fine.
def looking_patt(pattern,cursor,found):
big_s = []
for i in range(1,101):
if i % 10 == 0:
big_s.extend([1,2,3])
else:
big_s.append... |
This is my implementation of AVL tree, it works fine. is there any thing that can be improved about addition and deletion procedures specifically when deleting the root,
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
typedef struct treenode node;
struct treenode
{
int value;
int height;
node *le... |
After learning a bit React in the last weeks I've decided to make a toDo-list.
I've got the basic-functionalities (create, update, delete entries) finished.
I'm going to enhance the app with a feature for to define priorities. Moreover should it be possible to change the order of entries.
For the final-syling I'm goin... |
I am working on some website for League of Legends statistics, which uses the RiotGames API.
The API allows you to do a maximum amount of requests per 10 seconds, and another maximum amount of requests per 10 minutes.
I made several functions to realize a queue concept, where I pass the API requests into and which only... |
I have 2 nested for loops which i want to get rid of. Any thoughts?
I am calculating distance between cities based on their longitude and latitude. There is a custom function earth.dist() that i am using in the loop.
for (i in 1:nrow(dat)) {
#for each other airport
for (j in 1:nrow(dat)) {
#if both airport are... |
Problem Statement:
Watson gives Sherlock an array \$A_1\$, \$A_2\$ ... \$A_N\$.
He asks him to find an integer \$M\$ between \$P\$ and \$Q\$ (both inclusive), such that, \$\min \{|A_i-M|, 1 \le i \le N\}\$ is maximised. If there are multiple solutions, print the smallest one.
Input Format:
The first line contains \$N\... |
Just started learning Java three days ago and am currently doing a problem in my textbook where I do some basic cash register functionality. So far my code can
factor in taxes, let the user get change, and tell them the amount the actual tax is.
public class Register {
private double purchase;
private double pa... |
Here is the problem description (from an algorithm course: https://www.coursera.org/learn/algorithm-design-analysis):
The goal of this problem is to implement a variant of the 2-SUM
algorithm (covered in the Week 6 lecture on hash table applications).
The file contains 1 million integers, both positive and negative
... |
I've written a class I call ReceptiveMapQueue. Its purpose is to organize the internal structure of an AFKable RPG. It only has two public methods - dumping entries into the queue, and extracting values from the head of the queue. I won't waste time describing it in paragraph form, since it is fully documented.
The exp... |
I'm writing a program which uses OpenCL, and the OpenCL types are mostly over-aligned. Sometimes when using stl containers with these types, I'd get segfaults, so I tried to write my own aligned allocator which I could use instead of the standard allocator.
I've done a bit of testing in valgrind etc. and so far everyth... |
I'm trying to convert this Objective-C code (originally found in this Stack Overflow question) which turns an NSString into NSData to Swift:
- (NSData *)dataFromHexString {
const char *chars = [self UTF8String];
int i = 0, len = self.length;
NSMutableData *data = [NSMutableData dataWithCapacity:len / 2];
... |
This code is meant to display book titles that are incomplete. I have a HashMap with the book title and a number that represents the amount of the book that has been read.
I want the program to:
Check to see if there are any books in the HashMap
Check to see if there are any started, yet incomplete books
If there are ... |
I am trying to implement a class for the Node of a Tree in C++ in order to represent an HTML structure.
It is not complete by a shot, but i'd still like an opinion.
TreeNode.h :
#ifndef TreeNode_H
#define TreeNode_H
#include <string>
#include <vector>
class TreeNode
{
private:
std::string textContent;
... |
I'm having a bit of trouble trying to find a more Rubyist way to achieve the following. Essentially, I want to try and iterate over every element e and apply e.method(n) for every \$n \in \text{array}\$, \$n \ne e\$. In order to determine whether or not \$n = e\$, I'll have to use an index comparison (really just test ... |
EDIT: Alternate answer on overflow: https://stackoverflow.com/questions/38487692/how-can-i-interpret-the-time-with-less-code/38492144#38492144
But I really want to keep Jonah's answer here too. Just let me know if I really have to close either this one or stackoverflow's question.
I really don't like sticking many ifs... |
I have created a gorgeous ATM machine program. It makes all other ATMs look like crap, if I do say so myself. What I would like is some sort of critique on what I've done:
Is there better syntax I could use for the if/else's such as ternarys?
Can I improve this in any way?
Can I move more of the code into separate met... |
I've been learning how to use Maven, and in order to understand it better, I want to try and write the smallest possible pom.xml file, while being as modern as possible, i.e. using java 1.8, utf-8, having the latest possible version of plugins and dependencies without breaking compatibility.
And so I came up with the f... |
I have made a random maze generator that allows for custom sizes via command arguments. It uses depth-first search and is written is C++. Could you look over my code and suggest any improvements possible?
/*
* Maze Generator:
* Made by Jaden Peterson in 2016
*/
/*
* This program is free software: you can redistr... |
I was wondering if someone could review this simple bit of code that originally was in C++, but now converted to C# as practice in using bit-shifting and creating a sort of a quasi-array functionality. Consider the partition size as a size of our array which can only hold a specific size limit for said partition. It wa... |
I wanted to make a class for type hinting that the result of a function is a homogenous deque.
from typing import MutableSequence, T, _geqv
from collections import deque
class Deque(deque, MutableSequence[T], extra=deque):
"""A typing-like type for use with function signatures using deque's."""
def __new__(cls... |
I solved this question in Swift, but was wondering if there is a better way or if my code can be improved:
Given a 6x6 2D Array:
1 1 1 0 0 0
0 1 0 0 0 0
1 1 1 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
We define an hourglass in to be a subset of values with indices
falling in this pattern in's graphical repre... |
My version of Knapsack works only when the weights or values of items are whole numbers.
Restrictions
You are given an array of objects each of which contains a weight and value.
You are also given a bag which has a maximum capacity.
Both the values and weights for every item are integers. This example will not cover ... |
This is my very first attempt to write HTML and CSS. I designed this website for a friend. I'm not sure if I used the best practices or maybe I did something wrong but I just started my learning process so I would love a review to point bad practices and things I could have done better or I did wrong.
This is meant to ... |
I'm trying to implement a simple name search using elasticsearch and a java app as the client.
Schema:
{
"firstname": {
"type": "string",
"analyzer": "standard"
},
"lastname": {
"type": "string",
"analyzer": "standard"
},
"fullname": {
"type": "string",
... |
Finally happy to see that now we can have iterators and generators. I also need to try to have private properties too so that we have well encapsulated data structures and I see that there are Proxies and Symbols which could help me do that.
Utils:
export const isDefAndNotNull = object =>
object !== undefined && obje... |
from application import app, mail
from threading import Thread
from flask.ext.mail import Message
__all__ = ['send_email', 'send_bulk_email', 'create_email']
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_bulk_async_email(app, emails):
with app.app_context():
... |
A user can track a show, and mark episodes and seasons of that show as watched. To support this I have the models below:
Models
public class Show
{
public int ID { get; set; }
public string Name { get; set; }
...
public ICollection<Season> Seasons { get; set; }
public ICollection<UserShow> UserShow... |
I want to fill collection of ToolbarItems from XAML, but change visibility of some ToolbarItem from view model.
I implemented BasePage with some wrapper around ToolbarItems collection:
public class BasePage : ContentPage
{
public IList<CustomToolbarItem> CustomToolbar { get; private set; }
public BasePage()
... |
Here is my little snippet:
def genericDecorator(*decoArgs, **decoKwargs):
"""Accept arbitrary arguments, and use them to decorate functions.
"""
def decoWrapper(func):
def funcWrapper(*funcArgs, **funcKwargs):
# You can do anything else you want here
print decoArgs, decoKwar... |
I've read this question about computing the digital root of some integer, and wondered how it would look like in Python.
As a reminder,
"If you take the digits of any number and add them together, and then add the digits of the resulting number together, and continue doing that until you get a single digit, that singl... |
I'm beginner coder and I would like to request for critique review of my minesweeper implementation. Game was made using bootstrap 3 and game board itself is a simple html DOM table. Game is complete and working but I feel it could be written in more simple and elegant manner. What in my code can be improved/written in... |
Here is my implementation of a Linked List. I think it should be efficient because of the head node and rear node tracking. Please give any feedback on my implementation of Linked List.
import java.util.Scanner;
public class LinkedList{
private static LinkedList head;
private static LinkedList rear;
private Lin... |
I need some advice on my code structure. I have read that setters and getters break one of the OOP principals, encapsulation, and that we should avoid them if possible but I cannot think of any other way to expose info other than getters.
I have a class which calculates price, savings and taxes based three inputs from ... |
I want to make post editing on my blog. I get data from a form and want to put it into a database. I'm not sure if using setters is the best way, so maybe you can show me better solution?
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$formData = $form->getData();
$post->setTitle(... |
For my first Kotlin project, I'm implementing the Redux pattern with simple Increment and Decrement buttons and a text view to display the current value.
My main questions have to do with Kotlin and Android idioms and how I structured my code. Is the below a radical departure to how Kotlin is normally written? For exam... |
I asked a question yesterday, based on the answers to that question and some personal insights I was able to update the original code. which I am posting here to get reviewed. I also thought about posting it as an answer to my own question but since that will not provide any more inputs to improve the code, I am postin... |
What is the best way to refactor this long if else statements?
make it shorter and more readable code.
I thought to use sub-classes but I don't understand how to implement that, so examples will be blessed.
public void redirectFromScheme(String scheme, Context context) {
if (!scheme.contains(SCHEMA_WALLA)) {... |
A little over a week ago I posted my basic Brainfuck interpreter here. I have since improved the interpreter on all suggested points except two minor details. (reporting the position of parsing error, which should be obvious from just the error, in Brainfuck; and a problem that would only occur in a program with at lea... |
I am working on a project on VBA where the objective is to have a "program" that fetches rates from a website called X-Rates, and outputs to excel the monthly averages of a chosen country.
Initially I was doing simple XMLHTTP requests and output to Excel the results.
But now I have tried to develop a "pseudo" multith... |
I'm using this code to login to an experiment login system created by me for this purpose.
import requests
import re
def get_page_data(regex, req):
match = re.compile(regex).search(req.text)
if match != None:
return match.group(1)
return 'no match found on {}'.format(regex)
def print_req_data(req,... |
I'm implementing the Two-sample Kolmogorov-Smirnov test in MATLAB. I must admit I know very little of formal statistics and was simply trying to implement the description in wikipedia's page.
Right now I take as input the two vectors to be compared x1 and x2, and optionally the p-value that the check will run on. It ou... |
I've solved this question. Wasn't sure if I was suppose to use a dictionary in this case, as the question was to use a dynamic array, but I didnt know how else to do it. Was wondering if I can get feedback on my code or if there's a better way to approach it:
import Foundation
// reads input for N(number of sequences... |
My solution correctly solves the problem, but I would like to optimize its performance. For a capacity of 7 and bars = [ 4, 1, 1, 2, 1], the output is 7.
def knapsack(capacity, bars)
if capacity == 0 || bars.nil? || bars[0].nil?
return 0
end
solutions = []
sum = 0
(1..capacity).each do |i|... |
This question is a follow up from my previous question.
I am working with some wireless communication in Arduino.
979797 is the address of the transmitter. I have written the following code to check the address first before processing the data. My main concern is speed of computation.
void printBuffer(const uint8_t *... |
I recently started learning about algorithms and data structure's. I decided that for every algorithm I learn about I'll implement it without looking at any pseudo code or actual code.
I have implemented Quick Sort using Hoare's Partition. The pivot is the last element in the array. Can someone check and tell me if its... |
I need to write a function in C which performs a checksum using the rule "add without carry". As I understand it, the "add without carry" concept is equivalent to the bitxor operator and given that the bitxor operation is associative and commutative, I am relying on that to perform the calculation. Below is my function... |
A few months ago I got rejected at the technical interview for a position.
The problem that they gave me is the following:
From a binary file, parse two shorts, x and y and build a Point object with these coordinates.
Repeat the process until there is no more shorts to parse. From all those points, return the 10 closes... |
As a beginner and curious guy I'm interested in implementing data structures and algorithms from scratch. Here's my implementation of Stack and Queue, the most fundamental data structures.
Are there are any mistakes/ memory leaks in the code that I have missed? How I can improve my implementation.
#include<stdio.h>
... |
Just for the fun of it, I wanted to have a hidden keypress function on my website that performs an event when the user types in the Contra code for thirty lives. I'm curious how the implementation for this simple piece of code holds up and where it could be improved.
Note: keypress doesn't seem to detect the arrow key... |
I'm a novice programmer asking first question here although I've gotten tons of help from previous questions.
The following code is abstracted from what I currently have working.
List<decimal> teamAverage1 = new List<decimal>();
List<decimal> teamAverage2 = new List<decimal>();
List<decimal> teamAverage3 = new List<d... |
I'm not a pro in js so, my code is a mess (but it's working!). I would like to ask your help to reduce some redundancies in two cases. Those two are codes are affecting these two forms:
<form action="contact.php" method="post" name="form1" onsubmit="return validateForm1()">
<input type="text" name="name" id="inputN... |
As the question says....Can this be done any better? I could introduce more variables to cut down on function number, but does it make sense? So this is a simple cross-fade between two images :
var slide_number = 1;
var slide_number2 = 2;
var slide1 = new Image()
slide1.src = "img/top_slideshow/slideshow-1.jpg"
var sli... |
I just finished this Merge Sort in Clojure, structured according to ex. 22-26 of this workshop.
The main question I have can be answered without spending time understanding the code: halve is called twice in merge-sort, is this still \$\mathcal{O}(n \log n)\$? (last lines in the code sample) Since it's functional progr... |
I finally worked out all of the bugs in this bit of code. I'm pretty proud of it and I wanted to give it to all of you so that you could have it if you wanted it for any console programs that you make.
At the same time, this is ridiculous. C++ is double my age and there should seriously be a better way of getting valid... |
I have developed the following code to hold n latest items it has received, and when asked for provide these n latest items.
The interface is:
public interface ICircularBuffer<T> {
void Put(T item); // put an item
T[] Read(); // provides the last "n" requests
}
The idea is to build a buffer that will ... |
I wrote a crawler that for every page visited collects the status code.
Below my solution. Is this code optimizable?
import urllib
def getfromurl(url):
start = urllib.urlopen(url)
raw = ''
for lines in start.readlines():
raw += lines
start.close()
return raw
def dumbwork... |
I've set myself the task to write a function that parses Verilog-style number literals. In Verilog, numbers are written like this:
8'b10101100, 16'hffff, '789, 32'd0, 12'o7, etc.
The syntax is:
<size>'<radix>value
where <...> denotes an optional field, and
size is the binary representation length of the number (in b... |
Here's a simple school assignment I did:
Problem 1: Write a program that asks the user for a positive integer
no greater than 15. The program should then display a square on the
screen using the character “X”. The number entered by the user will be
the length of the side of the square. For example, if the user e... |
I wrote an age verification module in Python 2.5 . How can I improve on current_year? import time perhaps?
current_year = 2016
year_of_birth = int(raw_input('Enter Year Of Birth: '))
age = current_year - year_of_birth
mytext = 'You are %s years old.'
print(mytext % age)
if age < 18:
print('YOU SHALL NOT PASS!')
el... |
I have the following class in Typescript (using the Aurelia SPA-framework).
import { inject } from "aurelia-framework";
import {Apiclient} from "../services/apiclient";
import * as gravatarUrl from "gravatar-url";
// Dialogs
import {DialogService} from "aurelia-dialog";
import {RedigerBruker} from "./dialogs/rediger-b... |
I am making a class method in ruby to convert from roman number to Arabic and vice versa. However the loop is run to match each character and again to match with roman mapper. Can I optimize the same?
class String
private
def roman_mapping
{
1000 => "M",
900 => "CM",
... |
I'm loading three kinds of entities from an API (in csv format unfortunately). While the first two are fine, the third has foreign keys to both of them. What I'm currently doing is constructing the first two lists and then while constructing the third list I assign the entities for every item. This is how it looks:
var... |
I have not used C++ for a while. Could you please tell me if my usage of the <random> module is correct? I am not sure if I need to be creating a new instance of uniform_int_distribution on each recursive call. I am not sure that I should be seeding the generator on each recursive call. I suspect these two actions need... |
I have some validation classes. To keep things smooth, I create a single class that has those validation classes inside of it. That class will be a singleton, and gets injected into my other classes.
The validation classes have a method that needs to be executed by the depending object. So lets make this clear:
The Ma... |
Update: I addressed the changes and created an updated post.
I'm reviewing C by working through the edX CS50 problem sets. This task was to implement Game of Fifteen aka 15 Puzzle. Project details here.
Implemented as an interactive console game. The board is initialized with "tiles" as descending values with the objec... |
Can you find a more understandable way to write the following one-liner?
Enumerable.Range(0, relation.Fields.Count).
Any(i => relation.Fields[i] != relation.ForeignFields[i])
but still preserving its brevity?
Simply put, I wanna cycle on relation.Fields collection to see if their string elements are one-by-... |
I am creating a GUI program using Tkinter wherein I utilise the Feedparser module.
My code executes in the following way:
Get the stock ticker to insert into the URL from the user.
Parse the URL and append key data to a text file.
Read the file and output it to a message box.
At the moment, the order that the items are... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.