instruction stringlengths 71 95.1k |
|---|
The code below generates tables of contents with collapsible subsections from HTML headers. I have done it for a WordPress website, so I can use either PHP or JQuery/JavaScript. I have used PHP to generate the HTML of the ToC and JQuery to collapse/un-collapse the sections.
The code works fine, but I was wondering if i... |
I was assigned the connected components labeling (CCL) algorithm and in order to implement the CCL algorithm I first had to implement the Union-Find algorithm.
This is my try at it, any review and tip would be greatly appreciated
classdef UnionFind < handle
properties
PARENT = containers.Map('KeyType', 'doub... |
I'm creating a generic pagination helper class.
Personally I use this class for navigating through Records which are loaded into
any sequential containers e.g QVector, QList etc.
The idea is that you load your data from any source such as a database, cloud, file, etc.
You specify how many results you want to load p... |
I have implemented a splash screen which is the main activity of my Android app. This splash screen shows an image, and after 1000ms there is an animation to show another activity's layout.
The code I've written is the following:
public class SplashScreen extends AppCompatActivity {
@Override
protected void on... |
Motivation / Task
An apparently trivial problem....
A CLI app tries to make use of box drawing characters. But depending on the stdout device this may not be appropriate so there is a -t option to use pure ASCII text.
The concept is just an example, this applies anywhere where we want to select from two or more sets o... |
I am currently creating a chess game in JavaScript, some aspects are yet to be done such as the computer player and turns, but before I get into writing these features I would like to know how to restructure or edit the code so it is more flexible to changes, and is more manageable. Right now it seems that to implement... |
I started learning python with the connect four game.
Now I'm searching for the best way to get all diagonal and anti-diagonal rows of a matrix. It should work with any 2-dimensional matrix.
My code works, but there are certainly better ways to do the task.
I get those rows with this generator:
def get_rows(self, width... |
I have a function that returns the contents of a file.
Since reading files from disk is expensive, I'd like to avoid having to read the file again after the first read.
I've come up with the function getFileContents that caches the file content in memory during the first call and returns the cached contents when called... |
I am currently working on an object-oriented mental math program using Java Swing. Since I am relatively new to the object oriented principals of design, it'd be nice to know how well the code conforms to OOP principals, and what kinds of improvements to make, including:
If it would be possible to introduce subclasses... |
I want to coalesce (lvalue references to) optionals of the same type, in C++17:
#include <optional>
template <typename... Ts>
constexpr auto coalesce(std::optional<Ts>&... optionals );
template <typename T>
constexpr std::optional<T>& coalesce(std::optional<T>& x, std::optional<T>& y)
{
return x.has_value() ? x :... |
When I submit the form, I need to validate the input data from an HTML form field, which comes from the user who submitted the data. So inside the Page_Load event, I added this.
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
AntiForgery.Validate();
}... |
CodeWars 6 Kyu: Reverse or rotate?
I wrote my Javascript "hello world" on Thursday, so I'm definitely a JS beginner. I do have some experience in Python though, so I'm not a complete novice to programming in general.
Question
The input is a string str of digits. Cut the string into chunks (a chunk here is a substrin... |
To convert JPEG file, C function, bgraToGrayscale is called from Swift.
Is there a better way to
1.allocate memory and
2.access pointers
than the ways they have been done in code below?
And maybe things that have been completely missed, like freeing memory?
converter.swift
func BGRAToGrayscale(srcImg: CGImage) -> CG... |
I am a beginner Java developer, and I am self learning Java by developing a real life business desktop application intended for management in repair shops. It is unimaginatively called Repair Shop Software. You can see the whole project on GitHub here. I just wanted an opinion on my data-structure management class Data... |
Pick peaks
Wrote my "hello world" on Thursday, so definitely a beginner. I know some Python, so not a novice to programming in general.
Question
For example, the array arr = [0, 1, 2, 5, 1, 0] has a peak at position 3 with a value of 5 (since arr[3] equals 5).
The output will be returned as an object with two properti... |
I have created a simple code which finds the factors of any given integer. It then compares the value of the input to the range of numbers. Because a prime number can factorize into 1 and itself. Then I search length of the factor list. If the list contains 2 or less elements it is added to the all_primes list. I have ... |
I have a method visible on a QuerySet class which should return all articles an user can see. If the user is not logged in, all articles with min_age should'nt be visible, otherwise, if the user is logged in, all articles which min_age is lower than the user's age should be visible. I wrote this code but I think it can... |
I have a REST library. These are the abstractions. Have I missed anything that a developer would need to use this in a dependency injection / IoC Container scenario? Anything that bothers you about this?
All Code Here
public interface IRestClient
{
IRestHeadersCollection DefaultRequestHeaders { get; }
TimeSpan... |
So this is my first attempt at making a calculator in c++, and i'm looking for experienced people to pinpoint what i could do better to make my calculator run better! *please note that i had to translate some parts of the code to english from my native language, and had to change bunch of names so if i forgot something... |
This is my first script that I've written. As a result, I'm sure there are extra lines that are unneeded, or maybe better more concise ways of doing things than I have done here. I have tried to add explanations to each section so that it's a bit easier to understand what's going on, and why I'm doing what I'm doing.
... |
This is the code (here):
import React, {
useContext,
useReducer,
createContext
} from "react";
import ReactDOM from "react-dom";
import "./styles.css";
const stateReducer = (state, action) => {
switch (action.type) {
case "increment":
return {
count: state.count + 1
};
default:
... |
shippingAddress.first_name = shippingAddress.first_name.trim()
shippingAddress.last_name = shippingAddress.last_name.trim()
shippingAddress.address1 = shippingAddress.address1.trim()
shippingAddress.address2 = shippingAddress.address2.trim()
shippingAddress.phone = shippingAddress.phone.trim()
s... |
I need to perform a bunch of string manipulation tasks on an original string, then output the final string. Best I could think of is extracting some functionality into functions. Any better way to structure it? Also, are the variable/function names too long?
strip out unicode chars from original string A, reverse them... |
I have not done Javascript programming in almost a decade. I see that it has changed a lot. Below is code that displays colourful block digits. Any constructive feedback is welcome.
function getRandomColor() {
const colours = ["#FF6663", "#94FF63", "#63FFEA", "#A763FF", "#F2FF63"];
return colours[Math.floor(Math.... |
I have some Python tests I have written, but these are for making assertions about data in infrastructure code (AWS CloudFormation templates). I am using the Unittest framework.
I have code like this:
class TestData(unittest.TestCase):
def testConfigStackYaml(self):
bad_list = []
for stack in glob... |
This is "homework" from a Swift course, which I'm currently taking. A mockup and the image-assets are provided by the instructor. We are supposed to create the layout and to write some appropriate code.
Here's the code of my ViewController:
import UIKit
class ViewController: UIViewController {
// MARK: Outlets
... |
I've created an small lib to allow writing to console with multiple threads and reading from console at the same time avoiding output being written in the middle of input because console cursor is there.
My library implements simple mechanism to make console write output above input.
TSConsole is the main class for in... |
There are many side controllers in my project, like the following images.
They share the same head view appearance and layout.
Use protocol to extract common code .
protocol SideHeaderDelegate: class {
var h: SideHeader{ get set }
var view: UIView! {get}
var follow: UIView {get}
func back()
}
Use... |
This code currently works i wonder if i could make any optimisations or anything to make the code appear cleaner using functions or whatnot, suggestions are welcome!
#include <cmath>
#include <cstdio>
int prompt(const char* name)
{
printf("%s", name);
int value;
scanf("%d", &value);
return value;
}
int main()
{
... |
I made an n-body gravitational simulation in python. The algorithm does produce an approximate solution, which is shown at the bottom of the post. Additional methods to produce animations (among other things) can be found here. I would like to see if efficiency, readability, and/or accuracy can be improved.
The main i... |
I am creating a simple model relation in ASP.Net core. My model relations are like this:
A user can have many posts
A post can have many comments
A user can have many comments
Now I am trying to seed the relations using the dbcontext. I have a feeling that I am doing something wrong. Can anybody determine if I am doi... |
Say you have an array that is "semi-sorted", e.g. something like this:
[7,8,9,10,1,2,3,4,5,6]
Where a part of the end of the sorted array was transferred to the beginning.
Is there a way to still find an element in it in log(n) time?
Here's my solution:
def findVal(arr, val):
return helper(arr, 0, len(arr) - 1, va... |
Sum Strings
Codewars kata.
It's supposed to be able to handle big integers.
Question
Given the string representations of two integers, return the string representation of the sum of those integers.
For example:
sumStrings('1','2') // => '3'
A string representation of an integer will contain no characters besides ... |
Sometimes, I have a lot of things I want to ask the Internet, so I decided to make my searches go faster with some automation...
But I think this could be programmed better, even though I think it's pretty compact.
from subprocess import call
with open("C:\\Users\\Andy\\Desktop\\queries.txt").read().splitlines() as f,... |
Wracking my brain trying to figure this out. I'm not the greatest with Jquery but know enough to kinda get by. Right now I am trying to develop something that will check if a radio button in a group is checked and then to see if its value matches so it can then show the correct corresponding section. I have a crude JSF... |
I don't know whether if this is the right place to ask this.
I am semi-beginner in C. I always wanted to build my own Programming Language. Here I have built a lexical analyser completely myself. The lexer breaks the source code in tokens consisting of strings, characters, identifiers, constants and special symbols. I... |
I'm writing a tool which users can select multiple choices at once. Whilst I can't provide the actual content, I've replicated it with fruit. I'm replicating some functionality from Nikto where it allows different flags like "-mutation abcd".
for example here we have three fruits:
1- apple
2- orange
3- kiwi
I wanna le... |
I tried to create a reusable component which would allow the user to create cards which can have a header, cover image, avatar section (image, title and sub title), a description, a table, a list and a few buttons (add, delete, edit, like, share). All of these are optional and the user can omit whatever is not needed f... |
I wanted a polyfill of flexible array members in C89.
So I made something similar, and made a toy std::vector with limited functionality on top of it.
Here is the code:
vector.h
/* Flexible array member example in C89 - Just because we can!
* It's demonstrated by vectors, but can be generalized.
* MIT License; see be... |
What is the problem when I return a promise from angular service instead of Observable?
If it's a matter of any manipulation or side-effect, that I can easily do inside angular service itself. Then why I shouldn't return a promise over observable?
Here's my code for service class
public async getCountriesAsync(filter: ... |
I wrote script to install public key of my system to remote host.
I had tested the script it is working fine for me.
script take data like IP password and ssh port form CVS file.
I do not want to use import os.
only use CSV and paramiko imports.
My aim is to copy public key to my remote host.
import csv
import os
from... |
Very new to JS (wrote my "Hello World" around 3 days ago), but not to programming in general. My documentation is inspired by the approach I followed for Python (since I haven't learned JS documentation conventions yet).
My Code
"use strict";
/*
Inserts elements from a given source array in a specified target array... |
This generates a square matrix with spiral inward increasing values. How can I reduce this code?
Input Number = 3
Output
1 2 3
8 9 4
7 6 5
import math
row=int(input("Input nomber := "))
lis=[[0 for i in range(0,row)]for j in range(0,row)]
y=row
a=1
c=0
z=0
x=1
k=1
f=row/2
f=math.ceil(f)
for b in range(0,f):
if b=... |
As the year comes to an end our company need new time-sheets for the new year. Because this is my task to do, I thought I would do my collegues something good by automating some tasks they would otherwise need to do manually.
Until now we had a worksheet for presettings, like setting employee-name, ident-number, rema... |
I think we all know the game of Scrabble and how popular it is as a simple programming challenge. Here's my attempt at computing a Scrabble score for a given word done in Go.
I must admit, I'm fairly new to Go (been learning it for a week or so). Having said that, I'd greatly appreciate all sorts of tips for improving ... |
I am trying to refactor a chess game I am currently creating so the code is more flexible and maintainable, while doing this, I came across an event listener which I have no idea on how to make "cleaner". Some of the variable names in the event listener are unintuitive but apart from that, I would like to know how to s... |
I am making a ros node to implement dijkstra's algorithm on a 1000x1000 pixel map.
I have used map_server to convert the map into an nav_msgs/OccupancyGrid.
The map is in the form of a row dominant matrix and I have declared visited, distance and prev in the same form. Distance stores the distance of each index and is... |
I'm quite new to C programming so I'm trying to learn the basics. I've made a program that creates a linked list of numbers, then ask user for which number he/she wants to replace and then what number should come instead.
I finally got it to work, but since I'm learning this on my own no one is there to say when my sty... |
This is my solution to the Codewars problem TV Remote (symbols).
Description
In short, you are given a virtual keyboard with 3 modes between which can be switched by pressing the Shift button on the virtual keyboard.
You have to navigate using only arrow buttons (up, right, down, left) and an OK-button to press the cu... |
Using Rails 6. Here's a piece that I wrote just to display number of stars. Obviously I am disgusted by my own code. How would you refactor?
# application_helper.rb
module ApplicationHelper
def show_star_rating(rating)
zero_star_icon_name = "star"
full_star_icon_name = "star_fill"
half_star_icon_name = "s... |
I am writing code to implement data sync from multiple sources. I want code to be maintainable to add more data sources if required.
Here is the pattern I wish to follow:
class Source1Client:
def get_domain(self):
pass
def get_endpoint(self):
pass
def get_headers(self):
pass
... |
I'm quite new to both Java and OOP.
I'm assuming that pretty much everything about my code can be improved and I appreciate any feedback. However, I am particularly interested in what you think about my code clarity/structure/organisation. For example, I've struggled to decide when functionality should be extracted in... |
I've wrote a little program to play Tic-Tac-Toe:
public class Control {
public static void main(String args[]) {
Gui gui = new Gui();
}
}
The following classed is used for applying the rules of tic-tac-toe:
import javax.swing.*;
public class TicTacToe {
public static int count = 0;
public sta... |
I have a 60GB file of domain names. Some of them are repeated several times and some of them have sub domains that need stripping out too.
For example this might give you a better idea of what the file looks like.
email.example.com
test.staging.lol.uni.ac.uk
hello.test.com
email.example.com
test.com
After parsing the ... |
You are given to paint a floor area of size A. There will be 12 paint buckets from 4 primary
colors with each having 3 shades (i.e. total 12 buckets). The bucket size, or more specifically,
the amount of area you can paint from each shade is given in the following arrays.
The different shades of the same primary color ... |
I was wondering if anyone would be kind enough to review my basic c++ program. I'm a beginner programmer so was hoping to get feedback on how well I've used object oriented programming i.e. using a class in my program. And in general, how can I make my program better? Many thanks in advance.
// Created by George Austi... |
We are using a plugin for our WordPress website. I'm trying to add some custom code to it and finally got it working however it is ultra janky. The HTML is a simplified version of the actual site's but it's the JQuery I need help with. I'm trying to trim as much fat as I possibly can. I'm am not the greatest with JQuer... |
I'm trying to generate the sum of a collection of strings by calcuating each character's byte value into a sum:
$sum = 0;
foreach( $array as $item ) {
$bytes = unpack( 'C*', $item );
for( $i = 1; $i <= count( $bytes ); $i++ ) {
if( isset( $bytes[$i+1] ) ) {
$sum += $bytes[$i] - $bytes[$i+1... |
I just wrote a Python script that will take a list of urls and find which ones are about to expire.
The program queries a database, gets the websites, sanitizes the list, then loops through the list and prints the expiration dates to the file. Any websites that expire within 30 days are printed to a text file as well ... |
I've finished implementing a dynamic array in C++. I'm a beginner in C++ and also in algorithms and data structures, so any constructive feedback about improving the implementation would be greatly appreciated.
#include <iostream>
using namespace std;
#define INITIAL_CAPACITY 5
template <class T>
class dynamic_array... |
Here is a functional "card-drafting engine" which runs through pygame. It simulates fliping cards face up on the table, and the ability for two players to draft through the cards.There are two questions I have, and am very open to advice.
import pygame
import random
import pandas as pd
"""Layout"""
DISPLAY_HEI = 700
D... |
I am trying to code a menu that:
Is horizontal on lg+ displays at the top of the page
Shows a hamburger menu when the user scrolls from the top
Will display as the collapsed format when the hamburger is clicked on desktop and mobile
I managed to code this in a way that exhibits all of the proper behaviors, but it feel... |
My application state is represented by a string of numbers and I'm trying to encode the string so that it is as small as possible (ie. fewest number of characters). An example string would be: 133223333302302040
I realized that most of these strings consist of number pairs containing 0, 1, 2, 3 (4 and 5 also exist but ... |
I wrote the following Python program to take 1 word from the user and return certain characters replaced by numbers. Given a dictionary, the program should print all possible combinations of the same word with various characters substituted:
import sys
def main(argv):
if len(argv) != 2:
print(f"USAGE: {ar... |
Scenario
A session would start & end within a time frame. Within this time frame, the device would be moving within a constraint environment. The movement would be extremely slow (slow-walking to stillness).
This session could (& would) be entered & exited several times, although doing just a single session might be s... |
This is an AI class that takes an array of the board as an argument, and plays the best move after evaluating the board and gets a win rate. I haven't used any java package to do this. How can I make a genetic tree and calculate all possibilities for a given situation
public class AI
{
int turn,ID;
AI(int pID)
... |
Shown below is a function I wrote for pawn move generation, I find it difficult to understand what the code does in a glance due to the cumbersome if statements, so any changes I make are done unnecessarily slowly. Is there a way to avoid these complex if statements so that the code is more maintainable?
if(standardP... |
I have written a quick sort routine to inplace sort an array in descending order:
module sort
contains
recursive subroutine qsort_self(array)
real(kind=8) :: array(:), temp
integer :: length, pivot, i, j
i = 0
j = 0
length = 0
pivot = 1
temp = 0
length = size(ar... |
I have developed this script to read employee_language table records of a PostgreSQL database using Python 2 (due to some OS limitation). I want to find duplicate language records for each employee, check if there are any duplicate language records for each employee, get the most completed language records among duplic... |
So I am solving this task:
We have an permutation of the numbers 1..n.
I need to answer m queries:
-How many numbers between X-th and Y-th position are in the interval [L,K] (<=k and >= L)?
So my solution is simple: I create a segment tree and in every node i keep an map -> which numbers are in this interval and the p... |
I want to learn Wasm and Rust. This project can execute Wasm from GitHub Pages. The first attempts failed because of some policy error with the Wasm MIME type. When I tried Yew Framework then it worked to run Wasm for my first attempt (it just writes random rows from a text file).
For some reason I got a MIME type erro... |
I'm trying to find a sensible way to structure a REST API written in Flask. I'm new to writing such things and I've not seen this structure used anywhere else, so before I continue I wanted to ask whether this is a decent way of structuring my API code, or if I'm missing something.
I have decided on the following struc... |
The problem is as follows: Given two arrays, write a function to compute their intersection.
The below code is my solution.I'm just curious as to what the space time and complexity of below algorithm would be.
var intersection = function(nums1, nums2) {
const intersectionArr = nums1.filter((value)=> nums2.include... |
Is my Python Script to play Hanoi Tower respectful of OOP spirit?
I have difficulties to create meaningful classes so I started an easy project. Here is one class at the plateau level and then a class to handle towers.
How can it be improved (on the OOP level and on script level)?
I want then a GUI with TKinter, a thir... |
Please be gentle. I'm a pygame n00b and haven't touched pygame in years. This is my unique implementation of the classic game snake. In this game, the snake has a velocity which can vary along both axes of motion in increments of one pixel per frame and the tail follows the exact path the head travels as the snake move... |
This is more to get clarity on an implementation that I did. I am working on a React, Node, and Electron application that essentially has a form that a user inputs values that will update some content files.
The application has to scale for a lot of different scenarios so I found that I kept writing switch statements t... |
The code takes a very simple xml and converts it into a dataframe in csv file.
This is the Xml file
<Data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Phones>
<Date />
<Prog />
<Box />
<Feature />
<WIN>MAFWDS</WIN>
<Set>234234</Set>
<... |
I've never programmed in C before, but decided I wanted to try making Chess. Currently there's no way to check whether the game has ended. Was looking for critique for future projects.
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
// 1 pawn 2 rock 3 bishop 4 knight 5 queen 6 king
int currentTurn = 1;
int bo... |
So in my quest to learn coding while having very little formal training has got me here. I am trying to learn the OOP concept and this is my first proper attempt at using OOP.
Can you guys point out what can be improved and what are the better practices? I have tried my best to make the program as robust as possible - ... |
hackerrank.com Task:
Given a base-10 integer, n, convert it to binary (base-2). Then find and print the base-10 integer denoting the maximum number of consecutive 1's in n's binary representation.
This question has already been answered but it was in Ruby and I couldn't quite understand the concept, I am just startin... |
Just starting to get the idea of MVC with tkinter. I wrote this simple program and I'm looking for feedback. There are no errors, but I don't know if I set it up right or not.
import tkinter as tk
class Model():
def __init__(self):
self.list = ["email", "sms", 'voice']
class View(tk.Frame):
def __ini... |
Background
This is solution to Problem 11 on Project Euler that is concerned with finding largest product of four adjacent numbers in the provided grid.
Other than solving the problem I was also interested in creating a search function that would have a more generic character and could search across any number of adjac... |
I wrote a code to parse an HTML knock-off from HackerRank, and I would like a review. Mostly I hope to get better at STL and code style. But any tips would be very welcome.
Sample input that I would read from cin to parse and answer queries:
4 3
<tag1 value = "HelloWorld">
<tag2 name = "Name1">
</tag2>
</tag1... |
I would appreciate some feedback on the below code I wrote for a Project Euler problem. The answer comes out correct but I'd like feedback on the design of the function and implementation of docstrings. It seems to me that it may be overly complicated but I'm not sure how to simplify.
"""
Number letter counts
Problem... |
The Challenge
Given a big string and a list of smaller strings, find the minimum amount of spaces that must be inserted between characters of the string in such way that it becomes composed only of elements from the list of smaller strings. (and which are the respective elements used). [Python 3]
For instance, if you... |
I have implemented a Matrix class that allocates memory using unique_ptr. How to make it more diverse and optimized in terms of memory usage and efficiency?
//
// Created by Mayukh Sarkar on 26/12/19.
//
#ifndef DP2_MATRIX_H
#define DP2_MATRIX_H
#include <cstdio>
#include <memory>
#include <algorithm>
template <typ... |
What would be the shortest way to capture folder structure in code? I would like to have a more or less reusable strictly typed approach to use in scripts instead of stringly typed paths we all usually deal with. Here is how a part of my simple “system info” utility looks like:
static void Main(string[] args)
{
for... |
Whats the best practice for calling a function with a complex set of arguments?
I've seen a 1 and 2 in most codebases, but I haven't seen 3.
Since it's almost impossible to search for **{ in codebases, does anyone know why this pattern isn't used more often?
I'm using Google's Sheet's API v4 as a demonstration, which... |
I implemented a sha256 hash function for javascript just for a practice and I want to know if my code needs more improvement. Please tell me which to simplify if there's any. Thanks.
Here is my code:
var sha256TOOLS = {};
//sha256 constant
sha256TOOLS.k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x5... |
I have created like this validator for reactive form, all working but I think I used so many statements, can somebody help me to make proper validation
Here is my validator
export function validateIfOneIsRequired(): ValidatorFn {
return function validateIfOneIsRequired(formGroup: FormGroup) {
const startTime = fo... |
I am trying to make a function for floating point numbers comparison.
The goal is to "evaluate" all operators in single function: >, >=, =, <=, <.
If X>Y, then F>0. If X==Y, F==0. If X<=Y, F<=0 etc (where F is returned value).
I took a piece of code from numeric limits. First thing I changed, in scaling of epsilon, fa... |
The problem is:
Given an undirected graph represented as an adjacency matrix and an
integer k, write a function to determine whether each vertex in the
graph can be coloured such that no two adjacent vertices share the same
colour using at most k colours.
Source: https://www.dailycodingproblem.com/
The propo... |
I'm learning object oriented programming and am still trying to understand the best way to structure a class for modularity and attempting to follow DRY principles. I currently created a class containing multiple requests that share the same self.reponse block repeatedly. I am not sure the best way to abstract this out... |
I have created a script for article scraping - it finds title, subtitle, href-link, and the time of publication. Once retrieved, information is converted to a pandas dataframe, and the link for the next page is returned as well (so that it parses page after page).
Everything works as expected, though I feel there shou... |
I been writing code for my company for years and there is never any constructive criticism for what I do. I am the only developer here and I would appreciate your opinion on this web page I made. It grabs data from a mssql database and places it in a data table adds some calculations then displays the data in a gridvi... |
I've decided on splitting my environments keeping them in .js files in an environment folder and keep all the sensitive information in .env file (use a third-party module 'DOTENV').
That's what I've come up with but I understand that it's not the best practice and there are a lot of things which should have been implem... |
I don't have much experience with testing but I'm trying to make it part of my routine to develop better software.
The class below is a service class in Laravel. It needs to save a record on the database, saving the customer's customer_id, a route (location_id_from and location_id_to) and which location to bill (locati... |
I have a transformer helper function. It reduces over the array and transform key/value pairs. At the end of the loop there is the key 'EXAMPLE1' exists and I should insert two objects after the first and the second array(result) items. Right now, it works as expected, but I have concerns - is it a good approach for us... |
After using an online tool to convert a PDF glossary of English-French cognates to a .txt file, I wanted to write a simple script to extract the cognate pairs and save them to a CSV. I could then import them to my flashcard software (Anki). The .txt file ended up being rather messy, and, as a novice programmer who's ne... |
I have a redis caching server. If that caching server is down, my app will query the database directly.
I want to know from the logs if my caching server is not reachable. However, if I add a log error, it would completely spam my logfiles if a high amount of users would try to access data.
As a result, I would like to... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.