instruction stringlengths 71 71.9k |
|---|
I've written a simple program in C++ to practice OpenGL. It takes a set of numbers through stdin and then plots it in Decartes coordinate system with x for position in input, and y for the value itself.
Example
Input:
1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361 400
Points to paint:
(0, 1) (1, 4) (2... |
There is method GetFull that should use OData return related entities.
When I call GetFull(12, "entity1,entity2") then I will get to current object with id = 12 and related entity1 and entity2 (http://.../api/City/12?$expand=Region)
When I call GetFull(12, "0") then I want to automatical find and get all related entiti... |
As per a previous question here and answers I got, I used it to get a new implementation. I found that I have to make two implementations match once "to ignore other consumers after matching once" and match all "to execute all consumers its filter matching the input", and made a common interface to abstract usage of tw... |
I have written the below program to write a Java stack implementation. I have added a method which returns the maximum value in the stack, e.g, a pop. The implementation for this is based on the Max Heap Sort algorithim. I have little doubt on the time complexity analysis - it's not \$O(\log n)\$ is it?
public class St... |
I've built the beginnings of a numerology calculator, and would like an experienced javascript developer to review this code.
It works as expected, but I can't help but think there is a better way to write it instead of using multiple for loops.
There are a few calculations that have to be made, so I can't see any way ... |
As Optional have only ifPresent and not have another function to be run in false case so I did the below class for that, please check it and give me your feedback:
public class OptionalConsumer<T> {
private Optional<T> optional;
private OptionalConsumer(Optional<T> optional) {
this.optional = optional;
}
public s... |
I'm teaching myself C++ by reading Stroupstrup's Programming Principles and Practice Using C++, and I'm working on an exercise in chapter 4. The exercise asks to convert input as a digit to the corresponding spelled-out value e.g. input of 1 gives the output "one".
#include "std_lib_facilities.h"
using namespace std;
... |
Problem
I want to receive advice on my code, which takes 0.012 seconds.
import numpy as np
import time
start_time = time.time()
raw_data= """
75
95 64
17 47 82
18 35 87 10
20 04 82 47 65
19 01 23 75 03 34
88 02 77 73 07 63 67
99 65 04 28 06 16 70 92
41 41 26 56 83 40 80 70 33
41 48 72 33 47 32 37 16 94 29
53 71 44 65 2... |
In order to exercise and learn Clojure, I decided to write a simple Minesweeper game from scratch. I'd consider myself as a Clojure novice and would be thankful if somebody could do a review or give me feedback on the code.
The full repository can be found here but I'd be also happy if somebody could have a look on th... |
I designed my repository class and I need some advice from you. Now I have a method GetByID that returns a generic type:
public T GetById(object id)
{
return this.Entities.Find(id);
}
I'm going to use OData to filter data, and for that (when I'm using $expand for single row) I need to do something like this:
Si... |
Given
Roy wanted to increase his typing speed for programming contests. So, his friend advised him to type the sentence "The quick brown fox jumps over the lazy dog" repeatedly, because it is a pangram. (Pangrams are sentences constructed by using every letter of the alphabet at least once.)
After typing the sentenc... |
I am learning OpenMP+MPI hybrid programming. As an example I have chosen Gauss-Seidel+SOR. My implementation uses MPI_THREAD_FUNNELED style hybrid programming, overlapping of communication and computation, neighbourhood collectives, MPI IO etc. Based on my analysis and running many executions it seems to be correct (ca... |
I think the running time of this should be \$O(log_{2}(n))\$:
def count_bits(num):
assert num >= 0
count = 0
while (num != 0):
num >>= 1
count += 1
return count
print count_bits(0) #0
print count_bits(2) #2
print count_bits(pow(10, 2)) #7
print count_bits(pow(10, 9)) #30
|
As part of an exercise I've written some code to generate multiple HTML files based on information stored in a couple of XML files. I'm not really sure how much code you'd need to evaluate my function so this is most of the relevant code regarding the actual HTML from XML generation:
# search taxonomy.xml for nodes w... |
This is a C++ program that rotates a point initially located at origin by a given angle A (degree) counterclockwise and L translate its x-coordinate (sum L to it).
Here is my program:
Firstly it reads the number of test cases.
Each test case has 2 real numbers and 1 integer that represents a rotation, translation and h... |
I've created a class to help resize Swing components while maintaining their aspect ratio within a container.
The class works by creating an instance and adding a container's components to it, then the SwingResizer's resizeComponents() method can be invoked whenever the container's size is changed.
At present the class... |
I'm relatively new to programming and have started writing some code for work. This script is something I wrote that I'd like to have someone comment on. Am I doing anything silly, stupid or totally unnecessary? Am I making things more complicated than they need to be?
This script takes a plain text file downloaded ... |
I've written this English checkers game. Meanwhile, it's a human vs. human game, although it is easily extensible to a game between other players (such as a computer one).
"""Play English Checkers.
see https://en.wikipedia.org/wiki/English_draughts
"""
from collections import namedtuple
from itertools import cycle
# ... |
I'm using this technique for highlighting current links (e.g. how the "Questions" link is highlighted on this very page you're looking at). I changed the code a little bit and came up with this extension method:
public static MvcHtmlString MenuLink(
this HtmlHelper helper,
string content, string act... |
I've extracted a subroutine from some perl code I've written. (I also included the use enum line for easy reference.) Its purpose is to parse the given code, returning a string with an error message if the code is malformed. The purpose of the whole program is to check code for errors, so the 'normal' path where undef ... |
I completed the following task:
You need to create the foundations of an e-commerce engine for a B2C (business-to-consumer) retailer. You need to have a class for a customer
called User, a class for items in inventory called Item, and a shopping cart class calledCart. Items go in Carts, and Users can have multiple C... |
I have a calendar table with a record for every date I need to care about (i.e. 365 records per year), with various meta-information about each date, including the weekday, the fiscal calendar week, month, quarter and year it's under, whether there's a Holiday on that date, etc.
The table has the following keys / index... |
I wrote the following function to implement counting sort:
def CountSort( Arr, Max ):
counter, retVal = [0] * (Max + 1), []
for _ in Arr:
counter[_] += 1
for i in xrange( Max + 1 ):
retVal += [i] * counter[i]
return retVal
NOTE
The function takes the array of integer/list of integer as ... |
I wrote a small program to address some assignment tasks related to making a game called 'Dice on a Yacht'. I sent the code to be reviewed by a company I was applying for, and I have not gotten the job (as I had expected shortly after submitting code and thinking over it further). I realize that I need to start prepari... |
I've the following tables
Candidates
Id Name PicId
1 Tom NULL
2 James 1
3 Bob NULL
4 Manny 2
Attachments
Id Name
1 One.jpg
2 Two.doc
3 Three.rtf
The join table AttachmentCandidate
CandidateId AttachmentId
3 1
3 2
4 3
So from the above tables it sh... |
Let's say I have a class:
class Data
{
public string Name { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
public Data(string name, string lastname, int age)
{
Name = name;
LastName = name;
Age = age;
}
}
I want to get the age of a person,... |
I have a JSP page with a table containing data from java.util.List. The items from the list are taken from the database.
Each row has an edit button that will get all the values from that specific row to be edited on another page.
Each row has a checkbox where if selected means it will be deleted from the table. The "... |
This code checks whether an image whose parent is .papers.left has completely loaded into DOM and if yes then the background of its right content's height has to be same as the background of this images parent. So below is html to understand the structure
<div class="row">
<div class="col-md-6">
<div cla... |
Because I'm both lazy and wanting to mess around more with time management and Ruby, I thought it would be fun to create a simple script that opens Code Review once every day to go towards the daily login badge awards! There are so many ways to go about this that I'm certain you could probably do this within several li... |
I have created an implementation in GO for generating Flake ids. The implementation in based on Factual\Skuld's implementation in Clojure
Current limitations include:
The current implementation does not store last timestamp in a persistent store. This means that in case the process hosting flake is stopped, the system ... |
Background
I'm working on a system that records information about a large number of external documents. These documents are organized by "repository". There can be a modest number of repositories (hundreds). Each repository can contain an essentially unbounded number of documents (tens of millions in some cases). Each ... |
Tear me to shreds.
The class RandomForestRetrainer will be used to retrain a machine learning algorithm. It has functionality for taking in a directory containing malware or benignware files and splitting them into training and testing sets, creating statistics from these files, creating concatenated mw/bw training/te... |
This is my take on a simple hangman game, which is played from command prompt.
import random
wordlist = []
word = random.choice(open("words.txt").readlines())
#word.txt is a list of words, in the same directory with the game file.
length = len(word)
mock_word = "_ " * length
#The underscores presented to the p... |
Does this method follow the rules of objective programming? If not, how can I change it?
static void SaveStudentData(Student[] student)
{
StreamWriter File1 = new StreamWriter("First.csv", false, Encoding.Default);
StreamWriter File2 = new StreamWriter("Fourth.csv", false, Encoding.Default);
for (int i = 0;... |
Here is an updated version of my Caesar Cipher script. I am looking for ways to improve it, make it more succinct, and expand it's features.
I would eventually like to add text import and export features.
Here it is with comments galore!
####Collin's Caesar Cipher: A Caesar Cipher by Word Length (V.2)
#To import the... |
I have two threads. One runs a simulation and one runs a UI.
In the UI, it is possible to trigger a "tick" of the simulation. There are a few constraints:
Ticks run on the simulation thread
Each tick takes a bit of time to complete.
When the user asks for n ticks, n ticks should be completed, even if they are reque... |
I'm relatively experienced with Java and C++ so picking up PHP wasn't too difficult. I wanted to get some feedback on my first PHP class. There's nothing extremely complicated as of now, but its nice to get feedback.
The only part I feel that I will definitely get feedback is for the readCSV() function. I made it speci... |
I've created some base classes for items, and I want to know how maintainable or expandable the method seems.
using System;
using System.Diagnostics;
using AbilitySystem;
using AbilitySystem.AbilityClasses;
using AbilitySystem.BehaviorClasses;
using AbilitySystem.EffectClasses;
using ItemSystem.Enums;
using Microsoft.X... |
For a small personal project, I was looking to write a number as a human readable number. For example:
1023 -> 1K
12345678 -> 12M
Stack Exchange, like a lot of others websites, use the same trick. It is called metric prefixes.
Humanizer is a library to convert data in a human readable form. Since my feature match with... |
I'm probably not the first to think this up, but here we go. An trinary search tree is a generalization of a binary search tree in the sense that instead of a comparison function returning true or false, it will return -1 for less than, 1 for greater than, and 0 for equivalent.
Once equivalence is found, a search alon... |
My script looks for handshake files in an input folder to determine whether certain processes have completed. If it finds them, it will update the database with the current time stamp.
Things I am wondering:
My update_db function takes 5 parameters. I have heard that in that case there is probably a better way to do... |
I am relativly new to Python and I decided to try to write code that would factor any polynomial using the Rational Root Theorem and synthetic division. I have two questions.
Is there any way I can clean up my code or any common practices that I should know about?
How could I allow my function to factor polynomials wi... |
I am in the process of writing a Cloud application (mostly hobby, learning) that required a very quick cache, queue, and messaging system. I have looked at a few different options from Microsoft (hosting is on Azure) and all seem to be slow (for my relative needs). Then I hit Redis, and the speed was right where I need... |
This is an exercise in implementing the maximum sub-array sum problem.
It asks for several solutions of complexity:
\$O(n)\$
\$O(n \log n)\$
\$O(n^2)\$
\$O(n^3)\$
For an additional challenge I completed it using Python.
import random
import timeit
#random array generator
def generate_array(item_count, lower_bound, u... |
I'm a little rusty in Java, but I'm using it to get ready for interviews. Here's the problem description from HackerRank:
Problem Statement
Suppose you have a string \$S\$ which has length \$N\$ and is indexed from \$0\$
to \$N−1\$. String \$R\$ is the reverse of the string \$S\$. The string \$S\$ is funny
if the... |
I'm using bluebird for promises in my Node/Express application and wrote an API call in which the user passes in a JSON Web Token that contains their user information, and then I decode the token, and pull up the events that user should see based off their userId.
If anyone could give me advice on how I can clean this ... |
I am executing a shell script from my Java program using Process and I want to kill/destroy that process if my script takes long time.
I came up with this code and wanted to see if there is any better way or anything I can improve on.
public class Test {
public static void main(String[] args) throws IOException, I... |
I've decided to make a wrapper class for the java.util.Properties class since, in its current state, it only allows for storing and reading String values.
Is there any way I can improve the following code?
public final class Prefs {
private static final Properties properties = new Properties();
private static ... |
Problem Statement
There are N integers in an array A. All but one integer occur in pairs. Your task is to find the number that occurs only once.
Input Format
The first line of the input contains an integer N, indicating the number of integers. The next line contains N space-separated integers that form the array A.
... |
I inherited a project that has many imports. Is there any way to refactor it so that we don't have this many imports?
from logging import getLogger
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.exceptions import O... |
Problem Statement
You will be given a list of 32 bits unsigned integers. You are required to output the list of the unsigned integers you get by flipping bits in its binary representation (i.e. unset bits must be set, and set bits must be unset).
Input Format
The first line of the input contains the list size T, whi... |
I have this class with two public async methods, which also calls some private methods that are async.
Here's the class:
public class AggregatedDataService
{
public IPrincipal User
{
get { return HttpContext.Current.User; }
}
public object SessionToken { get { return HttpContext.Current.Session... |
I want to apply three levels of filtering on record.
rec in cname. rec is string of >2 words, so I want to consider all ngram of rec to be checked in record
i. if gram matches into record increment filter_company_level and write it to file
2nd Filter on record is for each value value in self.keyword_material_info list... |
I am a newb, and whilst I'm sure my formatting can be improved, I really want to know, how I can re-use my code for this simple program. The objective is simple, football game with a menu, that allows game status to be loaded and saved.
MainmenuTest.java
package mainmenutest;
/**
*
* @author Darren Estcourt
*/
imp... |
I have a C# application and a CakePHP website. These communicate between them using GET and (WebRequest) POST method.
My problem is that it's happening too fast. I have made a diagram that shows some statistics. I retrieve the data from the website using GET method (XML file), such as:
https://www.my-website-link.com... |
As a beginner to Python with some rookie experience in building software, I decided writing an API wrapper for Strawpoll would be a good exercise in learning the language and design patterns.
The intent was to finish writing the entire wrapper but I feel something is amiss, but am unable to identify why the code I've w... |
I have developed a tiny bit of JavaScript to quickly output a Froogaloop Vimeo video and some basic controls attached with almost no effort. You don't have to include the script from Vimeo (the script will add it for you) and it will create only the very basics of controls for now - although they can be amended. I also... |
I have written an ASCII art generator library. I was practicing data abstraction and code abstraction and I wanted to know if there is something that can be improved.
File tree:
| |--Makefile
|--fonts--|--StarStrips.c
| |--whimsy.c
|
| |--core.h
---|--include--|--StarStrips.h
... |
I'm writing a tool, to manage our application, specifically to store passwords in encrypted view. I made a class which is based on two posts:
https://stackoverflow.com/questions/20852664/python-pycrypto-encrypt-decrypt-text-files-with-aes
and:
https://stackoverflow.com/questions/4102761/python-config-parser-cache-to-re... |
A while ago I took one of @Simon's scripts and updated it to make it more geared towards normal users (no offense mods) and this Question was created. But the link to the Github is no longer correct and the code has changed quite a bit to get it to work on Firefox and Chrome (and Opera and IceDragon and Safari).
I woul... |
I am writing a regular expression for parsing PHP annotations in a flexible way.
I'd like to accomplish all the goals listed above with one single expression. So I would appreciate any suggestions about the quality of it (in terms of corner cases, performance, best practices and correctness).
PCRE expression:
/[\*\s]*@... |
I have a correlation matrix containing 4 time points, each with multiple samples. Each sample is identified with a time point with its name. What I am trying to accomplish here is to create a directed graph using Python's (2.7) Networkx with edges connecting nodes from the last time point to the first time point (6h --... |
I have this code and this works fine but I think it's too lengthy. I want to know if there can be a less lengthy code. I've heard from people that lengthy code is often not considered good.
<html>
<head><title>Table</title></head>
<body>
<form method = "Post" action = "Table.php" >
Enter a number between 2 and 20 to ... |
Yesterday I have found that I can't use the wireless network at some spots in my house. I used another modem as a WiFi booster and I managed to cover these spots.
The problem is that when I go to these dead spots I need to use static IP and change my primary DNS servers, or I get limited connection. Also, I still want ... |
This based on this question in StackOverflow. The accepted answer uses Convert.ToString(int, base) to get the binary string, reverses it and converts it back to int. Nice trick!
I have very little experience with bit twidling (using Flags is about it :p ) so I decided to try and code the solution to this problema witho... |
I worked on my code a bit from the earlier post and was able to make it work. I am new to C++ so please be kind.
I basically have two questions apart from the peer review.
When I use templates definitions in a header and just call it from source, it doesn't work. Why?
To make it work using strings I want to use a type... |
I posted a custom byte cipher on this site a few months back, and after spending three days recoding it from scratch, wanted to post it again to see if you can offer any improvements. (I am not looking for: "You should use var instead of explicit declaration". I'm looking for significant code improvements, not coding s... |
This question now has a follow-up:
Implementation of a lock-free fixed-sized allocator - follow-up - with commented code
I've tried implementing a lock-free fixed-size allocator while trying to learn synchronization through atomic variables.
Here are the related classes:
template_utility.h
#ifndef OAG_TEMPLATE_UTLITY_... |
I had to ask myself a couple years ago: before Edsger Dijkstra invented his famous shortest path algorithm, how brute force approach would seem.
Below is my version. It's super slow, but I find it funny.
BruteForceShortestPath.java:
package net.coderodde.graph.experimental;
import java.util.ArrayList;
import java.uti... |
Given these classes:
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
//...
}
}
public partial class LoginForm : StackPanel
{
private LoginRegistrationWindow parentWindow;
private LoginInfo loginInfo = new LoginInfo();
public LoginForm()
{
... |
I am writing a small utility that reads a number of print files to extract out financial data, and then build a spreadsheet populating the data in specific cells.
I have it working, but it's not elegant and certainly not what you would call Pythonic, so I am rewriting to make it more efficient and improve my Python ski... |
I've made a pretty standard console in which you type a command and it does something. However, the issue that comes to my mind is scaling: if I want to add hundreds of commands, I have to manually add a new Command instance for each one individually, which is... less than ideal.
The full code is stored in this GitHub ... |
The scenario is as follows: We have a streamed enumeration that we have to check if it's ordered or not before processing it (about 75-80% of the time it is ordered). We are talking about pretty big enumerations, in the range of 10-100 million elements.
Because the first step processing the data is ordering it and we n... |
I've been researching about JavaScript and jQuery function chaining and different callback techniques. I am trying to create a very generic code that allows chaining, and in a way that I may create several parallel chains without them interfering in one another.
Expected Usage
Setting up
/*---Usage---*/
var chain = ne... |
I'm a newbie and I'm new to C# (thus statics and copy-paste) and I'm painfully aware that this code smells. I'm trying to implement a web service that handles a similar pass-through logic with three different data structures that are processed by three corresponding different methods of an external service.
How can I a... |
I have the following code which I implemented to delete all the nodes for the matching value. My code handles all the 63 varieties of test case scenarios including scenarios like deleting 1 from linked list 1->1, leaving the linked list empty.
public ListNode RemoveElements(ListNode head, int val) {
if(head != ... |
I'm trying to extract specific files and visualise them in a list/grid. For that purpose I'm starting a Service to do the background job, and when it finishes it fires an Intent which will be captured by a Fragment/Activity. The files are extracted in an singletone container which feeds the adapter when the broadcast i... |
Here's the JSFiddle, the GitHub repo, and here it is out in the wild.
Note: the application uses Chrome's Speech Synthesis API and only works on Chrome or Safari for iOS7 (oddly enough).
It was my first voyage into jQuery-UI. I'd love some feedback on structure, coding style, and things that could break.
JS
var json... |
Given two arrays (for instance a list of people and a list of subjects), I need to initialise a Hash with all zeros for all possible combinations of these two arrays. I can manage to do that with the code on the bottom, but it seems like there should be a less convoluted, more elegant way to do this.
people = %w(tom ma... |
I implemented the inversion count algorithm using the merge sort approach for this question.
The question begins with a number t = number of test cases and then for each test case you input size of array and then the array entries.
For each test case we have to find the number of inversions = number of shifts made by i... |
If there are two or more words that are the same length, return the first word from the string with that length. I am a beginner. Could anyone highlight good and bad parts of the following program.Also, had it been last word from the string with that length, would it give different result in Chrome and Firefox because ... |
I'm now posting the second semi-complete part of my operating system makefile. The kernel itself is currently incomplete, so don't be surprised by the small size of the makefile. When the kernel expands, it will follow suit.
OFLAGS = -Ofast
DEBUGFLAGS = -g -g3 -ggdb3
TARGET = i686-elf
CC = gcc
INCDIR = -I kernel/includ... |
I have grid N × M in which each cell is coloured with one colour.
When the player clicks on any cell of the grid of colour α, the cell in the top-leftmost corner of the grid, of colour β, receives the colour α, but not only it: all those cells which are connected to the source by paths which use only the colours α or ... |
I've recently been writing an application which does a lot of work with the output of commands. To call the commands I've been using the subprocess module, and originally, was using subprocess.PIPEs for the stdout and stderr, and then using the communicate method once the process was complete to retrieve the output to... |
I have written the below class which encrypts and decrypts a PHP array. The encrypted data and the hash are sent over an insecure connection and I would appreciate if you could check the code for any vulnerabilities I may have overlooked.
class ArrayEncryption
{
const encryptionAlgorithm = 'aes-256-cbc';
const ... |
I've run into a problem twice just recently. Though I'm getting around it I can't help but feel that it's a rather unconventional method and that there's a better one.
This app is an exercise in using different types of persistent storage. I have 1 table to store short notes. In a ListView those notes are displayed alo... |
I tried to create a class for porting Java's synchronized keyword to C++ using below code using *nix pthread's library.
In general my test cases seem to work, but since this is a very critical topic I would like to have someone else have a look on it in case I missed something which might invalidate my test cases.
The ... |
I have implemented a thread safe holder to safely pass data between threads.
User can set value many times, but only the first SetIfEmpty call stores the value, then user may read the value many times.
template <typename T>
class ThreadSafeHolder {
public:
ThreadSafeHolder() : is_value_set_(false) {
}
void... |
I have a string which I want to check for characters other than those in this list {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", ".", "i"} however this check gets run several thousand times a second.
I am therefore looking for the most efficient way of performing this check, what I have tried so far:
If Not System... |
I would use the same RecyclerView.Adapter with two or more different fragments. Every fragment uses a different view items layout so I must use a different RecyclerView.ViewHolder for binding the data.
For the implementation I have created one RecycleView.ViewHolder that binds the two different view layout with a switc... |
I've written a basic dice program in Java which takes a number of faces then randomly selects a number within that boundary. Here is the code:
package com.georgegibson.diceroller;
import java.util.Random;
import java.util.Scanner;
public class DiceRoller
{
public static void main(String []args)
{
Rand... |
I am trying to learn Java by doing some (easy) ACM ICPC problems. The problem consist to check if the knight in a chess game can move from a point A(r1, c1) to B(r2, c2) with one move only.
package dalia;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
public... |
I have an object that needs to have a single point of initialization, and other callers need to wait until the initialization is complete before continuing.
I have done this with jQuery, and it feels like I'm working with the design, but the same approach with a native JavaScript Promise seems like it is going against ... |
I've been designing and coding my Laravel API boilerplate for couple days now, and I'd like to hear some advice/improvement hints!
I'm pretty satisfied with the result, but I'm also aware, there might be (and surely are) some things that can be improved.
Basic concept:
Every controller should extend my App\Http\Control... |
I wrote a decorator which makes Python 3.5 raise exceptions if the arguments that are passed to a type-hinted function are of the wrong type.
from typing import get_type_hints
def strict_types(f):
def type_checker(*args, **kwargs):
hints = get_type_hints(f)
all_args = kwargs.copy()
all_arg... |
I'm working on an RPG so of course I have to have some dungeons. I've got the dungeon generation working, with the output being a DungeonTileType[][].
Now I wanted to create the code for the player to be able to enter the dungeon. To do so, I created a Dungeon class that will hold all of the information necessary for... |
I needed something that would get the URL of a chosen video from YouTube and store it in a file.
Since I didn't find a way to write/edit an existing file with the URL alone, I had to use a patchwork of JavaScript and bash to stitch together the complete URL.
I'm asking if there were things I could have done better or w... |
The first line will contain numbers m (number of rows), n (number of columns), and b (number of rotations to be performed).
Suppose I have following 4X4 matrix:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
and b = 1,the output must be:
2 3 4 8
1 7 11 12
5 6 10 16
9 13 14 15
The problem I am facing is 3 test case are ti... |
As my first (keep that in mind!) Haskall program (full code at end) I've written a simple Enigma machine and would like feedback on the core code related to its stepping and encoding — stripped of comments to see how it fares without them. (I expect to post a follow on where a more complete package is reviewed; but thi... |
I have a simple if statement which, based on user input, determines which expression is going to be utilized. It looks like it can be done better.
Func<Unit, bool> exp;
if (onlyChildren)
exp = u => u.PhaseId == id;
else
exp = u => u.PhaseId != id;
var unitGroups = _db.Units.Where(exp).GroupBy(m => m.UnitTempla... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.