instruction_seed stringlengths 71 95.1k | _source stringclasses 1
value |
|---|---|
I am working on an AB tool in JavaScript using the following:
Calculate the Conversion rate based on the conversions divided by the hits.
Calculate the Z Score by passing in the control and treatment objects.
Determine the confidence of the Z Score with Cumulative Normal Distribution.
How accurate is this?
/**
Exam... | stackexchange/codereview |
I have this script that moves a box around the screen and the loops the second part of the movement. I have altered the code to drop another three boxes (4 in total) into the animation so the boxes follow each other around the screen.
I want it to work exactly like it does, but I'm sure there's a much better way of doi... | stackexchange/codereview |
We're migrating our streaming ETL application from Python into Clojure,
the hottest part of the code isn't yet performing as well as our existing
implementation. This looks to be down to the algorithmic complexity of our flattening function.
Take a nested map, flatten the data structure and rename keys. We take data
... | stackexchange/codereview |
The PowerShell script below queries the Security event log on one or more servers for events with id 4663. When trying to retrieve all audit events for event id 4663 with the following code the computer throws the following exception: how can we to optimize this PowerShell?
So I just want to fetch security event log ba... | stackexchange/codereview |
My code here is completely working, but I feel like I destroyed or didn't follow the DRY rule, what suggestions can you give to me for this code??
<?php require_once("./includes/Utilities.php") ;?>
<?php require_once("./includes/Db_Resources/db_connection.php");?>
<?php require_once("./includes/Db/DatabaseUtilities.php... | stackexchange/codereview |
Regular timers in JavaScript (setInteval & setTimeout) have two problems:
They aren't as much accuracy as you can get in JS. If you set it like this:
setInterval(fn, 1000);
You can't be sure that it will be called every 1000 ms. It'll be called 1000 + 1-10ms or even more if some heavy tasks were before the tick.
This... | stackexchange/codereview |
Here is my class to read a csv file and I was wondering if there is any improvements that I should do. I feel there are some performance improvements or in exception handling because I just took IO exceptions.
package com.mypackage.utils;
import com.opencsv.CSVParserBuilder;
import com.opencsv.CSVReader;
import com.op... | stackexchange/codereview |
This was a little app I wrote looking for a way to create consistency in the way employees taking phone orders enter the address.
The purpose of the app is to require a user to enter a valid address.
The scope broadened to include two secondary objectives, performance and proper rendering.
Performance: No IF ELSE o... | stackexchange/codereview |
I have been trying to do a simple query and return the results with node-mysql however I had several problems. Originally I wrote it where there was no promise, but if I tried to access user after just doing a query if returned undefined
The solution I came up with is the following, is this a good way of doing it? I ne... | stackexchange/codereview |
Created this little config class, any room for improvements? Think I have done an alright job but would like to know if any improovements could be made?
<?php
defined("SECURE") or exit('Please define SECURE keyword to continue.');
class config
{
private $configValues;
private $configFile;
public function _... | stackexchange/codereview |
For the sections between count=1s and the start and end; combine overlapping positions and output the median of the counts.
Input
chr start stop strand count
chr1 0 13320 - 1
chr1 13320 13321 - 2
chr1 13321 13328 - 1
chr1 13328 13342 - ... | stackexchange/codereview |
I have a JSON file like
{
"Changes": [{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "RESOURCE_NAME",
"Type": "A",
"TTL": 60,
"ResourceRecords": [{
"Value": "RESOURCE_HOSTS"
}]
}
}]
}
where I need to repl... | stackexchange/codereview |
I am working on a Chess AI using chess.js, and currently, it can run 3 layers in under 10 seconds, but 4 or more takes minutes. How can I optimize my current code to be able to run 4 or 5 layers, or do I have to implement a different algorithm.
Here is my code:
function startMinimax(depth, game, isMaximisingPlayer) {
... | stackexchange/codereview |
I have written a safe read function for haskell (for education!). I think this is fairly idiomatic haskell code, but I'd like to know for sure. If you see anything else that could be improved, please let me know in your answer.
module ReadNum (readNum) where
main = print $ readNum "87k7"
readNum :: String -> Maybe I... | stackexchange/codereview |
This is the first coding class I've taken and I'm not getting much feedback from the instructor. The function of this program is to take two roman numeral inputs, convert them to arabic, add them together, then convert the sum to roman numerals. I wanted to see if any of you code ninjas could give me some feedback on t... | stackexchange/codereview |
I have created a simple program in which the user is prompted for various details about their employment. In my Employee.java file, I have all the methods.
Employee.java:
import javax.swing.JOptionPane;
public class Employee {
private static String name;
private static String jobTitle;
private static int ... | stackexchange/codereview |
Introduction
This is my first attempt to mess with memory allocation using C and create something close to a python dictionary. Coming from a high level programming language like Python or Java, I am not really used to correctly handling low level code. I tried to follow C conventions/style but I can tell I already fai... | stackexchange/codereview |
This is the "Climbing Stairs" problem from leetcode.com:
You are climbing a stair case. It takes \$n\$ steps to reach to the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways
can you climb to the top?
Note: Given \$n\$ will be a positive integer.
Example 1:
Input: 2 Output: 2 Explanation: ... | stackexchange/codereview |
This question is an improvement I did based on recommendations from these other questions:
Simple object-oriented calculator
Simple object-oriented calculator - follow-up
Simple object-oriented calculator - part 3
To those looking at this question for the first time, I'm trying to find a correct OOP model I can use in ... | stackexchange/codereview |
For a section of a much larger program that generates plots, I am creating a list of styles that I can pull from to create a consistent format from plot-to-plot. It works as follows
I have a list of colors shade = ['k','m'] and a list of styles style = ['--', ':','-','.'] that I am concatenating to get the desired list... | stackexchange/codereview |
I am calling a service outside of my control. My application must include a time out, so that if the call to the service takes too long, an appropriate time-out message is returned.
// Client connected to remote service
RemoteClient Client = new RemoteClient();
private async Task<MyResult> CheckItAsync(CheckRequest rq... | stackexchange/codereview |
I wonder if there is a nuget that can do this already
Anyway, here is my code
Public Shared Function splitArrayIntoSmallerArrays(Of someObject)(arrayOfSomeObject As someObject(), chunkSize As Integer) As List(Of someObject())
Dim output = New List(Of someObject())
Dim newestArray = New List(Of someObject)
... | stackexchange/codereview |
Background:
I have been working on a service which allows users to signup on different apps and on each login checks if the request is valid or not based on a series of checks.
The below snippet is small part of the whole application but covers my question and is working fine for now:
Code:
'use strict';
const bcrypt ... | stackexchange/codereview |
I am trying to create pagination with pure PHP and jquery. I have done this and it works exactly how I want it to work. Essentially I get all products from my database using PHP.
I then populate the whole page with the products and hide every row after the first 6 products. Then using jquery I create the pagination but... | stackexchange/codereview |
I'm working on a jQuery plugin. The problem is that when I use it I can see a high CPU usage in task manager.
I think the problem is here:
$elementTSMask.on("mousemove", function(event){
if(isMouseDown && isLeftButton){
var toScroll;
if(endPosition != 0){
toScroll = scrolled + (event.pageY ... | stackexchange/codereview |
I've created a linked list class in Python, but I'm not sure how to enforce only passing Node objects into the insert routine.
# linked list in Python
class Node:
"""linked list node"""
def __init__(self, data):
self.next = None
self.data = data
def insert(self, n):
n.next = self.ne... | stackexchange/codereview |
Below code is for Given an even number (greater than 2), return two prime numbers whose sum will be equal to the given number
my task to reach the lowest time complexity
I tried it differently, but I cannot reach the lowest time complexity - please help, and I am running it on an online compiler.
class Solution:
de... | stackexchange/codereview |
According to the first part: Forum crawler - counts statistics for words in chosen forum topic
I take into account the review of Janos and created Iterator for my classes.
This is part of the whole App. I have a problem with dividing it into classes, I'm not sure about this architecture which I've provided.
Descirptio... | stackexchange/codereview |
I'm implementing an iterator which takes a single value and which you can advance for n times with a dereferencing yielding the single value - but before or after that range of n 'positions' you can't dereference. So it's as though you filled a length-n std::vector with a single value and were taking a const iterator o... | stackexchange/codereview |
I have attempted the below question, however my solution is too slow (i.e. It does not fit the 2 second time constrain for java). How can the solution be optimised?
While at IOI 2020 in Singapore, you decide to go outside one night and
look up at the stars. At exactly midnight you observe a bright planet
directly abov... | stackexchange/codereview |
This is in continuation from the project posted here: Making a report from payroll details part II
Basically, based on the user input in columns F, G, H, the macro generates a varying string in column I.
Eventually this spreadsheet is combined together in a mail merge in Microsoft Word (if anyone knows how to do that i... | stackexchange/codereview |
I have just started learning python and I am solving Project Euler problems alongside for practice. This is my solution for problem 5. Project Euler asks for the minimum value divisible by all numbers from 1 to 20 but I have made the program so it works from 1 to n.
I think there is a lot of room for improvement in it ... | stackexchange/codereview |
I've created a small project that contains a league table from Premier League updated constantly using local node.js server. Data is fetched from local server.
I'm wondering whether my solution is optimal, especially table ordering.
'use strict';
var React = require('../node_modules/react/addons'),
GamesService = ... | stackexchange/codereview |
I've been learning python for some time and I've come up with the idea to practice it a little. I created a script that removes files by their extension .html and .srt and also empty directories. It works good, but I've got a feeling that it could be improved. Can someone help me improve the code? Also I know it is not... | stackexchange/codereview |
I am a relatively new programmer. I am trying to use iter and cycle to cycle over a list (key) and 'pair' each item with each consecutive item in the second list (message). The code below works as expected, producing the desired pairs and stopping when it is done. It does not, however, execute that last print statement... | stackexchange/codereview |
I'm new to Java and find it hard to grasp the concept of objects. I wrote a simple guessing game to practice the concept of OO programming but I am not sure if I am doing it correctly.
The objective of the game is to guess a number from 0-9 with 3 players and the first player who guesses it correctly will win the game... | stackexchange/codereview |
After writing a basic API with rocket, I'm trying to improve it, but I'm not sure how to follow up. Each time a new request comes in, the code keeps looking for the variable from the environment.
// Connect to redis
pub fn connect() -> redis::Connection {
let redis_host_name =
env::var("REDIS_HOSTNAME").expect("mi... | stackexchange/codereview |
The author of my book does not release odd-numbered solutions to students, so I can't check my solutions. I was wondering if there was a better way to solve this problem without simply printing out the square roots.
Here is the question:
(Game: locker puzzle) A school has 100 lockers and 100 students. All
lockers ar... | stackexchange/codereview |
#include <iostream>
#include <string>
using namespace std;
string reversal(string a) {
int i = a.length();
string reversed_string{};
for (; i >= 0; --i)
reversed_string += a[i];
return reversed_string;
}
bool palindrome(string a) {
if (a == reversal(... | stackexchange/codereview |
This assumes there is no need to aggregate results from the listeners of a broadcast signal.
Technically I guess the slots are whatever your std::function holds, so they aren't special. So I guess this is more of a Signals/Connections design.
The "connection" or Signal<T...>::Listener is the owner of the callback. It's... | stackexchange/codereview |
The program is asking you to guess a number between 1-100 and if you guessed too low it says that in Swedish and the same goes for if it's too high and if it's the correct answer it says congratz you guessed right in Swedish.
I'd like comments about any aspects of my code.
public class Kidsprogram {
public static v... | stackexchange/codereview |
I am writing an importer service. I have different sources and at the end I would like to push them into database tables.
For different db tables, I am using different dbset in the context. I also am aware for each db what is the primary key (it could be different, because other naming conversation).
I would like to re... | stackexchange/codereview |
The following code is mainly concerned with the conversion from byte/bit stream to numericals such as int, unsigned int, short int, unsigned short int, float, and etc. These functions are heavily used in my image data decoding program. I feel an insufferably slow when dealing with bigger image. Would please help me im... | stackexchange/codereview |
I'd like to put some of my code under critique. The following code will take a supplier for elements and a filter function. Once provided -> the elements will be held by the model until "refresh" is called. Changing the filter will cause filtering.
Model changes will be published by a listener pattern like:
A listener... | stackexchange/codereview |
I have a web application where my users can upload text documents and emails into what I call Streams. A stream is like a "stack", that holds all emails / documents.
My users can then add fields to the stream, and field_rules. This means, that every time a new document or email is added, the text content of the documen... | stackexchange/codereview |
I made very simple interpreter in C and now, I want to make my code better.
Here is my code:
#define size_t unsigned long long
int printf(const char *format, ...);
int scanf(const char *format, ...);
void *memmove(void *str1, const void *str2, size_t n);
size_t strlen(const char *str);
int main()
{
char ch[50];
... | stackexchange/codereview |
I know this works but I want to improve this code! I don't expect anyone to re-write this but if you have some "try this instead" then great!
import java.util.*;
public class Polynomial implements Iterable<Object>, Comparable<Polynomial> {
Comparator<Polynomial> compare;
private Term head = null;
//A const... | stackexchange/codereview |
Question:
Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string "".
Example :
Input: strs = ["flower","flow","flight"]
Output: "fl"
Source: https://leetcode.com/problems/longest-common-prefix/
My Code:
public String longestCommonPref... | stackexchange/codereview |
The following code allows users to enter multiple optional quantity fields after first filling in a value of the current quantity input. If the input field contains a value it will then display the next quantity field, if not, it will remove/not display it.
The code is currently working as intended but I don't believe ... | stackexchange/codereview |
I'm creating an option checkbox for an Organization data only if they have Organization data to submit from their CSV. I am creating a <div> and my <select> and <option> are wrapped inside of the <div>.
Do I need to create an input ? I'm in Vue.js and don't see any current methods or v-if nested in the right way. I wan... | stackexchange/codereview |
This is a binary-to-text encoder that is based on Base64, but it works by converting data into an almost pronounceable string (consonant-vowel-consonant-vowel for each 3 bytes). Any improvements, suggestions, etc. are welcome.
bitspeak.hpp
#ifndef BITSPEAK_HPP
#define BITSPEAK_HPP
/*
Encoding:
******** ******** *... | stackexchange/codereview |
I have coded my own lightbox for the sake of my own custom needs because I want to be able to do this kind of thing myself and learn all the various things involved. I realize I could use a plugin, but that is not the point here.
Last week I posted this vague question to get some feedback on the style, and ultimately t... | stackexchange/codereview |
Background
This is a follow-up of this CR: Compile-time plugin system. The code exposed below can also be browsed on this gist, which shows the differences between both questions (original is version 1, this one is version 3).
This is a simple factory which is able to serve the requested specific implementation of an i... | stackexchange/codereview |
There is an interface:
interface JournalCreator {
@Async
Journal create(Parameters params);
}
And many different implementations:
class CarsJournal implements JournalCreator {
@Autowired
private JournalRepo journalRepo;
@Override
public Journal create(Parameters params) {
String name... | stackexchange/codereview |
I'm learning Vue and I would like an opinion to improve the form validation that I have implemented. This is my component:
<template>
<section class="p-0 d-flex align-items-center">
<div class="container-fluid">
<div class="row">
<!-- Right START -->
<div class="col-md-12 co... | stackexchange/codereview |
All right, let's do this one last time.
This is continuation of this review.
I applied most of the proposed changes, making interface of my container very close to that of std::set.
(I also added a few things that weren't explicitly mentioned but I found them on cppreference.com. For example, some type definitions like... | stackexchange/codereview |
I am working on a python3.6.5 question about BST:
Binary search tree (BST) is a binary tree where the value of each node is larger or equal to the values in all the nodes in that node's left subtree and is smaller than the values in all the nodes in that node's right subtree.
Write a function that, efficiently with re... | stackexchange/codereview |
I develop a small game using C# and need A* in it. For that, I need a PriorityQueue, which .NET does not have. I wanted to make my own one for practice. Here is it, please comment on performance and usability:
public class PriorityQueue<T> : IEnumerable
{
List<T> items;
List<int> priorities;
public Priorit... | stackexchange/codereview |
I'm new to Android programming and this is my first project so I'm not sure if this is the correct method of rendering the toolbar or the navigation of the drawer on the screen:
So I have a BaseActivity class that has the methods displayToolbar() and displayDrawer() to display the ToolBar and the Navigation Drawer resp... | stackexchange/codereview |
Over the weekend I was perusing the web, and came across the programming problem, finding the longest non-decreasing subsequence in a grid, and I wanted to tackle it. I'm a web developer by profession, and sometimes, honestly, I feel like I fit the bill described by Jeff. I don't feel that I chose web development becau... | stackexchange/codereview |
What I'm trying to do
abstract the caching actual cache provider (memory || distributed || ...).
enable a caching diversity. each cached item type has different behavior.
simply add more than one cache provider. and decide what provider to use with each cached record type based on configuration and settings
there are... | stackexchange/codereview |
I wrote simple C# TCP Server application and my program use a lot of cup, i was wondering anyone can review my code and would be grateful for any hints and suggestion.
This is my code.
public class Program
{
static void Main(string[] args)
{
int _Port = Convert.ToInt32(System.Configurat... | stackexchange/codereview |
I have prepared an implementation of sort_by_keys filter:
{% for donation in donations|sort_by_keys:'date,-value' %}
<img src="{{ donation.stamp_img_url }}" />
{% endfor %}
Example data:
donations = [
{
date: '29-07-2014',
value: 150,
},
{
date: '07-10-2014',
value: 450,... | stackexchange/codereview |
I have a problem to solve. My algorithm is assigning Players to Positions. On the start I have a list of about 16 positions and 4 players. The problem is to assing every player to it's closest positions so the overall distance is as low as possible.
I've already done this:
List players = ...
List positions = ...
Set po... | stackexchange/codereview |
I'm trying to solve the Oil Well problem on Hackerrank using dynamic programming and it works. However, it times out for some of the test cases. I wanted to know how this program can be improved so that it runs faster.
The challenge is, given a matrix \$M\$ of size \$r \times c\$ (at most \$50 \times 50\$), where each ... | stackexchange/codereview |
I created a binary tree that stores information about brackets in a single elimination tournament, the code works as expected, however I think the implementation could be better.
I'm using PostOrder Traversing method to go over the tree and store the information about the teams participating in matchups with help of a... | stackexchange/codereview |
How should one break this component down to better perform unit test on its behaviors?
Issues:
Authentication middleware component makes external request.
Must recognize preflight and final flight. (Exceptions)
Must verify path.
Only want to expose crossOriginRequest.
Please criticize anything you see wrong in logic... | stackexchange/codereview |
I use Groovy to write business rules into big, long term Java software. Use Groovy in object way, that is not as groovy Script, but every elementary groovy source overrides some Java API class.
i.e. AtLoginScript, PreparePaport etc.
I had an idea to clone in very little scale IDE functionality: generate class from, or ... | stackexchange/codereview |
I have a service that is subscribed to a specific channel of ActiveMQ.
Every time a message arrives the service has to start a "job" (submit instances of Callables).
Since there will be thousands of messages, in order to limit the throughput, I was thinking about implementing a custom ThreadPoolExecutor with these feat... | stackexchange/codereview |
I have multiple sign up pages that I am currently testing. Each of the form have seprate fields. However, some share common fields(as you can see from signup page.py).
This is what I have so far(I am using Page Object method), I would like to know how I can improve my code to make it more robust.
Here is the signUp pa... | stackexchange/codereview |
I have written a basic C Shell. It features the builtins cd, programmer, ver and exit. The code for the shell, named vsh, is as follows:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#define BUFSIZE 1024
#define TOK_BUFSIZE 64
#define TOK_DELIM " \t\r\n\a"
char *... | stackexchange/codereview |
I am currently working on a project which uses the MVVM pattern. I have a POCO which I want to present in an editor and, because the object is composed from a number of smaller, reusable POCOs, I thought it would be appropriate to show it in a TabControl.
The result looks like this:
On the left is a collection of Prod... | stackexchange/codereview |
This finds a peak element in an array. Please consider I want only one peak element. Also, my code should follow only C++11/14 and not C++03.
#include <iostream>
int peak(int * arr, size_t size)
{
auto start = 0;
auto end = size - 1;
//empty array
if(arr == nullptr || size <= 0)
{
return -... | stackexchange/codereview |
I'm a Java beginner currently practising MVC pattern and came up with this. Could you please check if this is a proper implementation of MVC and if there are any best practices that I have broken?
public class Appka {
public static void main(String[] args) {
Model model = new Model();
Cont... | stackexchange/codereview |
I run a coding dojo at work. for one session I'm to showing that you can use a kata to get into a new language.
I'm using the FizzBuzz Kata to show JavaScript (and F#) because it is short. The problem is my JavaScript knowledge is only slightly above the copy -> paste -> fiddle level.
Thus, I would like to see better... | stackexchange/codereview |
I'm just playing with Python, trying to refamiliarize myself with it since I haven't used it in a few years. I'm using Python3, but as far as I know it could easily be Python2 with a change to the print statements. What I'm generating is something similar to GitHub's Identicons.
I know of two possible issues, one is th... | stackexchange/codereview |
For an assignment I had to create a highly multi-threaded scoreboard for a multi level game. So every time a user adds a score if the level doesn't exist, it gets created ad-hoc.
Important point: a user CANNOT appear twice in the 15 best score. No database or disk persistence was permitted (so everything in memory). Th... | stackexchange/codereview |
I was practicing question 1 of the 2020 british informatics olympiad past paper:
The Roman look-and-say description of a string (of Is, Vs, Xs, Ls, Cs, Ds and Ms) is made by taking each
block of adjacent identical letters and replacing it with the number of occurrences of that letter, given in
Roman numerals (*), foll... | stackexchange/codereview |
Background
I created a simple class to reflect emotion classification based on the Lövheim cube. The code is not scientific at all, and I just did it for fun, but I want all code I write to be as Pythonic and efficient as possible, so I was hoping for some help refactoring it.
Code Purpose
Class Emoter takes in seroton... | stackexchange/codereview |
The following question was taken from Absolute Java 5th ed. by Walter Savitch:
A government research lab has concluded that an artificial sweetener commonly used in diet soda pop will cause death in laboratory mice. A friend of yours is desperate to lose weight but cannot give up soda pop. Your friend wants to know ho... | stackexchange/codereview |
I am coming from C# and I am learning how to use Python more seriously.
So I decided to try a little side project to help me see how much I earn (or lose) from my trades on the stock market.
I would like some advice about how I structured my project, in C# I am used to put each class in its own file, but I read that in... | stackexchange/codereview |
Description
The code uses strtol() to convert text that represents a value in a given base into an integer.
It takes three arguments from the command line, including the string and the base. The string may begin with an arbitrary amount of white space followed by a optional - or +. If the base is 0 or 16, the string ma... | stackexchange/codereview |
For a university project I'm trying to build a system that has a general architecture of:
Client app <=====> Client library < - - > Server library <=====> Server app
I'm trying to make the client and server as general (in the context of a java application, cross-platform compatibility is a concern for later) as possibl... | stackexchange/codereview |
I have been trying to solve this HackerRank problem:
We're going to make our own Contacts application! The application must perform two types of operations:
add name, where is a string denoting a contact name. This must store as a new contact in the application.
find partial, where is a string denoting a partial ... | stackexchange/codereview |
I want to output only the roles that contain the same group as the user.
// User can be part of many groups
const user = {
groups: ["group2"]
};
// Roles can have many groups
// What you see here is the output or 2 different data source
// Thats why we have group duplication inside different role
const roles = [{
... | stackexchange/codereview |
SQL:
CREATE FUNCTION dbo.fnRandomForeNames ()
RETURNS VARCHAR(50)
AS
BEGIN
RETURN (
SELECT TOP 1 [FirstName]
FROM [tmp_ForeNames]
ORDER BY (SELECT new_id from GetNewID)
)
END
GO
Similar functions for dbo.fnRandomSurNames() etc.
UPDATE Table1
SET firstname = dbo.fnRandomFo... | stackexchange/codereview |
My code snippet is like this:
public static string EventId
{
get { return HttpContext.Current.Request["eventId"]; }
}
And I will call this property EventId whenever I need it. Is it a good practice?
| stackexchange/codereview |
The code takes a list of names and extracts the three letter pattern from the names. Then return the list of names as a value in the dictionary with key as a pattern. The list name has a fixed naming pattern like three letter Spp in the example. It can extent like App, Bpp, Cpp etc..
How can I improve this code?
impor... | stackexchange/codereview |
We're converting the City of Philadelphia's website to be served as static files. In order to support redirects and rewrites (URL masking), we decided to use a Lambda@edge function, which modifies (or responds to) the inbound request. I expect this will be maintained by other people so readability is very important. I ... | stackexchange/codereview |
I have the following diagram (did this only to ask here, it's obviously missing details):
From the diagram you can see I have to check if all sensors in an environment are respecting the established conditions, but I'm not comfortable with the way I'm implementing this...
class Environ:
def __init__(self):
... | stackexchange/codereview |
I am asking this for coding style. I have a program class that calls a function(of a data access class) that reads from a table (using entity framework by the way), and I'm preparing to write the DataAccess.ReadMethod().
Is it better to pass the function a 2d string array string[rows][fields], reading each field and ... | stackexchange/codereview |
I need to inject same variables into settings.py for multiple django apps.hence i wrote a module which takes in output of local() and modifies. This works but is it the right way to do things?
def enable_theme(theme_name, container):
"""
Enable the settings for a custom theme, whose files should be stored
in ENV_ROOT/t... | stackexchange/codereview |
This utility tells you how much time is left until the time you set before.
Setting time:
> timeleft set '2017/04/25;15:00:00'
Using utility:
> timeleft
2 days, 10 hours, 40 minutes, 25 seconds remaining...
Code:
#include <string.h> // strcmp
#include <stdio.h> // fopen, fclose, fprintf, fscanf, sscanf
#include <time... | stackexchange/codereview |
These functions work well for me. Can they be improved or made more standard in some way?
Each function has a documentation header block, which contains a description of what it does, along with example usage and reference links where applicable.
:<<COMMENT
Alias function for recursive deletion, with are-you-sure p... | stackexchange/codereview |
This:
Is a data table we get from our financial platform with lots of useful information. For reference, "--" is also the string they use to denote empty values.
This:
Is a spreadsheet I built (and had reviewed here) to track our customers' regular income requirements.
The code produces reports to show:
Whether ... | stackexchange/codereview |
I'm writing a PowerShell script to loop through an organization's PowerBI workspaces and spit out the report IDs, names, and URLs for each workspace - so, a nested loop.
Here's my working script thus far:
Install-Module -Name MicrosoftPowerBIMgmt
$myArray = @()
Login-PowerBIServiceAccount
Get-PowerBIWorkspace -Scope ... | stackexchange/codereview |
I am decoding GS1 barcodes and need to match up application identifiers with relevant data about them.
00 SSCC (Serial Shipping Container Code) N2+N18 FALSE SSCC
01 Global Trade Item Number (GTIN) N2+N14 FALSE GTIN
02 GTIN of Contained Trade Items N2+N14 FALSE CONTENT
10 Bat... | stackexchange/codereview |
I'm using this code to compute a cartesian product:
def cartesianProduct[T](in: Seq[Seq[T]]): Seq[Seq[T]] = {
def loop(acc: Seq[T], rest: Seq[Seq[T]]): Seq[Seq[T]] = {
rest match {
case seq :: Nil => seq.map(acc :+ _)
case seq :: remainingSeqs => seq.flatMap(i => loop(acc :+ i, remainingSeqs))
}
... | stackexchange/codereview |
This code aims to replace labels used to explain a text box's container. This is done by adding a default string when the text box is considered empty to explain the purpose of the text box. However, when the text box is not considered empty, the text box will behave normally.
This is what I have written to solve my is... | stackexchange/codereview |
I was wondering if I am doing any useless conversions byte←→int, for example:
byte((int(ch-'A')+shift)%26 + 'A')
Converting ch-'A' to an int is because the shift argument can be negative (to implement the decode function). I couldn't figure out a simpler way to negate the operation using bytes.
package main
import (
... | stackexchange/codereview |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.