instruction
stringlengths
71
71.9k
My concern is speed, since this may be used in an e-commerce website I want it to be as quick as possible. Where can I improve? def get_queryset(self): search_terms = self.request.GET.getlist('search', None) if not search_terms: return [] # removing trailing slash on restangular calls sea...
Dilemma The code below is in its infancy, but for now is an effort to crawl my entire file system and find duplicates whilst adhering to a variety of exclusion criteria. My current strategy for determining if two files are identical—comparing their checksums—seems unfeasible because it takes far too long to run (days, ...
I am using Callable in my code which will be called by multiple threads as shown below. Given a user id in DataKey object, I will find out what are the hostnames I can use to get the data and then I will iterate that hostnames list one by one to get the data. As of now, whenever any RestClientException is thrown on a ...
This is a Python 3 solution to the problem stated in Sales Tax Problem, rejected for not being up to their standards. It also seems like the same thing as the problem stated in Sales tax calculator, rejected for being not OOP. I'm not bothering with the requirement to round sales tax to the nearest 5 cents, and I'm tak...
I went through a question on SO, and optimized the code according to OP's requirements. I would like a review if it is done properly or not. Here is the code snippet, there are 2 level buttons, when clicked 1st level button, it toggles second level button group. Second level button group toggles div, which contains che...
Lights Off is a puzzle game consisting of an \$n\times n\$ grid of lights. At the beginning of the game, some of the lights are switched on. When a light is activated, it and its four neighbors in the cardinal directions are toggled. The objective is to turn off all the lights. Input: 000 110 010 Output should be 000...
I wrote a PHP function that generates salts for use with password hashing: function getSalt() { $charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/\\][{}\'";:?.>,<!@#$%^&*()-_=+|'; $randString = ""; $randStringLen = 64; while(strlen($randString) < $randStringLen) { ...
I've created a simple command-line program that downloads the Bing Image of the Day, then sets it as my desktop background. It is a console application, and closes immediately after setting my desktop background. It runs daily via Task Scheduler. I've been working on this as a mini project for a while and would like to...
I am just a beginner in C++ and I tried solving this problem: What is the first number of the form 1 + 2 + 3 + … + n that has over five hundred factors? But it seems my code is not that efficient because its taking ages to find the answer: #include<iostream> using namespace std; void triNum(int); int main() { i...
I want to ask you if my PHP code is safe enough. I don't know if I should escape special characters in string after regex validation: <?php require_once '../../../wp-load.php'; $errors = []; if (preg_match('/[^a-ząćęółśżźń ]/i', $_POST['name']) || strlen(trim($_POST['name'])) == 0 || strlen($_POST['name']) > 60) { ...
I am reading variable length messages where each message is an int + msg bytes. Messages could be any size. Right now my strategy is to have a direct buffer that reads from the socket, which then transfers the bytes read into an array-backed nondirect buffer. However my solution has a lot of copying, some loops and jus...
I have come up with this code to do level order traversal recursively for a binary search tree. private void printLevelOrder_Recursive(Node root2) { Queue<Node> queue = new LinkedList<Node>(); queue.add(root2); Stack<Node> stack = new Stack<Node>(); stack.add(root2); if(stack.isEmpty() == false) {...
I have a small program in Java with GUI, which is generating passwords using Secure Random. I am posting my code here because I want to correct myself in style and, eventually, in efficiency of writing code. Should I use try catch in, for example, button handling or password generating? I saw some user answers who disc...
I am a beginner in Access SQL. I am in need of writing a parameter query for Access SQL and found a few tutorials and links for that but that wouldn't satisfy my requirement. DB: Access DB This updates a 'PD' column based on the values of 'OG', 'CPTY-BA' in an INPUT table. I need to calculate PD values from other refer...
I am looking for a way to merge two files with a list of distinct words, one word per line. I have to create a new txt file that would contain all the words of the first list and all the words from the second list. I don't have any other specifications. The order of words in the result doesn't matter. public class tes...
A follow-on, rags-to-riches implementation of The most efficient way to merge two lists in Java The original requirements are to: Identify the distinct values from two input files, and output the distinct values to an output file. There is no specification for the order of the output, only that each line should be...
I wrote a Java program implementing a neural network with backpropagation. For anyone who isn't familiar with Neural Networks and Backpropagation, here is a good resource. Here is another informational site with some code. (A great book/code that uses python is neuralnetworksanddeeplearning.com) Also the backpropagatio...
Things to deal with this problem. An infinite Arithmetic progression. A prime number. - p. The starting number of an Arithmetic Progression. - a. Common difference in the arithmetic progression given to him. - d. You have to print the first index of a number in that Arithmetic Progression, which is a multiple of t...
I picked up a programming game, TIS-100. Programming manual can be found on Steam as well, but I have described the relevant syntax in my question. Basically, you're dealing with some old machine that uses its own variant of assembly. It's a gamification of learning assembly, almost. The machine consists of nodes. Eac...
var phi=function(n){var count=" " //an empty string for(var i =1;i<=n;i++){ if(for(var j=1;j<=i;j++){ i%j===0;n%j===0;count += j.str;}) //appended the j as string into count {return count.length;}} }; The Euler totient function phi(n) gives the number of numbers <= n which are relatively prime to n.
I've finally written my own Shader class. It's a basic implementation based on a tutorial, and it works perfectly. Any suggestions on how to improve, or correct my code are welcome! Shader.h #pragma once #include <GL/glew.h> #include <map> #include <string> #include "LogManager.h" #include "bindable.h" #include "dispo...
For this program, the user needs to enter an exponent and the program will calculate \$e\$ (Euler's number) to the power of the exponent the user inputs. This is done by two ways: By the math.h library By a for loop (Series) Then the program calculates the difference of these two functions (which we now call \$d\$) ...
I was wondering if you would be willing to give me some suggestions on shortening this code. I feel as if the amount of if statements I have is a bit much. using System; using System.Collections.Generic; using System.Linq; using System.Speech.AudioFormat; using System.Speech.Synthesis; using System.Text; using System.T...
<?php function filterExactPhrase($input, $phrase) { $phrase = explode("\t", $phrase); $phrases = count($phrase); for($i = 0; $i < $phrases;) { if(preg_match("/(" . $phrase[$i] . ")\b/", $input)) { $out[] = ['INPUT' => $input, 'FOUN...
It adds and removes classes from animate.css when mouse events occur. Though I hate how I had to write the same thing twice in both events. var item = $('.work-item'); item.mouseenter(function(event) { var $this = $(this); var cover = $(this).find('.item-cover'), coverTitle = cover.find('.title'); cove...
I wrote a script which changes names of last downloaded songs and copy them to music directory. Can it be written better? #!/bin/bash IFS=$'\n' for file in $(find "/home/stanek/Downloads/" -iname "*.mp3" -mtime -7 | sort) do nowy=$(echo $file \ | sed "s/_/ /g" \ | sed "s/\s*(*[A-z0-9.]*.pl)*//g" \ #leav...
Can anyone offer any criticism on the following at a simple FizzBuzz in terms of Ruby idioms or otherwise? class FizzBuzz def initialize(fizz = 'Fizz', buzz = 'Buzz') @fizz = fizz @buzz = buzz end def is_number_divisible_by?(number, divisor) number % divisor == 0 end def get_text(number) fi...
I am working with a little project intended to allow applications to benefit from aspect oriented programming. The first aspect is logging, which is already working. However I want this code to be more performatic and cleaner. Whole project The basic goals is to annotate methods - private/public static or instance - wi...
I generally like to be Rubocop-clean, but it seems like breaking up the first case statement will only make things harder to read. Any suggestions? Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provider 'virtualbox' do |vb| vb.customize ['modifyvm', :id, '--memory', host_hardware[:memory], ...
I enjoy making silly programs every once in a while. This is one of them. It makes nice sounding notes that vary slightly depending on the key being entered into a TextArea. When you press enter, it plays back all the notes you have entered. That's pretty much all it does. I'm looking for constructive criticism regardi...
I currently have three buttons, perhaps more to come. When I click on a button, I want a toast notification or message (popup message) to show up with some text. What I have works perfectly but it is very redundant. How I refactor what I have below to prevent redundant code? @Override protected void onCreate(...
I got a very unusual problem of adding and multiplying very big numbers (≥ 1e+100). So I've written simple functions that would operate on string representations of numbers, both as an input and an output. Multiplication: function multiply(a, b) { if ((a | 0) == 0 || (b | 0) == 0) { return '0'; } a...
I have a lookup table "RequestTypes" that has the following data: ID Type ---- ----- 1 Leave 2 Loan 3 BlahBlah Using EF, and whenever the need arise to check the type of the request, I used to do something like: if (row.RequestType.ID == 1) { // request is leave } else if (row.RequestType.I...
I wrote a Java NIO Echo Server and want to maximize the number of connections to the server. The problem is that when I try to connect more than 10k clients the clients get their connections refused: error Connection Refused : no further information available. The client program that I use generates a batch of 50 cl...
I have different roles in my system. HOD Staff Non staff I am having a form at the front end and fields shall be visible to only users with specific roles. The ShowInGui levels are like this: Show to All Show to staff/HOD Show to HOD Any other do not show I am planning to write a method which will take the user rol...
This is Conway's Game of Life written in Python and using Tkinter for GUI. Problems are: The "Play" button works so slowly. I can see how the canvas is redrawing from top to bottom. But when I quickly click on the "step" button - I see that I want to get from "play" button: I don't see redrawing process. How can I mak...
I decided to make a script that will evaluate a user input and attempt to figure out what keyword they meant to type, by checking what characters are next to the ones they entered. ie. On a QWERTY keyboard, d is surrounded by e,r,s,f,x and c, so if you wrote selete, this script would be able to check if you actually m...
This function calculates the standard deviation of a patch, given a kernel size and greyscale OpenCV image. The middle pixel of the patch is kept if stdev of the patch is below the given threshold, else it is rejected. This is done for each pixel except the border. I have never worked with OpenMP or optimization of C++...
I have a class Currency, where I want to store business logic for working with currencies: public class Currency implements Comparable<Currency> { public static final int NAME_MAX_STRING_LENGTH = 50; public static final int ISO_CODE_STRING_LENGTH = 3; public static final int SYMBOL_STRING_LENGTH = 1; pu...
I have written some template helpers to check if a class has a certain method with a certain signature. The code is based on this answer. I attempted to extend it for generic methods. An important feature is that it also detects inherited methods. #include <type_traits> #include <string> #include <iostream> template <...
I recently did an interview task. I was rejected because of bad code quality. There was two tasks. Here I will present the first, second will be posted in time. This project is avalible on GitHub First: Table view Please create an iPhone application that will present the list of most popular wikis from wikia.com Requir...
This loops through folder to open files and get important info from the columns of names "HOLDER" and "CUTTING TOOL" and printing all the info to one excel document, masterfile. It utilizes a dictionary and collection. I am very new to VBA So I do not know if I have stayed consistent with my naming of sheets and files ...
#include <stdio.h> int main(void) { int a[100],n,sum,i,j,b[100]; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); b[i]=0; for(j=0;j<i;j++) { if(a[i]>a[j]) b[i]++; else b[j]++; } } for(i=0;i<n;i++) printf("%d ",b[i]); ...
Here I'm instantiating different classes based on the value of a type property. This type property will determine what view is rendered and displayed on screen to the user. As you can see there's a lot of repetition here. The main problem I'd like to eliminate is all those else ifs. onShow: function() { var type =...
Requirement primes numbers which do not have digit 1 in it. Input The first line contains T, the number of test cases. Followed by T lines each contain two numbers M and N Output For every test case print the total count of prime numbers which does not contain 1 as a digit. If all prime number with digit 1 between...
I have two arrays of variable lengths: people1 and people2. I want to create an array of arrays where each inner array is a pair of elements from people1 and people2 The pairing should be based on a matching key. I'm using Ruby 2.2.0. For example, given this input: people1 = [{ name: :jon, id: 1 }, { name: :jay, id: 3 ...
As part of an exercise by Jamal to clean up old questions on Code Review that have no code in them, I helped by writing this query on Stack Exchange Data Explorer: CodeLess Questions select Id as [Post Link], CreationDate from Posts where PostTypeId = 1 --questions and Body not like '%</code></pre>%' and ClosedDate...
This is a short and simple Python written to help me sharpen my dulling recursion skills. It expects a sorted permutation of integers n1..n2 in list format, with a single step missing (e.g., [10,11,13]). I know it does nothing to check errors; I'm more interested in theory here. from __future__ import division from mat...
Use case: I sometimes write programs that want to store a little state between runs, e.g., "What was the last file selected last time this program ran?" I wanted a convenient way to track this state. Python's built-in shelve module is pretty good but I wanted a way to restrict the possible set of keys in the shelf so t...
I'm developing a shop system and using this method to store the customers with their respective orders: try { $connection = new PDO("mysql:host={$HOST};dbname={$DB_NAME}", $USERNAME, $PASS); } $connection->beginTransaction(); $sql = "INSERT INTO orders (customer_id, customer_name, order_value, order_date) ...
I'm working on my first Clojure project, which is a parser. Since it's my first project I'm unsure of many aspects, from my general approach to solving this problem to the small implementation details. I also don't know anyone proficient in Clojure so any guidance is welcome. In higher terms, my implementation will tak...
I'm introducing someone to JavaFX. It still feels relatively new and I don't take being someone's first exposure to something lightly. I want to know if there's anything I'm doing unconventionally, inefficiently, or just plain oddly in this code? Although it is relatively simple, If fresh eyes could discern something u...
I have created two classes to help me work with images in C#. I decided to wrap the System.Drawing.Bitmap so I don't have to deal with different file formats (let the framework open/save them), but the Get/Set methods of System.Drawing.Bitmap are far too slow. I created an abstract class instead of an interface so I do...
I would like a review of a Scala validation library I am writing. For now we can focus on the regular expression component. The usage is described in RegexExample.scala There is an outline of the interface in RegexRuntime.scala But the macro and most of the craziness lives in RegexValidator.scala The idea being, if ...
I have an class definition: class ScoreDetail(Document): location = StringField(help_text = "province") school = StringField(help_text = "school") spec = StringField(help_text = "major") bz = IntField(help_text = "1: Bachelor, 2: Academy, 0: except...
I have this code below which establishes connection to server (from device). Basically assembles some buffer, sends it to server, gets response, parses and prints it. I would appreciate if someone can review it critically - see potential bugs, undefined behaviour, etc. First some declarations: typedef int s32; typedef ...
After a little work, I've finally ironed this out... Though could I get someone to go over this and see if there is a better way to present this library within the code, before I publish it? Premise: Kimchi (a Korean transliteration library) Kimchi, apart from being a delicious Korean side dish is also a Korean transli...
I have done the following kata in TDD style and would appreciate it if someone could review my code and my tests. String Calculator Create a simple String calculator with a method int Add(string numbers). The method can take 0, 1 or 2 numbers, and will return their sum (for an empty string it will return 0). For exam...
I've been working on learning React, and so like most people do when they get started on something new. I created an arbitrary simple project to get a bit more familiar with the concepts. It's so simple that it shouldn't really require any explanation. Here's the React code. var TestInput = React.createClass({ prop...
Given a string array that either contains empty strings or non-empty strings, arrange the contents such that all the empty strings are at front and non-empty strings at back, retaining their order from original array. For example, input: {"","a","","d","","o","","g",""} {"d","o","g"} {"","","",""} Output: [, , ...
Follow up from General Game Loop 2.0 It has been quite a while. Some major changes involve: Removed dependancy on Swing. The more I read up on Swing, the more I understood it was meant for handling forms. Directly "Swing is a GUI widget toolkit for Java". As games generally depend a on GUI but aren't solely based on i...
I have a sheet that order a bunch of information on individual orders. Order numbers are in column A, other information is in columns B-P, and then product numbers are the headers for columns Q-DL. The cells within the order number and product number contains an integer that corresponds to the location that product is ...
I have this string containing this block of code: [General] StartWithLastProfile=0 Profilist.notifications=true Profilist.dev=true Profilist.dev-builds=80k Profilist.launch_on_create=true [Profile0] Name=Dev Profilist IsRelative=1 Path=Profiles/j0a1zjle.Unnamed Profile 1 Profilist.tie=0 [Profile55] Name=Main IsRelati...
I am building a login using an API call to a URL that returns JSON data. The login works and is functional but in terms of "correctness" and "professionalism", I am looking to get input from some of the devs here. Please give me an tips that could possibly aide in making the most functional program here possible. (Plea...
I am looking for advice if the below code is a good idea or not. If not, why? I am building a website which allows a user to purchase items. The user account and cart items will be stored in Session. My approach is to create a singleton class that will manage all the sessions. Is this approach good or bad? public class...
I just want to return the first word in the image name (before the dash, dog in my example). Now I use it like this but believe it can be done in a simpler way (like one line of code): $live_site_image = "http://example.net/wp-content/themes/example/images/dog-in-park.jpg"; $live_site_image = substr( strrchr( $live_sit...
I have code for googly eyes that is too long. Basically I have variables for each element pupils (one for right -other for left), eyesockets (left, right). I wish I could compress my code so I can call a function animateEye (eye). function animateEye(eye) { console.log(eye); var pupille = eye.fin...
Is there any room for improvement? import random def play_again(): while True: replay = input('Play again? Yes or No?\n') if replay.lower() == 'yes': return True elif replay.lower() == 'no': return False print('Invalid input.') def main(): print('Welcome...
Goal: I needed to calculate the salted hash of a password, where the password is stored as a SecureString. There doesn't seem to be much .NET framework support for SecureString. In particular, none of the crypto functions have overloads that take a SecureString. The goal is to provide a way to salt and hash a SecureStr...
This is how I write all my database interactions now in Lucee: storedproc procedure='OrderDetail.WhereOrderHeaderID' { procparam value=session.Usr.UsrID; procparam value=url.OrderHeaderID; procresult resultset=1 name='OrderDetail'; procresult resultset=2 name='OrderHeader'; } Assuming I've done th...
Modify the maxmin.c program so that the max min function uses a pointer instead of an integer to keep track of the current position in the array. maxmin.c /* Finds the largesy and smallest elements in an array */ #include <stdio.h> #define N 10 void max_min(int a[], int n, int *max, int *min); int: main (voi...
Problem: Data: 75 95 64 17 47 82 18 35 87 10 20 04 82 47 65 19 01 23 75 03 34 88 02 77 73 07 63 67 99 65 04 28 06 16 70 92 41 41 26 56 83 40 80 70 33 41 48 72 33 47 32 37 16 94 29 53 71 44 65 25 43 91 52 97 51 14 70 11 33 28 77 73 17 78 39 68 17 57 91 71 52 38 17 14 91 43 58 50 27 29 48 63 66 04 68 89 53 67 30 73 16 6...
I have a relatively simple problem: I have an IEnumerable<T>, which takes considerable time to yield each term. This is then used by another piece of code, which takes considerable (but not identical) time to process each term. As I understand it, this is a classic producer-consumer scenario, so I'm choosing to use a B...
This is a response to this brute-force version where the algorithm was not intended for review. In this challenge you are prompted to find the path through a large triangular set of numers, similar to: 75 13 92 43 77 12 11 55 86 7 .... The goal is to find a path from the top to the bottom while summing ...
What's the opposite of CodeLess Questions? Perhaps CodeOnly Answers? (Also known as code dumps.) Inspired by the opposite question, here's the opposite query: SELECT Id AS [Post Link], Score, CreationDate FROM Posts WHERE PostTypeId = 2 -- answers AND Body LIKE '<pre><code>%' AND CHARINDEX('</code></pre>', Body) ...
This was a portion of a skills test given to me by a company. The task was to write a method that takes a string, reverses it, and sets the vowels as capitals and consonants to lowercase. I was also told to prove that my implementation works. using System; using System.Diagnostics; namespace StringOperation { usi...
I recently coded a program to stimulate Conway's Game of Life. Originally, my program just printed an array of 1's and 0's where the 1's represented the "live" cells, but I tried to teach myself some graphics programming to add graphics to the game. Currently, my program draws a black rectangle to represent a live cell...
My JavaScript code is slow for large inputs. However, it is especially slow in IE. The browser will freeze for about a minute while the select is being reloaded. Any ideas for how to optimize this code, especially for IE? function reloadSelectWithJSON (elementid,query){ /* It is assumed that the elementid passe...
So, first off, a little bit of unrelated information: I am preparing for a technical interview. I was reading this article, How to Prepare for (and Ace) the Technical Interview, by Rich Hein and I decided to try to tackle the problem he uses as an example. From the article: We are looking for a solution that is compa...
I am programming a graphical text adventure using python. The game is playable, but I am not sure whether the code is well-suited for newcomers (code smells / quirks / general readability). Here's the main script: import time import sys import printer from rooms import * from _player import Player VER = 0.01 SCENES...
This stream class is designed to hold data only until it is read from the stream. As opposed to the MemoryStream which holds data until the stream is closed. It was written some time ago and was based on a sample found online. I can no longer find the source, but I believe I used it as a start and cleaned it up. I ...
I made a simple calculator. I would also like to write some simple unit tests for my CalculatorEngine class. I had to make some of my private methods as package-private over this. How is it usually better to do it - to enhance access modifier or to make inner test class? And what another more complicated cases it's bet...
I had to come up with a way to convert sqrt(#) into its actual numeric value because before I would have an array containing elements such as: [sqrt(3), -sqrt(3), 1] If I tried to multiply, I would get the error: Argument "-sqrt(3)" isn't numeric in multiplication (*) Here is my work-around, but I think there's a be...
I've written this JQuery program for checking whenever caps lock is turned on. $("input[type='password']").keypress(function(e) { var kc = e.which; //get keycode var isUp = (kc >= 65 && kc <= 90) ? true : false; // uppercase var isLow = (kc >= 97 && kc <= 122) ? true : false; // lowercase // event.shift...
I wrote this code earlier to parse Chase.com's online transactions page. It's written in WinForms. stepBtn is a button that starts this. wb is a WebBrowser that is already navigated to the page. Can you give me advice? I'm primarily looking for optimizations, but any other advice would be great. private void stepBtn_...
I have made a custom webview which is used to open a very heavy site in terms of database. The webview uses custom code for uploading files using an upload handler class. I need suggestions on how I can optimize my code for better performance. Features necessary (current custom webview written below does it all): The ...
This question is a follow up in regards to the comments suggested in a previous post regarding a Ringbuffer implementation in C++ for audio processing. Ring buffer for audio processing template <typename T> class Array { public: Array(); Array(std::size_t const& cap); Array(Array<T> const& other); Ar...
I wrote this simple implementation of the sum of primes for the code eval Challenge Description: Write a program which determines the sum of the first 1000 prime numbers. I would like to know of a better - more efficient - way of implementing the solution. import java.lang.Math; public class SumOfPrimes { publi...
I am creating list of dictionary from two different results. I appreciate any improvement suggested. redditFile = urllib2.urlopen("http://www.bing.com/images?q="+word) redditHtml = redditFile.read() redditFile.close() soup = BeautifulSoup(redditHtml) productDivs = soup.findAll('div', attrs={'class' : 'dg_u'}) for div ...
Here is my code: #include <stdlib.h> #include <stdio.h> int sum(int *arr, int size) { int sum = 0; for (int i = 0; i < size; ++i) { sum = sum + *arr; arr = arr + 1; } return sum; } int sumx(int *arr, int size) { int sum = 0; for (int i = 0; i < size; ++i) { sum = sum ...
I'm working on a small library to help me format numbers easier as my current project deals with a lot of them. I want to be able to just supply the value, precision, width, and fillchar to a method and have it do all the work for me. Based on the standard way of doing things with rjust()… print '{:.2f}'.format(123....
I am making an eCommerce web application using the Laravel 5 framework. I have created a Categories controller for the administrator and with the following actions for the categories: Add / Delete / Update / Delete Permanently I want to know whether the created controller matches the standards. If it doesn't, then ho...
I need to change some array values in a 2-dimensional array for some cases. Sometimes the all values from an child array and sometimes only some values. In this cases I should only change the variable $stamm which $stamm2. This code is the statement of an if condition, where all relevant verbs for this changings is me...
I want to collect my users' data as an array: h = {} a = [["user_3", 765], ["user_1", 2], ["user_1", 1], ["user_2", 124],["user_1", 3], ["user_2", 223], ["user_2", 334]] # Expected output :: {"user_3"=>[765], "user_1"=>[2, 1, 3], "user_2"=>[124, 223, 334]} a.each do |x| if h.keys.include?(x.first) h[x.first] = (...
I am learning how to do object-orientated programming in JS. In particular, I am learning about the constructor pattern. In an attempt to exercise what I have been learning, I made this: var assert = require("assert"); var Book = (function() { // private static variable (why this exhibits static behaviour, I have n...
I have a simple c# mvc client that calls an external api..here is my attempt public class ProductController : Controller { private readonly IProductService _productService; public ProductController(IProductService quizService) { _productService = quizService; } public ActionResult List()...
I'm working in MVC5/WebAPI using ASP.NET Identity, with a custom storage provider for my UserStore, custom ApplicationUser inheriting from IdentityUser, and a pretty expansive configuration in the project (both MVC5 and WebAPI endpoints in the same project). I've been working on the user management/settings controller ...
I'm looking for some opinions on improvement/technique of code in C# calling to a Neo4j database to perform a multi-faceted query looking for users. My goals were to lookup by first/last name, phone number, birthday, and e-mail address. I wanted case insensitivity, and I want the query to respect certain privacy settin...
I have this Excel VBA function that takes three parameters. It is essentially a translation mechanism with the following parameters: A sentence which has to be translated. A range of words to look for and what to translate them to. Shows in which column the translation is in the range (usually it's 2). This function...
I have following code to use timer (System.Timers.Timer) in windows service. The goal is that new time handler should not occur if previous one didn't finish its job. Here is how I achieve this: protected override void OnStart(string[] args) { try { // // Create ...