instruction
stringlengths
71
71.9k
Our application architecture consists of: SPA JavaScript calls a set of Web API endpoints The Controllers then call an Entity specific Service Entity specific Service calls a Pass Through Service Pass Through Service calls an API Service that calls external APIs using the HttpClient library via a wrapper. The respon...
I used to do simple SSH rate limiting using an UFW Puppet module. To get more flexible blocking I've changed to using the official firewall module instead. Are there any significant issues with the following? In manifests/host.pp: include ssh_server include my_firewall […] resources { 'firewall': purge => true, } Fi...
I am solving a problem on SPOJ and am currently unsatisfied with my submission time, given that my fastest time is 0.28s (which ranks me 123/5037) and the leading submission is 0.04s. The problem is pretty simple: Given a list of bank account numbers, print the bank account number along with the frequency at which it i...
The goal of our application was to use the same custom logging we created for our ASP.NET MVC applications. We implemented a solution that used some of the techniques in ElmahExceptionLogger: WebApiApplication (Global.asax.cs) protected void Application_Start() { var serializerSettings = GlobalConfiguration.Configu...
I'm updating an Excel workbook that I've inherited and had to figure out if/when/where Functions/Subs were being called. Ran into instances where in the code I couldn't find it being called and deleted/comment out, only to have it run into an error later on since a button uses it. The code that follows is an attempt to...
I am a beginner in assembly. But that didn't stop me from making a simple operating system completely made in assembly. It's very simple and doesn't do much. It's just a proof of concept. I would like to know what I can improve. Any feedback would be great. bits 16 mov dl, 0 ; Cursor position column mov dh, 0 ; Cursor ...
Just for fun I have written a Conway's Game of Life in cmd batch file. I like writing in batch - its restrictions and limits are its appeal. However - it is slow, very slow on a large grid. Any tips to speed it up? I think the slowest part is the function GETNCOUNT - this gets the count of the neighbouring 'live' cells...
As part of my ongoing development of a 3D game engine based on PyOpenGL, I am trying to do some refactoring to make working with textures and framebuffers as painless as possible. I feel this refactoring is needed so that my texture class can handle all of these (and more!) use-cases seamlessly: Loading in image data ...
I just finished this code for my own practice purpose. This code works just fine but I understand there still a lot insidious problems. Any advice for improvement would be appreciated. So here it goes: Package DS; import java.util.*; public class basic_Array { public static void main(String[] args) { int op...
Consider this code segment: if (empty($_GET)) { $page_number = 1; } else { $page_number = $_GET["page_number"]; } I wonder if there is a better, more succinct way to express that idea. I thought about using a ternary operator, but the improvement over the original is not substantial: $page_number = empty($_GET...
Background I've tried to solve /r/DailyProgrammer Challenge #303 [Easy]: Ricochet (summarised below) in Haskell. The code below is now the second Haskell script I've ever written, so I'd consider myself quite the beginner. It works (to a bare minimum), but I'm not particularly happy with it. My knowledge in Haskell at ...
Credits for the original implementation I based my code on: Quora - What is the most efficient way to sort a million 32-bit integers? Implementation // RadixSort - works for values up to unsigned_int_max (32-bit) template<typename Iter> void radix_sort(Iter __first, Iter __last){ typedef typename iterator_traits<I...
I am contributing a solution to the following task on Rosetta Code: Task Split a string into comma (plus a blank) delimited strings based on a change of character (left to right). Show the output here (use the 1st example below). Blanks should be treated as any other character (except they are problematic to displ...
In golang I am finding that there is a definite pressure in the language itself and built-in libraries to do things in a canonical way. Please can someone critically look at these two ways I am considering using to provide transactional synchronisation of state manipulation within a library and provide me with some fe...
This deeply nested set of callbacks is very unreadable and I'm looking for ways to improve it: seedGroups('Branch/Divisions', null, null, null, null, true, true, true, false, true, function(err, result) { seedGroups('Capital Account', null, null, 'Balance Sheet', 'Assets', true, true, true, false, true, function(er...
#include <iostream> #include <ctime> #include <numeric> #include <vector> #include <functional> #include <map> #include <stack> #include <algorithm> #include <cstring> #include <cstdlib> #include <iomanip> #include <memory> const int initWeight = 100; const int precCoeff = 50; const double stepCoeff = 0.65; const int ...
I have written a todo list app. I want to understand how to improve it. Here's what I'm trying to understand: My problem is when user clicks on task to edit, because it passed by reference, so if user edit task, it will change directly the task object. (see the code below). My questions: In my code I wrote one way to...
I decided to write a (more or less simple) C++ calculator; init.cpp generally gets most of the user input, and calls the functions. Here are my files: //init.cpp (main file) #include "includes.hpp" int main() { char t = '\t'; //tab character, used for menu formatting char nl = '\n'; //new line character, used for m...
My question is to print all possible codes for the string. Assume that value of a=1, b=2, c=3, d=4, .... z=26. E.g. for “1123” possible codes are aabc, kbc, alc, aaw, kw Here's what I could come up with. private static void printCodes(String str, String ans) { if (str.length() == 0) { System.out.println...
I have created a simple program in Python which downloades all issues of the MagPi magazine by parsing this web page for links ending in .pdf, then downloading them using the urllib module. It also supports command line options, using the argparse module: $ ./magpi_downloader.py -h usage: magpi_downloader.py [-h] [-q] ...
From this Wikipedia article, the following unsolved problem is presented as a result of Waring's problem: It has been proven that a finite number of k exist, and so far none are known. The follow code is meant to brute-force search for a solution: #include <boost/multiprecision/cpp_dec_float.hpp> //#include <cmath> #...
Problem statement: Print out to console the ternary tree preorder traversal. Suppose that the tree can have at most 3 children, left, middle and right. Preorder traversal is to visit the middle child first, and then left, and then right. Every node has integer value. My introduction of Algorithm I was asked to write ...
John has discovered various rocks. Each rock is composed of various elements, and each element is represented by a lowercase Latin letter from 'a' to 'z'. An element can be present multiple times in a rock. An element is called a 'gem-element' if it occurs at least once in each of the rocks. Given the list of...
A class that keeps track of lines and columns in a text file. I use it in a parser so that when an error occurs, I can print out the line and column at which it occured. Here's line col.hpp #ifndef line_col_hpp #define line_col_hpp #include <cctype> #include <cstdio> #include <cassert> ///Keeps track of lines and col...
Basically, I'd like to be able to solve a proportion after entering in all but one term. Specifically, I'm working on creating a calculator for the Combined Gas Law. $$\frac{P_1\cdot V_1}{T_1} = \frac{P_2\cdot V_2}{T_2}$$ Right now, what I have is a program that takes in two double arrays for the original and final val...
I am trying to implement algorithms related to trees in Scala. I have dabbled with the following implementations of a tree. Are there any pros and cons of preferring the non-Option related implementation over the one that uses Option? Implementation with Option: sealed trait Node { val label: Int } case clas...
I am working my way through "Cracking the coding interview" problems and have finished implementing this question: "Given, two strings, write a method to decide if one is a permutation of the other". Can anyone give me any feedback on my implementation in regards of efficiency or improvements? public static boolean con...
The following code implements a simple interface to operate on mutable* Strings in C. It is composed of two files: one for the structure definition and the available operations, and the other with the actual implementation. *This can be inexact, as only adding characters to the end is implemented. Any comments on codin...
I am new to Python and recently started exploring web crawling. The code below parses the S&P 500 List Wikipedia page and writes the data of a specific table into a database. While this script is hardcoded and I would certainly be interested in some thoughts on performing the same task in a slightly more generic way (p...
I have created simple algorithm to generate the new Location from given latitude and longitude. // How to use : first call SetupLocation(InputLat,InputLon float64) to set base latitude and longitude. // To genreate the location you can call RandomLatLong() to generate using seconds degree. // And RandomLatLongMinute t...
I basically want to write a simple GUI program to sync to directories using the rsync command. The core part of the code is below. My main question is, do I need to have the waitFor method included? At present, I have left it out, because I would like to show the user the --progress responses as it would in terminal, n...
can you review this code for me? how do i make it better? //this is the calculator import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; class dog extends JFrame { private JButton n1, n2, n3, n4, n5, n6, n7, n8, n9, n0, add, sub, mul, div, slo, cls; private JPanel panel, panel1...
What is an efficient way to write this raw PostgreSQL query using in go? I'm using go-pg but something with just the pg library should translate well to go-pg. Table: companies: - id string, primary key - name string, not null services: - id string, primary key - company_id string, not null, foreign key (compa...
For an FASM assembly course I've to do the following exercise: "Write a program that takes the number n as input. Then it prints all the numbers x below n that have exactly 2 different integral divisors (Besides 1 and x). For example: 15 is such a number. It is divisible by 1,3,5,15. (Here 3 and 5 are the two different...
I have this function that returns me a list of users with their roles and groups. As you can see, this is how I fetch and create list of objects. I'm wondering whether this is a good approach and what parts should be improved. I'm not that experienced with PHP so I would appreciate code samples. I'm also wondering how ...
Now I know the same type of question (same task) has been asked on this site before, but I recently wrote my C++ implementation of the Hack Assembler from the Nand2Tetris Chapter 6 course (defined here). I'm not really looking for tips on solving the task itself, although these are appreciated as well. Basically, if I ...
I've written a queue supporting one producer and multiple consumer threads. The idea is that the queue instances a definable number of long running consumer threads. Internally I'm using a BlockingCollection to solve the producer consumer problem. I've done some little testing via a console application, and it seems to...
I have written my own object pool class called ObjectPool<T> which uses SpinLock and Stack<T>: public class ObjectPool<T> where T : class { private int _size; private Func<T> _factory; private SpinLock _spinLock; // storage for the pool objects. // the first item is expected to be most often case. ...
The application I would like help with is a booking calculation tool that runs a few simple calculations in order to work out the cost of someone's stay. It currently contains only two java files, Booking.java and BookingCalc.java (which is imported into the project from another library). The tool takes both user inpu...
Working with futures and .then, I keep running into the problem of needing to "capture by move" in a lambda. In fact, not only that, but when implementing e.g. when_all, I find myself needing to capture a whole parameter-pack. Neither of these things are supported out of the box in C++17. However, we can capture a whol...
I'm working through Algorithms Cormen et al to learn more about algorithms and modern C++. I've implemented the maximum subarray problem and would like some feedback. I'd really like to use the modern additions to C++ effectively, so please let me know where things can be improved. One of my concerns was using std:...
Common Lisp does not have a generic copy function for reasons outlined in Kent Pitman's article The Best of Intentions. However, it may still be convenient for rapid prototyping purposes to provide such a function that would recursively copy any given lisp object down to its immutable core objects. In the initial stage...
I read that, in HTML, it is better to display non-tabular data using the <div> tag instead of the <table> tag. I have a website that is displaying a lot of things as tables, because I like the look of it. Here's what it looks like: Screenshot Here are the CSS and HTML for the table: table{width:100%; border-collapse...
Overview The following code is a solution for a Project Euler+ problem on Hackerrank. A circular prime is a prime number whose rotations are also prime. For example, 197 is a circular prime since it and all it's rotations (197, 971, 719) are prime. The sum of all circular primes less than 100 is: sum(2, 3, 5, 7, 11, 13...
I recently bought a 4x4 keypad. It is one like this: http://www.learningaboutelectronics.com/images/4x4-matrix-keypad-pinout.png Now every code I found on the net was either using a highly overloaded library or was poorly hacked by a guy in the arduino forums. I realized that almost all blogs about electronics just see...
Disclaimer: not a Pythonista, first actual Python programme written right here. I'm reading a DHT11 sensor from GPIO pin 4 on my Raspberry Pi (thanks Thomas Ward for sending the RPi to me), and I want to log it to a file which will later be parsed into a web-page. So I wrote the following Python script which is called...
Prior to Android 6.0, Mongolian text is not supported on Android devices. And as far as I know, OpenType smart font rendering is still not supported. Therefore, in all my Mongolian apps I use a rendering class to convert Unicode text to the appropriate PUA glyph based on the context. The following is the main method of...
function uploadImages(uploader,callback1,callback2){ uploader.onchange=function(){ callback1() var reader=new FileReader() var i=0 reader.onload=function(){ var image=new Image() image.onload=callback2 image.src=this.result if(++i < upl...
This is my C++ program. I wanted to print out Pascal's triangle. I let the user decide how many rows to print out. The first row is considered as 0, and is just: 1 I'm using vectors for this task. I think that I do not have to store the full triangle as that would take up too much extra space. I just store the previo...
Build a project which can allow user to post and search for job listings, I have written some code and divided into different modules. My motivation is to understand how much over-engineering is needed or not for a system like this which is basically a CRUD system. db.js var pg = require('pg'); var config = { host: ...
So I decided to expand a little one-off C# console program I wrote awhile ago to download the free e-book offered by Syncfusion, and decided to also do it for other free e-book publishers... like O'Reilly. But I now want to make it a generic e-book downloader, and make it easily expandable and maintainable. I plan to o...
Program description The goal of this program is to get a number, which is the number of lines of inputs (lets call that number N) that the program will receive. Then the following N lines will consist of two parts, first a char which is either 'T' or 'M'. The next part will be a string that is a little different for 'T...
I have an array and must fill another one. Depending of a boolean I copy first or second element and the rest must be as is... Currently I do it like this (data has the desired info): const newArray = []; newArray[0] = theBoolean ? data[0] : data[1]; for (let i = 2; i < data.length; i += 1) { newArray[i - 1] = data[i...
Background I have tons of very large pandas DataFrames that need to be normalized with the following operation; log2(data) - mean(log2(data)) Example Data The example DataFrame my_df looks like this; iovrrx nfinsu mvdfjc idjges fubmrg lvuhfv 0 0.987654 0.206104 0.802920 0.011157 0.860618 0.575...
I have the following code: (emailList type is List<string>) //Add All emails foreach (var mail in emailList) { var isEmail = Regex.IsMatch(mail.Trim(), @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.Ignor...
I've researched this morning how to use Google Analytics to track outbound page views. However, I think the implementation might be a bit difficult on our website (as we have hundreds of outbound links) Here's what google recommends. /** * Function that tracks a click on an outbound link in Analytics. * This functio...
I've recently put together a library for working with Crypto in Go. I did not roll my own, I'm relying on stdlib for the core parts of this, but I would still like to get this reviewed by some experts in case I've done something horrific. If you're interested and want to view this in a more palatable format, you can fi...
This program should convert a file containing Mana, Hashcat or John the Ripper NTLMv1 hashes to another file containing Hashcat or John the Ripper hashes. Do you have any suggestions on how to make the code cleaner? The hash format selection code feels kinda dirty. #!/usr/bin/env python3 # Takes a file of NTLMv1 hashe...
I'm using PHP (Laravel) to iterate over the survey_answers table and build datasets which I can show in a graph. I'm just wondering if this is the way to go. ChartFactory.php public static function buildFromSurvey($survey) { $chart = new Chart($survey->name); foreach($survey->answers as $answer) { if(...
We are using a message broker called rabbitmq. The code checks the status of number of messages in q queue and sent messages. This is achieved by a curl request to a given API.The script has a sleep of 5 seconds. I want to beutify and optimize this code for memory. I am getting offences too many lines. Since there is a...
Trying to find way to do this with only one pass through the array, so I won't run a sort on it and take arr[0..1]. Not sure how to make it look better: def LowestSecondLowest(arr) lowest,second_lowest = nil,nil arr.each do |n| if second_lowest.nil? second_lowest=n elsif lowest.nil? if n>secon...
Very simple code, works fine. I'm mainly interested in the method I used to count lines. I thought about using fgetc, but I'm not even sure if it'd read the newline character, and I think it's slower too. #include <stdio.h> #include <stdlib.h> #define MAX_SIZE 1000 int main(void){ FILE *in_file; char line[MAX_...
I am especially concerned about: Correctness: Does my algorithm always output the correct answer given a correct input? Readability: Is my algorithm easy to understand for an experienced Ruby programmer (or, in other words: how many WTFs does a experienced Ruby programmer say while reading my code?) Performance is no...
I am building a bare bones freestanding kernel in ASM and C. My make file is below. CFLAGS= -ffreestanding -nostdlib -gdwarf-4 -m32 -ggdb3 -Wall -Wextra -Werror -std=c11 ASMCFLAGS= -f elf32 -F dwarf -g -w+all LDFLAGS= --nmagic -m elf_i386 --script=os.lds BUILD_DIR=../build/os BUILD_DIR_IMM=$(BUILD_DIR)/imm BUILD_DIR_I...
My Windows desktop is messy with many files of different types here and there, therefore I thought of writing a program to organize it, and other directories too, for me. Here is my code: import os import shutil class File: """Represents a computer file. attributes: path, name, extension """ def __in...
I'm creating an application for foosball matches. I have models like below: class Player(models.Model): match_amount = models.IntegerField(default=0) wins = models.IntegerField(default=0) avatar = models.ImageField(blank=True) user = models.OneToOneField( on_delete=models.CASCADE, to=Use...
The purpose of my code here is to play a part in genome sequencing analysis, and while functional it takes days to run, so I am looking for any way I can improve speed. The input is up to 500 million lines long (making speed code efficiency important) and contains sequencing reads and corresponding info. Each read take...
This looping has no problem if I have under 100 rows in the looping table sheet. However, If it go over 100 rows, looping takes a while to filtering and paste value in looping sheet. Is there any way to optimize this VBA code to run faster? Sub Testingloop() Dim endrown As String Dim ex As String Dim ez As String Dim e...
I created a recursive function that uses binary search to just return true if it finds the value and false if it does not. I'm new to recursion and binary search so please let me know where I can improve upon. /** * Uses binary search O(log n). Returns true if the values is in the value array false if it's not. Recur...
Following my previous question Create a table that lists macros in a workbook or worksheet here's my Sub to determine worksheet visibility in a workbook. This arises from updating code that used extremely hard to understand logic and several disparate NamedRanges to subsequently hide/reveal sheets. Is there a better/o...
I am new to bash scripting. Could you please give a review of this code that copies recently modified files from one directory to another in bash? The main commands are in my bash_aliases file. Main code #!/bin/bash # Aliases file cpRecent(){ . ./helperlib.sh __processoptions $@ if (( $? == 0 ));then ...
I often do golf challenges, and thought it might be advantageous to write some code that automatically removes all the unnecessary whitespace from a program. After a few refactors, this is what I ended up with. In all the tests I've run it through, it's correctly removed only the whitespace that doesn't change the mea...
I would like a review of the transformation of the first method to the updated one below: private static ArrayList<String> getValuesfromXML(String key1, String key2) { ArrayList<String> valueArray = new ArrayList<String>(); try { String scriptPath = getScriptPath("prop.xml"); File file = new ...
I have a PANDAS DataFrame that contains sensor data that is recorded every hour (sample included below). It is important to note that every hour is not necessarily in the dataframe, as sometimes the sensor is down and nothing is recorded. This data is going to be used as input into a predictive model, but before that...
I'm experimenting with writing a dynamic string library in C, and I decided to write an implementation of sprintf. In my code, I call vsnprintf with a buffer of 0 bytes, just so I can get the number of bytes it requires. I was wondering if there is anything wrong with this code and if there a better way to do this. It ...
I had a curl command which I converted using this. This is the Ruby script: rabbitmqctl_url = CONFIG['rabbitmqctl']['url'] rabbitmqctl_user = CONFIG['rabbitmqctl']['username'] rabbitmqctl_password = CONFIG['rabbitmqctl']['password'] uri = URI.parse("#{rabbitmqctl_url}/api/queues") request = Net::HTTP::Get.new(uri)...
I have recently coded a system where an instance of class Player is created for each connected socket, once the player class has been created, in its constructor the Socket that connected starts receiving data from the client side. I won't be including the client side code, just the server side for this question. Once ...
Rule of Thumb: Don't roll your own encryption--I'm no cryptographer obviously. Also note my apologies for my awful C-style C++. For a fun little project I've written my own hash algorithm as a practice project. The goal was to write an algorithm that took an input digest and gave me a generally unique output hash in th...
I'm doing this, but as I'm the expert here (because no-one else is doing it) I have no real idea how awesome my code actually is. So the code should do the following: Export the tarball from subversion on the target box Untar it. Run the install script, answering questions appropriately. For this review, I'd love inp...
I have this code which creates a team using the github API and returns the team-id(success) or -1(failure). My problem is with the error handling. When the request responses with an error status code I try to deal with a few different types of failure. It looks like a mess! Is there any way to make it more readable/e...
I have an Excel where i have file names in one column with the revision numbers in another column. I need to remove the duplicates(file with higher version should be retained and lowerversion deleted).Can you guys help me with excel VBA for this. Eg Raw Data Desired output from macro What i have tried( i am new to VB...
I've recently started programming and been self-studying on various online courses + official documentation of oracle / java. Code is quite messy and if you don't have time to understand it, I wouldn't even bother in your place. This is also not Object Oriented since I didn't see a reason to do it that way although I w...
Just completed a /r/dailyprogrammer challenge. Challenge #238 to be precise. A Github repository with the wordbank.txt is available here. import random difficulty = {1: [4, 5, 6], 2: [7, 8], 3: [9, 10, 11], 4: [12, 13], 5: [14, 15] } #Keys are the various word lengths for eac...
Below is my code import pandas as pd import math import csv fund = 10000 print("investment",fund) pval = 0 oldportfolio = [] dts = ["06 Feb 2017", "07 Feb 2017", "08 Feb 2017", "09 Feb 2017", "10 Feb 2017", "13 Feb 2017", "14 Feb 2017", "15 Feb 2017", "16 Feb 2017", "17 Feb 2017", "20 Feb 2017", "21 Feb 2017...
This is my first module I wrote in Rust. I'm new to the language and couldn't find a way to easily replace some words in a file, so that's my go at it. If there's already something like that and I just missed it, feel free to point me to it. I'm looking for advice as to how I can make this more efficient and more "rust...
I've tried to implement the counting sort algorithm in C. What efficiencies can you spot? I squint at the end when running through the original array again to assign it the sorted array. Maybe there is a better way? /** * Sorts array of n values. * Using counting sort O(n) */ void sort(int values[], int n) { //set o...
Here's an iterative implementation of the Ackermann function for review: #include <stack> #include <iostream> #include <tuple> #include <vector> int Ackermann(int m, int n) { std::stack<int> s; s.push(m); while (!s.empty()) { m = s.top(); s.pop(); if (m == 0 || n == 0) n...
snake-game is a game where you control a snake in an enclosed square without running into the walls or your own body. The snake grows when you run into whatever item you are supposed to run into. My snake eats mice: click to watch on youtube You can get it to play from github and hopefully it will work To be clear, i...
I have the following data in a csv file called BarData.csv: Fruit,dt,amount Apple,12/28/2016,4566 Apple,12/29/2016,5898 Apple,12/30/2016,3694 Apple,12/31/2016,5586 Apple,1/1/2017,4558 Apple,1/2/2017,6696 Apple,1/3/2017,7757 Apple,1/4/2017,8528 Apple,1/5/2017,5543 Apple,1/6/2017,3363 Apple,1/7/2017,5464 Pear,12/25/2017,...
I have the following code that I'm using to create combinations of elements in my dataset: start_time = time.time() question_pairs = [] import itertools as iter for memberid in IncorrectQuestions.memberid.unique(): combinations = IncorrectQuestions[IncorrectQuestions.memberid == memberid].groupby('memberid').quest...
For a project that I'm developing, I need to implement the producer/consumer pattern, but the quantity of consumers cannot be higher than some number (say 40). I created a concept project on GitHub to test it, and now I want to share with us to get some feedback. class Program { private static readonly int ...
I have 2 dataframes. The first one (900 lines) contains corrections that have been applied to a deal. The second dataframe (140,000 lines) contains the list of deals with corrected values. What I am trying to do is to put the old value back. To link the corrected deals to the corrections I have to compare a number of a...
I have written a program in scala which actually does the below For every number between the maximum and minimum value of the array calculate the distance for each and every element in the array and find the element with maximum distance. I want to master functional programming in scala. Trying to understand how I c...
I am a beginner in python programming, and I am trying to implement multiprocessing to the code I use daily for my data treatment. Essentially, the input file has around 10 - 30 millions of reads where each read contains 4 lines of information. There are two elements in the first line of every four lines that I am look...
I cobbled together a function from various sources that takes an integer and returns it as its respective English word formatted as a string. The function is as follows: def int2word(num, separator="-"): """Transforms integers =< 999 into English words Parameters ---------- num : int separator : st...
I have a twitter data set. I have extracted all the expanded urls from the json and now am trying to resolve the shortened ones. Also, I need to check which urls are still working and only keep those. I am parsing over 5 million urls. The problem is that the code below is slow. Can anyone suggest how to make it faster?...
I have finished writing a C library whose purpose is to provide a simple API for asynchronously executing functions, waiting for events on file descriptors and waiting for timeouts. The whole library is published here https://github.com/ernacktob/asyncio. The entire library is probably too large to be reviewed in a sin...
This is my code for clustering 111272 by 29987 tfidf vector but it is taking long time .How can I speed up the code execution. The tfidf matrix is sparse and works well for 10000 records. /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | T...
I have a configuration engine that allows the user to specify a dictionary with text templates (read from a JSON file) where each placeholder like {x} can be substituted for a value found under a key with the same name e.g. x. var constants = new Dictionary<string, object> { { "x", "foo {y} baz" }, { "y", "bar ...
I found a post I made here an year ago (Compiler for a minimal LISP dialect to run on the Java Virtual Machine) and got interested on this subject again. This time I decided to implement the instruction level myself instead of relying on the Java virtual machine like last time. An obstacle is that since I'm implementin...