instruction stringlengths 71 71.9k |
|---|
I'm processing a list of files, and want to check the filenames against a list of regex, like:
IGNORE_FILES = [
re.compile('^./Vendor.*'),
re.compile('^./Pods.*'),
…
]
def in_blacklist(file):
return len(list(filter(lambda r: r.match(file) != None, IGNORE_FILES))) > 0
def in_whitelist(file):
retur... |
I want to set flags which are given in string representation in any order. And it is intimidating, because you have to check like 2^3 possible options in my occassion. I was just wondering is there any better way to do that than just simple brute-force. Any optimization and readability improvment would be great. This i... |
There are some things that smell about this code, for instance multiple checking, length both returning value and changing some other variable. But I can't for the moment figure how to make it nicer, or if that's even possible. Converting it to stack-based solution seems to be making it a bit too-complicated.
Please pr... |
My task is to select items from a pool to match a specific selection criteria in a browser game.
My Problem: Usually my algorithm can find the desired results after 200–400 iterations. But every once in a while it does not find a result even after 1 000 000 iterations.
I would be very happy to receive optimizations or ... |
The requirement: search a string in a text-string (from DB) and show additional info around when presenting the result.
Examples:
text string = "The Quick Brown Fox Jumps Over the Lazy Dog"
search ==> result:
"The" ==> "The Quick ..."
"Quick" ==> "The Quick Brown ..."
"Brown" ==> "... Quick Brown Fox ..."
"Lazy" ==> ... |
I just started learning C, and got to the "for loops"—where an exercise is given to convert Celsius to Fahrenheit ( from -50 to 1000 with a step of 20 ), and print the values. I decided to play with it by adding different steps when certain values are reached.
I do have some programming experience ( Python/Java/JavaScr... |
As a part of a console utilities module, I created a function that takes a table in the form of an array of arrays, and generates an ASCII table with the given contents.
I've also added the options of adding a header, determining the in-cell alignment, and adding a border to the table.
Table cells have auto computed l... |
I have 3 ToolBars that I use across my whole application
The first one is just a ToolBar with a close button.
The second one is a ToolBar with a close and delete icon.
The third one is a ToolBar with a close and home icon.
Here is my case, I use this ToolBar in many places, and I dont want to use Fragment for some rea... |
So I just experimented with some code to make a huge if-else construct more human readable, extendable and configurable (switch positions of conditions).
The idea was to have a vector that contains all conditions and their actions and then just iterate over the vector, executing their ConditionalAction.
I solved it wit... |
I have a set of functions to run according to combined options. Options are easier/harder, add/multiply, wait/nowait, 1/-1.
You can see the whole module here.
For now I have put all functions in an object to be able to access them according to the options. For instance:
var stair = {
down: 3,
sameStairCount: 0,
s... |
I have a map of cars Map<String, Set<Car>> which can be returned by getCarsMap() method where key is model of car , and value is list of cars of same model.
I would like to improve Car addCar(Car car) function. For now I wrote this a bit ugly piece of code.
public Car addCar(Car car) {
if(getCarsMap().entrySet().stream... |
This basic function to detect negation while performing sentiment analysis. So that not good kind of words can be considered a negative.
This code is working fine. Can someone help to improve it or find if any bug present?
def negate_sequence(self,text):
"""
Detects negations and transforms negated words into "... |
Is it normal to catch exception in concept of MVVM inside model? Or how should it be? How to improve this code?
This is simple application that allows user to drop .pfx certificate on the label. LoginModel checks the password for validity and check the publisher. if the validation fails throws an exception that is catc... |
The original task was to find the first non-repetitive character in a string.
Every now and then I read questions here on Code Review and try answering them myself, and as such I stumbled upon this one.
Now, I have two solutions:
The first one:
struct ch {
int num;
char c;
} characters[127];
char find_first_no... |
Problem statement: In Windows Workflow Foundation we have a long running state machine. We had an issue with SQL server deadlocks putting workflows into a suspended state. Since Workflow instances are independent actors, we cannot easily coordinate these calls. As part of our workflow error handling strategy, if the... |
I want to refactor below code.
Do() method below gets the position number from other component "_calComponent.GetPosition()" and compares the
value with the pf control positions (PfControlPositions).
As you can see there are many if conditions that I had to use here. I did not like this approach. I am not able to w... |
I'm trying to implement the UoW pattern using ADO.NET and this is what I've achieved so far:
The IUnitOfWork Interface:
public interface IUnitOfWork : IDisposable
{
IDomainTableRepository DomainTables { get; }
IVariableRepository Variables { get; }
IModelRepository Models { get; }
IStructur... |
I have a word document which has a lot of active x checkboxes on it and I have just been told the way it has been coded and done could be improved upon a lot, so I am asking for a bit of help.
To quickly explain it, the checkboxes are tied to a "completion overview" at the bottom of the document.
The code on the checkb... |
The following code displays a Timetable, but the code needs too long finish the whole process.
<?php
class showTimeTableModel {
static $home = false;
static $type = NULL;
static $c_id = NULL;
static $class = NULL;
static $subjects = NULL;
static $kn;
static $year;
static $kw;
static... |
I recently got in really deep on a question to find the overlapping meetings and I rewrote a bit of the code and added some things to the code, and I would just like a general review of my code and what I could do to make it even better, maybe performance wise or whatever.
Here is my LINQPad 5 Code Dump, you should be ... |
I am a beginner programmer and I've been trying to complete an unbeatable tic-tac-toe program, my code is below. The program itself works, but it seems rather inefficient, as I literally have to type out every case of possible victory or defeat. Any suggestions on how to make the code more efficient, or general suggest... |
I tried to write this code as concisely as possible. Is this the best way to do it?
def collatz(n):
"""
Generator for collatz sequence beginning with n
>>> list(collatz(10))
[5, 16, 8, 4, 2, 1]
"""
while n != 1:
n = n / 2 if n % 2 == 0 else 3*n + 1
yield int(n)
|
Can someone review my code? I am trying to implement radix sort in JavaScript.
var numbers = [90, 46, 7, 12, 100, 68];
var length = numbers.length;
var buckets = new Array(10);
Clear();
function Clear() {
for (var i = 0; i < 10; i++)
buckets[i] = [];
}
RadixSort();
function RadixSort() {
var maxElem... |
The following code is a function that works. It's just slow and I don't know how to speed it up. It takes an Excel row number and the value of its headerval (string) and finds the same headerval on a different sheet then copies the formatting and applies it to our new sheet. The true false is because the source sheet h... |
Motivation: Have std::vector<std::unique_ptr<T>> accessibility at std::vector<T> speed.
std::vector have one inconvenience - you can't store pointers nor indexes to elements if the vector grows/alters.
To overcome this problem we usually use vector of pointers / deque (if only grow) / list / etc. Having our elements in... |
I use this script in amazon lambda for image processing. Script should do:
download image and watermark from amazon S3
resize image to two sizes
put watermark on it and annotate with text
put resized and watermarked image to other bucket
send to external host some metadata info
At this moment it works as expected, bu... |
Original question
Reimplemented solution following JS1's answer.
Changed bit string hack to bitwise operations to get the corresponding base64 index values.
#include <stdio.h>
#include <assert.h>
void get_b64_quads(char *hex, char *b64quads, int pad)
{
char *dec_2_base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnop... |
I have written the following the code to complete a matrix based on data provided in a second worksheet, but the code is really slow (note that s1=12,000, s2=40 and s3 = 200,000). Any suggestions on how to make this code faster?
Sub UpdateMatrix()
Dim wsOverview As Worksheet, wsData As Worksheet
Dim rngTable As Range
... |
The code for a binary search on an ordered string by alphabetical orders seems to work. I am wondering if there is a better way to write this.
function binary_search(arr, letter){
var first = 0;
var middle = Math.floor(arr.length/2);
var last = arr.length -1;
while(true){
var test = arr[last];... |
I'm working on my first NodeJS / Express application with the async module. It's been an uphill battle for me learning node (and even JavaScript) as I go along so I'm sure there's a lot of room for improvement.
I've written a GET event handler for my REST API and I'd like to know:
Where and how to decompose this into ... |
I wrote these extension methods to provide a generic/re-usable method for saving a form's size, position, and window state. What I would primarily like to know is if there is a better way to handle storing the WindowState property. I would also like to know if there are any bugs I might have overlooked, unnecessary cod... |
Problem URL
This is the solution I came up with the minimax problem stated above. I did a top-down recursive approach with memoization, and I think this should be \$O(n)\$, since we are filling out a memoization table with \$n\$ elements, with constant number of operations per each recursive call. Nevertheless, I am ge... |
I have recently written a Brainfuck interpreter in C#. I tested it with the examples given on EsoLang website. It does not handle errors right now.
Questions:
Even that it can run only one program at once, should I maybe put the variables into the class (create new class) or just leave them inside the BF method?
Shoul... |
I have the following code in Python which opens and closes a file in every iteration (using with keyword). In 95 % of iterations the file will be the same, so there's no need to open and close it again. Is it possible to optimize it if this optimization has sense?
import sys
import re
def createFileName(str, index, nu... |
Numbers are being stacked in the following manner:
7
4 8
2 5 9
1 3 6 10
The x-axis is horizontal and the y-axis is vertical. With that in mind, here are a few examples of the values and their coordinates:
2, 3 (coordinate) ==> 8 (value)
2, 2 (coordinate) ==> 5 (value)
I need to write a function \$fn(x, y)\$ which ac... |
I've written this program that, renders a circle in the middle of the screen. It's been written in a very elementary way.
Any suggestions on principles or techniques? Or any more optimal or efficient ways of drawing circles in C?
I'm using SDL2 (Simple Direct Media Library) and GCC to compile.
#include "SDL.h"
#include... |
I have written some code for mapping excel columns to table columns and processing data after mapping columns. Please review this code, check for SOLID, OOP principles and suggest any improvements and optimizations. Any critiques, suggestions or comments are warmly welcomed.
API Action Method to get table and excel co... |
As this will eventually become part of an operating system I'm developing, there is no specific adherence to any particular ABI, even though this is being developed and tested on Ubuntu 16.04. My OS will however adopt a SYSTEM V paradigm insomuch as passing values by register, but they will be passed in the one most su... |
So, I have an assignment due in a couple days where I need to create a card game.
I chose to do a memory game and I'm nearly completed however I'm completely stuck and not sure how to move all of the methods or functions into classes. Shuffle, cardFlip etc I'm wanting in classes but not sure on how to move them without... |
I was attempting a question on HackerRank-Dijkstra's Shortest Reach 2 and upon submission my programs times out in 3/7 test cases. One of the test cases had 200 nodes and about 2000 connections. Here is my code-
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.i... |
I am in the process of refactoring this simple binary search tree code responsible for adding new values:
void add_internal(Node *root, int value) {
// Decide whether to insert left or right
if (root->value >= value) {
// Decide whether to insert here or down the subtree
if (root->left) {
... |
I have made this pong game as a 1 player game, versus the computer. however it is impossible to beat the ai. Any ideas to make the code better would be appreciated.
import pygame
from pygame.locals import *
pointcounter = 0
class Pong(object):
def __init__(self, screensize):
self.screensize = screensize
... |
I am programming my first android app. It is going to be a quiz. It will have 40 different categories of questions and for each category I am going to have a SQLite Table, which holds the questions for that category.
I have a working DatabaseHelper for the first 2 tables. If I keep going like this for the next 38 tab... |
I am using this code to upload an image. Please review it and give your feedback regarding performance, security, and quality. This also works in PDO project.
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<form action="" method="post" enctype="multipart/form-data">
<h2>Upload File</h2>
<label for="file... |
I'm trying to write a function that produces an infinite list containing strings of the form \$a^nb^nc^n\$.
My first idea was to do it using comprehensions.
f = [replicate n 'a' ++ replicate n 'b' ++ replicate n 'c' | n <-[0..]]
But this does a lot of duplicate work. I then decided it would be better to do the followin... |
I have a function that returns rows from my database, and it works fine, but I was told that it was poorly written, and there is a lot of unnecessary code in it. I'm wondering if there is a simpler, easier way to rewrite this function.
function gd($query) {
global $connect;
$fetch = mysqli_query($connect, $que... |
My algorithm for finding an Euler tour of a digraph, G⃗, if such a tour exists, starting from some vertex, v.
'use strict';
var graph = {
1: [{val: 2}],
2: [{val: 3}],
3: [{val: 5}, {val: 4}],
4: [{val: 1}],
5: [{val: 6}],
6: [{val: 3}]
};
var EulerCyle = (function(G, source) {
var Cycle... |
I'm working to make a thread that monitors a web API to get the latest announcement via JSON. I cannot test this currently, so I'm unsure if anything needs to be changed with this. I've read through other questions but everyone else doesn't seem to be using a loop to keep getting a response.
public void run(){
try ... |
As an attempt to learn multithreading better, I wrote a program to crack the password of a ZIP file. It is sort of slow, processing a three-digit password of the 95 printable ASCII characters in about 1:45 minutes. This is my class that actually handles the cracking:
class DecryptPassword
{
private readonly List<... |
I've been just getting started with Agda. I tried to prove, as exercise, evenness.
even : ℕ → Bool
even 0 = true
even 1 = false
even (suc (suc x)) = even x
x : even 12 ≡ true
x = refl
But asserting truth using _≡_ seems like a really bad way. What would be the best way of doing the same thing?... |
I have this project about using OOP in python. How to fully make use of OOP and use __init__(self)?
class Parent:
name = "Player"
lives = 3
#display player running
def run(self, name):
self.name = name
print "%s is running." %self.name
#player will start to jump against enemy
de... |
Background
I am working on a WebGIS application using JavaScript and ArcGIS JS API. I am new with js, so please bear with me.
While learning and developing with js, I am trying to follow some rules, such as Asynchronous Module Definition (which ArcGIS JS API encourages), Revealing Module Pattern, and the Standard Style... |
On my quest to learn Ruby I figured exploring the proper usage of different data-structures would be invaluable, including strings, arrays and hashes.
I decided to build a hash containing the numbers 1 till 100 inclusive. These hashes would contain:
Whether the number is prime
What it's FizzBuzz output would be
The n-... |
I'm tutor for a university operating systems course, and part of my work is creating exercises for them. Those exercises are mostly about concurrency and synchronization issues. For the next exercise I intend to show them the finished implementation of an unfair counting semaphore, and their job is to make a fair one. ... |
I have a working useless todo app created with ReactJS.
I'm just wondering if my code can be improved.
This app can add a todo item and it can display editable list of todo items.
This is my ReactJS code.
var TodoApp = React.createClass({
getInitialState: function() {
return {items: []};
},
addItem:... |
I've been looking at some code done in C# ASP .NET WebForms and for some reason I really don't like the below code. What is the best alternative for creating a document and downloading it in Webforms, on the click of a button? Should the developer be messing with the Response at all, in this way?
Response.ClearContent(... |
I recently had the need to detect how long a button is pressed and perform different actions based on that. I found some examples on Stack Overflow, but the ones I looked at showed how to use timeout().
I came up with this. There are probably other ways to solve this. While searching, I found an example using IIFE in J... |
I got tired of starting timer every time I need to do something simple as running some function 5 seconds after something in my code happens. So I tried to write a function (actually, 3 of them: setTimeout, setInterval and clearInterval) to write one line of code when I need it instead of, say, five.
It is working, at ... |
I've written a jQuery Plugin which searches text and replaces it with other text or HTML.
Now everything works quite well, but recently I came across this SO question where the OP could have use of my plugin. That's why I linked to the GitHub repo and asked him for critiques and/or contribution.
Soon after, he said tha... |
(See also the Algorithms part.)
Post details
The program I am putting for being reviewed does not fit entirely in a single post, so I have to resort to the equation by Niklaus Wirth:
Algorithms + Data Structures = Programs
This part is about data structures: a set of classes that do not do anything fancy. Of course, ... |
Yesterday, I've come up with the idea of using python context manager to ensure cleanup available here. This time I am using that context manager to make a decorator.
The context manager
# SafeGPIO.py
# updated, warning silenced
from RPi import GPIO
from exceptions import RuntimeWarning
import warnings
class SafeGP... |
Update: Version 3 is here.
My first version was an answer I provided to EBrown for his original post titled "Multithreaded Mandelbrot Generator". My answer had many good things in it, but I felt some of parts of the code were weak, particular around my efforts to apply some flexible scaling rather than using a constan... |
Note
This post is a continuation of Discrete event simulation of a prioritized lunch queue in Java (Data structures). Please refer to it for problem description.
This part about "algorithms": all classes that are more about doing rather than representing information.
PrioritizedQueue.java:
package net.coderodde.simula... |
I made a library that adds undo/redo functionality to EditText widgets in Android. It came from problem I had building text-editing apps that deal with large (1,000words plus) volumes of text, and the performance problems I came across using some pre-existing solutions. Calling setText() with large amounts of text on s... |
I have a list of boxes and need to list only the outdated ones.
For example, input will look something like this:
maier/alpine-3.1.3-x86_64 (virtualbox, 1.2.0)
maier/alpine-3.1.3-x86_64 (virtualbox, 1.3.0)
ubuntu/precise64 (virtualbox, 20151202.0.0)
ubuntu/vivid64 (virtualbox, 20150821.0.0)
ubuntu/... |
Inspired by this answer and previous a commentator of code review use:
Given a complex Perl data structure, traverse/jigger/modify as follows:
If ORACLE_SID is 'key' in any hash then keep only ORACLE_SID section matching of $ENV{ORACLE_SID}
Eliminate any single level arrays, if after step 1, we're left with s_level ar... |
A while back I asked a question about my Simon Says game and did well on my assignment! But now we need to go back in a make some modifications to the game to be more advanced. I've done that as well, but I need some tips to make it more pristine and little cleaner, some things I'm still working on, but any help here w... |
I have implemented a simple client-server solution using Java sockets and useful classes from java.util.concurrent.
The communication protocol is rather simple:
Client sends a string with the appended request_info#.
A server responds to a client with the message that provides a description on how to use a server.
If... |
This is a program I wrote to grab restaurants/bars from Google, Yelp, and Foursquare. It then ranks them more effectively based on the rating, the number of ratings, and the number of data sources using a Bayesian average. My guess is that the main method could be broken into more functions. I'm also guessing I'm missi... |
In my OpenCL kernel, I have the following logic:
size_t id = get_global_id(0);
uchar index0 = (id / 32760) % 16;
uchar index1 = (id / 2184) % 15;
uchar index2 = (id / 156) % 14;
uchar index3 = (id / 12) % 13;
uchar index4 = (id / 1) % 12;
if (index1 >= index0)
++index1;
if(index2 >= index0 ||
index2 >= in... |
I have four fields a, b, c, and d. All of them must be populated if any of them have a value.
So what I want to do is validate that they are all populated, if any of them have a value. I'm trying to determine the best way to do this. I think I could do this:
class User < ActiveRecord::Base
validates_presence_o... |
I have this great C program I'd like to embed into an iOS app. One passes command line arguments to it and the results are printed to stdout via printf and fputs - like with all the good old Unix programs.
Now I'd like to just edit main and the print functions to use my own printf function which collects all the output... |
Rock Paper and Scissors is a pretty basic program.
The reason I wrote this program is because I wanted to see what a small script that used all of the main programming paradigms looked like.
My code contains:
OOP: A Player object.
FP: First class functions : player.intelligence is a function is stored in a variables a... |
I use the following script to download the result of a SEDE query and scrape a specific column from it using BeautifulSoup:
import json
def extract_column(soup, colname):
"""
Returns a generator of cell values in selected column.
For simple columns like timestamp, a cell value can be simple,
for exam... |
I had to recently implement a code to count the union of all intervals (if there are overlapping intervals) for an interview. I was provided with the following function stub:
public int solution(int[] A, int[] B) {
}
A[0] and B[0] form one interval, A[1] and B[1] the next one...and so on.
I tried two approaches.
Co... |
Recently I was asked to implement a stack specifically for storing 'int' type data and find memory leaks. Isn't the garbage collector responsible for releasing all the memory? What are the possible memory leaks and how do I handle them?
import java.util.NoSuchElementException;
public class MyStack {
private int st... |
Given a String, if the String begins with "red" or "blue" return that color String, otherwise return the empty String
public String seeColor(String str) {
if(str.length() <= 3){
if(str.equals("red")){
return "red";
}
return "";
}
else if(str.substring(0, 3).equals("red")){
return "red";
}
... |
How can I change my two functions to be more readable functions (i.e. in steps), because I am using pycharm.
import collections
def compute_word_importance(fpath1,fpath2):
mylist1 = []
mylist2 = []
with open(fpath1, 'rt', encoding='UTF-8') as f:
for line1 in f:
for word in line1.split(... |
I'm using node-ftp to download some files from an FTP server; due to nodeback difficulty and nested calls I'm promisified some of the calls, hoping that this will help get me out of pyramid code hell, but I think I'm still mis-applying something.
Before I get to my code pasted below, conceptually the pseudo-code of wha... |
I have a method which will merger two sorted list together. The function works, but I saw some duplicated code.
Any ideas to make the code more elegant?
class Node(object):
def __init__(self, data=None, next_node=None):
self.data = data
self.next = next_node
def MergeLists(headA, headB):
head = ... |
I need to be able to store results of a game in a file with names and high scores where I will eventually want to review the file and sort it alphabetically, etc. I'm unsure if I have the correct way of storing the results to be able to do this.
class_number = input('Please enter your class number: ')
from datetime i... |
I wrote a Cordova plugin for an app that I'm working on, and now I'm trying to write an Angular definition to wrap my plugin. So far, I've followed the model in ng-cordova.js:
angular.module('ngCordova.plugins.audioPlugin', [])
.factory('$audioPlugin', ['$q', function($q) {
return {
init: function(session... |
If you came here because of the title, chances are your server isn't down. But if by some miraculous reason it is:
A while ago, I posted a program that would ssh and ping all the servers at work. I got some very good feedback and went ahead and rolled with it.
Here's what I came up with:
It now is much more readable, ... |
The idea of the game is that the player and the computer take turns entering either 1, 2, or 3, and that number is added to a running total. Whoever goes over 21 loses. I need to develop a strategy that lets the computer always win.
I have a strategy worked out, but I was wondering if there is a more efficient way to d... |
I am wondering if this is a safe and/or sensible way of going about doing the following task:
My problem is that I have a folder with loads of directories with names of form YYYY-MM-DD. They are from my camera. Each directory contains picture files. The problem is that the picture files are designated by just 4 digits ... |
It is a simple program which allows you to input a username an password. If the username/password is equal to the String it launches a JOptionPane that says "Correct". If it doesn't it launches a JOptionPane that says "Incorrect".
import java.awt.event.*;
import javax.swing.*;
public class Main {
//The Strin... |
This is an adaption of a single player Battleship game. I made it two player, and I also tried to implement OOP and DRY principles. I would like my code to be reviewed for OOP, DRY, PEP8, and overall best practices. I am new to development (about 1 month strong), so any constructive feedback would be greatly appreciate... |
I'm trying to improve my understanding of inheritance and template classes in C++ so I coded a hash table (see compilable source code below).
I would be greatly appreciative of any comments on how to improve this code.
Description: The LinkedList template class inherits from the template class Stack. The Stack class co... |
When I finished this problem, I thought about how I initialized my loop iterator variables i and j. Originally I had i = 0 and j = 0, but then I had to initialize count to 1, instead of 0. And that just seemed a bit odd to me. A similar conundrum came to me when I was incrementing/decrementing count, and deciding if I ... |
I am working on Problem 2.30 from Structure and Interpretation of Computer Programs. I book is in scheme, but I am doing the exercises in Clojure.
The problem is to write code that takes a tree of numbers and return a new tree with the numbers squared. I have done it in two ways:
Without higher-order functions:
(defn ... |
How can I refactor these switch cases?
void selectOption(Shape** shapes, int size, int selection) {
int obj1;
int obj2;
bool init2 = false;
bool init = false;
int option = 0;
do {
cout << "\n (1) Rectangle #1"
<< "\n (2) Rectangle #2"
<< "\n (3) Circle #1"
... |
I'd say currently my understanding of C# is within the range of (1Beginner-10Intermediate) a solid 4-5. Thus I am seeking to broaden my understanding of C#; I've started coding an IRC bot to improve. This is the code:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
... |
My problem is this: Given two strings, append them together and return the result. However, if the strings are different lengths, omit chars from the longer String so it is the same length as the shorter String. So "Hello" and "Hi" yield "loHi". The strings may be any length.
Is there a way to do it without using of S... |
I will first explain the context. I want to read serie subtitles contained in .srt files. I have already done the part of extracting the words from the files (and how many times the word appears for a serie) but when it comes to inserting the data in my SQL Server database, it takes more and more time to do the updates... |
I just watched the video from "Think Like a Programmer, Episode 2: Puzzles & Problems".
The problem is:
Assign number 1-7 to three departments in a city: Fire, Police,
Sanitation.
Requirement:
Each department should have a unique number
Police should be an even number
Fire + Police + Sanitation = 12
Generate a li... |
Does someone want to review my solution to part 1 of Day 7 Advent of Code in Scala?
The assignment is here: http://adventofcode.com/day/7
Without repeating the whole text, in short:
Given a text file of the following form (simplified):
x AND y -> a
x -> 1
y -> 0
calculate the value of a. Here is an example of a full i... |
I've written a program that encrypts files (or stdin) with a user-specified key from 1 to 255. This "encryption" is very insecure, but still a bit better than ROT13 (at least for people trying to crack it using pencils and paper). How can I improve this program?
#include <stdio.h>
#include <stdlib.h>
#include <string.h... |
I have wrote some service in AngularJS that use defer, can you check my code and tell me if I getting it right?
Service (I dont really like name: WatchableTeaser, have you got another?):
.factory('Teaser', function ($resource, DateUtils) {
return $resource('api/teasers/:id', {}, {
'query': {method: 'GET', i... |
I have recently written a jQuery plugin called Pageee.
Pageee is a jQuery plugin to scroll through full pages automatically, by arrow buttons, or by dragging the page.
I have now come to Code Review to ask you if you have any suggestions to the code appearance (readability), the browser support (should only support ... |
I have working code with original design, and now I had a slight design change so trying to code review that as well. I already had code review on my original design here.
Original Design:
I am using RestTemplate as my HttpClient to execute a URL and then my server will return a JSON string as the response. The custome... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.