instruction stringlengths 71 71.9k |
|---|
I am new to Scala / Akka and this is my first attempt at writing an actor.
The task that I am trying to accomplish is: given a sequence of soccer matches, generate a ranking based on the usual rules of soccer (winner gets 3 points, loser gets 0 points, and 1 point each in case of a draw).
Here is my current ranker acto... |
Please review my code for scanning active IP address . Please Suggest improvements ...
import socket
import threading
import sys
ip0=input('STARTING IP : ')
ip1=input('ENDING IP : ')
port=int(input('PORT NUMBER : '))
timeout=int(input('TIMEOUT :'))
timeout=timeout/1000
print()
ip0=list(map(int,ip0.split(".")... |
I have a list of aircraft returned from a REST call which describes the status of each aircraft. In order to make the UI templating simpler, this single list is split into four homogeneous lists in order to group by status.
My primary concern is that we iterate over the primary array \$s\$ times which, while still in p... |
I've created a Noughts and Crosses game in Python using pygame, and I'm quite pleased with the result that I've produced. I've managed to reduce the code to what it is now, as it used to be much longer, and I'd like to submit it here for review. I know that it's common practice to not have more than 79 characters on an... |
I have the following method in .NET Core that returns the description attribute of an enum value. I think this code can be more elegant. I'd appreciate some suggestions.
public static string GetDescription(System.Enum input)
{
Type type = input.GetType();
MemberInfo[] memInfo = type.GetMember(input.ToString());
... |
I need to know if my code is a valid implementation of the factory method pattern. Also, if the Configuration and Editor were interfaces would this still be a valid implementation of the Factory Pattern?
public abstract class Configuration {
protected List<String> keyWords;
abstract void getTheme();
abstr... |
First of all, disclaimer; this is for a school assignment. I hope I'm not doing anything inappropriate by asking for input on it, but if it makes a difference, the assignment has already been submitted and graded.
I've been having some problems with the professor that submitted the assignment, but I value my education ... |
I do a lot of steps of processing over an input_file. To avoid having to think of an output_filename at every step, I created the following name generation function:
def generate_out_file(in_file, suffix='out'):
body_str = in_file.strip('./')
flag = '.' in body_str
_list = body_str.split('.')
body_list ... |
I wrote the code for my undergraduate TA jobs, to check assignment codes of students in Python class are correct or not.
Usage of the code is
$ python [test01.py[,test02 , ...] answer.dat grade.md
It will write grades (range 0~100) to a file called grade.md.
"""
Testing Assginments
by kidkkr
03-16-2017
"""
import os... |
The below function is used to create multiple content division elements (i.e. <div>) inside a containing <div>. The function is working correctly and is as expected, I just feel the quality of the code itself is a bit poor.
Therefore, can the following function be, in any way, simplified or improved?
generate(chartData... |
I'm trying to make a simple module I can paste into my various projects to provide basic logging capabilities. I'm hoping to become less dependent on print because:
Using logging will allow me to quickly enable and disable what's being logged
logging has built-in file and formatting utilities
The built-in levels of lo... |
How can I improve this? It's large and ugly. Any advice?
I'm receiving a POST from a API, and I want to update only the fields that are not null.
titulo = request.data.get("titulo", "")
image = request.data.get("image", "")
price = request.data.get("price", "")
wholesale_price = request.data.get("wholesale_price", "")
... |
The program will read the user's input, if it's longer or equal to 10 characters, it will print it.
It's pretty compact and works fine.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_SIZE 1000
int main(void){
char line[MAX_SIZE];
int length; /*String length*/
while((fgets(line, siz... |
I am new to the concept of prepared statement and i am trying to adjust my "user login" function to be a prepared statement. The part i am really struggling with is the fact i have multiple SQL queries in the one function and the biggest hurdle right now is fetching from a prepared statement.
Here is the code i have wr... |
Purpose:
This class exists to ensure actions created from other threads are executed in a synchronous manner. Additionally, it provides functionality to add actions that run after a delay.
Code: (Note that the comments may be inconsistent and inaccurate in places.)
class ActionQueue
{
// We don't lock on the actual... |
Yesterday you found some shoes in your room. Each shoe is described by two values:
type indicates if it's a left or a right shoe;
size is the size of the shoe.
Your task is to check whether it is possible to pair the shoes you found in such a way that each pair consists of a right and a left shoe of an equal size
For... |
Here is a simple ObjectPool collection that I use for some of my classes. Could someone review it?
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Mango.Collections
{
sealed class ObjectPool<T>
{
private readonly Concu... |
I am developing a plugin for the GIS software, QGIS. The code below reads the number of layers in various groups (as shown in the image) and adds them to a QTableWidget:
For each group, I want to count the number of layers, divide 1 by this number and then add the result of this to each of the layers in each group in ... |
I'm creating a Windows service and so have the Program class inheriting from the ServiceBase class and overriding OnStart and OnStop. Inside these methods I have made use of TPL instead of using Threads like I would have done in the past. This what the methods look like:
private CancellationTokenSource _cancellationTok... |
this is my code (assembly x8086, not MIPS, and I'm using emu8086) to display a 32-bits number on screen. Of course the basic algorithm is as follows:
Input: Number
Set r=0,q=Number,counter=0;
while q > 0 do
divide q by 10
q <- Quotidient, r <- Remainder;
push r;
counter = counter + 1;
end while
while counter > 0 do
po... |
I'm using X.PagedList for paging functionality in my application. The code I have works fine but when I return larger sets of data it seems like it could be faster. Is there anything I can do to my code to have it perform more efficiently?
Controller Code
var employees = _service.GetEmployeesByOffice(region, area, of... |
I am relatively new to programming and while I am fairly comfortable with the math, I cannot say with confidence that I feel the same way with programming. Anyway here is a simple finite difference employing Maccormack technique. There are some lines with similar commands and I am sure there is a way to make this more ... |
Look at the code below. When I run the program. Only 'You're still a pup!...' gets printed out. No matter how high of a number I put. I DO know that it is taking the correct number because I echoed out the age to test separately.
<?php
function prompt($prompt_msg){
echo("<script type='text/javascript'> var answ... |
I wrote this code, in order to implement a cache decorator which handles least accessed eviction.
The role of this decorator is to memoize decorated functions calls with args and kwargs and return the previously computed value if still in cache.
Warning, this handles only serializable args and kwargs, for the sake of s... |
I am in a computer coding class and we have to make a project for Java.
Is there any way we can better our existing connect four code?
import java.util.*;
public class Connect4
{
public static boolean putDisk(char[][] field, int column, char color) {
if (field[0][column] != ' ')
return fal... |
I work at a small English school in Japan and I'm trying to create a database to handle student attendance and class scheduling. I'm using PostgreSQL for the database and I'll use PHP for interacting with it. I've looked at some examples of similar designs here and elsewhere for guidance, but since I'm still an amateur... |
I am designing a system and in it there is a view where teachers can see a summary of test data on students. Here is the component of it:
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute, Params } from '@angular/router';
import { Student } from '../../models/student'
import { Student... |
Kruptos is a simple tool that encrypts and decrypts the ~/.kruptos directory with the password that is stored in ~/.kruptos/.phrazein. There are 3 commands:
e - Encrypt
d - Decrypt
i - Initialize
Goal
I have a couple main goals:
Design: How could I make this more resilient to change?
Readability: How could I make th... |
After working on Van Emde Boas tree -based map in Java, I came up with this code. I managed to fix the bugs and improve the performance by using internally primitive integers instead of wrapped java.lang.Integers:
VanEmdeBoasTreeMap.java
package net.coderodde.util;
import java.util.Collection;
import java.util.Collect... |
I'm two months in a programming course and our instructor told us we should think about building real-world applications as to gain valuable experience. I got the idea of doing a simple temperature conversion app.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threadi... |
I made my own extra slim flat file CMS with PHP, for a website that needs simple updates. You can have a look at its functional current state here (username is Username, password is Password).
I tried to follow an MVC architecture for the project, and I am stuck with having the Controllers as classes.
Let me describe t... |
I made some custom control named Range Control in Unity. It has two buttons a "plus" and a "minus" and an input field that shows the current value. The control has (for now) two implementations:
None-List - The value is clamped between a min and a max.
Using a List - The control accepts a range (list) of values and c... |
Today, I took a coding challenge with this question:
Given a List of Strings, write a method removeDuplicates that removes duplicate words from the List and returns an ArrayList of all the unique words. The returned ArrayList should be lexically alphabetically.
One thing that I learned while doing this problem is a Tre... |
I have this B-tree based map in Java:
BTreeMap.java
package net.coderodde.util;
import java.util.ArrayDeque;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.Deque;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementEx... |
I have put together the following script to automate a process I have to perform at my work. The script solves some basic math functions and then inputs text values in certain cells. I have several of these scripts tied to different items that we produce, activated by a button on the sheet, so that if button A is press... |
I am trying to use a class to convert between miles, meters, inches, yards and feet. My instructor told me that
I have way too many functions
My return statements are not storing any values and
My print function is empty - which I think will make more sense to me once 1 & 2 are solved.
How can I do this using less... |
I have two lists of protein sequences, I have to check every entry's existence in the two lists, say like
list A = [1,2,3,4]
list B= [3,4,5]
result = [
[1, true, false],
[2, true, false],
[3, true, true],
[4, true, true],
[5, false, true]
]
I did it this way. Not sure if it's the right way
def FindDifferences(): ... |
I decided to try some google codejam problems to get some more experience coding. The problem is at http://code.google.com/codejam/contest/6254486/dashboard, my solution is below. It gets the correct solution but would appreciate any tips on coding.
Problem
Bleatrix Trotter the sheep has devised a strategy that helps ... |
I'm a student to programming. I currently just working a thing where the player can walk around a field of hashtags. so far you can only walk horizontally but before i go any further, i realized that the program flickers a lot? Is there any cure for this? I'm using python 3 on windows.
import os
from msvcrt import getc... |
Problem Description
Kevin was thinking about telephone poles and came up with an idea for a fun programming challenge. There are n telephone poles ascending a mountain and each pole has a weight and a unique altitude. Our program must move the poles into k number of stacks, but we can only rearrange the poles accordin... |
Scenario:
There is a 20 years old windows application with SQL Server as database. There are 42 companies within the Group and each company has its own database.
Now we have started building new applications and all critical data like finances etc need to come from and be written back to old system's database.
To ma... |
I implemented date range picker logic using the jQUery UI datepicker component:
var onDocumentReady = function () {
var datepickerConfiguration = {
dateFormat: "dd/mm/yy"
};
var startDatepickerHandler = function () {
var selectedDate = $(this).val();
var newC... |
I've been using Java 8 Stream features quite a lot these days and am very happy with it. I've written a code that uses groupingBy and max but was wondering if it can still be optimized or even just be tweaked for better readability.
Some sample data:
Name, OrderDate, DeliveryTime
abc, 2010-01-15, 2010-01-15T11:00:00
ab... |
The Context
My daily workflow largely consists of producing, styling, and circulating plots from a dataset to my advisor and collaborators. We use the C++ framework ROOT to generate and store histograms and I am writing my code in Python to take advantage of its Python bindings (PyROOT).
Since a ROOT file is the funda... |
I need to write a method where a int[] will be supplied as an input and it should return an array, but with all of the numbers that occur more than n times removed entirely.
Input:
(int list) data = [1, 2, 2, 3, 3, 3, 4, 5, 5]
Output:
(int list) [1, 4]
These are the steps i have tried:
Copy the int array to ArrayLis... |
Have a working version of MySQL implementation of ThorsSQL library done.
If you want to check it out you can find the whole thing on github ThorsSQL.
This is a follow on to previous code Reviews:
Part 2
Part 1
The documentation for these classes is here:
Part 3 (Layer 1): The MySQL Implementation
Layer 1: Simple Stream... |
I tried coding this for practice. Is there a more memory-efficient way to work in place without using more arrays etc (using raw array operations)?
public class SpaceUrlEncoder
{
// arguments are passed using the text field below this editor
public static void main(String[] args)
{
String unencoded = "Mr John... |
I've recently made a slightly similar question with respect to the rendering performance, however my question this time is a bit different and with respect to which kind of JavaScript approach is the "best". The previous question was with regard to which css approach gives the best performance on animations.
With "best... |
I have implemented a iterator based version of Quicksort, which allows the user to define and pass his own pivot-selection-strategy:
template<typename It>
It Partition(It begin,It end,It pivot)
{
std::swap(*begin, *pivot);
pivot = begin;
It i{ begin }, j = std::next(begin, 1);
for(;j != end; j++)
{... |
I am new in iOS development and Swift. I am going to develop a simple application which communicates with external REST services. This is my first experiment.
I appreciate feedback on best practices and improvements. Style comments are always considered as well.
import Foundation
import SwiftyJSON
class UserObject {... |
I am trying to obtain all possible ways to go from a city A to a city B on a given day by plane, with a maximum of 2 stops.
I have as input a list of dictionaries:
flights = [
...
{'dep': 'FRA', 'arr': 'AMS', 'dep_dt': '2017-05-01 12:00:00', 'arr_dt': '2017-05-01 13:15:00', 'price': 100},
{'dep'... |
This code shows an icons from the Segoe MDL2 Assets font, depending on the number in a variable. However, I'm sure there is a more elegant way of doing this.
switch (numberOfPeople)
{
case 0:
return "";
case 1:
return "\xE77B";
case 2:
return "\xE77B \xE77B";
case 3:
retu... |
I created a code that runs 60 optimizations through solver through 4 series of loops (each with 15 'iterations'). The code works great but it is taking FOREVER to run through (over an hour). Each optimization is a simple linear model (global solution is found), just changing which month I am looking at.
Problem setup: ... |
I'm new person who working on jQuery and I need your help.
$('.spinner-input, #flight-class').change(function() {
var ap = parseInt($('#adult-passenger').val());
var sp = parseInt($('#student-passenger').val());
var cp = parseInt($('#child-passenger').val());
var bp = parseInt($('#baby-passenger').val()... |
I was just wondering, is there a way to load these better and log the times they each took? It seems like a headache having to write about 90+ stopwatches, which is what I will have to do as I have about 100 of these to load.
// PacketManager
var packetManagerStopwatch = Stopwatch.StartNew();
_packetManager = new Packe... |
Basically this is my first login form.
I am using SQL and C# WinForms.
I made user roles such as "Admin" and others and the user is taken to a specific WinForms, according to his appointed role (appointed by me manually now).
I have also allowed users to create their new accounts, in which they pick their user name an... |
I'm using some resources in the code below to pin an array in memory and construct a Bitmap using that buffer. I'm not sure if I'm handling all of the resourced in the proper way.
I'm interested if the way I'm handling the GCHandle and other resources in the constructor in a safe manner, so there are no resource leaks.... |
I am trying to speed up some reporting on all employees but I am having difficulty determining where the "proper" place to parallelize my tasks. In order, this is what my code is currently doing.
Ask for all developers
Create a Developer object for each employee
REST call to Jira to get JSON of all tickets for employe... |
I was given code a while back that was a mess, and have completely rewritten it. However now the code takes .2 seconds per line which for a 500,000 line document is much too long.
Purpose of the Code: This code takes the new information that has been provided by a cleaned data dump and recalculates all columns based o... |
I've wrote a pretty useful method to prevent multiple requests per single get url. There is a well known pattern - to store promise and return it for each next request. But there is too much copy/paste for my taste. So, please check my solution. Maybe you can give me advice to make it better or maybe point at any mista... |
I am soliciting some feedback on my doubly-linked list implementation. In particular, I am looking for your take on my unit-tests and their coverage of the code itself. That is, I developed this class using the test-driven development approach and am wondering how it turned out. In addition, I would welcome any suggest... |
Spoiler
This code is actually BAD for performances! So don't use it! ;)
For a while now, I've been using this wrapper to avoid retyping most of it :
Public Sub PerfWrap(SubNameToRun As String, _
Optional ByVal DispStatusBar As Boolean = False, _
Optional ArgumentsToPass As Strin... |
I need to calculate a Bayesian likelihood in its negative logarithmic form:
$$-\ln L = N\ln M -\sum\limits_{i=1}^{N} \ln\left\{P_i \sum\limits_{j=1}^M \frac{\exp\left[ -\frac{1}{2}\left(\sum_{k=1}^D \frac{(f_{ik}-g_{jk})^2}{\sigma_{ik}^2 + \rho_{jk}^2}\right) \right]}{\prod_{k=1}^D \sqrt{\sigma_{ik}^2 + \rho_{jk}^2}} \... |
https://plnkr.co/edit/bOZW1a9u62W1QA6cYjYj?p=preview
My goal has been to separate the Dashboard states from the Feed state.
Inside the Dashboard state these are the following views: Tickers, Tags, Social.
Changes in those 3 should not effect the Feed module. (However changes from the Feed will eventually need to update... |
Have a working version of MySQL implementation of ThorsSQL library done.
If you want to check it out you can find the whole thing on github ThorsSQL.
This is a follow on to previous code Reviews:
Part 3: Layer 1
Part 2
Part 1
The documentation for these classes is here:
Part 3 (Layer 2): The MySQL Implementation
MySQL ... |
These are some utility functions that I use for building error messages:
SQLUtil.h
#ifndef THORS_ANVIL_SQL_SQL_UTIL_H
#define THORS_ANVIL_SQL_SQL_UTIL_H
#include <map>
#include <string>
#include <sstream>
namespace ThorsAnvil
{
namespace SQL
{
using Options=std::map<std::string, std::string>;
}
/* The ... |
I know that promises are the current recommended way to go for asynchronous chaining but, every time I use promises, I don't feel as comfortable as I wish. All that "then" statements and managing scopes always look a bit strange for me.
So, this is the way I've been creating modules and chaining functions. I use a simp... |
The intent of this SQL Server query is to:
Dynamically work rebuild/reorganize all indexes in all tables in all databases on a server.
Rebuild or reorganize depending on the specified fragmentation threshold values.
Attempt to perform an online rebuild. If an online rebuild can not be performed due to column types... |
I need to set date and time (12 hours 0 minutes) via Angular UI DatePicker Popup.
plunker
I had two issues:
1. When page was loaded:
Input had value 17-March-2017 12:00:00.000. It's right.
But Selected date was: "2017-03-17T14:57:51.080Z". It's not true, not 12:00.
2. When I changed date via button:
Input view was... |
Given an array, A=[a0,a1,a2...an], perform queries in the form left
right x y. For each query, print the number of elements satisfying
the following criteria:
left < i < right
a[i] = y(mod x)
Note: We can write a[i] = y(mod x) as a[i] % x == y in most popular
programming languages.
Input Format
The first ... |
The purpose of the code is to simplify benchmarking of arbitrary functions. The reason I want to benchmark things is that I would like to get a "feeling" of performance. Although the framework leans on synthetic benchmarks, I think it is a good starting point.
After trying to write a benchmarking framework a few times ... |
Recently, I've solved the "Valid Parenthesis" problem on LeetCode:
Given a string containing just the characters '(', ')', '{', '}', '['
and ']', determine if the input string is valid.
The brackets must close in the correct order, "()" and "()[]{}" are
all valid but "(]" and "([)]" are not.
I've decided to itera... |
The problem:
std::vector and other containers have two functions for accessing / modifying their content: operator[] and at().
at() is meant for debugging, to catch out-of-bound bugs. However, at() is also quite a lot slower than operator[]. Both above facts would yearn for a way to switch between the use of at() and o... |
I wrote a simple program that converts graphic files in a folder to a single PDF using Magic.NET. It works fine. I'm interested in general comments about the code as well as suggestions how I can make it run faster. Answers with some code are especially welcome.
static void Main(string[] args)
{
Stopwatch stopWatch... |
I was recently asked to solve the following challenge (in C++) as part of the interview process. However, I haven't heard from them at all afterwards, and based on past experiences of unsuccessful applicants that I've read online, my submission didn't meet their standards. Since I did solve the challenge to the best of... |
I'm writing a library to verify GTINs (GTIN-8, GTIN-12, GTIN-13, GTIN-14) and calculate their check digits. The calculation of the check digits don't differ from type to type, so I can use the same code for all types of GTINs.
My question: Should I use separate classes for each type of GTIN or should I store the length... |
Here is some code I wrote as part of a project that I am working on to learn C#. It is a class responsible for applying filters to images. In this case, my code offers filters such as sepia and grayscale (sorry, no Valencia for you Instagram users!). Any input on how it can be improved is appreciated.
using System;
usi... |
I succeeded in the first part of the exercise, this attempt is the second part. I am not sure I have accomplished the goal, and would appreciate the input of more knowledgeable minds. As always, critiques of my techniques welcome.
This is an exercise from the book titled 'Beginning C++ through Game Programming' by Mic... |
This is my second attempt to solve this problem, my first attempt is here: UVA 100: "The 3n + 1 problem"
This time I tried to take lessons from the failures and mistakes You pointed out in my first attempt.
I resigned from packing multiple statements in one line. (This resulted in the code length balooning, though :( ... |
I have been trying to pick Haskell back up so I decided to try to implement binary search as practice. I am aware that binary search in Haskell in inefficient because Haskell's lists are implemented as linked lists, but I wanted to try it anyway. I would love to know how I could improve this or how it could be more idi... |
I'm new to Python, but I really want to get into the swing of doing things the pythonic way. First, does my code follow the pythonic path? Or does it run screaming bloody murder, as it zig-zags through my C++ thought of mind? Probably the latter.
import sys, random, string
#import pdb
#pdb.set_trace()
def read(nam... |
I'm working on an exercise using Assembly 8086 which inputs a number (in string form) then output the binary form. Here is what I did (tested on emu8086 by the way):
Convert the string to numeric form: I simply iterated through the string, and for each new value I simply multiply the old value by 10, then add by the n... |
I have a piece of code which looks like below:
Problem hashProblem;
String indexName;
if(condition.getOwner() != null) {
indexName = sourceLocation ;
hashProblem = new Problem().builder()
.locationID(condition.getLocationID())
.sourceLocation(condition.getSourceLocation())
.build();
}
el... |
we are using jquery for grid view image slider with thumb image. but the jquery code is static can any one help me to make this dynamic.
jquery code:-
jQuery(document).ready(function($) {
$('#myCarousel').carousel({
interval: 5000
});
$('#myCarouselTwo').carousel({
interval: 5000
});
$('#myCarouse... |
I have a Matlab structure with several fields, 3 of which are interesting here:
elec.label %Nx1 cell-array of strings
elec.chanpos %Nx3 matrix of doubles
elec.elecpos %Nx3 matrix of doubles
The label contains unique names of channels, while the chanpos and elecpos contain coordinates, in such a way that elec.label(1) ... |
Have a working version of MySQL implementation of ThorsSQL library done.
If you want to check it out you can find the whole thing on github ThorsSQL.
This is a follow on to previous code Reviews:
Part 3: Layer 2
Part 3: Layer 1
Part 2
Part 1
The documentation for these classes is here:
Part 3 (Layer 3): The MySQL Imple... |
Assume we have a data-structure like this:
(def data
(atom [{:id 1 :first-name "John1" :last-name "Dow1" :age 14}
{:id 2 :first-name "John2" :last-name "Dow2" :age 54}
{:id 3 :first-name "John3" :last-name "Dow3" :age 34}
{:id 4 :first-name "John4" :last-name "Dow4" :age 12}
... |
This is the merge part of my solution. Method merge merges two already sorted lists. I feel the code I wrote isn't the best implementation. Please review the code and tell me where I can improve.
public static List<Integer> merge(List<Integer> tomerge1,List<Integer> tomerge2){
int n = tomerge1.size();
int m = t... |
I'm creating my first Bash script newpost.sh, which generates a Markdown file containing the metadata for a new blog post. This blog post will be hosted in a Jekyll engine, like GitHub pages. The idea is to facilitate:
The generation of date
The conversion from the post title to URL
Compatible in both mac OS and Linux... |
Following is my solution to Knapsack problem using all combinations of the sent list of items (in Racket programming language). Although it is very short, I am sure it can be improved in many ways.
(define (maxI L) (- (length L) (length (member (apply max L) L))))
(define (knapsack maxwt itemL)
(let* ((combL (filte... |
I've implemented a simple doubly linked list structure. I would appreciate all criticism relevant to code, style, flow, and so forth.
How to implement end iterator and pop_back/pop_front properly? Where memory may leak?
P.S.I didn't make it template, because this is simple version version.
#include <cstddef>
#include <... |
I am writing this question to get some advice on improving this Database Management library. I'll explain a little about it:
Database Manager - DatabaseManager is the holder, it generates new connections when the NewConnection is called, it returns a new DatabaseConnection with the saved connection string.
Database Con... |
The following code is part of a big application. I am new to Go, and appreciate feedback on the best practices and improvements. Please consider styling and comments as well.
Every 30 minutes, this will fetch news from HackerNews and store it in a database:
What fetches the news:
package services
import (
"fmt"
... |
I'm currently working on a small application, as a learning exercise for a Javascript novice. I need to generate an object based on a folder structure. Here is an example of the folder structure:
RootFolder/FolderA/FolderB/FileA
RootFolder/FolderA/FolderB/FileB
RootFolder/FolderA/FolderB/FolderC/FileA
RootFolder/Folde... |
I'm trying to lighten the code review load for the maintainers of boost.math, and I was hoping you guys could help me out. I have a pull request which implements tanh-sinh quadrature, which is provably optimal for integrands in Hardy spaces.
Here's my code:
Documentation
Interface
Implementation
Tests
which is also r... |
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Please choose the minimum of your range: ");
double minimum = scanner.nextInt();
... |
Have a working version of MySQL implementation of ThorsSQL library done.
If you want to check it out you can find the whole thing on github ThorsSQL.
This is a follow on to previous code Reviews:
Part 3: Layer 3
Part 3: Layer 2
Part 3: Layer 1
Part 2
Part 1
The documentation for these classes is here:
Part 3 (Layer 4):... |
I am trying to write a program to find the practical numbers, from an input from \$1\$ to \$n\$.
Practical numbers
My code is running correctly but it is extremely slow when calculating numbers around 50 - it gets stuck at 44.
import Foundation
func getInteger() -> Int {
var firstNum:Int = 0
while true {
... |
I wanted to create a class that encrypts provided clear text using Caesar Cipher. Do you find my implementation clean? Any suggestions?
package biz.tugay.caesarcipher;
import java.util.Locale;
/*
Encyrpts a clear text using Caeser Cipher (https://en.wikipedia.org/wiki/Caesar_cipher)
with given shift amount.
... |
This is a simple Powershell script to provide menu driven manuals and standard operating procedures.
Sops and mans with the extension .sopman.txt will be loaded.
The file motd is required, it is intended to prompt the user with a banner containing useful and or up to date information.
Use the markup +color+ to coloriz... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.