instruction stringlengths 71 71.9k |
|---|
We are to normalize a database, though it is mostly all theoretical, we aren't actually plugging in the SQL. This is the Data we have normalized to these tables..
and here is our SQL for normalizing it. I'd just like to know if anyone spots any glaring issues.
insert into bldg_table (bldg)
Select distinct bldg from a... |
Inputs are two values \$1 \le m , n \le 10^{12}\$. I don't know why my code is taking so long for large values where the time limit is 1 sec. Please suggest some critical modifications.
#include <iostream>
#include<algorithm>
using namespace std;
int main() {
long long count = 0, m, n;
cin >> m >> n;
for ... |
I found sorting large arrays by a comparator that looks at the floating-point difference problematic, especially -ffast-math, (https://stackoverflow.com/questions/24442725/is-floating-point-addition-commutative-in-c.) This is intended to compare 32-bit floats exactly using integer arithmetic. Most references cited conc... |
I am working with CUDA and I am currently using this makefile to automate my build process. However, there are multiple --compiler-options, basically one for each flag I want to pass to gcc.
How can I avoid repeating it over and over?
(Any suggestion about improving my makefile is also really welcome)
CC=nvcc
LIBS=-lm
... |
Hey so I have a function written in c whose cache performance I have to improve. The statistics are being provided by cachegrind. But I'm completely stuck and cannot get more than 10% improvement in the performance. I really need help with this.
Here is the function:
#define LARGER 50000
typedef struct {
char c1... |
First I work on all of my projects alone, and I feel like I need my code to be reviewed by others and deep dive into performance and best practice ... etc.
I created a simple jQuery plugin that excerpts text of an element depending on whether lines / characters count.
If option of type was set to chars the method of _... |
This is a program about finding all the permutations of an string. I want to be able to make it faster and more efficient like eliminating the recursion maybe. Please advise.
What is intended is to also find the permutations of the sub-strings of the main string while repetitions should be omitted.
public class StrPerm... |
The problem is as follows:
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.
Using Project Euler to stretch my C# learning, I solved problem #4 with the code b... |
Briefly, I'm looking at getting the code below to execute faster. I have 100k images to go through. I'm running a query against MySQL, looping through results and then running exiftool against an image, then moving it.
I started running it and it quickly became evident it wouldn't be a quick thing :-(
import mysql.conn... |
Today I had an interview where I was asked to solve "Given an binary tree, convert it to binary search tree in minimum time, space complexity".
I wrote this code, but got the feedback that complexity could be improved without using sort and without using external storage.
How to do it?
##code goes below##:
class Node:... |
I was practicing for interview questions, and my friend recommended this one:
Given an initial list of integers L, and a number N, find the smallest member M of L, which on being replaced by N, gives the subsequence with the largest sum S for any subsequence within the modified list.
Examples:
L = [1, 2, -1, 3, 4], N ... |
I'm currently working through "Algorithms in java" by Robert Sedgewick (3rd edition, german version) on my own and am trying to solve one of the exercises there.
The exercise
Write a program that counts the amount of nodes in a binary tree, that
have an external and an internal node as children.
In the following p... |
Scenario : Sending a POST to 2 different endpoints (not related to or dependent on each other).
I'm really just not sure if I went about this correctly, and whether or not the responses will have returned from the context before the method returns. I have read some about async/await and the context for which it operate... |
I am using following classes/interface to redirect user (after login, register, logout etc.)
File: RedirectInterface.php
interface RedirectInterface
{
public function getUrl($customerId = null);
}
File: LoginRedirect.php
class LoginRedirect implements RedirectInterface
{
public function getUrl($customerId = nu... |
(See the previous iteration.)
What I did
Now I have took some (not all) good points from the previous iteration.
Removed the entire weight function class,
Got rid of node IDs,
Improved the math a little bit,
Removed the hashCode and equals,
Cosmetic improvements.
Problem definition
We are given an undirected graph \$... |
In a simulation of mine, for which performance is paramount, I have the following bottleneck.
I have a huge 2D grid of dimensions width and height, whose dimensions are stored in linearized form, i.e. positions at x and y are stored as one integer x + y*width. Every iteration I have to get thousands of such linearized ... |
Using the contains method I'm checking to see if an object is in an arraylist, if it's not then I add it else I want to increment the count.
if (!data.contains(d)) {
data.add(d);
} else {
for (int j = 0; j < data.size(); j++) {
if (data.get(j).equals(d)) {
... |
I have finished a battleship game, written in c++. I was hoping someone could review my code and tell me where I could improve. I have posted all of the code below, I hope that is okay. If not, and I can only post snippets, please let me know and I will delete the question. The options for gameplay are a human vs cpu a... |
I have a problem with Youtube videos being deleted from my big playlist and not knowing which videos got removed. So, I decided to write a Python script to save certain information(title etc.) about the videos in a playlist into a text-file. I particularly don't like the setChannelNames() func, but that's the best I co... |
I have the following series of click events in my jQuery code:
$('#morning .up .hour').click(function () {
morning.hour++
update_hour(morning);
});
$('#morning .up .min').click(function () {
morning.min++
update_min(morning);
});
$('#morning .up .sec').click(function () {
morning.sec++
update_sec(morning)... |
I have been reading the book Pattern Recognition and Machine Learning (Bishop) for a while, and recently I came across this figure, which was created using Bernoulli mixture model on the MNIST dataset:
I figured it would be fun to code this, so I basically followed their algorithm:
Suppose you have N images of handwr... |
I wrote simple generic function to check if any STL container has an element. It seems work fine. I have tested it with VC++, GCC and Clang compilers. It works perfectly.
How can I improve it further.
#include <iostream>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
#include <vector>
#include <a... |
I am making a userform that grabs data from a data sheet and puts it into a table:
Grabs the data based on what the user wants (Brand -> Items for brand)
Allows multiple items to be added
Displays the info about the items
Allows the user to specify how many of each item (for when the data is put into the inventory tab... |
I'm at uni and working on an assignment in c# that takes some user input (from they keyboard via console).
The input validation required:
numbers must be within range (range will vary depending on which menu they're in)
strings must not be empty/null
string must be no longer than 30 characters in length
So I've chose... |
This is the Swift code from one of the view controllers in my app that calculates a one rep maximum weight a person can theoretically lift. This particular view controller presents a list in a tableView of all types of lifts a user can choose from to set as a default preference. When the user selects a lift name, the r... |
I'm looking for a better way to implement a huge CompareTo function that relies on an Enum to perform sorting. The data structure is essentially a flattened Multi Level Group. Any ideas and concept to make this function easier to understand and extend are appreciated.
With the exception of of the Field 1,2,3 names ever... |
Having played Human Resource Machine for over a day, and wanting to improve my interpreting / tokenizer skills, I made a Human Resource Machine interpreter.
For those that do not know, so if you do you can skip this. Human Resource Machine is a game where you're an 'instruction follower' employee.
You are given tasks ... |
I have to write a little social network for a case study at university. I have done some simple webapps before but nothing that required authentication, login and so on. So I wrote this little application after reading several guides on how this is usually implemented.
What I came up with is a simple login.html file in... |
I want to show you an iterative algorithm to convert a signal to a Fourier series. When I ran unit tests I gaven following results:
one iteration: 1 sec, passed;
ten iterations: 3 sec, passed.
I use Visual Studio Community 2015 environment. I'm writing this library in C# and MathNet NuGet package.
How can I optimize ... |
I have been working on a problem that asks me to a write recursive function that can reverse the words in a string. For example if the string is "cat is running", then the result should be "running is cat".
I already completed the problem, but I feel like my implementation is really bad. Does anyone know any other way ... |
I would like to merge multiple arrays that are already sorted, into one sorted array.
My arrays look like this :
{
"arrays": [
[
{
"type": "tag",
"position": "start",
"text": true,
"offset": 1280,
}
{
"type": "tag",
"position": "end",
"tex... |
I have written some improved C-type classes in C++ and wondered whether these are suitable for professional use or in which way they would have to be improved to be professional or more powerful.
Especially in such cases I was not sure about it:
template <typename arg, typename ...args>
void DoubleArray::append(arg num... |
I am trying to make a scrolling game in Tkinter. However, with all my for loops and functions it is extremely slow.
I am reading the tutorial from Khan Academy's advanced JS. In their JS game everything is fine, so is it just a problem of python is slow or am I doing things inefficiently.
import tkinter as tk
import r... |
I wrote this program, which purpose is to visit the 18th link on the list of links and then on the new page visit the 18th link again.
This program works as intended, but it's a little repetitive and inelegant.
I was wondering if you have any ideas on how to make it simpler, without using any functions. If I wanted to ... |
Challenge
Given a test case print out a FizzBuzz Series.
Specifications
The first argument is a path to a file.
Each line includes a test case.
Each test case is comprised of three spaced delimited integers.
The first two integers are the dividers X and Y.
The third integer, N is how far to count.
Print out the ser... |
This is a Windows Presentation Foundation application that queries active directory and can display lists of users, users by group, groups, and users by manager (direct reports). It operates on whatever active directory server the host computer belongs to, and dynamically builds a TreeView of all the Organizational Uni... |
Novice coder here. I have the following code to perform a few actions like clearing filters, copying a range, and then pasting a formula down a row till the last line.
It works perfectly, but it takes longer than a minute to complete since I am addressing each in my for next loop individually. Would anyone know how to ... |
I have the following script that reads JSONified data from within a DIV, generates HTML with values using JavaScript, then sends them to another DIV.
What I'd like to improve is to remove HTML from JavaScript. Namely, not have HTML inside the JavaScript. I am not 100% on how to do this. I want "minimal work" but "... |
This is good practice, to make square image? Side of the square container is equal to its width.
public class SquareImageView extends ImageView{
public SquareImageView(Context context) {
super(context);
}
public SquareImageView(Context context, AttributeSet attrs) {
super(context, attrs);
... |
I am swapping structure lexicographically by name.
Is there any way to improve the code when the structure entries are heavy.
Here is the code
#include<stdio.h>
#include<string.h>
struct College
{
char name[100];
char city[100];
int yearOfEstablishment;
float passPercentage;
};
void displayCollegeDetail... |
I have not written very many stored procedures before, and this is the first one I have written to be used in a real business application to write new data into the database, so I would like to get advice to improve it from more experienced SQL developers.
In short it is meant to insert a new person along with their c... |
This is basically my school homework and I want to know what to improve, and what not to do.
The homework basically is this:
You will get a input in seconds, which is supposed to be shown as H:MM:SS where H is hours M is minutes and S is seconds. The formatting is supposed to look like in my example. ( note: In output,... |
Is this efficient?
"""
merge sort algorithm in python
"""
def merge_sort(array):
if len(array) == 1 or len(array) < 1: # base case
return array
int_mid = len(array) / 2
left = merge_sort(array[:int_mid])
right = merge_sort(array[int_mid:])
return merge_arrays(left, right)
def merge_a... |
Is this the best way to implement a genetic algorithm framework? I'm just a student and wanted to know if I can improve the code that I have done. Some of the code I copied from the framework documentation:
namespace xx.xx.xx {
class Program {
static GrafoDistrito grafo;
static int total;
... |
This is question #10 from Project Euler:
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million.
I just started programming and read that a Sieve of Eratosthenes is the fastest way to find primes however this code is taking forever to run. How can I make this go faster?... |
I would like to optimize a snippet of code, which uses a multiple nested if statements. I am looking for a formula to make it as a combination of multiple arrays logical operations. Please, I need just a hint to start. Can you please help me review the loop and vectorize it?
The I is an input image (any):
I = 5*rand(4,... |
I'm making a hotkey program to aid me using PC faster. By saying hotkey here, I mean any combination of two or more keys in the keyboard.
For example, if I press G, hold it then press M, I have hotkey GM. Then I can launch Gmail from the default browser.
The idea is same with the famous AutoHotkey software, but with a ... |
I had already put up code for review a small poker program but I have rewrote it utilizing a more appropriate data structure.
How would I compare Poker hands accordingly?
Full source repo
enum poker_hands check_hand(vector *hand) /* check what kind of poker hand player has and return a score from 1 to 10 */
{
sort_... |
I solved this exercise of displaying a table of numbers from 1 to 256 in binary, octal and hexadecimal. I made this program to convert from decimal to binary and took that binary number to convert to octal and hexadecimal to made a table of binary, octal and hexadecimal. You might see that the way I found out which was... |
Here I want to improve the code in addListofEmployees and mainMethod. How can I do so?
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
public class AddEmployees extends Employee {
public static List<Employee> addListOfEmployees(long upperLimit) {
... |
I've written the second iteration of my math expression parser, utilising what I learned from the first attempt to make a more reliable, maintainable piece of code.
If anybody wants to see the first iteration to see my progress, see here.
With the first version, I tried to evaluate the expression string directly, witho... |
I wrote the java method to answer this question :
Write a Program to sort String on their length in Java? Your method should accept an array of String and return a sorted array based upon the length of String
So my questions:
1. Is my method efficient enough?
2. Can it be improved somehow?
private static String[] sor... |
One way to write a client which uses a specific protocol, eg http like in this case, is to create a base class with the basic socket handling functionality with virtual functions which can be overridden with an inheriting derived class.
But it is more flexible I think to be able to get the socket handling class to cal... |
The below code returns an array filled with the number of users last seen for each day for $dayCount number of days that is specified via a parameter into the function.
It does this by executing a database query for each day from the previous day going back $dayCount amount of days, and another function produces from t... |
I completed the following exercise on HackerRank. My program is fed a list of commands, such as:
12
insert 0 5
insert 1 10
insert 0 6
print
remove 6
append 9
append 1
sort
print
pop
reverse
print
Where the first line of the input is the number of commands, the rest of the lines commands and parameters.
Here is my ... |
The problem
I have lately been working Project Euler: 231:
The prime factorisation of binomial coefficients
The binomial coefficient \$ ^{10}C_3 = 120 \$.
\$ 120 = 2^3 × 3 × 5 = 2 × 2 × 2 × 3 × 5 \$, and \$ 2 + 2 + 2 + 3 + 5 = 14 \$.
So the sum of the terms in the prime
factorisation of \$^{10}C_3\$ is 14.
Find th... |
I'm working on a minecraft plugin for my Spigot Minecraft server.
I have a class which works as expected. I've done my best to hammer every single bug out (famous last words, I know) and am now taking a look at the way it's written. I've noticed that documentation definitely is not lacking, and looks over documented, t... |
I made a prefix notation calculator.
Prefix notation, aka Polish notation, is a form of notation for logic, arithmetic and algebra, like infix and postfix (reverse Polish) notation.
The expression '+ 3 4' in prefix notation is as valid as '3 + 4' in infix notation, as well as '3 4 +' in postfix notation.
The calculator... |
The "Save Humanity" problem on Hackerrank asks us to:
... find all substrings in the patient DNA that either exactly matches the virus DNA, or has at most one mismatch.
For example: "aa" and "aa" are matching, "ab" and "aa" are matching, while "ab" and "ba" are not.
Input Format
The first line contains the number of t... |
I am making a Pacman Player vs Player game in Java, and I am wondering if I am implementing movement in the game in a good manner. Anything that will reduce the code size or make the program faster is wanted.
Note that the game is not complete, and I have only worked on player one (Pacman). I have not started on player... |
I have an array of strings and on click of the "NEXT" button it displays the next array item in a <p> tag while on click of the "PREV" button it displays the previous one. When it reaches to the end (beginning) it continues from the first (last) item.
I have had some hard time to find a way to get the right item index ... |
In fact, this is a group assignment for our C programming lesson, but seeking help from others is not considered cheating.
The goal of the following code is to:
Sort the data in start.txt by destination, and then by month if two trip routes share one destination.
Count how many trip routes each month and destination h... |
I'm building a simple iOS app using Swift that calculates the One Rep Max weight a user can theoretically lift. User inputs a weight lifted, the number of repetitions and the app uses one of several formulas to calculate the maximum weight they should be able to lift one time.
I'm skeptical about the way I'm implementi... |
I wrote a module to simulate physics of 2D elastic balls and the community helped me to improve it on this post.
Now I implemented a GUI using Tkinter to display the simulation in a window.
I'm a beginner in programming GUI and I don't know if my script can be more efficient and/or simpler.
Indeed, I'm not really sati... |
I have just received feedback regarding a junior dev test that I submitted. It was unfortunately not great, and the recruiter could not articulate the issues, I tried to show that I was thinking about the problem in a deeper way, but the feedback was that the solution was "over complicated".
This is the challenge:
// C... |
I wrote this program to implement a shopping cart. It supports adding/removing items to the cart, viewing the current order, and completing the checkout process.
import java.util.Scanner;
public class Keychains1 {
public static Scanner keyboard = new Scanner(System.in);
public static boolean stay = true;
... |
This code is Express NodeJS code that handles post registration .post action where the user must select a custom username. The username is validated, and if valid, the database is updated. If not, the user is redirected to the page with an error message so he/she can try again.
I would like to know if you would refacto... |
I've created my first complete JS app, which lets you add tasks and control how much time you spend on them. I posted this to get some ideas how to improve readability, efficiency and the speed of my code.
The first table shows tasks that you add via input box. Every time you press the "Add task" button, the generateRo... |
I find the default Exception.ToString() formattig very difficult to read especially if there are inner exceptions involved. I guess everyone knows how it looks:
System.ArgumentException: This is a message. ---> UserQuery+TestException: You need to specify a valid id.
at UserQuery.foo(Int32 id) in C:\[...]\LINQPad5\_... |
I'm writing a Ruby extension in C. It's a string processing module working on UTF-8 encoded strings only.
One method, full_width_to_ascii!, converts full width characters to ASCII equivalents (https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms). Essentially, it subtracts an offset of 0xfee0 from any full width... |
This is the script I wrote to make an automated POC baby-sitter in 5 lines.
I first found this on a GIF or meme site and thought of making a POC script that does the same.
#How Linux users babysit
while :
do
eject
eject -t
done
I don't know aything about bash. So, I want improvements.
You can find the origin... |
I have the following task:
Implement a simple command line Java application for booking bus
seats. For simplicity suppose there is only one bus, initially all
seats (lets say 50) are free. Users can book one seat at time through
the application API, the application itself should try to take the
first available... |
Precursor for this revision here in code-review:
Recursive spinlock for C using ASM
Improvements have been made thanks to forsvarir.
Now I am trying to optimize this lock so it becomes more practical.
The code in question.
#define gate_Gate volatile int
#define gate_Pass volatile int
extern inline void
gate_Enter
(g... |
I am working on a problem that simply calculates and prints the credit card balance. I hope this code can be improved/optimized a lot.
I am from a Java background. If it was Java code, I would have pulled all the code lines inside the for loop and place it at the beginning of the method and inside for loop I would call... |
I have some of my code that I have tried to improve on to make it cleaner and efficient and I would like some feedback to see if I am going in the right direction with what I am trying to do.
I have a page with a menu, and when you click on menu item it displays the appropriate fieldset.
HTML:
<!-- dashboard_container ... |
I am trying to perform a loop and then stop the loop when the last line of code in the if statement is printed to screen saving on CPU cycles.
I want to start a while loop and then kill the loop after it is complete, but not breaking out of the loop so I can re-initiate the loop once again by pressing a GPIO button "B1... |
I am writing a search indexer for a site I built. It counts the number of times a word is used in a given story allowing one use of the word per chapter. I have also attempt to weight words in the titles and the descriptions more heavily by including them in every chapter that is indexed.
I would like to know if I am h... |
Using SCSS and React, I have made a little table (not an HTML table), which is responsive based on variable-width cells. That is to say, each cell whose width is not variable has a flex-basis value, whereas variable width cells have a flex-grow value of 1 and no flex-basis.
The example I have used is for match odds for... |
Currently, I'm working on gamification platform and I have the following rules for achieving a new level:
Level 0: When user registers
Level 1: When user confirms account
Level 2: When user completes a quiz
Level 3: When user completes a mission and publish more than 5 comments in the blog
Level 4: When user completes... |
I'm learning concurrency and asynchronous programming in C#. For a better grasp on the matter I'm trying to create an OLX Crawler. My issue here is the performance: It takes roughly 159 minutes to crawl 17.901 links.
The method which crawls each item is this:
public async Task FetchItemsData()
{
var itemsTa... |
This question began as an off-topic answer to this question, but the code here serves a different goal.
I wrote the following class for the purpose of populating a dict on demand from an iterator. The intent of the iterator passed to the constructor is that it could alternatively be passed to dict, which would consume ... |
I'm trying to come up with a system to populate my item images on demand, this is what I have so far. One obvious bug is that an item image could be downloaded multiple time since the _image will remain nil until the first download has completed. I could work around this with a loading property.
My main issue is about ... |
I'm trying to let users log in with multiple columns (e.g. ID, email, phone). If one fails, it checks the next column.
I would like to minimise my if and else statements. Is there better way of doing it?
$email = $request->only('email', 'password');
$ssn='';$badgenumber='';$ophone='';$fphone='';$pager='';
... |
I made a simple, semi-playable command line Chess game for my class exercise.
At this point, this game can do the following things:
Print out the updated board representation after every move
Players can take turns
Players can actually move pieces
The code is pretty long so I don't really expect people to read all o... |
Here is a Java collection puzzle I found online. I was wondering if anyone can provide me with suggestions on how Appearance and tests can be improved. Suggestions of any kind and scope are very welcomed. it would be even better if reasons can be provided along with the suggestions.
Problem:
Appearance class:
package ... |
Found this problem somewhere online and wanted to try this out with my beginner skills. I was able to solve this problem but how can I make my code better?
We need to print a pattern like this (each line has one more character in length):
E
my
iyt
hTri
bbiann
i
Here is the solution I have written, and I wa... |
PHP program which extracts attribute list from the custom tag. It also strips out the single and double quote if it exists around attribute value.
<?php
function parseAnswerTag($tag)
{
// input => <answer scale="10" points="7">
// ouput => ["scale"=>10, "points"=>7]
// get the answer tag and parse out the... |
I have to implement an image-Carousel.
Because I'll reuse the snippet within other projects which might contain all kinds of external libraries I used an immediately invoked function expression.
Could my code be improved?
All Hints appreciated.
(function (imgPaths, imgTag, prevButton, nextButton) {
var length = im... |
There's a csv file with format:
x0, y0, v00
x0, y1, v01
...
x1, y0 v10
...
And what I want to do is to plot a heat map, in which at location (x, y) the value v is plotted with corresponding color. Below is my current implementation.
import random
import numpy as np
import matplotlib.pyplot as plt
def create_test_csv... |
I have written a function diff that takes two nested dictionaries and it computes a difference of their content (what is inside the list) returning a new dictionary. To better explain what I mean by difference here is an example of two input dictionaries:
dep={'cl1': {'to_do': ['bill', 'ann 46.0.1']},
'cl2': {'to_... |
So I have doubts about my code and if it is any good. I have a parent class Spell:
using UnityEngine;
using System.Collections;
public class Spell : MonoBehaviour {
public enum SpellType { AttackType, AreaType, BuffType, DebuffType };
public float damage;
public float speed;
public float cooldowntime... |
I'd like to suggest the following implementation:
// Find an instance of substr in an array of characters
// the array of characters does not have to be null terminated
// the search is limited to the first n characters in the array.
char *strnstr(char *str, const char *substr, size_t n)
{
char *p = str, *pEnd = st... |
This macro pulls in two workbooks, one being a template with saved formulas already, and the other containing data with thousands of rows...I need to increase the speed because the process takes more than 15 minutes.
Sub WbtoWb4()
Dim Wb1 As Workbook
Dim Wb2 As Workbook
With Application
.ScreenUpdating = False
.Enabl... |
I have a mock_Data:
structure(list(Sample = structure(c(29L, 31L, 21L, 25L, 15L,
17L, 13L, 27L, 23L), .Label = c("109d0", "109d2", "116d0", "116d2",
"125d0", "125d2", "136d0", "136d2", "138d0", "138d2", "141d0",
"141d2", "144d0", "144d2", "18d0", "18d2", "28d0", "28d2", "30d0",
"30d2", "39d0", "39d2", "4d0", "4d2",... |
I'm writing a Rails service in which a series of operations are performed on a record:
class RecordBaseAmountService
self.build
new
end
def call(record, subrecord)
record = calculate_base_amount(record, subrecord)
record = adjust_base_amount(record, subrecord)
record = pro_rate_record... |
This is my first program using a class that I personally designed. Please pay special attention to the design of the class and I would love pointers and advice on how to better improve logical design of classes (what should be grouped with them, better ways of creating classes to interact with each other, etc).
I am a... |
I am using a WordPress multisite network and want to pull information from options pages in Advanced Custom Fields to create a json file. I currently have this code running whenever an options field is updated on a subsite. The json file lives on the main site.
The code works and runs successfully, however, it takes fo... |
My code calculates \$e^x\$ with series expansion. Is there any way to make it shorter and cleaner?
#lang racket
; evaluate e^x with series expansion, use first 10 terms.
(define (exp x)
(letrec ([f1 (lambda (n cx cn)
;(writeln (list n cx cn))
(if (>= n 10)
0
... |
So, given a file with the following format:
[header]
line of data
line of data
line of data
line of data
[header 2]
line of data
line of data
line of data
...
I add a line of data to a specific header so the result would be:
...
[target header]
line of data
...
new line inserted
The program ... |
I'm trying to implement the repository pattern in the following manner:
Interface:
public interface ISurveyRepository
{
Survey Add(Survey survey);
IEnumerable<Survey> GetAll();
Survey GetById(int id);
bool Update(Survey survey);
bool Delete(int id);
}
Implementation:
public class SurveyRepository ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.