instruction_seed stringlengths 71 95.1k | _source stringclasses 1
value |
|---|---|
Here is the problem description (from an algorithm course: https://www.coursera.org/learn/algorithm-design-analysis):
The goal of this problem is to implement a variant of the 2-SUM
algorithm (covered in the Week 6 lecture on hash table applications).
The file contains 1 million integers, both positive and negative
... | stackexchange/codereview |
I was working on a timer code in pure JavaScript and would like to know any pointers to improve:
Features
Start/ Stop/ Reset on click of a button.
Set limit to clock.
Update class name for warning and error based on threshold timer.
JSFiddle
function timer() {
var time = {
sec: 00,
min: 00,
hr: 00
}... | stackexchange/codereview |
I wrote a simple word-counter in Python a while ago, capable of processing DOCX, XLSX, TXT, and some PDF files. Now I gave it a simple GUI - this is my first tkinter program ever. What do you think?
import openpyxl
import docx2txt
import PyPDF2
import tkinter
from tkinter import filedialog
def excel_counter(filename)... | stackexchange/codereview |
Given an unsorted array. The task is to find all the star and super
star elements in the array. Star are those elements which are strictly
greater than all the elements on its right side. Super star are those
elements which are strictly greater than all the elements on its left
and right side.
Note: Assume fir... | stackexchange/codereview |
I have just written a function copy_lowbits_off to copy any number of bits (not bytes) from a source buffer to a destination buffer. The function also supports arbitrary offset (expressed in bits) in the source and the destination buffer.
Could you have a look at it and let me know if anything can be improved in style,... | stackexchange/codereview |
This code pings 1 time every IP while using TTL to identify if it's a Windows PC. If so, it outputs it. It's very slow, so is there any way to make it go faster (1-255 in 12 min)?
@echo off
echo running, it will take a long time to scan
(
FOR /L %%N in (1 1 254) DO (
FOR /f "tokens=1,3 delims=: " %%A IN ('ping ... | stackexchange/codereview |
I have a performance issue in R. I have a function that iterates over a dataframe for different levels of "site" and "method". The function samples 1:1000 interactions (rows), converts these to matrices and calculates a value of connectance for each matrix. This is repeated n times. The function runs exactly as I want ... | stackexchange/codereview |
I am working on an implementation of the Needleman-Wunsch sequence alignment algorithm in python, and I've already implemented the one that uses a linear gap penalty equation for scoring, but now I'm trying to write one that uses an affine gap penalty equation.
I tried using as a reference the chapter that covers this ... | stackexchange/codereview |
Anyone want to comment on this plugin I'm making? (improvements, etc)
(function($) {
var methods = {
init: function(data) {
var options = {
function: null,
timeout: 1000,
option: undefined
}
return this.each(function() {
... | stackexchange/codereview |
Please review my generic implementation of the Knuth-Morris-Pratt algorithm. Its modified to search a source of indeterminate length in a memory efficient fashion.
namespace Code
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// A g... | stackexchange/codereview |
A while ago I created a program for fundamental analysis of stocks. Back then, I used to enter all the values by hand, which took a lot of time and was very annoying if a value was entered incorrectly.
Now the script takes care of most of that on its own. Sometimes, when the API is incomplete, the script throws a KeyEr... | stackexchange/codereview |
The user can provide a JSON object to configure the plugin when they initialise it. I want those options to be available whenever a plugin action is performed.
I have read the plugin documentation but I'd like to get confirmation that I am going about this the right way.
Plugin is initialised with:
$(selector).hide_and... | stackexchange/codereview |
My project is a blogging app, which is a recruitment assignment. It is now finished and working.
Following function handles updating a comment votes, very similar as on StackExchange sites, preventing duplicated votes and ensuring single vote per IP address.
I am not sure how to make the following function unit testabl... | stackexchange/codereview |
I have a block of code that checks to see if a check box is checked or not, and assigns a value to a variable for saving to a MySQL table. There are approximately 8 of these boxes.
if ($("#amOld").is(":checked")) {
var amOldGuide=1;
} else {
var amOldGuide=0;
}
if ($("#folOld").is(":checked")) {
var folOld... | stackexchange/codereview |
Unit testing in VBA is... lacking. (What isn't lacking in VBA though?) Since I've become more interested in unit testing lately, I decided I needed something better than Debug.Assert(), so I started building this framework. Currently there is a ton of functionality missing, but since I'm new to unit testing and interfa... | stackexchange/codereview |
I am trying to find a more efficient way to print the number of descents in a permutation using R as my programming language. This code does it for the numbers 3 to 10:
# this function finds the number of descents in a permutation
numberOfDescents <- function(prm) {
descents <- 0
for(i in seq_len(nrow(prm))) {
... | stackexchange/codereview |
I wrote my first simple image upload script that allows users to add items to a database along with pictures of said item. My script takes the images uploaded via a form, processes and resizes them and finally saves them to a hard disk, with their file paths added to a database.
While my code is currently working, I ha... | stackexchange/codereview |
Solving it by the logic:
find the length
traverse to length-n+1
remove item
I've written the following code
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next ... | stackexchange/codereview |
I have implemented a radix sort algorithm in Python 3. It first finds the maximum number of digits in the list, then changes them to strings and adds 0's. For example, [7, 23, 107, 1, 53] to ['007', '023', '107', '001', '053']. I then make a new matrix, [[] * 10]. I append the numbers with last digit of 0 in lst[0], n... | stackexchange/codereview |
I don't find this algorithm in Go language here, so I just want to check that it is really most efficient algorithm in Go:
func checkUnique(s *string) bool {
var a [256]bool
for _, ascii := range *s {
if a[ascii] {
return false
}
a[ascii] = true
}
return true
}
| stackexchange/codereview |
Here is an implementation of compression with Huffman coding. It works well by my testing. It compresses a 1 GB string in about 30 seconds, and decompresses in about 15 seconds with VisualStudio 2022 "Release Mode x64" on my machine.
I've used std::vector<bool> as the "bitset", but simply replacing that type with boost... | stackexchange/codereview |
Problem Statement:
Watson gives Sherlock an array \$A_1\$, \$A_2\$ ... \$A_N\$.
He asks him to find an integer \$M\$ between \$P\$ and \$Q\$ (both inclusive), such that, \$\min \{|A_i-M|, 1 \le i \le N\}\$ is maximised. If there are multiple solutions, print the smallest one.
Input Format:
The first line contains \$N\... | stackexchange/codereview |
Introduction
I'm working with Java 1.8. There is a lot of repetition in the MessageHandler class that I would like to remove but I'm having trouble implementing a fix.
External Code
I'm working with a message library that I should avoid changing. This library consists of these files:
BaseMessage.java
package external;
... | stackexchange/codereview |
I'm just finished my version of iterable hashtable. I want to review code in general (code style, data structures, remarks about the algorithms) and I have some questions:
I don't know how to implement errors in return-value way. So, I chose way when we contain error flag variable in struct. Is it correct?
What funct... | stackexchange/codereview |
Please review my Stack using linked list:
template<class T>
struct Node {
T item;
Node* next;
Node(T t = {}, Node* link = nullptr) :item{t}, next{link} { }
~Node() { delete next; }
};
template<class T>
class Stack {
public:
int size() const { return n; }
bool empty() const { return n == 0; }
... | stackexchange/codereview |
I wanted to share my first experience with JavaScript. I've been taking JS courses for the past 2 months and finally got the first chance to code a small guess-my-number project.
(Everything is completely coded by me and took 4 hours in total. I wanted to test my skills.)
Am I on the right path? Is the code clean enoug... | stackexchange/codereview |
The following function receives a vector of positive integers and list of brackets. The function returns a data frame with a logical vector for each bracket indicating whether a given element of a vector falls within that bracket.
Background
Received arguments
Vector x consisting of unique positive integers, usually c... | stackexchange/codereview |
I wrote a Keylogger in Python who transfers the Key Strokes to an S3 storage. What do you think about the Code? I would add the file saving in an other place and make it more legible. Feel free to copy the code and use it for your own.
To run and compile it you need:
Python 3.7.5
boto3
pynput
pyinstaller
Greetings
""... | stackexchange/codereview |
So far I have reached chapter 5 of the K&R Book, Edition 2 from which I have been learning C. I spent a few days thinking of a solution to this program. I wrote two or three versions of the same program, And the truth is that I couldn't bring myself to think of a better solution for this exercise:
Exercise 5-11. Modif... | stackexchange/codereview |
So far I was successful to get what I need using below mentioned script, but I'm sure my script is far from being perfect (if it is possible at all). So, I'd greatly appreciate your comments on how would it have been done differently in order to improve it.
p6_ch1 <- read.xlsx("BEO_charts.xlsx", sheet = 7, startRow = 2... | stackexchange/codereview |
Related to this question: Spigot Plugin: Generic form of the plugin's main clas
I've created a Clan-Plugin, in which I have one "main" command, which is simply /clan. Then there are several sub-commands, e.g. /clan leave, /clan money, etc. There are also subcommands that require multiple arguments, like /clan create, w... | stackexchange/codereview |
I have a script that makes use of datetime in order to name files.
Only business days (Mon - Fri) are used.
Here is my part of the code that finds the last business day:
lastBusDay = datetime.datetime.today()
shift = datetime.timedelta(max(1,(lastBusDay.weekday() + 6) % 7 - 3))
lastBusDay = lastBusDay - shift
yesterday... | stackexchange/codereview |
I made an isSorted function in Scala and Java as well and when I measured the time of functions' run I saw that the Scala version was very slow. It ran about 3.2 sec for 10000 Int but java version just ran about 10 ms!
How can I make faster my Scala version?
Scala:
def main(args: Array[String]) ={
println(isSorted(... | stackexchange/codereview |
I have written code that gets the reputation badge from given score like this:
I use an if-else statement here:
func GetReputationBadge2(score int) string {
badge := "badges-off.jpg"
if score >= 50001 { // Diamond
badge = "diamond-1.gif"
if score >= 500001 {
badge = "diamond-5.gif"
... | stackexchange/codereview |
I have this JS that has a lot of redundant functionality, and it works but looks unseemly.
I would love some assistance with making this more DRY (Don't Repeat Yourself):
// This provides character & word counter functionality
counter = function() {
var body_value = $('#post_body').val();
var title_value = $('... | stackexchange/codereview |
Start Program
Comments
In Linux you can install a program called fortune. This program gives you a random wisdom each time you execute it. I thought about making a game, where you have to do something before you can read some wise words.
This is "the biggest" program I have written so far. I tried to practise object or... | stackexchange/codereview |
I made an autocomplete input box of every town, city and village in the UK. Yes, every single one. The load times are painful so is there a way to reduce that?
Here is a sample:
<input type="text" id="location" name="locations" placeholder="Edinburgh, Belfast, Cardiff, London">
$( function() {
var availableTags = [... | stackexchange/codereview |
For the longest time I always felt lost designing a robust OOP program, especially in C++. I felt like I didn't know enough theory or algorithms so I would study and never write code, not to mention I was always afraid of criticism or looking amateurish. Recently I came to the realization that I been holding myself bac... | stackexchange/codereview |
I tried this problem below and solved it in O(test_cases * string_length * pattern_length) complexity involving three nested loops. I want to know how can I further decrease time. I figured as much:
1: I'm comparing few patterns more than once.
2: Should find a way to not repeat the comparisons which I am unable to do.... | stackexchange/codereview |
To teach myself how to do meta-programming using Prolog, I've been playing around with translating ABNF syntax into DCG syntax. I'm still at the lexing and tokenising stage, but hope to advance to the "yacc" stage soon.
Using Json, since it is defined in ABNF at https://trac.ietf.org/trac/json/browser/abnf/json.abnf?re... | stackexchange/codereview |
Now I have that parallel Quicksort for (primitive) integer arrays.
ParallelIntQuicksort.java:
package net.coderodde.util;
import static net.coderodde.util.Util.median;
import static net.coderodde.util.Util.swap;
/**
* This class implements a parallel Quicksort.
*
* @author Rodion "rodde" Efremov
* @version 1.6 ... | stackexchange/codereview |
I've been asked to keep track of how long a user has been connected to a site without interruption.
So far the solution I've come up with is to use ajax to poll the site every now and then to check how much time has elapsed since the last call.
Any suggestions for possible improvements would be appreciated.
P.S: Not su... | stackexchange/codereview |
I am currently studying data structures and i am looking to see if my implementation of the insertion method in an M-way search tree is good and i am looking forward to improving my coding approach.
There are some basic cases in inserting a node in an M-way search tree:-
Basic Case: If there is still space in the node ... | stackexchange/codereview |
I'm fairly new to Arduino and C++ in general, coming from a heavy Python background. The code below is functional, but my lack of C++ knowledge is keeping me from spotting any errors in style, idioms and other good practices.
Not all of the library code is used by the example, as I tried to keep that to the minimum (th... | stackexchange/codereview |
I'm not sure about this code but it feels ugly to me. It is a solution to this.
package main
import ("golang.org/x/tour/tree"; "fmt"; "reflect"; "sort")
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int) {
if t != nil {
ch <- t.Value
... | stackexchange/codereview |
This is the solution for a simple challenge from Hackerrank.I am just trying to solve Sorting: Bubble Sort Problem on HackerRank.
We are asked to count the number of swaps performed during a bubble sort and to print the first and last item of the ordered vector.
Sample input
3
3 2 1
First line is the number of element... | stackexchange/codereview |
I've been working a strategy game for iOS for a little while, and each time I add functionality to the game model I'm finding myself building a lot of UI code to sync up with it. I believe that my latest creation could use some code review.
The basic idea is that each worker can have certain job permissions turned on ... | stackexchange/codereview |
I have a private function in PHP that takes a given URL string and just leave the Alpha or numeric and certain punctuation left. I need the stripping of string due to having it match against ElasticSearch and ElasticSearch doesn't take it too kindly for special characters when it comes to exact match.
The following fun... | stackexchange/codereview |
I asked a similar question here which is:
The language L={anbn} where n ≥ 1, is a language of all words with
the following properties:
The words consist of strings of a’s followed by b’s.
The number of b’s is equal the number of a’s.
Examples of words that belong to L are:
ab, where n=1;
aabb, where n=2;
aaabbb, ... | stackexchange/codereview |
I wrote this class recently to better structure and handle MySQLi related interactions with PHP and would love to get some feedback.
<?php
/*
* simpleMysqli
*
* @usage This class is meant to be extended, with
* the resulting class setting the $table parameter
* in it's __construct().
*
*/
class simpleMysqli ex... | stackexchange/codereview |
A common use for Keras LSTM layers is to generate text. There are
many examples showing you how to do it.
The usual method is to convert the text into a sequence of tokens and
then slice up the sequence into overlapping windows which is used as
inputs and the windows following tokens are the outputs.
So if your token s... | stackexchange/codereview |
I have written the following thread pool implementation in C++14.
It appears to work fine on my system, but I am looking for a second opinion on the thread safety of my implementation and any other possible implementation flaws or concerns.
#include <atomic>
#include <condition_variable>
#include <exception>
#include <... | stackexchange/codereview |
I am working on my first object-oriented programming project, written in C# for Unity. My code does what I want it to do, but I am wondering if there is a better way to do it. I think I am building something that will be hard to manage going forward.
Info
I have a set of semi-related manager classes that are responsi... | stackexchange/codereview |
I need to split a string into parts of varying predefined lengths, given as a sequence of integers. After a first imperative attempt using a sequence expression and a reference cell, I have now come up with this implementation that uses Seq.scan and doesn't need mutability:
let segmentString lengths (input : string) =
... | stackexchange/codereview |
Preamble: it's a self-assigned and pure syntetic task to learn (and remember what I already knew) C# threads and synchronization and data structures.
The original question was here https://stackoverflow.com/questions/16458937/synchronization-of-remote-files-download
The short task explanation:
Let's say I have a dictio... | stackexchange/codereview |
I wrote this code for a multiplayer game I am developing to transmit floats over the network. It works, on the systems that I have tested it with. What I am worried about is the little-endian big-endian thing and the possibility of different float representations in general over computers. So here it goes:
private stat... | stackexchange/codereview |
I have SQL scripts that I want to be executable directly in the editor (like DataGrip or SSMS) and also in automated integration tests. However, in each use-case they require different environment and version parameters. I cannot use string_split because we use an ancient SQL Server 2012.
In order to differentiate betw... | stackexchange/codereview |
I have an array of length n that contains numbers from 0 to n-1 in random order.
I now want to "inverse" this array to one that where index i corresponds to the location of i in the source array.
Example
Source_Array = {2,0,1}
Transform to:
Result_Array = {1,2,0}
This means I find the index 0 at position 1 in my sour... | stackexchange/codereview |
I'm caching the value of a configuration object in a private field:
private Configuration _config;
public Congifuration Config { get { return _config = _config ?? GetConfig(); } }
Config is populated by reading a JSON file from disk, so performance is an obvious concern.
I like how concise this code is.
But I'm wary o... | stackexchange/codereview |
I have an array of a struct containing 5 byte values.
I need to sort this array by each value in a different order depending on the situation.
These arrays are sometimes quite small (10-30 elements), sometimes quite large (1024-16384).
Below is the code I'm using. The reason this has become a bottleneck for me is due... | stackexchange/codereview |
This is my custom implementation of a double Linked list. Code is apparently working fine. Need advices on improvement and/or optimization. This is a tiny academic side-project. I am still pretty green to C++ .
Would also want to know what are the differences between all sorts of custom implementations and STL implemen... | stackexchange/codereview |
This method is an attempt at removing duplicates from arrays without the use of extensions.
func arrayWithDuplicatesRemoved<T: Equatable>(from array: [T]) -> [T] {
var results = [T]()
return array.compactMap { (element) -> T? in
if results.contains(element) {
return nil
} else {
... | stackexchange/codereview |
I built an app where a user has a recipe box with recipes in it - for the db, there is a user and recipe model, user has "recipeBox" property. The recipebox is an array of objects like so:
User model....
User.recipeBox = {
["id1", "done": false],
["id1", "done": true],
}
The done property is for a checkbox on the fro... | stackexchange/codereview |
What do you think about this code? Do you have some advices and remarks for me about them? I have started learning python recently.
types = {
"str": str,
"int": int,
"float": float,
"complex": complex
}
def my_input(kind, msg, msg_wrong, detail):
""" Add-in for input(). Performs validation of the ... | stackexchange/codereview |
my task is to generate random strings and store in a file till the size of file is less than 10MB. My approach towards this problem is as follows.
import java.io.File;
import java.io.FileWriter;
public class Application {
public static void main(String[] args) throws Exception {
long start = System.current... | stackexchange/codereview |
I would like to receive review on my code. It has only depth first search (DFS) and bidirected graph is the only member of the hierarchy. I added name member for the BiGraph to make it easier to debug in the future, because there might be several BiGraph instances. Also, I would like the review to primarily focus on n... | stackexchange/codereview |
When a user is created, deleted and update the system will give feed back. e.g. User Deleted/Updated/Create success or unsuccessfully, but I'm sure there is a better way to do it than what I have done because I repeat the same code in all functions within my class.
Code to create user
$userOne = new userActions($databa... | stackexchange/codereview |
A bit of background. In the application I work on there are emails sent to notify users about articles they need to review. Each email+recipient pair is stored in database and may be assigned a different creation date ( called DateCreated ) due to emails being generated over some time.
I needed to calculate how many ti... | stackexchange/codereview |
I would like you to take a look at this simple script I wrote that's supposed to emulate the Unix sort [FILE] | uniq -cd command. What's different about my script though is that it also lists line numbers telling the user where occurrences of duplicate lines are located in the file. Please, tell me what you think as we... | stackexchange/codereview |
What is a Pythonic way to construct intervals from a sequence of integer numbers? E.g. sequence [1, 2, 3, 6, 7, 9] could be converted to ['1-3', '6-7', '9']. I have implemented it like this:
def sequence_to_intervals(seq):
intervals = []
interval_start = None
interval_end = None
for i in sorted(seq):
... | stackexchange/codereview |
I wrote (as part of a greater work) a Boost.Spirit grammar that would parse string literals, including support for the various escape sequences known from C/C++ (\n, \x7f, \341, \u017f, \U00010451).
At some point I encountered some problems, mostly due to my lack of understanding either Boost.Spirit or Boost.Phoenix to... | stackexchange/codereview |
I read through other questions here and improved the code and added a new feature. The old question can be found at: Email a notification when detecting changes on a website
The improvements that are done until now:
Using a difflib.SequenceMatcher
Added a logger
Using format for strings
Exceptions are now logged and t... | stackexchange/codereview |
Following my java class is required to be reviewed and couple of clarifications about class variable loading is required. Following is my class.
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ValidateUtil{
private static Pattern pattern;
private static final String REFFERE... | stackexchange/codereview |
I'm currently writing a client library to use with a courier's SOAP API to create and manage shipments. I'm using the service classes generated from the WSDL provided by the courier, their implementation is on the verbose side (multiple objects nested inside each other to specify a country code for an address as an exa... | stackexchange/codereview |
Recently I made a script to get available IP automatically. I was woundering if anyone can give me tips on how to make this code look better, preferably in a class and OOP. I'm gonna show the code to my boss, but i want it to look clean and nice before i do so, and hopefully learn a thing or two about writing better co... | stackexchange/codereview |
Our system is largely a PHP-driven system. We're not doing the full split back/front-end. Most pages are plain HTML served directly by PHP. However, a few parts of the system are very dynamic and so are built with an Angular front-end.
A few relevant details:
I wanted the transition from the PHP-driven website to t... | stackexchange/codereview |
BACKGROUND
I have a function where i cache file from aws s3. I provide it the path on s3 and also the local path of where i want the cached file to live. Sometimes if the file does not exist on s3 it will return a 404 error. That makes sense but i want to handle it gracefully. What i want to do is if the file i am tryi... | stackexchange/codereview |
Basically, all I have to do is read some xml from a file. And I have a working solution, although I am not sure that it is the best way of going about doing things, as I have only recently started working with xml. Any advice on how I could improve the following?
[XmlRoot("iosLayout")]
public class iosLayoutXml
{
[... | stackexchange/codereview |
I'm trying to write a function that takes a sports bet and returns its Net result.
If you are not familiar with betting, an exhaustive test suite should help with understanding what the program is supposed to do. How can I solve this problem in a way distinct from enumerating all of the possible cases?
SUPPORTED_BET_TY... | stackexchange/codereview |
I am trying to understand good design patterns in Python and I cannot think of a way to break this huge function into smaller parts without making the code cluttered, overly complex or plain ugly.
I didn't want to clutter my question by posting the whole file. This function itself is already very large, but the class h... | stackexchange/codereview |
Recenlty I have finished this primitive console string calculator in C. I need your balanced criticism, I'd like to know what I have to correct, remake and learn.
Permitted operations: + - * / ( ) ^
Sample input string: 11 * -10 + 15 - 35 / (35 - 11) + 2^2 =
main.c
#include "stack.h"
#include <stdio.h>
#include "calc... | stackexchange/codereview |
I am writing a D3D9 hook plugin to give back to a community that helped me learn programming. It is a community based on programming and scripting for games.
The plugin is supposed to hook d3d9.dll and allow clients to read pixels from the backbuffer. That is the entire extent of the plugin.
Thus I have hooked only the... | stackexchange/codereview |
I wrote this code to get all possible magic squares that can be made with a list you put in. The only contraints are that the count of numbers is a square and that each number is unique. It even works for complex numbers.
I dont know how good the performance is, it needs about 1.5 to 2hours to find all 7040 4*4 magic s... | stackexchange/codereview |
To find answers where users expressed their gratitude (by mentioning "thank" in comments),
I put together this SEDE query (latest):
DECLARE @username AS NVARCHAR(60) = ##DisplayName:string? ##;
DECLARE @userId AS INT = ##UserId:int?-1##;
-- SpecialThanks: Special thanks only "Enter 1 for YES, 0 for NO"
DECLARE @Specia... | stackexchange/codereview |
I am doing some practicing with back-connect proxies and asyncio/aiohttp. The IP changes on every request to the proxy and I am allowed up to 1500 threads. The big issue with back-connect proxies, is you do not always get a proxy that works. This forces me to keep requesting the URL until there are no errors so I can r... | stackexchange/codereview |
I was trying to solve one of the hackerrank practice questions. Could anyone please let me know how can I make this code much effective, in terms of time and space complexity?
The Super Bowl Lottery is about to commence, and there are several
lottery tickets being sold, and each ticket is identified with a
ticket ... | stackexchange/codereview |
I have written the following class:
NOTE: There is a bug in the third party component that means that if a DHXBlockTime is there for a day of the week and a specific date then only the ones with a specific date are shown so that is why there is the seemingly redundant AddNonWorkingHoursAsDateInsteadOfDay method.
inter... | stackexchange/codereview |
I'm relatively new to programming as I've just started university. My assignment was to develop a program (by using a function and a linked list with pointers with integer elements) which does the following:
The function visits every element from the beginning. If the current element plus one is <= to the following el... | stackexchange/codereview |
I am writing a basic image upload script in PHP, and am looking for critiques. The script below is the result of various suggestions I have found online... for now I am running it locally and it works fine, but I would love for someone more experienced to look over it.
Is this secure? Poorly implemented? Too redundant?... | stackexchange/codereview |
Problem statement (online source)
Given a digit string, return all possible letter combinations that the
number could represent.
A mapping of digit to letters (just like on the telephone buttons) is
given below.
Input: Digit string "23"
Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"].
Note:
Althou... | stackexchange/codereview |
I was given that assignment recently as part of a coding interview.
The idea is to find if a gtin is valid or not valid.
The requirements are the following:
make sure the input is in a string format
the length must be either 8,12,13,14,17 or 18
The algorithm is the following:
TL;DR: You need to multiply all odd posi... | stackexchange/codereview |
I wrote simple TCP Client Server application, I was wonder could you please review my code. I would be grateful for any hints and tips regarding to logic of app, coding style or naming convention.
Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;... | stackexchange/codereview |
I wrote a program that changes the attributes of a file.
How can I make the program more efficient? Please find program problems. How can I improve the program?
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <linux/fs.h>
typedef en... | stackexchange/codereview |
For those who don't know, Twine is just a simple interactive fiction making tool. It lets you easily create a series of passages that are hyperlinked to each other, making a choose your own adventure style structure. It exports as HTML format, but if you wanted to just use Twine to write nodes to use elsewhere it's lac... | stackexchange/codereview |
I created plugin for MySQL Workbench that allows you to export an ER Diagram to RoR migration files. I would like to know if any other developers appreciate it.
export-rails-4-migrations_grt.py
# -*- coding: utf-8 -*-
# MySQL Workbench module
# <description>
# Written in MySQL Workbench 6.3.6
from wb import *
import ... | stackexchange/codereview |
This was born out of a need to create database users on a new server to allow views to be created correctly when restoring databases. This is designed to be run from a command line NOT via a web server. It works with MySQL and MariaDB.
It creates 2 files, one that contains the grants to create the users and a second th... | stackexchange/codereview |
The following is a problem I found on this wiki. What can I do to optimize my algorithm, and make this code more C++11?
Write a program to discover the answer to this puzzle:"Let's say men
and women are paid equally (from the same uniform distribution). If
women date randomly and marry the first man with a higher ... | stackexchange/codereview |
I'm a relatively new (~6 mos) developer, and I'm hoping for some feedback on my code style/structure. While I'm particularly interested in efficiency and maintainability, I'm open to feedback regarding anything that comes to mind from more experienced developers.
/**
* Attempts to create new SavedSearch (eventual POST... | stackexchange/codereview |
I have class point that represents point in 2D and I want to sort these points once based on their x-coordinate and second based on their y coordinate. Since x and y are double values my code looks like this:
public static class Point{
int id;
public double x;
public double y;
Point(int id, double x, do... | stackexchange/codereview |
From the previous 2 versions:
Sign an EC2/S3 URL Version 2
I fixed the comments from the previous version.
Most of the code remains the same (so I have split out the new code for review). The main body of the code is provided as reference.
The main addition is allowing six flags to be used. Four of these flags allow th... | stackexchange/codereview |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.