instruction stringlengths 71 71.9k |
|---|
Based on the value of what is in column B (column A is hidden) it groups/colors/removes the corresponding node(s). "R - " values are nodes that need to be grouped. The rows are 6 cells apart before a new node starts. It also adds a formula below the value.
I wrote this code and it of course looks messy. I just want to ... |
I am trying to write a generic Python script that do the following types of tasks:
Load .npy file (the .npy file is of shape (m_samples, channels, row, column), which corresponds to m_samples images, and here the channels are always 1
Check whether a given path exists
Iterate against the .npy file, and save each image... |
I learned Python and Pygame and now have coded a few games. For the last few months I have been working on this "luck free" pokemon battle simulator. I feel my program runs well in the current state and at the same time is being semi spaghetti-coded because as I try to improve the game I find it more challenging than i... |
There are many sorting algorithms, so how about unsorting algorithms?
But how could one go about creating a random list of unique elements while not using shuffle, NumPy or any other ready made tools to do it?
def get_un_sorted(limit):
numbers = list(range(limit))
shuffled = [0] * limit
for i in range(limit... |
I'm working on a linked list to save the information of students. I can insert anywhere on the list, delete and sort it. Now i'm reviewing the code to try to simplify it somehow. I don't know if the .c's and the .h's of the project are correctly arranged.
The program complies and runs as it should.
Do you think the me... |
I have this JSON schema:
{
"name":{
"first":{
"attributeValue":"firstName",
"attributeType":1,
"dataType":1
},
"last":{
"attributeValue":"lastName",
"attributeType":1,
"dataType":1
}
},
"age":{
"attributeValue":"age",
"attributeType":... |
This program takes a simple nucleotide sequence and finds the most common "k-mers" in the sequence, as determined by the supplied dataset (see below). The goal of the program is to find the origin of replication of a DNA sequence, as it is presumably the most common sequence, or in other words, the substring with the m... |
Last time I posted my code of Tant Fant Game. I got some really good advice and I have implemented all the suggested changes to my code. I was wondering if there were any other revisions that would be good to implement? Thanks! =)
class board:
def __init__(self) :
self.loc = ['B', 'B', 'B', '', '', '', 'W'... |
I'm creating a C# application that produces unique lines of data. The main purpose of the application is for me to learn C#. The secondary purpose is to have available lines of (dummy) data when testing database development.
For this particular question I'm concerned with the most efficient algorithm for incrementing c... |
I want to determine whether or not the selected element exists in the list. This is the current procedure that I'm using for finding the element exist in a list or array. Is there any fast procedure for finding an element with any of these?
int[] array = { 1,2,9,3,5,6,7,8,10};
boolean isFound = false;
for(int i =0; i<... |
For the last couple of months I've been working on a python script that pulls data from a specific Trello list and sums up the numeric values by list (lists are split up into months). I've worked on making my code pythonic, basic functionality, separating functionality into distinct functions.
It currently only works w... |
For a homework assignment I've been given the task of parsing out information from an 32-bit MIPS instruction. (For more information on the instruction formats, see here). The instructor has provided us with a header file enumerating all of the functions required, and it's my job to implement them.
Currently, this is w... |
Lauren has a chart of projected prices for a house over the next n
years, where the price of the house in the i-th year is P_i. She
wants to purchase and resell the house at a minimal loss according to
the following rules:
The house cannot be sold at a price greater than or equal to the price it was purchased a... |
Can I please get some reviews and suggestions?
This is what this app does:
It picks user login from Users table and compare it with the post in the login function. Then it logs in. You can query the payments table for payments in the database and also can update records using the add_rec() function.
It's a simple paym... |
I am trying to test my first functional tests. I would like to know if my functional test is well done, or if the structure of it is not optimal.
Any advice will be useful to me. As I said, I just started writing functional tests, so I have major doubts about my test method which regroups all of a sudden or should it s... |
I had to do some maintenance programming on a legacy software recently.
Most of the system's logic is done with Java and PL SQL.
The Java creates some special kind of XML. These XML is then displayed in the browser. JavaScript is used as a link between does XML-views and the backend Java.
The views consist of large f... |
This is my first foray into multi-threading, and I'm keen to know if I have fallen into any traps or have room for optimisation/improvement.
Example usage:
var success = new ConcurrentBag<CourseParticipant>();
var fail = new ConcurrentBag<CourseParticipant>();
using (var parallelEmails = new ParallelSmtpEmails())
{
... |
The problem is: Given two strings, write a method to decide if one is a permutation of the other. I wrote the following code in scala, may I know any other optimization one?
def checkpermutation(str1:String, str2:String): Boolean=(str1, str2) match {
case (a,b) if a==b => true
case (a,b) if a.length() !=b.length(... |
I have these classes:
public class BaseSearchFilter
{
public int IssueCount { get; set; }
public bool IsSelected { get; set; }
public string FilterDescription { get; set; }
}
public class IssueTypeSearchFilter : BaseSearchFilter
{
public StandardIssueTypeDTO IssueType { get; set; }
public bool IsVi... |
I'm writing a communications library for a class. Part of the requirements is that semi-reliable communications, which leads me to this monstrosity:
unit UDP.Communicator;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, DateUtils, SyncObjs, blcksock, fgl, SimpleThread, Common.Types, UDP.Shared;
type
{ TU... |
I developed a simple deck shuffle and drawing system, as a test on how to use collections and learn from it.
However, I think my code is a bit wonky, and I think here is the best place to get new tips on what to improve.
Public deck As New Collection
Public face As New Collection
Public symbols As New Collection
Sub a... |
I have some files that I want to process, and I know how to do it in sed/awk (for each one):
awk '{if (index($0,"#")!=1) {line++; if (line%3==1) {print $2,$3}}}' q.post > q
or
grep -v "#" q.post | awk '{if (NR%3==1) {print $2,$3}}'
It's one line, and rather beautiful and clear.
Now, my main program is in python (... |
Time for the most original question of the year: writing a FizzBuzz in Haskell!
So here is what I came up with:
fizzBuzz :: [Int] -> [String]
fizzBuzz xs =
[fizz x | x <- xs]
fizz :: Int -> String
fizz x
| mod x 15 == 0 = "FizzBuzz"
| mod x 3 == 0 = "Fizz"
| mod x 5 == 0 = "Buzz"
| otherwise ... |
I had a file with 2 hash functions (DJB2, NMEA0183), written in C-like way, e.g. something like this:
uint8_t NMEA0183Hash(const char *s, size_t const size){
uint8_t hash = 0;
for(const char *c = s; c < s + size; ++c)
hash = hash ^ (uint) c;
return hash;
}
Everything looked nice. However, I neede... |
I have a problem where I need to replace every base part of URLs in a body of text. However, I only want to replace it in specific URLs. Only URLs that go to "resource.aspx" that have the "source" query string parameter need to get the replacement. Other URLs could have the target base part and we don't want to touc... |
This class has the responsibility of parsing a string to one of the primitive types: int, double, float, decimal...
While creating it, I have noticed that it'll be terribly ugly.
It basically should perform a TryParse of each primitive type and return the first that returns true, along with the parsed value.
public s... |
I made an autocomplete input box of every town, city and village in the UK. Yes, every single one. The load times are painful so is there a way to reduce that?
Here is a sample:
<input type="text" id="location" name="locations" placeholder="Edinburgh, Belfast, Cardiff, London">
$( function() {
var availableTags = [... |
I have written a small program to query the Stack Exchange API, specifically for badges. The main idea of the program is to return the new list of Tumbleweed posts on Stack Overflow, every 10 minutes. The motivation for this bot was the Weed Eater hat.
The program queries the API every 10 mins. If there are new tumble... |
Exposing Inherited Members
I have a WPF Custom Control library (ContentToggleButton) and an app (spec) to test it. The Custom Controls, which derive from Presentation Framework elements, expose inherited properties as well as new properties to the consumer.
This means that the consuming app depends on the Framework Ele... |
In my code, I use fast method of reading input and a custom model of list. After reading the input into my 'list'.
The problem is that, when I test my code, most answers are correct, but for some INPUT my algorithm works slow. I unfortunately don't know the input data, but 6 from 12 tests finished with the wrong time. ... |
A magic square adds up the values in each vertical, horizontal, and diagonal row to the same value. In this case, that value is 34. I have changed different indices values and the program returns false. It seems to work just fine. But I'm just learning 2d arrays. Please let me know if you see something wrong, much appr... |
I'm trying to write the Josephus algorithm as a project for school, however, I think that there is a better way than what I already have.
public static int[] StartTheGame(int prisoners, int count)
{
var position = count - 1;
int[] list = new int[prisoners];
for (int i = 0; i < prisoners; i++)
{
... |
I wrote this code which adds children to nodes according to the weight of the heading of a non-binary tree. I am a novice programmer, so I would love to know how this code can be improved.
import java.util.LinkedList;
public class Sample {
public static void main(String... args) {
Sample buildTree = new S... |
My company uses an Excel workbook to schedule our manufacturing jobs. I'm attempting to log job positions on the schedule and import them into Access on a semi-regular basis (twice a month?). This will enable analytics of lead times currently impossible with our current system.
The schedule is made up of a 19-row-heade... |
I have written a small HTTP downloader using
boost::asio
Beast library (proposed to be included in Boost)
network::uri library for handling URIs
It's nowhere near completion but I would like to get some feedback from you guys. I wanted to use as much of async interface as I could.
The idea is that it gets a std::vec... |
I am studying software engineering and we just started learning about object oriented programing. I wanted to be a bit ahead of all others, so I decided to write a little text-adventure using classes.
I would be very glad to know what I can improve and what I can do better. Should I do something differently?
Main.cpp
#... |
The Challenge:
A valid string is one in which all distinct characters occur the same
number of times. Given a string S, check if the string can be made
valid by removing less than or equal to one character. If yes, output
"YES". Otherwise output "NO".
Constraints:
\$1 \le \lvert S \rvert \le 10^5\$
String S con... |
Just looking for a way to include a single validation function inside of another function, that will stop any other lines from executing if it fails.
NOT an if statement... I'm trying to avoid nesting, because.. idk, I want to try to avoid it as much as possible.
So.... Is it bad to throw an Error to do this? I can't ... |
I have a String with a double number. Unfortunately, the number is created on backends with different locals, so it could be both 101.02 and 101,02 (different delimiters). I need to get the position of this delimiter if it exists and get 0, if it is not.
I've come to two options:
int pos = amount.indexOf(',') == -1 ?
... |
I have a problem with generation of my report. Data is read from other sheet in report. Most time is wasted on execution of LineColor() and LineGroup(). Those operations are based on hierarchy, which is copied and pasted into cells parallel to every row.
CoreElementCode CategoryCode SubcategoryCode BMCCode Produc... |
I'm a beginner in Android and I've been experiencing "Skipped xx frames" everytime I load up my activity which is a list of languages. I tried optimizing the listview following tutorials (applied recycling and viewHolder pattern) but still can't get rid of the issue.
ListLanguagesActivity.java
package com.experiment.wo... |
I am using SAP BPM API's to fetch currently running process instance and the task belonging to the running process instance. I have return below method on an EJB Class which does the job, however it is extremely slow and have n2 complexity which is making it dangerous to move on production system as the process instanc... |
The below code is run on a routine rather than say login time but being new to using FETCH NEXT I can't help think maybe there is a trick here to merge at least one of the SET lines.
The end results should give me the total unique users, how many completed a module and how many passed.
Fields are indexed on the table... |
Could someone tell me their opinion on my leaderboard system?
library
#!/usr/bin/env python3
def write_score(score, name, scores, filename, splitter=','):
"""writes a score with a name to a file, in a specified format"""
score_tuple = (score,name)
scores.append(score_tuple)
with open(filename,'w') as f... |
I wrote a generic data converter that takes one kind of data and converts to JSON and XML types of file. Now, it reads data from the given CSV file hotels.csv. The first line is a header which describes all field names and, follows the rules given below:
a. A hotel name may only contain UTF-8 characters.
b. The hotel U... |
I have a well functioning Nagios Core system set up. I wanted to make our alerts both easier to read pertinent information quickly as well as provide additional details from custom host and service variables. While I have touched on Perl in the past this is my first real Perl script. The larger portion of CSS and HTML ... |
I'm practicing this question where I'm supposed to make a table programatically and although I'm not getting any errors the table is not showing.
var ROWS = 13;
var COLS = 2;
window.onload = function go() {
var out = document.getElementsByClassName("funky")[0];
var table = document.createElement("table"... |
I have created an object to handle all my database manipulation needs. Here is my object constructor and one of its functions:
class dataMonster{
var $sn = '';
var $un = '';
var $pw = '';
var $dn = "";
function update($table, $records, $set_value, $compare, $compare_value){
$table=preg_re... |
I have written a pop song generator which uses the Markovify library to produce lyrics based on (just for testing purposes) songs by Avril Lavigne.
In order to make the generator a bit more competent I have adapted some code which uses the nltk library to determine whether or not two words rhyme. I have used this to m... |
Today I present some code for finding all words that
begin with a given prefix and some simple test cases for review.
from itertools import chain
sentinel = object()
def insert(tree, word):
for letter in chain(word, [sentinel]):
tree = tree.setdefault(letter, {})
def words_beginning_with(start, tree):... |
I am leaving my first job because I always worked alone on projects from my day one, which was both useful but also taught me some bad practices some of which I managed to realize but many others are still there. Not being able to learn from colleagues, constantly being pushed with deadlines because it's a really small... |
I've created a scenario below, in which a user can build a pizza and choose their toppings, then order their pizza:
require 'active_record'
require 'logger'
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
ActiveRecord::Base.logger = Logger.new $stdout
ActiveSupport::LogSubscriber.color... |
I have written some code which works out which sums of reciprocals of whole numbers sum to one, e.g:
\$\frac 12 +\frac 13 +\frac 16 =1 \$
\$\frac 17 +\frac 18 +\frac 19 + \frac1{10} + \frac1{11}+ \frac1{14}+ \frac1{15}+ \frac1{18} + \frac1{20}+ \frac1{22}+ \frac1{24} + \frac1{28}+ \frac1{30} + \frac1{33}=1 \$
RecipSum... |
From SICP
The sum procedure is only the simplest of a vast number of similar
abstractions that can be captured as higher-order procedures. Write an
analagous procedure called product that returns the product of the
values of a function at points over a given range. ... "Also
use product to compute approximat... |
I had to build a cash register that included a Coin class that allowed for all types of coins to be used. Please note that for this, no control structures can be used and no data structures such as arrays, lists, and what not. Any constructive criticism is welcome.
public class CashRegisterTest
{
//Test the methods... |
I have a data set where leaf mass (MASS) was measured in 30 different tanks (TANK) on 3 dates (DATE). The tanks were also assigned to 5 different treatments.
I want to calculate the regression slope of the mass loss for each tank so I wrote the following function in R
k.tank <- function() {
k <- numeric(0)
tank ... |
I am still a beginner in CSS and am trying to make a tiles/cards design. I have reached this code, and I want to know if my layout this way is good or if there are any improvements I need to make.
Is writing margin and padding auto is the right practice? How about using flexbox as am doing?
html{
font-size: 12px;
... |
What I mean by displacing an enumerable is skipping the first n items, then returning the next n items, then returning the first n items, then returning the rest of the enumerable.
What do you think? Does this idea have any value?
using System.Collections.Generic;
public class EnumerableDisplacer
{
public virtual... |
This is a variation of the Dining Philosophers Problem. The task is to coordinate several students inside a gym. All students try to obtain their desired training weights from a shared weight rack. During runtime, the user can issue commands to:
block a student (b + student id)
unblock a student (u + student id)
proce... |
I have built a small script that provides touch screen right click context menu with long touch press in my ELAN touchscreen.
There is no need to remove your finger in order context menu to pop up.
System Specs: Debian 8 Sid, with XFCE and Nautilus as WM.
Some environments handle right clicks differently:
Environments... |
My employer gave me a sit-stand desk, but I was forgetting to use it: I just sat almost all day. So for fun and learning I wrote a simple JavaFX reminder app to remind me to alternate between sitting and standing. The app is pictured below:
In the screenshot the app is telling me to stand, and it shows the time the re... |
I have written my first JavaScript program from scratch and am looking for advice to check whether it is efficient and effective or how it could be improved.
var apiURL = 'https://services.domain.com';
function dataPlanOutput(countryCode) {
document.getElementById("dataplan_list").innerHTML = "";
... |
I am writing an app to copy the contents of a directory to a removable drive. I'd like to know if there is a better way of structuring this.
The UI layout is a TreeView for selecting the source directory, a CheckedListBox which lists the removable drives, and a copy button.
Here is the code I have for when a user click... |
I have this Huffman compressor that can compress both text and binary files by treating each as binary files. (By the way, it is fully compatible with this Java implementation.) See what I have:
Code
main.cpp
#include "bit_string.hpp"
#include "byte_counts.hpp"
#include "huffman_decoder.hpp"
#include "huffman_deseriali... |
I am a Java programmer and very new to Perl. I decided to work on a simple script that could solve a problem I encounter in my day to day work. This script will search the log file for a pattern and print the complete potentially multi line log statement that has a match for this pattern. Additionally, the matched patt... |
I'm trying to implement a sparse vector (most elements are zero) dot product calculation. My major idea is to represent each sparse vector as a list (which holds only non-zero dimensions), and each element in the list is a 2-dimensional tuple -- where first dimension is index of vector, and 2nd dimension is its related... |
I'm working on a problem to select k nearest points for a given point. Any advice for bugs, improvements are appreciated, including general advice to implement find nearest k points.
My major idea is using the select-rank algorithm (similar to quicksort, using a pivot value, and divide-conquer the distance array). I th... |
I feel like there would be a better way to this. Essentially, I am transporting the data from an excel file to a DGV, and then from a DGV to an Access database. Should I cut the middle man or is this fine the way it is? The problem here is that my cells structure has to match access very closely to work.
private void b... |
Overview
I wanted to create a small console app that would point at a given directory, evaluate the last accessed date of each file within that directory, and if the last access date was below a certain threshold, archive that file. The archive folder structure should match that of the source directory. I also decided ... |
I want to create a new Excel files from an Apache POI object. The filename should contain the standard name, the current date and a counter, if necessary, to prevent collisions. I have a working solution here:
private File createFile() throws FileNotFoundException, IOException {
LOG.debug("Create File");
DateFo... |
I have been making a script to interact with a library I created before. I have ended up with a working script, but feel that the argparsing could be done a lot cleaner, and better.
First of all, some details about the script. These are the different processes that I try to support, using * to show it's required:
Logi... |
I need to work with stored procedures, with the help of Entity Framework Core. This is my function:
public async Task<bool> CheckIfUserRegistered(string phoneNumber, DateTime dateOfBirth)
{
if (string.IsNullOrWhiteSpace(phoneNumber))
{
return false;
}
using (var cmd = _db... |
I am trying to write a simple reusable pool of curl handles. I found this wonderful implementation of the blocking queue.
The pool itself looks like this:
class curl_pool
{
private:
int m_size;
queue<int> m_queue;
CURL **m_handles;
public:
class connection
{
friend class curl_pool... |
I often perform a lot of reshape(), transpose() or squeeze() operations on numpy arrays for numeric calculations. Often, this obfuscates the code. The initial shape as well as the resulting shape is unknown.
Prior solutions involved:
Comments (which may outdate).
Tiny functions with somewhat helpful names from_tbf_to_... |
Is there a more elegant way to do this in JavaScript?
function swapKey(obj, oldKey, newKey) {
if (obj[oldKey]) {
obj[newKey] = obj[oldKey];
delete obj[oldKey];
}
return obj;
}
(I understand that it mutates the original object and is not functional and makes the returning of obj somewhat redundant and tha... |
I decided to code a simple Hangman in Python today and wanted some feedback on the code since I only started programming three weeks ago.
I intentionally didn't add a lot of whitespace, it just doesn't make it any more readable for me - but feel free to give me reasons to start doing so.
Any tips and suggestions are ap... |
Sum Lists: You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in
reverse order, such that the 1 's digit is at the head of the list.
Write a function that adds the two numbers and returns the sum as a
linked list.
EXAMPLE
Input: (7-> 1 -> 6) + (5 -> ... |
I've implemented a promises in mongoose to reduce the amount of callback hell but I am not sure whether my technique is correct.
The scenario:
Before I can save my schema I want to run some functions in specific order. These functions update other collections in mongodb. So I have used promises to implement this.
Code:... |
Assign equal number chores to each person (assertion made elsewhere to ensure chores % number of people == 0) with the stipulation that each chore must not be one which the person was assigned the previous time.
My simpleton solution (there has to be a cleverer way):
import random
chores = ["hoovering", "dusting", ... |
I was wondering if you can give me advice / and your opinion on the following code. I'm aware there are a few things that it doesn't presently deal with that could be enhanced (I don't have time, this is part of an assignment and the basic functionality is complete).
Notifying user of their guess count has to be incre... |
kinda new to OOP, and I wanna know if i'm heading into the right direction. Also I should mention I'm not using AJAX
AnswerVoteManager.php
<?php
require '../config.php';
interface voting
{
public function voted();
public function redirect();
public function vote();
public function deleteVote();
public function addVote(... |
Implementing OAuthAuthentication with OWIN and Identity to secure Web API and let external application like Chrome Extension to access our self hosted API for getting and posting data through our server.
I know this is the basic implementation of OAuth. Could this still be improved in terms of security and best practic... |
I have a little class for loading a config file:
// index.js:
class Config {
constructor(path) {
this.path = path || this.defaultPath;
this.config = fs.readFileSync(this.path, { encoding: 'utf8' });
this.config = JSON.parse(this.config);
}
get() {
return this.config;
}
}... |
On one of the projects I'm working on, we have many objects that store (small) strings, loaded from database. I know std::string's have small string optimization (SSO), but the overhead, in my opinion, is too big; most strings are < 16 characters, and on my platform sizeof(std::string) is 32, wasting 50% of memory. Als... |
I want to write a cleaner version of the code shown below. It's about two different rows consisting of numbers that have to be weaved.
It's for an assignment for a course i'm currently following. This is the assignment:
Traveler, if riches are to be achieved, the solution only has to be weaved.
5,4 4,5 8,7
Weave 6... |
For Advent of Code Day 1, I found myself needing to use a tuple as a key in a dictionary. Seeing that I can't extend tuples in Swift, I decided to extend CGPoint to conform to Hashable:
extension CGPoint: Hashable {
public var hashValue: Int {
return hash()
}
func hash() -> Int {
var hash ... |
This heap will be used for A* search pathfinding in my 2D isometric game engine. It uses lambda functions (instead of std::less or std::greater) to allow me to dictate min-heap or max-heap more dynamically. It also uses lambda functions for FindByKey, ReplaceByKey, and RemoveByKey so that the search key can differ from... |
I am reading about algorithms and got to the binary search trees. I wanted to ask if the following implementation of a Binary Tree is correct.
import random
class Tree(object):
def __init__(self):
self.root = Node()
def insert(self,data):
self.root.insert(data)
def delete(self,data):
... |
I was requested to make a Sign-in program for the LGBTA Center at my university. They wanted something where anyone that came by and visited could leave their name and email, but also so that no one that came behind them could see who else has come in, like an Excel sheet or regular piece of paper would do.
The progra... |
I wrote a function in VBA for Excel that finds the highest row and highest column number in a range, which may include multiple, non-contiguous areas.
The function contains a parameter I call rowOrColumnOptionand I want to only allow values r or c (to return either a row or column number).
I was able to do this with an... |
I've recently started learning OpenGL and thought that a great way to start using it in its simplest form would be to create a Chip8 emulator using the keyboard callbacks and graphics that GLFW and OpenGL provide. As this question would be too large to request a review on my classes used with OpenGL and my Chip8 emula... |
Below is a sub I wrote to dynamically resize all the controls on a form. It utilizes the Tag property of each control. In that Tag property, I put four numbers separated by colons. So for instance, the Tag property of one particular control might be 03:10:20:10. These numbers represent Left, Top, Width, and Height (as ... |
Background
I am authoring pulley.objective, an Open Source library that provides an object system inspired by Python's object model. I have some features implemented, and would appreciate feedback before I continue.
Ultimate goals include:
Support for calculated properties
Allow methods to be attached to an object an... |
I have this function I've written to encode strings of binary data as base64 strings. I'd like to see if there are areas where it could be improved, specifically:
Is the function correct? Are there edge cases I haven't accounted for? (Handling arbitrary UTF-8 correctly is a "nice-to-have" but not a "need-to-have" if i... |
I have this code I am doing to make my code modular js:
$(function(){
var url, settings ={};
var language = mainSettings.getLanguage(); /* there is an object in the page called mainSettings with current language */
function applyLanguageSettings() {
if (language == "en") {
settings.web = "... |
I am trying to self study algorithms and this is my attempt at topological sort using Tarjan's version of DFS. It runs correctly for the graph I included. Can someone tell me if this is correct and if/what optimizations I can make?
graph = {
'A':['C'],
'B': ['C', 'D'],
'C': ['E'],
'D': ['F'],
'E': ['F'],
'F': ['G'],
'G... |
This is an update of Using an API to obtain JSON data and get the date string and determine if data is stale
This is a Nagios check that will use an API URL, get JSON data, flatten the data into a usable Perl hash, and ultimately obtain a date string. Once the date is obtained, it should recognize the strftime format b... |
I already solved it in JavaScript, where I'm more comfortable. I pretty much ported the algorithm from there.
I wanted to try the first Advent of Code puzzle in a new language and I picked Racket.
It's a taxicab geometry navigation problem. Given input R3, L5 you:
turn right 90 degrees
move forward 3 steps
turn left ... |
Following is basic JS code to create a YouTube search bar, search of query and load the results in a dropdown menu.
I am new to JS programming and I am seeking advice for how to write better code.
main.html
<html>
<head>
<link type="text/css" rel="stylesheet" href="https://golden-layout.com/files/latest/css/goldenlayou... |
I'm trying to generate a random time between now and 3 years ago. To my knowledge, Go doesn't have a random(min,max) feature in either math/rand or crypto/rand where min > 0. To naively combat that, I generate a slice containing every time stamp within the relative now and 3 years ago, and then select the index at rand... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.