instruction stringlengths 71 71.9k |
|---|
I configure asp.net identity using Simple Injector
var container = new Container();
container.Options.DefaultScopedLifestyle = new WebRequestLifestyle();
//Identity
container.RegisterPerWebRequest<AppDbContext>();
container.RegisterPerWebRequest<IUserStore<User, int>>(() => new UserStore<User, Role, int, Use... |
I'm trying to build a reusable object cache for Angular. The goal is to:
Cache objects by type
Prevent collisions and conflicts
Find objects by like property
Ensure caches are separated by the logged in user
I am using Satellizer to determine if the user is logged in. Each object's service will act as a wrapper to ... |
When you were a little kid, was indiscriminately flicking light switches super fun? I know it was for me. Let's tap into that and try to recall that feeling with today's challenge.
Imagine a row of N light switches, each attached to a light bulb. All the bulbs are off to start with. You are going to release your inner ... |
I am working on a small project in the lab with an Arduino Mega 2560 board. I want to average the signal (voltage) of the positive-slope portion (rise) of a triangle wave to try to remove as much noise as possible. My frequency is 20Hz and I am working with a data rate of 115200 bits/second (fastest recommended by Ardu... |
This function has the purpose of injecting test cases into TestRail, it was written in bit of a hurry and I know there is room for improvement, any input will be appreciated.
def add_sections_and_test_cases(self, new_project_id, new_test_suite_id):
"""
"""
new_sections_list = []
new_sec... |
I am building this algorithm as part of a larger project for a network security class. The gist of this part is that I have been given a dictionary, and I need to find every possible option for a word in both upper and lowercase.
My teacher selected a word out of this dictionary, and messed with the case of a few rando... |
I am by no means proficient at being able to take mathematical concepts and converting them to code. I was wondering if you guys could look at it and make suggestions on how I could fix it or if my thinking is correct on these. I used a combination of the wikipedia pages for each of these as well as http://theory.stanf... |
I have written this code according to my requirements. But after finishing the code, it looks like there are too many loops. I have reduced it as much as I can. Can you find any improvements that I can make to this method?
The relationship is that one theater activity has many bookable resources. Note: Bookable resourc... |
I recently wrote a program that reads a plain text file, and compares every line and alerts you if any are similar, based on a float value that you pass in to a function.
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.*;
public class DuplicateLineFinder {
pu... |
Though i have never worked on perl, not even once.
I have ported the perl code into PHP and it seems like giving a correct result. But as I am going to use it on production server.
I want this code to get it reviewed, please let me know if there is any problem in the porting from perl to PHP.
#!/usr/bin/perl
use str... |
GPS3 is a python 2.7-3.5 interface to GPSD.
I've stripped back everything to two classes.
#!/usr/bin/env python3
# coding=utf-8
"""
GPS3 (gps3.py) is a Python 2.7-3.5 GPSD interface (http://www.catb.org/gpsd)
Defaults host='127.0.0.1', port=2947, gpsd_protocol='json'
GPS3 has two classes.
1) 'GPSDSocket' to create a s... |
I'm working on redeveloping a running project, and the main goal is to enhance the JS code as much as possible.
I'm using the observer pattern to watch the window events like scroll, and resize
The following is my implementation:
module.exports = {
// Watch window scrolling/resizing, then fire a set of watchers
... |
This is a routine I wrote to streamline analysis I need to do that originally took 1.5 hours and now takes about 4 minutes total run time.
I'm fairly new to Excel VBA so I welcome all criticism and advice!
Option Explicit
#If VBA7 And Win64 Then
Private Declare PtrSafe Function URLDownloadToFile Lib "urlmon" _
... |
I'm developing a Poker app. It is almost done, and I'm looking for improvement. One of the things I wonder is whether I should change how I perform iterations. I currently iterate by using tail-recursive calls. However, a friend of mine suggested that I use a while loop instead because loops don't require stack space.
... |
I was recently asked to help our Spanish BU to audit their AD for inactive accounts.
Grabbing a script from online I gave them this: https://gallery.technet.microsoft.com/scriptcenter/Get-Active-Directory-User-bbcdd771
However that doesn't scale well when there's multiple users; as this takes one account then manually ... |
I have been working with HTML5 and CSS3 for a long time now, but have avoided JavaScript because of my belief that it's most frequently used unnecessarily while having a tendency to be poorly written. So I held off until I needed to learn it to use something really cool and useful. The project that sold me was WebTor... |
This class simply allows you to use an enum while only allowing you to set a single flag. If multiple flags are set they will be rejected--unless the total of the combined flags is the same value of an existing flag. Such as Flag1 | Flag2 == Flag3 would be an example thereof.
C# 6.0:
public class RestrictedEnum<T> wher... |
I'm trying to make this Householder method run as quickly as possible. It runs fine now, but I'm still a bit new to java, is there anything you guys see to make this run faster?
public static ArrayList<double[][]> householder(double[][] A) {
int m = A.length; // rows
int n = A[0].length; // cols
byte sign; ... |
I'm looking for criticism on the following method used to determine if a collection of Integers forms an arithmetic sequence:
public boolean isArithmetic(Integer[] nums)
{
Set<Integer> result = new HashSet<Integer>();
Collections.sort(Arrays.asList(nums));
for(int i = 0; i < nums.length -1; i++)
{
... |
I am requesting a review of a portion of a 600 lines of code. This portion of the code process a filter that is farther down the page. It takes in the parameters and formats them into a query. Now I have included two bits. First the code, and then the portion of my DB class that makes the call to the database.
Code:
if... |
(See the next iteration.)
Given a positive integer \$n\$, I have an iterator that returns all possible solutions to \$n\$-queens problem one by one:
QueenIterableV1.java:
package net.coderodde.fun;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
* This awesome class iterates over all possible... |
I'm making a few forms of a mortgage calculator for my intro to computer science class. With inputs, I currently have it outputting the monthly payments. I'll eventually be outputting how long it will take to pay off the loan once I add some code. I'm just looking for suggestions for any easier/quicker ways to do it. I... |
It is just one of the files. I have also tried to write some tests using PHPUnit. Please give me some suggestions to improve my coding-writing skills.
The below is the test file for the above file:
<?php
class TestParseXML extends PHPUnit_Framework_TestCase
{
public function testSetup()
{
$... |
I am preparing for an upcoming exam and have the following practice question..
Write a method to determine if a word is a palindrome, without using
the reverse method.
Most of you probably know what a palindrome is, but for those that don't.. a palindrome is a word which reads the same backward or forward.
Anyway, ... |
I've got the following code in my calculator project:
private ITerm CalculatePostfixExpression(IEnumerable<ITerm> input)
{
var tempResult = new Stack<ITerm>();
foreach (var term in input)
{
if (term is IOperand)
{
tempResult.Push(term as IOperand);
}
if (term is I... |
I am creating an application that will move specific data from one Oracle database and moving it to a MySQL database. I created this class to help keep myself organized and this class holds all of the operations/communication that will happen with this database. I have learned C# on my own with no formal training I was... |
I'm learning Python and have made this start of a ATM program, I'm very new to this so please be gentle..
Is there a better way to rewrite this?
CHECKING_BALANCE = 4000
SAVINGS_BALANCE = 1000
def welcome_screen():
print """
Welcome to the Bank of Bam!
To continue please follow the instructions:
Pres... |
I've written a vector-like class in C++ and I'm trying to figure out issues in efficiency. When I use clock() to measure the time taken to emplace objects, std::vector outperforms this class until emplacing more than 1000 objects. For simple types, the performance is much more evenly matched.
The test I've been running... |
I'm trying to build a program that will find approximate text matches between two texts. Basically, I'd like to find a way of identifying quotations, so that when an author quotes, say, the King James Bible, Heroditus, or James Joyce, this program will identify the match, and show where it happens in the text, given th... |
I think I have this working, but I'm not sure it's completely accurate.
I'm trying to parse Option Symbols. An Option Symbol is made up of 4 parts:
Root Symbol (up to 6 characters)
Expiration Date (yymmdd)
Option Type (1 character)
Strike price (8 digits)
After parsing the following examples, the results should be as... |
I wrote some code which searches parts of a split-archive backup (it's an Android backup, I used flashfire to backup) and rejoins them. As you can easily see, I've achieved this by if statements and the maximal number of archive parts is hardcoded (although NOT limited to 4 parts).
As I'm very new to "programming" (if ... |
Hope, it's my last question about current project. Yeah, it's still about respecting SOLID-principles.
And it's still about calculator, so i've got realization of ITerm interface:
public interface ITerm : IStackManipulator
{
Object Value { get; }
/// <summary>
/// Term type. 0 for operands, 1 for operators,... |
I have a Sales Order Program that allows each customer to have their own Part Number for one of our Stock Items. The Customer Part Numbers are stored in a separate table. I need to make this as low impact on the User/UI as possible.
As a working model I have come up with a related demo using Person for the Order Table ... |
Rags, again.
This is the rewrite of Read stdin like a dictator.
From that post:
All too often I find myself wanting to allow only a certain list of characters to be written to stdin, and only recently did I actually bother to implement it. In Python, of all languages!
Essentially, this module provides a few APIs that... |
I have the following APEX code. I have been trying for hours to try and refactor it so that the SOQL query is outside of the for loop without any luck. Any ideas?
public static void ErrorIfWorklogsOverlap(List<Worklog__c> worklogs) {
for (Worklog__c worklog : worklogs) {
List<Worklog__c> timesheetWo... |
The full challenge from codeeval.com can be viewed here.
Input
Your program should accept as its first argument a filename. This file
will contain a comma separated list of sorted numbers and then the sum
'X', separated by semicolon. Ignore all empty lines. If no pair
exists, print the string NULL.
Output
Print ... |
I wrote a Java method (along with a private class) to check if a binary tree is also a binary search tree (BST). I would like some feedback on the design of my solution. Here is a brief description and the code is provided below it :
Do a depth-first traversal of the tree and test if each node satisfies the binary sear... |
Unity Configuration
public static void RegisterTypes(IUnityContainer container)
{
container.RegisterType<ITrackoApiDbContext, TrackoApiDbContext>(new PerRequestLifetimeManager());
container.RegisterType<IUnitOfWorkAsync, UnitOfWork>(new PerRequestLifetimeManager());
//Call External Unity Co... |
(See the initial iteration.)
Now I have slightly improved performance of the iterator. Whenever we have set a queen at a particular board cell, the previous iteration sacrifices \$\mathcal{O}(n)\$ time to check whether the position is safe. This one does the same in \$\Theta(1)\$.
(Everything needed for demonstration i... |
Im constructing metadata about a class. With reflection i iterate over the class properties, and those properties have attributes (name, validation etc). When iterating those attributes, i typecast to some specific attribute-types, and if successful store the relevant attribute information. Im looking to do this in a m... |
I want a function Select that takes a vector<int> and a condition (such as being even, being divisible by three, being larger than 4, or any logical combination thereof), and returns another vector<int> composed of the members of the original vector satisfying the condition.
For example Select(v, IsEven) should return ... |
I have a pseudosite, where I actually post small functions, so that I can re-use them*, but some posts have visitors. The top is Quicksort (C++). I feel that beginners visit it, so I do not care in improving (its poor) performance, but only the readability, so that the beginner can catch things more easily.
#include <i... |
There is no need for me to use 50 lines of code here, but how can I populate this array in a loop without using date/time methods.
var timeoptions = ["00:00", "00:15",
"00:30", "00:45",
"01:00", "01:15",
"01:30", "01:45",
"02:00", "02:15",
"0... |
For my project, I need to convert dollar to cents, so I wrote the following function to safely do the conversion. The input dollar is float and the output should be int.
def safe_dollar_to_cent(dollar):
parts = str(dollar).split('.')
msg = 'success'
status = 0
if len(parts) == 1:
return status,... |
I am trying to optimise the computation time of my code (for the second time after a first optimisation that gives very good results). Currently, this code is very time-consuming depending on the size of the data (i.e. sometimes very big matrices). So if anyone has some ideas to help me to optimize this code, I will be... |
I'm playing around with a class module to try to wrap up some complicated(ish) Range manipulation in Excel-VBA.
I might have a situation where I know the red range spans my target (the target is to have it's contents cleared) and all cells below the red range should go. Green areas are cells used that should not be del... |
I am in the process of creating a text-based RPG for the purpose of learning more about OOP in Python. Right now things are going well, but I'm facing a problem that I don't exactly can find a good answer: Skill implementation. I also think that I'm going to face similar problem with the Items.
At this moment I have 3 ... |
Here's what I have:
require('../../src/utils/date-object-to-yyyymmdd');
var eighteenYearsAgo = new Date();
eighteenYearsAgo.setTime(eighteenYearsAgo.valueOf() - 18 * 365 * 24 * 60 * 60 * 1000);
eighteenYearsAgo = eighteenYearsAgo.yyyymmdd();
Basically, I am generate a date, setting it to 18 years ago (from today), and... |
I as well as several of my colleagues have had an ongoing problem where we get bombarded with hundreds if not thousands of emails each day which come from automated services, such as SQL DBmail and other similar mechanisms. Many of these notifications are not really important to look at, and they are almost always sent... |
I was inspired by this:
If you would put a rabbit randomly on a circular table with radius r=
1 meter and it moves 1 meter in a random direction, what is the
chance it won't fall off?
I decided to develop a program to manually test this scenario. My code will run as many tests as you want with (hopefully) more te... |
I have made my own compression tool for a stack-based language that uses a dictionary compression method. The code for the decompression is the following:
elif current_command == "\u201d":
temp_string = ""
temp_string_2 = ""
temp_index = ""
temp_position = pointer_position
while temp_position < len(... |
I have a simple list and want to filter it by a specific key. But I guess my for loop solution is not an efficient way. I'm searching an other way or one best practice.
types = [
{
'name':'John',
'surname':'Doe',
'age':36,
'type':'customer'
},
{
'name':'Jane',
... |
RoundRobin is an implementation of the Round-robin style tournament:
public class RoundRobin implements Tournament {
private final Game game;
private final List<Player> allPlayers;
private final List<Player> remainingPlayers;
public RoundRobin(Game game){
this.game = game;
this.allPlaye... |
I have this command line program that asks the user to (partially) input the source sudoku with some missing values, and after that validates the input and solves it.
See what I have:
SudokuSolver.java:
package net.coderodde.sudoku;
import java.awt.Point;
import java.util.Objects;
/**
* This class implements a backt... |
I'm getting these three offenses:
libraries/helpers.rb:4:1: C: Method has too many lines. [11/10]
def get_files(url, file, destination)
^^^
libraries/helpers.rb:18:1: C: Assignment Branch Condition size for unpack_archive is too high. [16.52/15]
def unpack_archive(url, file, destination)
^^^
libraries/helpers.rb:18:1:... |
The below script takes two arguments
Path to the OSRM Map
Path to a .csv containing the columns [query_id, from_lat, from_lon, to_lat, to_lon].
It then does a few robustness checks before initializing an OSRM server (I have found that spawning more than one doesn't improve performance so have kept to it 1) and then... |
The game is a puzzle game made up of a grid of cells represented by html divs. Gameplay is as follows:
On starting a new game, the number of rows and columns is selected from a form.
The grid is created with all but one of the cells being initially filled.
A filled cell is selected by clicking and moved to the empty... |
I've made myself a JavaScript slider constructor. You can create new sliders and tell it what elements it should refer to.
var SliderControl = function (container, area, fill, action, actionWhenActive, actionWhenSet) {
'use strict';
var self = this;
this.action = action;
this.container = container;
... |
My biggest issue in this project was the structure of the code and using the necessary data structures. I organized it to the best of my ability but I am sure there much more room improvement and I would love some advice on this. The way I have my enemies firing feels a bit hacky and I'm not sure as to how to have that... |
I'm currently working on a project which involves EntityFramework with a (very) rich model (lots of inheritance). I'm currently facing a problem, quite interesting in my opinion.
My model is described in the Domain namespace. It involves 2 classes that inherit from 1 abstract class.
What I want to do is to be able to p... |
I have written a MATLAB function that converts decimals into Roman numerals.
function ans = dec2rom(z)
d = [ 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];
c = {'M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'};
[];
for ii = 1:numel(d)
if z >= d(ii)
ans = [ans,repmat(c{ii},... |
Based on this question (as a starting point) and a couple of other questions about rewriting vector in C++, I am planning to write another blog article to show the best way (or more precisely, the common pitfalls that most people fall into).
Before I start the blog article just wanted feedback to make sure I am not doi... |
I have made some code that will login to a device and send all your additional commands. It also logs the commands and the returned values to a file on the local system.
Hope somebody can tell me if the code is a little effective or how I can optimize it. I also have a question about the Sleep I think it's not so effe... |
I'm a fresh verilog / HDL programmer and I'm writing this post to get some feedback from more experienced verilog / HDL programmers.
My very first task was to divide a clock by eight.
I know there are some better methods to do this, but as I'm new to HDL this is my first, naive, attempt:
module prescaleMainCLK(CLK, pr... |
I wanted a very simple spring system written in Python. The system would be defined as a simple network of knots, linked by links using the following rules:
A knot is a massless connection between links. Each knot is only affected by the push/pull forces it receives from the links it is connected to (no gravity, visco... |
This is my first F# program.
It's a command line utility that takes a parameter containing a path to an height map bitmap and prints out this height map converted to JSON format.
open System.Drawing
let convertLine (y:int) (bitmap:System.Drawing.Bitmap) =
[ for x in 0 .. bitmap.Width - 1 -> "\"" + bitmap.GetPixel... |
Consider the following contrived data type:
Building: int age, char* location, float quality
The location is in the format "XXX-XXX" (exactly 7 characters).
Goal: Serialize the object into a binary format and then deserialize the object to display (on console) the exact same building info as inputed by the user.
For e... |
About
This is a SEDE query which will calculate your activity and participation on a site. It's geared for Programming Puzzles & Code Golf where questions are values more, but the values can be modified to fit general Q&A SE sites too.
Try it online!
So I did what all programmers do and I looked up how to most of this... |
I really like Ruby and want to get better at it. Any input is appreciated.
Description
This program prompts the user for a string which is ciphertext resulting from a Caesar cipher given (English) plaintext and a key on the range [0, 25]. The program then uses a table of character frequencies of the English language to... |
This is a program I made as I am currently living in Japan with a British bank account, so exchange rates matter to me.
On the first time run, you run the script with two arguments (two currencies) and it will track those currencies. You can add as many exchange rate trackers as you like.
It emails you daily (automated... |
I have the following class which is used for operations on a vector. The vector stores the following struct which has 3 enums and 1 boolean.
Info represents a computer node. Nodes communicate with each other. Some nodes are unique (in which case they don't have an ID (and others are not so they have a id associated wit... |
I have an array (or string) to parse and I want to examine each element sequentially. This is a perfect case for the iterators / consumers that Rust offers.
The problem arises when I have to access previously parsed data during iteration. For example, I need to subtract the item that was 5 places before the current ite... |
Courtesy of a few posts around here I've discovered HackerRank. Poisonous Plants is one of their challenges.
Of course, skip the following if you'd like to try it yourself.
Challenge:
There are \$N\$ plants in a garden. Each of these plants has been added with some amount of pesticide. After each day, if any plant has... |
I have written a Python 2.5.4 function which accepts as input a list of numbers alongwith the desired number of classes and yields a frequency distribution (i.e. a histogram) of the same data.
While setting class boundaries, I've attempted to increase the accuracy (i.e. number of digits after the decimal point).
Here... |
This question has a follow up question:
Binary Search Tree insert while keeping track of parent for node to be added - iteration 2
I am implementing a red black tree for fun and am wondering how I should modify my basic BST insert. Note: this happens before the red black tree rules are applied, it just finds the corr... |
The task is to return all root-to-leaf paths, given a binary tree (from leetcode).
This is my approach.
Take a helper array and a counter, keeping track of what has been traversed so far. If it is leaf node, print all till that point.
Reduce counter.
Please suggest improvements, if any.
import java.util.LinkedList;
i... |
Follow up question to
Binary Search Tree insert while keeping track of parent for node to be added
I am implementing a red black tree for fun and am wondering how I should modify my basic BST insert. Note: this happens before the red black tree rules are applied, it just finds the correct place within the tree to add... |
This is a continuation of An Alternative Vector, taking a closer look at the copy assignment operator.
In the following code, I am only posting the new version of the copy assignment operator; all the rest of the code is unchanged.
namespace ThorsAnvil
{
// Traits classes
// SimpleCopyableAssignableTraitNo... |
This is my version of snakes in C++ using the ncurses library. I would like to hear from you how this piece of code can be improved and general advice for future projects regarding coding and efficiency. I have tried writing this code in pure OOP, let me know about that too.
#include<ncurses.h>
#include<unistd.h>
#incl... |
I am teaching computing to an AS class and this was their assignment:
Bush Wanderer
Task 1
Create a 5x5 grid of hashes(#) where the player is an x on the
board
Prompt the player to move in either N, E, S or W direction and then
reprint the board to show the new position.
Example:
x # # # #
# # # # #
# # # # #
# #... |
I’d love some feedback on this human v. human, tic tac toe game I wrote in Python 2.7.10. I’d love to hear your thoughts on optimization and making the code simpler and more “pythonic”.
Also, I’m wondering if passing the player and turn variables around the way I have is the best approach, or if I should consider glob... |
Overview:
I'm using the following page template and scripts for navigation. I use a single page that loads menus and context content, and then use ajax or GET variable to load main-div's content, by passing $p variable to a php switch. Browser history is handled whith pushState function.
Main page:
<!DOCTYPE html>
<htm... |
I needed to create a mortgage calculator for an intro to CS class. As part of the assignment, with an interest rate of 6% needs to change to 7% after 3 years hence that if statement. The char dummy line at the end is a requirement from my professor.
I'm mainly looking for ways to clean it up or if I missed anything. I'... |
I am creating a way for users to filter results based on start and end values. An example of this would be:
?RangeColumn=DisplayId&RangeStart=640,830,670&RangeEnd=650,850,680
In this case, the api would return items where the "DisplayId" is between 640-650 or 830-850 or 670-680. My solution works but the query looks p... |
I'm trying to implement union from the standard Data.List library. I know it's reinventing the wheel, but reimplementing functions is how I learn things. Any feedback at all would be helpful!
union' :: (Eq a) => [a] -> [a] -> [a]
union' [] _ = []
union' _ [] = []
union' xs ys = nub' $ xs ++ ys where
nub' [] = []
... |
I am working on a Web Scraper for the first time using Test Driven Development, however I have caught myself into a huge CRAP (Change Risk Anti-Patterns) index (56) and I can not seem to find a solution about this.
<?php
/**
* Code Snippet MIT licensed taken from proprietary source.
*/
namespace WebScraper;
use Web... |
I'm new to C, want to know if I'm doing this right.
//repstring.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv)
{
//Initialize variables and pointers
int i;
int loop;
char *deststr;
char *str;
//Change second argument to integer
loop = ato... |
I've been tasked to solve this exercise lately, and this is what I wrote:
object Main {
def isSubstringPalindrome(inp: String)(start: Int, end: Int): Boolean =
(start.compareTo(end), inp(start)==inp(end)) match {
case (0, _) => true
case (1, _) => true
case (-1, true) => isSubstringP... |
Input
The input for this problem is a String of sorted numbers and a special number. The syntax of the input would be 1,2,3,4;5
Output
The program will output all of the possible sums that equate to the special number. The output for the example would be 1,4;2,3
I solved the problem by using some simple subtraction. ... |
We have two lists:
l=["a","b","c"]
s=[["a","b","c"],
["a","d","c"],
["a-B1","b","c"],
["a","e","c"],
["a_2","c"],
["a","d-2"],
["a-3","b","c-1-1","d"]]
print l
print s
Now, I am try to see if each 2nd-level list of s has fuzzy match to any of items in list l:
matches=list()
matchlist2=list()
print s2
for i in ran... |
I just started to learn D and ported my a bit over-templated trie. It looks way better than on C++.
I'm sure there is still room for improvement and to make it be real D code.
I checked an the array appending is doing x2 pre-allocation on resize (although 1.5 seems to friendlier, but for my use both are ok). Does this ... |
I'm creating a simple popup to be shown on footer of pages to make a email list.
I would like you to give a look at the code below if possible .. and would appreciate some suggestions in respect of the logic applied and the form of how the code was encoded.
Live fiddle here
var App = App || {};
App._elements = App._el... |
Today I decided to continue working on a UnrealScript (Unreal Engine 1) class that lets bots jump onto ledges by firing weapons beneath themselves.
(The only problem is that they don't aim and jump correctly, but as soon as this is fixed I'll edit.)
Methodology:
The Bot that wants to use the navigation node will call ... |
I finished Codeacademy and I'm looking to practice and get better at JavaScript. Is this coded correctly or should I have made a function for it somehow? The purpose of this code is to move a square around the page with arrow keys or buttons.
I have the entire script hosted here.
I mostly want to "Simplify this chain ... |
I'm trying to learn Golang from Java, and to do this, I wrote a basic circuit simulator with only two circuits. Is there anything I can do better to make it more idiomatic?
Simulator.go
package main
import (
"fmt"
)
const ITERATIONS = 10
func main() {
a := Wire{false, false}
b := Wire{false, false}
c... |
I have been struggling with understanding Model, View, Service, Controller architecture and wrote some code.
Is my Model class the Model part of MVC (did I define it properly)?
Is my Service class a Service Layer (did I define the layer properly)?
Did I connect my layers properly (is the 'wiring' set up correctly)?
... |
The Needleman–Wunsch algorithm is an algorithm used in bioinformatics to align protein or nucleotide sequences.
Here is an implementation in Scala:
package vu.co.kaiyin.akkconcurrent
import vu.co.kaiyin.akkconcurrent.NeedlemanWunsch.{ResultEntry, Score, SimilarityFunc}
/**
* Created by IDEA on 2/26/16.
*/
case c... |
So, I kept refactoring my Sage300 API wrapper - I wanted the client code to feel just like using Entity Framework - this is the closest I got to it:
using (var context = new SageContext(/*redacted credentials*/))
{
context.Open();
var header = context.PurchaseOrderHeaders.Single(po => po.Number == "NETAPI99")... |
I need to parse a simple JSON string (flat JSON, no hierarchy) for keys and values, and there is a system constraint that I cannot use any built-in JSON library and can only read a string once due to latency requirements. I need to use Python 2.7.x series and cannot use a higher version. It looks a bit ugly and I'm loo... |
I just wanted to know if this looks like a good way of reading a config file. Is this code good? Is it clean and easy to follow?
<?
/* class to parse a txt config file
*
* Boolean like string values (on/off, yes/no, true/false) will return true/false
* Numberic string values will return real numeric ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.