instruction_seed stringlengths 71 95.1k | _source stringclasses 1
value |
|---|---|
I'm writing a jQuery plugin.
I'm allowing the user to pass options (optionally-- argument 2 to extend) but I also require some defaults (argument 1), and some things user is not allowed to modify (argument 3).
I follow the global override pattern recommended by most jQuery plugins. But I'm running into something I'v... | stackexchange/codereview |
I've been getting help with this script seen below. It allows one input box to be used to put values into a text area and also display a list of the items. The items can be deleted once inserted:
http://jsfiddle.net/ZTuDJ/50/
// If JS enabled, disable main input
$("#responsibilities").prop('disabled', true);
// $("#res... | stackexchange/codereview |
I was hoping to get some feedback on the implementation of this class for programmatically converting an access file into a PostgreSQL schema (works by obtaining schema data from the cursor object).
import os
import json
import pyodbc
import psycopg2
import time
import sys
# Refer to https://code.google.com/p/pyodbc/w... | stackexchange/codereview |
I'm attempting the Graph Algorithms section in CLRS right now. Here's an iterative DFS using a stack called nodes.
T is a vector of pair(s) of ints which store timestamps for each node.
T[node].first = discovery time
T[node].second = finishing time
P is a vector recording Parents for each node in the DFS-Tree.
N is num... | stackexchange/codereview |
Here is a code I have recently written in the compiler for my programming language, written in C++. It rewrites code such as:
array_name[random_generator()] += 1;
to a code such as:
Integer32 temporary_subscriptXXXX;
temporary_subscriptXXXX := random_generator();
array_name[temporary_subscriptXXXX] :=
array_name... | stackexchange/codereview |
I noticed, that accelerometer and gyrometer sensor data tend to have problems. The gyrometer is not very precise and the accelerometer is getting problems with vibrations. I built a quadrocopter (to be honest more then one). My first one had a poor frame and the motors (very big ones) were vibrating a lot, because the ... | stackexchange/codereview |
Can it be made faster, and I am a newbie to complexity but I'm pretty sure the average case for this would be O(n). Am I wrong?
Output for the first list should be: (1,9), (2,8), (5,5), (-11,21)
The program finds pairs of an array whose sum is equal to ten.
#find pairs of an array whose sum is equal to ten
#bonus do it... | stackexchange/codereview |
Trying to script a simple command line tool for ingesting media to a target location following a structured naming convention.
It's functional in its current state but I'd like to know if there are things to improve.
#!/usr/local/bin/bash
#make target directory for transfer
make_directory(){
echo -e "\n\nFollo... | stackexchange/codereview |
I would like to design an elegant yet efficient circular buffer of integers.
I have designed a FIFO type circular buffer in C++(11)- starting with the class header (declaration) as follow:
[cyclicBuffer.hpp]:
#ifndef __CyclicBuff_HPP
#define __CyclicBuff_HPP
#pragma once
class CyclicBuffer
{
public:
CyclicBuffer(i... | stackexchange/codereview |
I made todo app in vanilla JS with functionalities like add todo, delete todo, edit todo, complete todo.. so, I think my code is not really good and I want to hear any suggestions on how to improve code and similar..
Here is the link: http://dash.vision-themes.com/
HTML:
<section id="todo">
<!---- Todo navigation -... | stackexchange/codereview |
I have a small node.js app (MY FIRST)
I have models using mongoose, controllers for each and a seperate route, I feel like this is pretty good seperation but something about the number of route files i would have to create seems not route, basically every section of the restful api would have a route, model and control... | stackexchange/codereview |
I've created a "simple" function that receives a MySQLi resource and, using a custom where query, will fetch random IDs from a provided table.
Some caveats on this:
No object-style! This needs to be understood by people who only know the old mysql_* procedural API;
No order by rand()! It is slow, but very tempting;
It... | stackexchange/codereview |
My task was to build a calculator in Python supporting binary addition etc.
To begin I define a couple of custom exceptions :
class MaximumValueException(Exception):
pass
class MinimumValueException(Exception):
pass
I then define the Binary class which does most of the work for me (I know that the division... | stackexchange/codereview |
In JUnit 3, I cannot tell JUnit what type of exception is expected. In JUnit 4, the declaration @Test(expected=NullPointerException.class) does it.
But, unfortunately in Android development, I can use only JUnit 3. So I wrote this simple method:
public class TestingUtils {
public static void assertExpectedExceptio... | stackexchange/codereview |
there is a knows problem stated as "Cyclic string":
A string S has been recorded many times, and then from the resulting line took a substring, and give to you.Your task is to determine the minimum possible length of a string S.
Input
In the first and only line of the input file contains a string that contains only le... | stackexchange/codereview |
I made a sequence and series solver just for helping me solve homework, and I'm in dire need of ways to make it further compact and efficient, since I used brute force.
If you want to see what this is supposed to do, please see my github.
This Python code is meant for the fx-cg50 calculator's micropython, where there a... | stackexchange/codereview |
For fun, I implemented a version of Python's range function in JavaScript. I found that underscore.js implements it as well, but with notable differences. I'm hoping others can comment on the differences. I assume that underscore's implementation is, if not more optimal, at least more idiomatic. And I'd like to build m... | stackexchange/codereview |
Here's a script I wrote for raising up a basic Nginx server environment.
The script includes an internal script named csb (create Sblock) which is used to create Sblocks in a comfortable way. As I'm new to Linux, I might have had about 2-3 mistakes, especially in that internal script.
#!/bin/bash -x
function nginx {
... | stackexchange/codereview |
Selection Sort
The selection sort algorithm sorts a list by finding the minimum
element from the right unsorted part of the list and putting it at the
left sorted part of the list. The algorithm maintains two sub-lists in
a given input list.
1) The sub-list which is already sorted.
2) Remaining sub-list which
... | stackexchange/codereview |
I'm hoping someone can help me here, I'm working with a file which has about 38000 rows and 180 columns. I'm using a macro to update the fields in the one workbook with the values in the other workbook, but it takes about 2 minutes to run. I'm looking for a way to reduce this time, I've tried everything I could find on... | stackexchange/codereview |
I have a list of JSON objects that looks like this:
[{
url: '/home',
...
}, {
url: '/analytics',
...
}]
I'm using the following function to count the frequencies of the URLs in order to pass it to a c3.js chart.
var getSectionFrequencyData = function(data) {
var frequencies = {};
data.map(function(entry) {... | stackexchange/codereview |
I have implemented HKDF in Rust, which passes all test vectors from RFC 5869, using HKDF with HMAC-SHA256. I also have a function to compare byte arrays in constant time, which I hope someone could confirm is correctly done. Any type of feedback is welcome.
EDIT: I mainly mean feedback on hkdf_compute(). HMAC in hkdf_e... | stackexchange/codereview |
I need to take data from a MySQL database and message it into a format expected by the front end of an application - I can not change the front end as other services provide it data in this same format.
The database is structured as follows:
id type value label optgroup
1 car ix5 Ford Ta... | stackexchange/codereview |
This copies the level graphics but uses a scale parameter. If the scale is 1, it copies a screen size segment. If it's 2, it copies a half-screen size piece and scales it to the screen size, etc.
How can I optimise this game level code or achieve the same outcome but simpler?
public void render(Graphics g){
int t... | stackexchange/codereview |
I've started to learn very interesting concept of DI, IoC and related stuff.
I have decided to learn it using simple application, very tiny calculator (only basic functions: add, subtract, multiply & divide), because it's very conveniently to learn any new stuff with elementary application.
My question relates to the d... | stackexchange/codereview |
As part of my study, I decided to do this task from frontendmentor site. It's a short html code but I would like to learn good practices from the beginning.
The problem I had encountered:
Adding names to classes to make them readable
What should I pay attention to when making the page accessibility
In the code below ... | stackexchange/codereview |
I am currently study the basic data structure and trying to implement everything as I go. can anyone give me some feedback about class BinarySearchTree how to make the code more elegant. any review are appreciated.
class TreeNode:
def __init__(self, value=None, left=None, right=None):
self.val = value
... | stackexchange/codereview |
I'm an HTML beginner. I've created my very first HTML + CSS single page from template given to me on a course I attend at a university. The code is probably very bad. It would be really nice if someone could tell me what to notice, how to make things different, what to learn and what path to choose. Below you can see t... | stackexchange/codereview |
I have been practising Python Practice questions and came across this question:
Write a Python program to add 'ing' at the end of a given string
(length should be at least 3).
If the given string already ends with 'ing' then add 'ly' instead.
If the string length of the given string is less than 3, leave it
unchanged.... | stackexchange/codereview |
I want to be able to accept True/False or a list of acceptable exit statuses for a command. This way I can choose whether to check and default to checking exit status 0 unless a list of exit statuses is provided to check against. My first instinct is to do a double reassignment.
def raw(self, ssh_command, check=False):... | stackexchange/codereview |
I'm playing about with JavaScript and wanted to create a simple validation script.
It works ok but is a bit clunky. How could I improve it?
var el = document.getElementById("username");
var el_pwd = document.getElementById("password");
var el2 = document.getElementById("feedback");
var el3 = document.getElementById("o... | stackexchange/codereview |
This package is on pub dev here
It's on Github here
class IocContainer {
final Map<Type, Object Function(IocContainer container)> _map;
IocContainer(this._map);
T get<T>() => _map[T]!(this) as T;
}
class IocContainerBuilder {
final Map<Type, Object Function(IocContainer container)> _map = {};
IocContainerBu... | stackexchange/codereview |
I'm a beginning coding and this is my very first Python program - a basic calculator. I would very much appreciate any recommendations or fixes!
if restart != "Y":
print("It was a pleasure calculating with you!")
time.sleep(1)
print("\nGoodbye!")
time.sleep(1)
sys.exit()
# Modul... | stackexchange/codereview |
Firstly, I apologize for the lengthy post. I was not sure which code I should include.
In practice of c++, I am writing a toy application for pub/sub using c++17. To keep things simple, both the publisher and subscriber are on the same OS Process, and thus only a deque is needed to store messages.
I don't use a Singl... | stackexchange/codereview |
This is the Kindergarten Excursion problem from kattis.com:
The kindergarten teachers had finally managed to get all the kids in a line for the walk to the bus station and the weekly excursion. What they hadn’t thought of was the fact that today different kids were supposed to go to different excursions. They should w... | stackexchange/codereview |
A friend of mine is a huge fan of a well-known comic website and he recently said that it'd be great to have a tool that downloads comic strips for a given date range, instead of clicking through the website.
So I thought I'd write a script that does just that. And I did.
It's far from perfect, but it does its job.
H... | stackexchange/codereview |
I want to make a booking entry. I want to ask whether the code that i wrote below is rightly format or not?
I haven't tried it, because there's still more code that needs to be written. I just want to ask this before I continue to write.
<?php
require 'Connection.php';
//Check Connection
if ($conn->connect... | stackexchange/codereview |
The following code takes either a URL or the title to an existing news article.
Searches Google News using the title.
Collects all links from search results.
import urllib2
from lxml import html
import requests
def get_page_tree(url=None):
page = requests.get(url=url, verify=False)
return html.fromstring(pag... | stackexchange/codereview |
I need to update a nested array of settings. There are several difficulties that I managed to solve, but I'm pretty sure the code can be written much simpler. I just don't know how, which is why I'm asking for a simpler solution.
Problem:
I have a nested array of settings in the database.
I have a form with fields tha... | stackexchange/codereview |
I would like to use a YAML file to store parameters used by computational models developed in Python. An example of such a file is below:
params.yaml
reactor:
diameter_inner: 2.89 cm
temperature: 773 kelvin
gas_mass_flow: 1.89 kg/s
biomass:
diameter: 2.5 mm # mean Sauter diameter (1)
density: ... | stackexchange/codereview |
I have implemented an Integer to Roman Numeral converter that converts any number in the range \$[1 \le x \le4999]\$ to its Roman number equivalent. Any comments on improving my code style or organization?
#include <string>
#include <iostream>
class Solution{
public:
Solution () : IntVal {1,5,10,50,100,500,10... | stackexchange/codereview |
I'm building web scraper application which takes name, code and price from few sites. I thought factory pattern would fit in my application. I would like to someone review my code and tell if I something missed out.
I have class Item which holds scraped data.
public class Item
{
public string Code { get; set; }
... | stackexchange/codereview |
Is this a better way to validate a text box for mobile number only?
Validation:
allow only numbers
will not allow to paste string including characters
allow copy from the box
length is set to 10 without country code
allow back space
Suggest some methods to help me improve my function.
Public Sub mob_validation(ByVal ... | stackexchange/codereview |
I have two arrays of double, say x and y containing some physical data.
I would like to find the best-fitting polynomial function at a given order:
\$y=pol_n(x)=c_0 + c_1*x + c_2*x^2 + ... + c_n * x^n\$
and return the coefficients (\$c\$) in an std::vector. There are no constraints on the function interface. The GNU Sc... | stackexchange/codereview |
A modified version of the prime sieve. I actually doubt it could be implemented any faster, but I might be wrong:
from math import sqrt
def sieve(n):
"""
* A fast implementation of the prime sieve algorithm. Finds all prime numbers up to a given upper bound.
* Params:
* n: The up... | stackexchange/codereview |
I have this function that contains two similar if statements that is kind of hard to re-factor.
I am saying this because these two share a significant portion of duplicated code, but because of the part where it differs slightly, like board[startX + 1][startY - 1] and board[startX - 1][startY - 1], I find it difficult... | stackexchange/codereview |
I want to search through an array of n numbers and find the numbers that are repeated. So far I have this code, which does the job, but I find it to be a rather cumbersome method, but I can't seem to find another method of doing it.
class Checknumber{
int [] numbers = new int [5];
Scanner inn = new Scanner(... | stackexchange/codereview |
I watched a YouTube video and completed the Todo List using Pure JavaScript.
Below is the code I wrote. I want to improve this code, but it 's not clear how.
I want to change this code to constructor function, but it's not easy. I think that the addItemTodo code is not bad, but the code in removeItem and completeItem a... | stackexchange/codereview |
I am trying to using HttpClient for making API calls from a different domain and for that purpose I have created the following service class after doing some research. It is 4.7.2 framework and not a .NET core system. I have created library class for this with following classes. Please give me your valuable suggestions... | stackexchange/codereview |
I have this function I'm building to return the RBG code of a cell I input. The code "works" but something funny is going on. If I write multiple functions each referencing different cells, then all the functions simultaneously show the last cell I run through the function.
I'm probably doing something trivial here, ... | stackexchange/codereview |
Currently, my team and I have 2 types of databases that are updated periodically, SQL Server and Access. Also, we run specialized reports based on those databases.
Basically, we have 4 tasks that need to be completed:
Update SQL Server
Publish SQL Server Reports
Update Access Databases
Publish Access Db reports
Acces... | stackexchange/codereview |
I'm writing a animate method to perform DOM animations. I know there are a lot of libraries out there that already does that (and I use some ideas of them) but I usually prefer writing my own code to pinpoint my problem.
The code below is working perfectly, but something with the structure is making me uncomfortable. I... | stackexchange/codereview |
I just finished Problem 04 on Project Euler, and I was looking at ways to optimize my code, just started learning functions too, so I'm pretty sure it's very bad, hopefully you guys can help me.
Question
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers i... | stackexchange/codereview |
I wrote a simple PHP login form for a website. It has an initialization script, as well as a form to allow a user to login, plus a link to log the user out after logging in.
lib/app_init.php
<?php
declare(strict_types=1);
require_once 'config/db.php';
try {
$db_conn = new PDO(PDO_DSN, DB_USER, DB_PASS);
$db_... | stackexchange/codereview |
I have code that converts each sheet of a spreadsheet into a .txt file. It works well, however, given the big number of exports (about 90 .txt files), I'd like to seek advice on how to speed it up.
Sub xlsxTotxt()
Dim i As Integer
Dim directory As String
Dim fname As String
Dim xWs As Worksheet
Dim xTextFile As String... | stackexchange/codereview |
I'm displaying multiple queries and if statements. In the if statement, it increments notice_category_id by 1 each time a category is created, but when I code the update/delete/edit (or if truncated), sections won't rowCount() increment the row and make duplicates. I'm just wondering if I should change the way the the ... | stackexchange/codereview |
I have a table with a Balance column of type decimal(18,0).
I want to get updates to its Balance field and reflect the changes in the parents of the updated row.
Currently I can easily subtract parent values by selecting from deleted table and add to parent values by selecting from inserted table in two different queri... | stackexchange/codereview |
Hello I made a sieve of Eratosthenes algorithm on x86 assembly using NASM.
The highest number it can take is about 2 million and it takes like 2 seconds to complete.
Here's the code:
section .bss
buffer resb 100
numbers resb 0
section .data
arrayLength db 0
section .text
global _start
_start:
... | stackexchange/codereview |
I am designing a new application to track sports statistics with code-first migration. I have the bare minimum POCO setup. The problem is that I am not happy with the design specifically how the players, teams and tournaments are relating to each other.
I appreciate any comments and suggestions.
PlayerAccount class:
/... | stackexchange/codereview |
Task
I was asked to write a function, which can determine (return a bool) whether 2 given strings are anagrams of each other?
That function should have the following constraints:
Upper and lowercase letters are considered the same
Non-letters (so numbers, punctuation, whitespace) should be ignored
My implementations:... | stackexchange/codereview |
Somehow, I couldn't redirect the user back after its authentication. I was using successReturnToOrRedirect property, but it kept sending it back to /. I checked req.session.returnTo and req.path and both of them have / as a value, even though I was calling /auth/facebook from a different page.
This was my first code:
... | stackexchange/codereview |
I am in process of making debugging output better for client-side application. We have lots of auto-generated Protocol Buffers classes which are used for communication by our protocol.
I am trying to make an function that would enumerate properties in any TObject passed to it, and return JSON-alike string that contains... | stackexchange/codereview |
I made this simple program that can solve every set of linear equations in two variables.
You just need to enter two linear equations of the form ax+by=c (without any unnecessary spaces) where 'a' is a positive integer (i.e. x should not have a negative coefficient) and b and c are just integers.
The program can also s... | stackexchange/codereview |
I have a working macro that finds a specific word and deletes the whole text. It finds the word "JOBSPECIALTYCODE" in the sheet, selects and deletes it, then moves to the next sheet. I just want to ask if there is any alternative way to make my macro work fast. I only use a record macro.
Sub aHaveProgess()
'
'
'
'
'D... | stackexchange/codereview |
I've got 20'000+ court documents I want to pull specific data points out of: date, document number, verdict. I am using Python and Regex to perform this.
The verdicts are in three languages (German, French and Italian) and some of them have slightly different formatting. I am trying to develop functions for the various... | stackexchange/codereview |
I'm trying to make a small program which takes a number (form 1 to 1000) and shows the primes between 2 and that number. Right now I have a quite functioning program (except a couple of bugs), but the problem is that it needs a lot of cycles. In the worst case scenario (limit = 1000) it takes roughly 2 million cycles t... | stackexchange/codereview |
I currently have a number factors program that performs the following things: The user enters a number, checks whether it is a perfect square (yes or no), prints the square root if it is a perfect square, determining the number if it is prime or not, and the number factors of that specific number.
import java.util.Scan... | stackexchange/codereview |
Is this thread safe?
I have a program that executes an SQL command on a number of files (selected by the user).
Here is where I create the threads:
var allThreads = new List<Task<bool>>();
if (fileList != null)
{
foreach (var file in fileList)
{
var fileName = Path.GetFileName(file);
if (File.E... | stackexchange/codereview |
The purpose: an express node.js server which can be launched using naught, with an integration test using supertest. Each worker naught runs will test itself on a unique port, and only if passes it will listen in on the main port and join the pool.
Major concerns are - no idea what I'm doing. How I provision the port... | stackexchange/codereview |
I'm wondering what people think about Dependency Injection vs Service Locator patterns. Specifically I'm using Prism with MEF. I'm also using the MVVM pattern.
So I have a service which I export. I also have a class which doesn't export its class type as I don't need that to be registered with MEF. This class is actual... | stackexchange/codereview |
I'm working through Sedgewick's Algorithms book for fun and educational purposes. I am implementing a simple Stack<T>, using System.Collections.Generic.Stack<T> as a guide:
[System.Diagnostics.DebuggerDisplay("Count = {Count}, Size = {_values.Length}")]
public class Stack<T>
{
// Constructors
public Stack(int c... | stackexchange/codereview |
Here is my solution to problem 11 on Project Euler. The goal was to find the largest product of any four numbers in consecutive line of any direction (vertical, horizontal, or diagonal). While my code achieved the solution it feels wrong to me in a way I cannot quite articulate. I attempted to implement a pseudo-mat... | stackexchange/codereview |
I have this PHP curl function to check if a site is online or not:
function check($proc,$url,$keyword,$method,$timeout,$maxredirs) {
// Format Link
$link = $proc."://".$url;
// Agent
$user_agent='Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.130 Safari/537.... | stackexchange/codereview |
I've created a Java class for Android that connects to a FTP server (using the FTPClient library from commons-net-3.6) and uploads a file that is stored on an Android device. The code of the class is the following:
public class FTPHandler{
private String HOST = "ipftpserver";
private String USERNAME = "mylogi... | stackexchange/codereview |
I wrote the following function for the purpose of reusability:
template<typename T>
bool contains(vector<T> v, T x)
{
if (v.empty())
return false;
if (find(v.begin(), v.end(), x) != v.end())
return true;
else
return false;
}
Is this the correct way to do, oor is there... | stackexchange/codereview |
I'm writing a small library to do some image-processing on GPU for WinRT, however, I'm not sure if such design breaks SRP.
One class loads and saves image, renders and maintains filters - isn't it too much?
Code
public class FilteredImageProvider : IDisposable
{
public event Action ImageSourceChangedEvent;
GPUI... | stackexchange/codereview |
The following code works but is slow and I know can be better, just don't understand how to make it work. The end result is displaying the actual driving distance from the users current location to multiple locations (I'm only including two end locations here to try and save space). This way they can see which location... | stackexchange/codereview |
Here is how it looks at the beginning:
And after I can add random counts of line edits:
Or delete them:
The main purpose is the possibility to add or delete QlineEdits which stores user names and each QlineEdit adds a username to the vector in the right order (index) like this:
users =>
[0] = "a";
[1] = "b";
[2] ... | stackexchange/codereview |
This is a question from careercup.com. Given a word w and a number k.Find k words in the file occurring before occurrence of w.Assume that the average word size is m in the file
eg.
aaa
bbb
ccc
booking
alpha
beta
gamma
for k=3 and w = booking
the output should be [aaa,bbb,ccc,booking]
similarly for k =2 and ... | stackexchange/codereview |
Answering a question on S/O about type annotations led to me writing a little decorator that adds type checking to functions with annotated arguments. It supports the meta types Any, Optional[], and Union[], as well as combinations such as Optional[Union[...]]. It takes no arguments itself, for ease of use.
I'm fairly ... | stackexchange/codereview |
I have a LINQ query which works fine. I am however very interested to understand if this can be written in a more optimum way...
var query = (from r in Results.All.AsEnumerable()
where r.RequestType.Id == Id &&
r.DateFrom >= sDate &&
r.Dat... | stackexchange/codereview |
I have a mutableListOf a sealed class.
I am trying to compare the result coming from the api with the ones saved in the db so I can update my UI base on isSaved attribute. Here is my code :
sealed class MasterList(val type: Type) {
data class FavoriteList(
val list: List<Info>
): MasterList(Type.FAVORI... | stackexchange/codereview |
I just found a whole bunch of plane tickets that only have a start and destination on them. I also know the route started in a certain city. I would like to recover the (alphabetically) first possible route a person took using these tickets. I added some examples in the doctests.
from collections import OrderedDict, de... | stackexchange/codereview |
The first block of code is my main app.js that is included on every request. It is essentially a library of functions and objects that include related functions (ie: app.utils) that I can use on other pages like page1.js:
./app.js
var app = window.app || {};
(function($){
app.req = app.req || {};
app.utils = a... | stackexchange/codereview |
I have written an n-body simulator, implementing the Barnes-Hut algorithm. Please comment on anything you can see wrong with this.
Wikipedia Barnes-Hut page
This is a screen shot of the simulation 20 hours in. All the particles spawn in a uniform disk, given an initial velocity in order to "orbit" the "Galactic center... | stackexchange/codereview |
Here is a script that opens about 200 pictures, the first time you open the webpage, loading of the 200 pictures is fast, However if you reopen the page, it takes about 4 minutes to load the same page the second time. Please advise.
session_start();
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('... | stackexchange/codereview |
I currently have two partials that I use for signing up and signing in. The code is essentially the same in both except for different images to represent sign up/in via Facebook/Twitter.
_sign_in_via.html.erb looks as follows:
<div class="sign-up-via-links">
<div class="row">
<div class="col-md-12">
... | stackexchange/codereview |
About a year ago, I was given a C++ assignment as a preliminary job-interview test.
The assignment included 4 different tasks, from which I had to choose one.
I actually chose and completed 3 out of 4 tasks, but I did not pass the test.
I was not given any specific rejections, so I would to like get an unbiased opinion... | stackexchange/codereview |
I use self-closing bodyless for loop to quickly find an element within an array or collection. Learned it from a Java teacher.
But I'm seeing warnings on certain IDEs that have a code inspection tool.
For example, IntelliJ deems this construct to be a probable bug and objects to the empty body of the loop.
The code bel... | stackexchange/codereview |
I have implemented a message queue for inter thread communication just like POSIX message queue. I want to know whether there is any scope for performance improvement and also any bugs which need to be corrected. This is my code:
#include <iostream>
#include <cstring>
#include <list>
#include <vector>
#include <thread>... | stackexchange/codereview |
I was solving the following problem on HackerRank.
Here's my solution -
from itertools import combinations
a = input()
ls = list(map(str, a.split()))
for i in range(1, int(ls[1])+1):
ls2 = []
ls2 = list(map("".join, combinations(ls[0], i)))
for elem in ls2:
ls2[ls2.index(elem)] = "".join(sorted(elem... | stackexchange/codereview |
I am good at logic and most of the time I write working code. But I want to learn writing code which follows best practices and is very efficient. I tried to implement some of them in my code but it still looks very unclean.
Could anyone please explain how I can make this code better and make it production standard cod... | stackexchange/codereview |
A link to the pull request in question.
I maintain a C++ DLL / Game Maker library that constructs an environment that allows one to call any game maker script/function from within the C++ dll directly. It does this by placing all DLL function calls in a second thread that then communicates function calls to the origina... | stackexchange/codereview |
I've written a small app using the kivy framework, which aims at reviewing your times tables. My major concern is about making this app easier to improve in the future. That is, how to organize the code to make it more clearer (by adding a User class that would store the data associated to the user, for instance). Sinc... | stackexchange/codereview |
The code connects multiple clients to a server using TCP sockets asynchronously. I have added code to attach a digital signature to the outgoing messages from the server, to authenticate the message the signature is verified on the client and the message is displayed. The signing and verifying of the digital signature ... | stackexchange/codereview |
take an array of two numbers who are not necessarily in order, and then add not just those numbers but any numbers in between. For example, [3,1] will be the same as 1+2+3 and not just 3+1.
function sumAll(arr) {
let start = arr[0];
let end = arr[1];
if (start > end) {
let temp = start;
start = end;
e... | stackexchange/codereview |
Please have a through look my custom implementation of generic repository pattern and suggest anything I may be lacking.
I am using a generic interface with 6 methods
I'll be using a repository class for each entity type (e.g UserRepository, ProductRepository, StoreRepository) which are not only going to implement the... | stackexchange/codereview |
So this is my very first time in this site. I have written this very basic Python code with PyQt5 to create a Memory Game. As I am not very familiar with OOP (but I'm trying to be!), I hope somebody could point me to where I could improve my game.
As it stands, the whole thing is working but it lacks of a pretty templa... | stackexchange/codereview |
Every month my department has to generate blank upload files (xlsx) for each day of the month.
The following code helps this process by copying a template, iterating through the number of days of the current month, and generating a file for each of those days from the template.
I found the copy_rename function which he... | stackexchange/codereview |
I got the following task to solve:
"PRODUCT_NAME","PRODUCT_CATEGORY","SALES_PRICE"
"Hair Gel","Beauty",6.99
"Scotch tape","Office Supply",2.99
"Office Chair","Office Supply",134.99
"Eraser","Office Supply",0.99
"Lipstick","Beauty",9.99
"Nail Polish","Beauty",8.99
"Note Book","Office Supply",2.99
"Flower Pot","Home & G... | stackexchange/codereview |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.