instruction
stringlengths
71
71.9k
I have about 10k categories, represented by their name. I need to find a match for a category input among this list of 10k categories. This is done through an API, and by batches: the endpoint will receive about 500 categories to match. The process is: -> Receive request with all categories to match -> For each word, ...
So as I understand it, you should always declare a function before it gets called. However in the code below, how could this be restructured so that this philosophy is satisfied? fetchTags is declared here as the 3rd function, somewhere below here I call it from a loadTags function. After the tags are loaded, I then at...
I've written a small piece of code to measure execution time. As this is my first attempt at something meaningful, I would really like some input on ways to improve my code. Timer.h /** Purpose: Measuring execution time using chrono. @author Rick Regeling @version 1.0 2017/01/05 */ #ifndef TIMER_H #defin...
After following the comment from greybeard, Below is the design for given first phase of implementation, Code directory structure: $ ls -LR .: type.h list testList.c testList.exe ./list: arrayImpl.c config.c virtualImplLayer.c linkedListImpl.c list.h listHandler.h listInterface.h Below is the implementation...
I am writing an update statement. I think my SQL statement is opening me up for SQL injections. Is there a better to do this? public void UpdateQuote(string quote, string quote_id) { using (IDbConnection dbConnection = Connection) { string query = "Update quotes set quotes = '"+quote+"', updated_at = NOW() whe...
I made a simple program with main class, Student class and several methods in main class doing job (list, create and Write to file, del item, add item, search and sort items). it's running good but, I wish to have it in more 'clean way' or 'object oriented' way, so to speak, e.g. to create another class Control where w...
So I learned from YouTube videos and online tutorials and they gave me a task to do a simple program. I need to pick 1 button from 4 buttons (radio buttons) and each time I pick a button he's changing a text in a text box. The program is working great ! I'm just asking you guys to check if I did something that is consi...
I'm attempting to make a program that will take user input and match it to one of multiple predetermined values. I'm wondering if there's a more efficient way to do this, or if there's any way that I can set the values without hard-coding them, such as making them dependent on a certain separate form. <!DOCTYPE html> <...
I have to calculate the configuration of hardware that uses the least number of capture cards based on the number of channels desired. The cards are available in 4, 8, and 16 channel varieties. It's important to note that the least number of cards is the first priority, and the second priority is using the cheaper (low...
I was unable to sleep on the 17th of December (after 12 AM IST) so I decided to make use of my time. I made a simple Snake game in JavaFX in 3 hours (roughly from 1 AM to 4 AM). Here are all the classes. Organisation src/astrobleme | +-- gui | | | +-- Main.java | +-- Painter.java | +-- logic | ...
In the past, I have used AsyncTasks to perform network requests for my Android app. I recently switched to RxJava to be able to cancel the requests when the user exits an activity. I have created a system to easily create new async tasks via RxJava which all cancel when a user exits an activity. I have attached some ba...
I am trying to get a working and good version of base64 conversions using OpenSSL. My alternatives were an implementation from an answer on SO and Boost (which I didn't chose because I read that is pretty broken). I will need OpenSSL in my project and I thought it would be a good idea to use it for base64 too so I can ...
I wrote a task using pandas and I'm wondering if the code can be optimized. The code pretty much goes as: All the dataframes are 919 * 919. socio is a dataframe with many fields. matrices is a dictionary that holds different dataframes objects. I apply a series of formulas and store the results in the result dataframe....
This query string parser is intended to parse the parameters and values of a parser query string. I'm particularly concerned about my use of std::move(...). I haven't used C++ almost 15 years and have never done so professionally, so any and all feedback is welcome. HttpUtility.h: class UrlUtil final { public: stat...
This is the Google Foobar challenge "Prepare the Bunnies' Escape": You have maps of parts of the space station, each starting at a prison exit and ending at the door to an escape pod. The map is represented as a matrix of 0s and 1s, where 0s are passable space and 1s are impassable walls. The door out of the pri...
In this particular question, I need the reviewers help to judge my understanding to MVC and OOP as it was my biggest problem in my original question a month ago. I included in the question the contact page controller and the contact page template file This post is a follow up for this and this. What has been changed i...
I wrote this simple API to be able to send logs from the client to MongoDB. Even though this works and fits my need, I would like to point out some concerns that I have regarding the following: Is it efficient to be calling the instance of MongoClient for every request? Do I need to close the instance of MongoClient...
Assignment Criteria Create another version of the Hangman game, this time using Lists. The program should ask for the word to guess and the number of chances to be given. It should then split the characters in the word into individual items in a list. The other player should then be allowed to guess characters in the ...
I wrote out a Minesweeper clone for a compsci project. I'm concerned a lot about code efficiency - any suggestions on how I could streamline my code to make it more efficient? This is the repo for it, if you want to compile/run the program. MineHandler.java import java.util.Scanner; import javax.swing.JFrame; import ja...
Several months ago, I asked Program to count vowels, which was asking for a code review of a vowel counting function in implemented in Python. Since I've been trying to learn Ruby, I decided to reimplement the entire program in it. I'm mainly looking for critiques on: Naming conventions Best practices for string iter...
I've written a simple Quad-tree in C++ for an SDL2 application I'm working on. It's quite simplistic, and seems to be doing its job. Its only designed to work with a collection of unmovable physical entities. I plan to expand upon it, but I'd just like to make sure I'm going in the right direction so far. One thing I a...
I have made a code to check if a word chain is correct or not. The first input is the amount of words that will following The first and last letter of every word should be the same Therefore a chain can look like this: Alaska - baobab - Cadillac - drievuldigheid - Enigma - fotografencollectief - Gasthuisberg If th...
I needed a test to know which firewall in out HA environment was currently active. We have a webFilter connected to our "primary" so if the firewall fails over the webfilter is taking out of path and internet access is completely open during that time. I have a bash script that will feed two IP addresses. I am aware t...
I am reviewing previous undocumented php work from a predecessor on these two scripts to manage access to an administrative dashboard, but I'm not sure about vulnerabilities and other things that usually go unnoticed. I tried to improve on his design and this is the result. Is this login check secure? <?php session_sta...
Recently, I have been trying to learn SOLID principles. I learn the best through criticism. I made this snake game in Unity with C#, where I put my current understanding of SOLID principles to test. The game itself works wonderful, but I am trying to write better code. Main questions: What principles am I breaking? An...
Today was my interview. The question which was asked was: Give an efficient solution to search smallest 3 numbers from a given array. The array contains unsorted numbers which can also repeat. There are 5000 numbers in total in array. I went step by step. I created an array of 700 numbers: private static Integer ...
I was running some rightsizing tests and had to blast random objects of my various class types. Here is the code I came up with. private static <T> T random(Class<?> recordClass) { Constructor<?>[] constructors = recordClass.getConstructors(); Constructor<?> maxParamConstructor = constructors[0]; for (Con...
I'm learning Haskell, and there was quicksort implementation, so I thought that I could implement it in a similar way in JavaScript. The result: const quicksort = ([x, ...xs], compareFn = (a, b) => a - b) => { // If x is undefined, the array is empty if (x === undefined) return []; const smallerSorted = quickso...
Given: *Main> :t text text :: (Selectable s, StringLike str, Ord str) => s -> Scraper str str I need to perform "second level" fmap operation: *Main> let z = fmap (fmap (:[])) text *Main> :t z z :: (Selectable s, StringLike a, Ord a) => s -> Scraper a [a] On one hand z follows API structure, but otherwise I find su...
Here is my version of TicTacToe on python 3.x I'm learning python for a several weeks and I will be very appretiated if you take a look on my script and review it! P.S. I've used NumPad to input move to make game more user-friendly. So 5 means center, 7 means right-upper corner, 6 means right side etc. from random imp...
I have a form, which I want to draw on-top some shapes. To be exact, rectangles and lines. This is the "Redraw" method. I call this method every 100ms from a different thread. public void Redraw() { g.FillRectangle(b, new Rectangle(13, 13, (int)drawMapX + 2, (int)drawMapY + 2)); /* Draw background */ ...
This question is a sub-post to this question This post is a follow up for this and this. "In this particular question I need the reviewers help to judge my Validator class" Validator.class.php a class designed to get used by the controllers. it has one purpose "handle client inputs" <?php namespace aap; // flags defi...
Given an unsorted array of integers \$A\$, the \$i\$th order statistic of \$A\$ is the \$i\$th smallest element of \$A\$. For example, \$0\$th order statistics of \$A\$ is the minimum of \$A\$; \$(|A| - 1)\$th order statistics of \$A\$ is the maximum of \$A\$; \$1\$th order statistics is the second smallest element, an...
My task: find all trains, which overtake another train and return their trainId. Implementation-suggestion: for all trains B for all trains A find station C, where A departs and B later departs than A (the earliest one) if there is such one for all stations D, where A stops after...
I am trying to design thread-safe data structure that I cna use as a buffer in my application. Can you please give me comments about this code and what can be improved: #include <deque> #include <thread> #include <mutex> #include <condition_variable> template <typename T> class Buffer { public: void add(T num) ...
I've implemented the K-Means clustering algorithm in Python2, and I wanted to know what remarks you guys could make regarding my code. I've included a small test set with 2D-vectors and 2 classes, but it works with higher dimensions and more classes. Here, it should sort all the elements starting with the same letters ...
A long time ago I posted my implementation of directed graph is Java. Recently I took a look at @coderodde's implementation and decided to write an implementation of undirected graph and directed graph. Besides I wrote some automated tests for both classes. It's partially based on @coderodde's solution. Here is the cod...
So I am working on an application (top-secret!) that I need settings for, these settings are pretty basic, but I don't want to make a single-row table with a bunch of serialized settings, or a single-row table with a bunch of columns, etc. So I made a Setting class that's pretty handy: public class Setting { [Key] ...
I came across the following problem (found on the SO link below): https://stackoverflow.com/questions/2991950/one-way-flight-trip-problem Given a flight trip that includes a number of transfers: we have a ticket for each part of the trip; we do not stop twice in the same airport; each ticket contains source and de...
Here is a list where I would like to keep only the 'windows' where there are a group of number higher than 3, but if in any case inside this group you find a smaller number, you keep it. Moreover, if there is an isolated high number (between zeros for example), we need to delete it. l = [3.5, 0, 0, 0.5, 4, 10, 20, 3,...
In our application we have complex objects with many nesting levels, each with various properties that are important to the business. We currently serialize and persist these objects along with their corresponding workflows (Windows Workflow 4.5), but, due to issues with updating active workflows (WF4.5 Dynamic Update...
I have the following class to help me deal with files: File class: # -*- coding: utf-8 -*- """ file ~~~~~~~~~~~~~~~~ """ from mimetypes import MimeTypes from os import path from lazyproperty import lazyproperty class File(object): """Class to help dealing with files. """ def __init__(self,...
I wrote a simple program to count the number of words in a string using C. Would you mind reading it and telling me if the method used is acceptable? Or if there are style errors or ways I can improve it? /*Procedure that counts the number of words in a string A word is any set of characters (or a single character...
I am looking for advices regarding my code. I am interested about the correctness, legibility and minimality of the solution. import nltk, string from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.cluster import AffinityPropagation punctuation_map = dict((ord(char), None) for char in string.punct...
I originally had the following code: type Suit = | Spades | Clubs | Diamonds | Hearts type Face = | Two | Three | Four | Five | Six | Seven | Eight | Nine | Ten | Jack | Queen | King | Ace type Card = { Face:Face; Suit:Suit } let suits = [Spades; Clubs;...
I'm trying to teach myself some programming and, working through the Project Euler problems, I've come across some instances where I've needed numbers that are larger than will fit into an int or long variable. I know that existing libraries already accomplish this, but I figured it would be fun/worthwhile/educational ...
This program asks the user to input a List of words. It then returns a list of encrypted words, and a second list which specifies the numerical shifts used to encrypt those words. The idea was obtained from https://www.khanacademy.org/computing/computer-science/cryptography/crypt/v/one-time-pad import random def rotat...
At work we use almost always the same pattern EF, DAL and BLL. I wish to try something new. This is the project structure: And here a code sample with only Users entity: public interface IRepository : IUsersRepository { void Save(); } public partial class Repository : IRepository { private DatabaseEntities _c...
I wrote a script in Ruby for a better family budget overview. The expenses are hold under a CSV file. Any feedback is welcomed! require "csv" FILE_DB = Dir.home << "/expenses2017.csv" CATHEGORIES = %w[ Baby Food Car Travel Books Poker Programming Rent OtherBills Beauty ] MONTHS = %w[ Jan Feb Mar Apr May Jun Jul Aug Se...
I have worked up an implementation of a for_each style function that can iterate over multiple containers at the same time. #include <iterator> #include <utility> namespace detail { //adapted from http://stackoverflow.com/a/6894436/1865694 template<std::size_t I = 0, typename FuncT, typename... Tp> inline...
I created a fun password cracker using literal brute force, searching each character to see if it matches an ASCII character 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ. The password is randomly generated and will vary from 100,000 to 250,000 characters long. I use a wrapper timeit function to time t...
I have an app which uses Stack Views to update its UI depending on the number of pigs. For example below, 1 pig and 4 pigs. I set up Stack Views in Storyboard and set isHidden to true based on how many pigs there are. I set up my custom view with my class below and set up x and y values of labels based on the current...
Here's some code I wrote to solve a problem at the server I'm working on. Is this valid? I've tested it, and it works, but I would like some opinions on this. It's basically a singly_lock_free_linked_list based on the RCU concept. class data_list { CRITICAL_SECTION update; std::atomic_int64_t count; concurr...
A friend of mine asked for help with his UWP app. Me being a .NET developer with an okay amount of WPF experience decided I could give a hand as well as give some good tips and tricks. After a few days of me learning and reading and comparing the two technologies I can see a lot of similarities. As I've learned in the ...
Symbol table It is key-value pair abstraction Insert a value with specified key Given a key, search for the corresponding value Here is the design for symbol table implementation for frequency counting of words: Code directory structure: ./Code$ .: fileIO list ST tinyTale type.h frequencyCounter.c frequencyCount...
I'm trying to parse values from a CSV file to a SQLite DB, however the file is quite large (~2,500,000 lines). I ran my program for a few hours, printing where it was up to, but by my calculation, the file would have taken about 100 hours to parse completely, so I stopped it. I'm going to have to run this program in a ...
Currently, I'm working with a PHP database connection class that is in one single file with a construct. Every time I need this connection, I instantiate the class and the construct creates the connection with only having to modify the user, password, DBname and host. It works fine and I haven't faced any problems with...
Square free no: It is an integer which is divisible by no other perfect square than 1. For example, 10 is square-free but 18 is not, as 18 is divisible by 9 = 3^2. The smallest positive square-free numbers are 1, 2, 3, 5, 6, 7, 10, 11, 13, 14, 15, 17, 19, 21, 22, 23, 26, 29, 30, 31, 33, 34, 35, 37, 38, 39 Is ...
Here is the code of my binary search tree and a few unit tests. BinarySearchTree package api; import java.util.ArrayDeque; import java.util.Queue; public class BinarySearchTree { private Node root; public void insert(int key) { if (root == null) { root = new Node(key); } else { ...
Given a text and the length limit I need to trim the text to the word which is nearest to the limit. function trim(text, limit) { if (text.length < limit) return text; let end = -1; var i; for (i = 0; i < limit - 1; i++) { let current = text.charAt(i); let next = text.charAt(i + 1); if (current !==...
I need to monitor my functions for "errors" and want to print the warnings at the end of the functions. I thought using singleton class could be a good idea in here (code inspired by this example): class Warning { bool status; std::string message; static Warning *global_warning_ptr; Warning() { defaults(); ...
I am developing an app which is somewhat similar to airbnb. There are two search function, one for searching apartment and other for searching car rental. When searching apartment, the result page shows the searched result along with some filtering options like filter from range of price and filter from various options...
I've written a function that can count the vowel groups in a string. def count_vowelgroups(woord): if woord[0].lower() in 'aeiouy': output = 1 else: output = 0 for i in range(1, len(woord)): if woord[i].lower() in 'aeiouy' and woord[i-1].lower() not in 'aeiouy': output +...
Given a string A = "Hello world" and another string B = "wor", I have to print ("TRUE" or "FALSE") whether the characters in B are present in A. For example, if B = "ollw l" the result should be TRUE; if B = "worlds" the result should be FALSE; if B = "ww", result is FALSE. It has to be done in O(n) time complexity. My...
Just recently started learning ML, first I've gone through the notes of Ng's Coursera stuff. While I have nothing against Octave, I'm trying to solve exercises in Python. It's my beginning with that kind of algorithms, though I got mathematical background, so sorry for a bit messy code. My questions: Is there a way to ...
I solved this problem. Problem Statement Given a string, sort it in decreasing order based on the frequency of characters. Example 1 Input: "tree" Output: "eert" Explanation: 'e' appears twice while 'r' and 't' both appear once. So 'e' must appear before both 'r' and 't'. Therefore "eetr" is also a valid answer. ...
My problem is that when I try to make an app with a lot of buttons, I end up with a ton of global variables, a ton of DOM selectors and an equal amount of click functions that while simillar, I don't really understand how I could go about making a single function or how to approach it, surelly there has to be a much be...
I've been working on a project to map a joystick (in my case Logitech Extreme 3D) to mouse and keyboard so I can use it for web games that don't support gamesticks. My design goals are: Flexibility - I want to be able to modify this for almost any combination of joystick/gamepad to a keyboard/mouse easily. Readability...
I'm using the program below to insert values from very large .csv files (~2.5 million lines) into an SQLite DB. It starts very fast, but begins to slow over time, before eventually hanging indefinitely at around 900,000 lines. My hunch says that it's eating up memory somehow, but not quite a memory leak, since it never...
I have the code below which is working as expected. It is doing a form validation with Vue.js and Vee-Validate. It is checking that at least one checkbox is checked. I only don't like that I have to manually call validate for oneChecked-Validator on form submission. With-out the call it's not validating on submit. It w...
Online challenge on Hacker Rank. Please follow the description from the above link. import java.util.Set; import java.util.HashSet; import java.util.List; import java.util.ArrayList; class Main { private static List<String> substrings(String s) { int length = s.length(); List<String> list = new ArrayList<>()...
I am learning Java and as a first exercise I tried to implement singly linked list without the help of java.util. I tested my program for basic operations and it seems to work fine. But I still want to know if there are any improvements I could do in terms of design or implementation in OOP. Node.java publi...
Here is my code for Tarjan's strongly connected component algorithm. Please point out any bugs, performance/space (algorithm time/space complexity) optimization or code style issues. from collections import defaultdict class SccGraph: def __init__(self, vertex_size): self.out_neighbour = defaultdict(list) ...
I wrote some code to encrypt and decrypt some user credentials for services that a locally run application needs to work. I get a password from the user, use it to stretch a key via Scrypt, and then use the key to do authenticated symmetric encryption with ChaChaPoly1305. I use the hostname as salt for the key, so that...
I'm mainly looking at usage of Dapper, but in general, any comments relating SQL -> C# object mapping best practices would be appreciated. I've got two super simple objects I'm working with: public class Subcategory { public Guid Id { get; set; } public Guid CategoryId { get; set; } public string Name { get...
I recently decided to try my hand at this problem of calculating the number of days between two given dates including leap years in the calculation. I chose to do it in C++ as it is the language I feel most comfortable with and was wondering about the quality of my code. #include <iostream> #include <vector> #include <...
I've made a Windows Forms application to track all of the processes running on my machine and it also saves the time an application is "active", an active application is the one that is on focus currently e.g your browser right now + it also reminds me every now and then (every hour) how much time I've spent on the int...
Problem statement Let us first describe a SimpleFunction: SimpleFunction( string A,string B ){ int answer = 0; for( int dig = 1; dig <= 9; dig++ ){ if(string A contains digit dig and string B contains digit dig){ answer = answer * 10 + dig; } return answer; } So b...
In a Swift project, I have a class should be used as a singleton: class NearFieldManager : NSObject{ static let shared = NearFieldManager() var dataToTransfer:Any! } This class helps me communicate between several nearby devices and the dataToTransfer is some information each device is advertising about itself....
Problem statement: Find \$kth\$ largest element in the union of two sorted array. My introduction of the algorithm I spent a few hours to review two algorithms, Leetcode 4:Median of Two Sorted Arrays and Leetcode 215:Kth Largest Element in an Array together since median is a special case of kth element problem, and als...
I'm writing a callback wrapper class for an embedded application in C++11. The basic idea of the class is to be able to use it as a replacement instead of C-style callback functions, with the added benefit of being able to wrap functors and lambdas. Requirements No dynamic memory allocations are allowed at all. It onl...
My code works fine, but it's takes too much time, say around 65 seconds, for large input data. If there are 50,000 numbers in the list \$a\$ and we have to rotate the numbers 45,000 times then it takes 1 minute. How can I reduce the time it takes to print all the numbers? Problem: perform an operation called a right ci...
This project is about helping people with common problems like "Partner dumped me" or "I hate my job", recommending self-help books for every problem and specific person according to age and gender. Can anybody suggest improvements for my project? How can I make this an actual useful project? import java.util.Scanner; ...
I'm using the code below to save a record in my database. I was thinking that I am creating new instances of the SQL Command object and fear that I might be bloating the system memory and not doing proper garbage collection for unused objects. Can anyone point out which parts of this code I can improve? By the way, thi...
So i was trying to find sum of an array using 3 ways in perl6 for while recursive (I know there are inbuilt perl6 functions for this) I want to know if there is a better way to do this or is this it? sub sumFor(@list) { my $sum = 0; for (@list) { $sum += $_; } return $sum; } sub sumWhile(@list)...
Online coding challenge Hacker Rank. I tried to solve it using the naive appraoch first but its failing on some of the inputs and rest its getting timed out. How to get started in problem like these so that I could reduce the time complexity involved? public class Solution { private static Set<String> substrings(St...
I wrote a base conversion program. This base conversion should also work with base 1 (unary) where 000 is 3 and 0000000 is 7 and so on. It is only for non-negative numbers. public class BaseConversion{ private final static String alpha="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; public sta...
This is my first attempt at writing something useful in F# and in a functional way in general. I would appreciate if you could point out any issue, even details, as I'd like to put all the bad habits aside as soon as possible. I tried to leave my OOP comfort zone when I wrote this but I feel like this is not enough. I ...
Yeah, it's another person wandering through from freeCodeCamp. Sorry. That aside, I've got a tribute page to George Washington Carver, developed as a project for the above. I'm generally happy with the way it looks, I just want to see if it follows proper conventions, or at the very least, is somewhat readable. I'm a n...
MyStack.h @interface MyStack : NSObject - (id)pop; - (void)pushObject:(id)object; @end MyStack.m @interface MyStack () @property (atomic) NSMutableArray *stackArray; @end @implementation MyStack - (instancetype)init { self = [super init]; if (self != nil) { _stackArray = [NSMutableArray new];...
I am working on a personal project and I have hit a wall. I know I am writing bad code and I really want to refactor the code below. The application has three tables on the same page. Each table contains data from a has-many-though relationship. In essence I have an employees page which contains three tables of employe...
There is huge legacy class MyService in which several new business cases need to be implemented. Unfortunately we are not allowed to touch existing legacy code within _legacyMethod and need to build a new condition on top of it. However I'd like to have a new code covered with unit tests (using NUnit) public class MySe...
I want to know if it's more appropriate to use a separate class (such as a factory?) to construct an object. While the code works, I am concerned about bloating of the model and the tight coupling. To construct the said object I need: environment variables like api tokens some of the user's attributes from the model c...
This is my second attempt at implementing the A* algorithm using F#, the first one is here. What I changed: I removed the Node class and added two records named MapNode and PathNode that respectively store map and pathfinding data. This leads to more immutable variables and an implementation that will help split pre-c...
Post problem and my code written in Python 2.7. Any advice for code bugs, performance in terms of algorithm time complexity and code style are appreciated. I did PEB8 self-check in PyCharm. BTW, a small issue in my code is, I feel this condition end_index == len(numbers) - 1 and cur_sum < target is a bit ugly, but I do...
Totally agree lack of { } on if else is bad practice. That is just how I roll and I can't do it at work. Use bisection to get to the index of a target value of a sorted array in O(sqrt(array.Length)) public static void SimpleBisectTest() { Random rand = new Random(); List<int> list = new List<int>(); int...
I am reading "Java 8 In Action" (by Raoul-Gabriel Urma, Mario Fusco and Alan Mycroft), section 5.6.3, pages 116 and 117. The code that is presented handles calculating so-called "Pythagorean Triples". Page 116 shows the first attempt, and page 117 shows an improved attempt to generate these triples, where both use the ...
I have an script that is receiving some JSON and then I am parsing it out using reduce. I am sure there is a more elegant way to do it. JSON var request = { "operation":"rate_request", // JSON removed to make more readable. "freight": { "items": // here is the array I am targeting ...
I'm struggling to improve this command-line java application, which reads CSV or txt files, ands allows the user do some "queries" with the data. I can't use any external library, so I'm doing it all and now I'm trying to do some refactoring on it, to let it be scalable, and maybe in the future I could add some new com...
I am creating a REST API to access a database of users. I am new to Node.js and developing REST APIs in general. I am also trying to use best security practices. main.js var fs = require('fs'); var restify = require('restify'); var bodyParser = require('body-parser'); var mongoose = require('mongoose'); var bcrypt = re...