instruction stringlengths 71 71.9k |
|---|
I'm new to jQuery but have managed to get it working the way I want. The problem is, it's a bit convoluted and could easily get out of hand if I add more options.
I am trying to show and hide divs based on a user's dropdown selection. I've made a JSFiddle with where I am so far, but I think it could do with some stream... |
I implemented type (UserRuleManager) that will apply list of rules to entity User. I need your code review and your advices.
Here is usage of that type
private void ProcessUser(User user)
{
if (!_userRuleManager.ApplyGeneralRules(user))
{
SetWarning();
} else if (!_userRuleManager.ApplySpecificR... |
As I am a novice, I was keen to solve the task, so now I want to optimize the code.
Sub AddOlEObject()
Dim mainWorkBook As Workbook
Set mainWorkBook = ActiveWorkbook
Sheets("SingleProfile").Activate
Folderpath = "C:\Users\sandeep.hc\Pics"
Set fso = CreateObject("Scripting.FileSystemObject")
No... |
I seem to be in a love-hate relationship with C++. It can make some parts of your code elegant and easy to grasp, and some others become an inconceivable mess. And it's not the language itself causing the problem, but the allure of some language constructs which can lead to many headaches in the long run.
I have a coll... |
I recently started picking up the Haskell programming language. I've managed to learn other languages rather quickly, but I'm still having a difficult time grasping some of the basics of Haskell.
I decided to practice and wrote a program that calculates the Fibonacci Sequence (original, I know) a certain amount of time... |
Challenge URL:
http://acm.scu.edu.cn/soj/problem.action?id=3330
Windy has a matrix A with size N*M which only contains 0 or 1. The
distance between Axy and Apq is: |x-p| + |y-q| Can you help Windy to
find the minimum distance between Aij and 1? Output the sum of the
minimum distance of all Aij.
Input
The first line o... |
I've been reading the Chapter 8 of this book.
Here's the view I'm currently coding. It list all characters/guilds according to the type of URL.
/ranking -> List Top 50 Characters
/ranking/guild -> List top guilds
/ranking/pvp -> list top killers
def ranking(request, type):
if type=='':
queryset_list = ... |
I am a computational chemist working with the program Gaussian 09. After I manually check the output(s) I want to create a summary for easier processing of the obtained values. Also avoid opening all the files again and again. The script searches for the last line of the energy statement. A portion of the output will b... |
I have an userform that has check boxes where user can decide which worksheets to print.
Code in userform:
Sub PrintOK_Click()
PrintSelection = Summary.value + _
CCSummary.value + _
DivSalaries.value + _
CCSalaries.value + _
PrintAll.value _
' Displays warning box if no report is selected
If PrintSelection = 0 Then
... |
This is related to my (unanswered) question here, but the code has changed considerably since I asked that question. I have a method that takes the filename of a PDF file and a Script object, and applies the Script to the PDF. If you are not familiar, PDFs support JavaScript to perform various tasks such as changing th... |
The function below is designed to return a UTC offset string, in the form used widely by timestamps, of the user's current time for when only naive date time objects are available (no time zone information).
I've tested it on two systems, which are in different time zones, and it works perfectly. However I'd like confi... |
This is related to here and here. These two methods are used to programatically add a text field to a PDF document. The field can be of any user determined size and have any user determined title, and will be on the pages specified by an enum value.
private void AddFieldToPdf(Field field,
iTextSharp.text.pdf.PdfSta... |
I was just writing some code the other day, and I found myself writing something I am not sure whether it is OK to do it like this, or not.
Let me give an example of what this is:
I have this Method:
public static string STOLENVersion()
{
string version = string.Empty;
try
{
... |
This js was written strictly for a visualization of a graph redesign included in a stats report within our game systems. It all works properly, but I know there has to be a much neater way to organize this. I have some ideas, but I don't quite know how to approach it. Any guidance would be greatly appreciated.
var ... |
I have written my first rock, paper, scissors project recently. I had to use a lot of if statements and System.out.println(); commands in the program. I am wondering what ways I could optimize my program to contain less lines of code/run faster. Are there ways to get the job done using more practical coding techniques ... |
I am a beginner with only about 2 months under my belt. I'm learning Python 3 using the Automate the Boring Stuff with Python manual. In the chapter on reading and writing files one of the exercises is to make a program that would fill in a mad lib that was read from a file. It works, but it's not very elegant. Can any... |
I'm seeking code review comments for the following implementation.
jsFiddle
/**
* You need to run a number of async tasks, but you're being rate limited.
* Run as many concurrent tasks as you can, queueing the rest for when the
* tasks are complete.
*/
/**
* @param concurrency: number of concurrent tasks that can be r... |
Challenged by Sandy Metz's newsletter, I've tried to implement this kata from exercism. However, my solution, which passes the tests, is quite a lot simpler than Sandy's solution. Ok, so she's using refinements and also supports the inverse, but still... As she's probably smarter than me, do I miss something?
class Fix... |
Task
I have a large spreadsheet where each line should include:
The URL of a social media account
A field indicating whether the account is "active"
A name and UID number for each account
I have to find if the activity field is accurate for every account on the list, and fix any mismatches.
Code
##### IMPORTS
impor... |
My code has a nasty smell that looks like this:
@RequestMapping(value = { "/updateGraph" }, method = RequestMethod.POST)
public ResponseEntity<ArrowsGraph> updateGraph(@RequestBody ArrowsGraph g){
try{
g = arrowsBo.updateGraph(g);
return new ResponseEntity<ArrowsGraph>(g, HttpStatus.OK);... |
I made a simple program in which I compare two images pixel by pixel and determine if the pictures are the same. I'm trying to adapt it to MPI, but I'm afraid that the communications are taking too long, making it way more inefficient than its sequential counterpart. I have tried with images of very big resolution and ... |
Original post here:
MIST - auto-implemented, attribute-driven .NET notification mechanism
I've developed (and use) an IL "weaving" solution for auto-implementing property change notification in .NET applications, but I'm considering using a different tactic for making the IL modifications.
I can replace the InsertNoti... |
In C# I wrote a method to move a folder into another existing folder:
public void MoveFolder(string folderToMove, string destination)
{
String destinationFolder = Path.Combine(
destination, Path.GetFileName(folderToMove));
Directory.Move(folderToMove, destinationFolder);
}
Usage:
MoveFolder(@"D:\myfol... |
I want to convert strings with the iso date format (2015-08-02) to the default format of our app (2 Aug 2015) in ClojureScript. As I don't need anything else, I don't want to pull in libs like cljs-time.
I'm quite new to Clojure & ClojureScript, so I want to ask for some feedback on this small snippet. Thanks!
(defn fo... |
I have recently started writing a userscript for Mozilla Firefox to tighten security and make it more private, but before I want to start publishing it, I would like to have some experts take a look at it to see if I made any mistakes, I am by no means a experienced coder, and this is my first little project. Things I ... |
Can anyone here please review my PHP code which preserves line break by splitting the line into as many line break as it have?
class PerserveLineBreak
{
//Preserves line break in HTML element content while stripping by splitting the html element content into two items
protected $text;
protected $pattern;
... |
Both ways work:
os.path.join(os.path.dirname(__file__), '../../../testdata'))
or
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'testdata'))
First is shorter. Is there any reason to use 2nd syntax?
|
As a follow-up to this SO question, I implemented, for my Prolog-based language Brachylog, my own labeling predicate brachylog_equals/2 which is not guaranteed to terminate but works for infinite domains:
brachylog_equals(Z,Z) :-
brachylog_equals_('init',10,Z).
brachylog_equals_(I,J,'integer':Z) :-
fd_inf(Z,'i... |
I am building an API where the client can send a url and some comma-delimited tags:
{
"url": "https://www.youtube.com/watch?v=pquxHIBx8ks",
"tags": "JavaScript, Sequelize"
}
Before processing this data, I want to validate the input. To do that, I wrote a middleware function called validateSubmitScreencastReq:
i... |
I'm trying to cover the following 4 scenarios:
No parameters
DB param
DB param and 1 option
No DB param and 1 option
So far I have the program working for all scenarios. However, I'm not happy with the way it's implemented. Is it possible to change this to a cleaner solution, rather than checking if there's only 1 pa... |
I started taking the Algorithm design class from Coursera. So into the third week they talk about Greedy algorithms and walks through a sample problem.
This is the Problem Statement that I could find which was close.
Professor Midas drives an automobile from Newark to Reno along
Interstate 80. His car’s gas tank, wh... |
In web api controller:
I am a newer in parallel and Async&Task programming. Need someone help me code review.
public async Task<IHttpActionResult> DoWork()
{
List<string> listTask = await Helper.GetBlockBlock();
userIds = listTask;
this.ParallelTaskWork();//step 1,must be finished,but I an not sure when..
... |
I'm solving some online puzzles and I had this problem:
Given a vector, write code to find the indices of TWO values which sum to a given number N
so if I'm given [2, 5, 6] and N = 8, I should output the 0-based indices [0, 2].
I wrote the following code to do this in O(N)
vector<int> twoSum(vector<int>& nums, int ta... |
Here is a snakes and ladders game I made using an Arduino using a serial terminal, a set of addressable LED's to create a physical game board, a 7 segment display, and a piezoelectric to create sound.
I'd love to get some feed back on this regarding what I did right, what I did wrong, and any improvements that can be m... |
I was asked the following question:
Given a data stream input of non-negative integers a1, a2, ..., an,
..., summarize the numbers seen so far as a list of disjoint
intervals.
For example, suppose the integers from the data stream are 1, 3, 7, 2,
6, ..., then the summary will be:
[1, 1]
[1, 1], [3, 3]
[1, 1],... |
From SICP
Exercise 1.28:
One variant of the Fermat test that cannot be fooled is
called the Miller-Rabin test (Miller 1976; Rabin 1980). This starts
from an alternate form of Fermat’s Little Theorem, which states that
if \$n\$ is a prime number and \$a\$ is any positive integer less than \$n\$, then
\$a\$ rai... |
I have some code where the purpose is the decide if a char is between quotes in an expression. For example, awk '{print $1}' has a { between quotes.
The function that I want to test is
int IBQplain(int pos, char *str, int offset);
int IBQdouble(int pos, char *str, int offset);
int IBQsingle(int pos, char *str, int o... |
The third post in the Code Explorer series is about the UI and main VM.
This is the XAML, except a few hundred lines of styling:
<UserControl x:Class="Rubberduck.UI.CodeExplorer.CodeExplorerControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.micro... |
I have a json file which needs to be restructured.
The following is the code.
while IFS='' read -r line || [[ -n "$line" ]]; do
COUNT=$(( $COUNT + 1 ))
#echo "[$COUNT]"
[ $COUNT -lt 5 ] && continue
sj=`echo $line | jq ._source`
index=`echo $line | jq ._index | tr -d '"'`
itype=`echo $line | jq... |
To brush up my C I decided to do some OOP programming in C. I have never tested this before, but I was curious to try it since seeing an example of it a while ago. I decided to implement a simple hash table. My first approach was to give each instance of the object its own methods, i.e. pointers to functions, but this ... |
This is a follow up of Simple, generic background thread worker class
What changed?
Moved from synchronized lazily evaluated static instances to true Singletons per the on-demand holder idiom https://en.wikipedia.org/wiki/Initialization-on-demand_holder_idiom
Added a constructor to auto-start the Thread.
Why is this ... |
I was solving the DIVFACT problem from Sphere Online Judge:
Given a number, find the total number of divisors of the factorial of the number.
Since the answer can be very large, print the answer modulo \$10^9+7\$.
Input
The first line contains \$T\$, the number of test cases
\$T\$ lines follows each containing the ... |
(Note: this is originally posted as this SO question )
I'm trying to refactor the error logging and exception throwing into a method.
Original code:
private Box retrieveBox() {
BoxParameter param = new BoxParameter("red", 10, 5, 3);
List<Long> boxIds = boxDao.retrieveByParameter(param);
if (boxIds.isEmpty... |
For a while now I've been meaning to post some of my Haskell code here so that someone can tell me what parts of the language/base library I've been completely overlooking. This is the first thing I've brought into a "working/finished" state that isn't a PE problem, and unfortunately it is a tad big.
It is rather mathe... |
Here's my solution but I am looking for ways to improve the time complexity of solution. Also this question is categorized as being solved by stack so I would like to know how to approach it using stacks?
Problem statement: Given n non-negative integers representing the histogram’s bar height where the width of each ba... |
Is there an easier way of importing data into an Excel array or other data structure? I've tried researching collections but I have found the documentation hard to comprehend.
MSDN
The code I have opens a select file and searches for the column header and then loops through each row storing the data according to header... |
This script reads records from a CSV file of customer names and addresses. The first record of the file is the header (field names); the fields could be in any order, and sometimes have different variations on the field names.
I import the header into a one-dimensional array of field names, and use this loop to assign ... |
I built a 404 page which involves parallax scrolling text. The program updates the position of 100-200 text nodes at each animation frame called with window.requestAnimationFrame. It runs decently well on my MacBook (although it occupies significant CPU), but on weaker computers like my phone, it runs very sluggishly.
... |
EDIT:
I've created a repo and uploaded it to Maven (still in dev though).
Any suggestion or pull request is more than appreciated. :)
https://github.com/enrichman/vigenere
I had the need to write a simple encryption algorithm (no security needs, it just needs to look a bit random) and I thought to add a bit of random ... |
This does what I want:
function test(data){
for(var key in data){
if(/_is$/.test(key)){
var obj = {}
obj[key] = data[key];
return obj;
}
}
}
test( {a: 'a', user_id_is: '1', b: 'b'} )
> Object {user_id_is: "1"}
But 8 lines of code for such a simple task looks ineff... |
I'm sure that my server can work with better performance, but it's just a dream.
Parsing a very long strings is not so obvious task for me.
I have a server that handles a lot of clients requests and finds a substring of a string.
Server
package api
import (
"net/http"
"stackexchange/api/controllers"
)
func st... |
I want to create a simple CRUD app using angular on the frontend.
I'm not really happy with the logic here, it seems a bit convoluted for fairly simple functionality.
<div class = "container-fluid">
<div id = "table" class = "row" ng-repeat = "o in objects" ng-init = "o.isBeingEdit = false">
<... |
The following code is designed to be a multidimensional array that works off of a continuous block of memory. It is designed to be able to be resized at runtime, but only when a resize is explicitly requested.
#include <memory>
#include <cstddef>
namespace detail{
//frame buffer class: represents a 2d array of au... |
Here is my code to create a definition text from 3 arguments. Is there any way to make it work with better performance and look nicer?
private const string IllegalCharacters = "\\" + "\"" + "'#,.[]{}" + " ";
public static string CreateDefText(string mainId, string secondaryId, string extraText)
{
... |
I've made this function to map alphabetic coordinates to their corresponding ordinal number.
var exec = document.querySelector('#exec');
// Maps alphabetic characters to their index
// within the alphabet.
// --------------------------------------------
// @param { string || array } chars - String
// cons... |
This is the "Minion's bored game" problem from Google's "Foobar challenge":
There you have it. Yet another pointless "bored" game created by the bored minions of Professor Boolean.
The game is a single player game, played on a board with \$n\$ squares in a horizontal row. The minion places a token on the left-most squ... |
I am writing a Model to read, write and store settings.
I think my code is pretty good, but I am not 100% sure.
Any advice on how I could possibly improve it is welcome.
import ntpath
import yaml
class Settings:
def __init__(self, paths=None, default_path=None):
"""Load, write and store settings
... |
Problem:
Given 2 strings, consider all the substrings within them of length
len. Len will be 1 or more. Returns true if there are any such
substrings which appear in both strings. Compute this in linear time
using a HashSet.
I know as a matter of fact that there are many areas upon which my code could be impro... |
This was my first foray into a Tkinter app and so I chose a simple and certainly overkill task to make into a gui.
Aside from one small aspect, this code functions as I was intending and seems to have adequate performance. I'm looking for help to make it more pythonic, not by simply pep8-ing it but by helping me better... |
I have written a script, that reformats the output of qstat -f1 of the PBS queueing system. Unfortunately this project is by far too big to post here complete, also I am still working on it.
The purpose is to have a quick overview of what is running by whom and what resources are blocked. I am am also using chains, whe... |
This is an update from here. This tool is a Windows Form application that can add fields and scripts to PDF files, as well as convert Microsoft Office Word documents to PDF.
The usage is as follows:
User opens program and presses "Select Files" button.
A dialog opens allowing the user to select one or more Word docume... |
I grabbed the form from some random site because I'm only interested writing the javascript at the moment.
I am trying to check that a user has selected or entered text for all fields. I've made it a long if if-else but that can't be the best/most elegant/easiest solution.
Leaving aside the radio button validation for ... |
I hope this is the right place for this. I basically wrote the below script for a SharePoint 2013 where I needed to get the department of the currently logged in user.
I was finally able to get it working, but I am not happy with the structure at all:
// globals
var currentUser;
va... |
I'm trying to learn Rust and am a beginner. How does one go about implementing a generic version of the Fibonacci sequence without using Copy trait in Rust? My code is given below.
I had to use Copy trait, otherwise the compiler would complain
cannot move out of borrowed content [E0507]
in the method next() (everywh... |
I have a similar problem as in this mail. I want that every time I return the same C++ managed object to Python, I get the same PyObject. With the standard converter I get always a new wrapper-PyObject. The solution should fulfill the following requirements:
get() == get() (the Python object is always equal, whatever ... |
I have a project here that looks pretty good and does exactly what I want it to do. The codepen is here. What I need to find out is if these divs that flip can be shortened in any way:
<div class="flip-container" id="flipcontainer">
<div class="flipper" id="flipper">
<div class="front" id="front">
... |
Memcache get and set can hit a race condition if you use them together to achieve something like locking because it is not atomic. A Simple memcache locking logic using get and set would look like:
def access(resource):
if memcache.get(resource):
return "Access Denied"
else:
memcache.set(resource,... |
"Funny String" problem from Hackerrank
Suppose you have a String, \$S\$ of length \$N\$ indexed from \$0\$ to \$N-1\$. You also have some String, \$R\$, that is the reverse of \$S\$, where \$S\$ is funny if the condition is \$\left|S[i] - S[i-1]\right| = \left|R[i] - R[i-1]\right|\$ is true for all \$i \in [1, N-1]\$.... |
I'm considering an application where a large data needs to be written to file often. I would like to use a queue and have a producer and consumer running on different threads. Additionally, I would like to have a fixed size queue as the data size can be very large. I've implemented a simple test of boost::lockfree::... |
I'm currently working with an SDK where methods return an optional array of objects with optional properties. Only the array itself is optional, it will either be nil or always contain non-optionals. I'm struggling to find a cleaner way to unwrap optional properties for each non-optional in the array:
class Person {
... |
I am a new SO/SE user and I initially asked this question on SO, but i was 'sent' here -for some reason i don't clearly understand but anyway- so here I am..! I was actually curious about my require.js setup, cause it is the first time I 'm using it and having seen many different approaches/examples, I am not sure if ... |
// The DataLayer to MySQL
require_once $_SERVER["DOCUMENT_ROOT"] . "/api/DAL/classes/User.dal.php";
class User
{
public $id;
public $name;
public $age;
public function __construct($id = null)
{
$this->dl = new UserDAL();
// Get an existing user object
if (!empty($id)) {
... |
Problem statement
Phone Number
Write a program that cleans up user-entered phone numbers so that they can be sent SMS messages.
The rules are as follows:
If the phone number is less than 10 digits assume that it is bad number
If the phone number is 10 digits assume that it is good
If the phone number is 11 digits and... |
I've gone through previous questions about implementing hash tables in python, but I have something little more specific. I am handling collisions with linear probing, and I want to grow/shrink my table when I go below/above a given loading factor. My put/get methods are heavily based from this source.
I would like to ... |
Just checking if I could still do it:
#include <iostream>
#include <algorithm>
std::size_t getParent(std::size_t n)
{
return (n - 1) / 2;
}
template<typename I>
void heapify(I begin, I end)
{
std::size_t size = std::distance(begin, end);
for(std::size_t loop = 1;loop < size; ++loop)
{
std::... |
On Monday and Tuesday I started learning Erlang through the Erlang Koans, and around Wednesday night I decided to use my newfound knowledge to implement a simple text editor (Akin to ed(1)). Currently I have the following (also on GitLab):
-module(text).
-compile(export_all).
%% State => {file, buffer, cursor}
main() ... |
How can I optimize this code
Header File:
#pragma once
#ifndef Account_h
#define Account_h
#include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include <assert.h>
using namespace std;
struct Birth_Date
{
int Day;
int Month;
int Year;
};
struct Name
{
// Nam... |
I wrote some classes to convert some documents (PDF, DOC, DOCX and TXT) to only text so that it can be stored in a search engine.
Here's how I use those classes :
$file = 'text.doc'; // comes from the user, hardcoded for the example
$file_extension = pathinfo($file, PATHINFO_EXTENSION);
switch($file_extension){
c... |
I have a task in my program that is inserting thousands (94,953 in one instance and 6,930 in another) of records into my database using Entity Framework.
Right now I am doing this and calling the .Add() method for each record but it takes about 1 minute to insert the smaller batch and over 20 minutes for the larger bat... |
I am trying to read a big file line by line, inspect and cleanse each row and write to either of two output files depending on the outcome. I am using channels for this. I am still quite new to this language so trying to build stuff by looking at examples.
I have kept a global count variable which I am printing at eac... |
I have a set of validation functions which return a response code along with an error message if the validation fails. Requests can be of three types, and each of them contains a different type of values to be validated. My question is what are the options to avoid the repetitive code, particularly in the message assig... |
I just created a simple gallery with scroll. Everything works fine but I'm not sure how should I optimize this code:
document.addEventListener("DOMContentLoaded", function() {
var smallImages = document.querySelectorAll('li img');
var bigPhotoDiv = document.querySelector('.bigPhoto img');
var scroller = do... |
I'm making an Angular web app to solve a pain with traditional messaging my friend and I had, of sending batches of messages (on multiple different topics) to each other every few hours and not having a UI optimized for that style of conversation.
I have a few concrete questions (and of course welcome anything else use... |
I am a fairly beginner-level programmer, and I have been working through the Project Euler Puzzles. I am currently on Problem #11, which asks to find the largest product of four consecutive numbers (horizontally, vertically, or diagonally) in a grid.
I would like someone to look at my code and give me any tips, pointer... |
This is one of the projects from freeCodeCamp. It's a game of Simon (a memory game). I would like a review on my code.
var generatedPattern = [];
var playerPattern = [];
var patternLength = 1;
var redRef = 1;
var greenRef = 2;
var blueRef = 3;
var yellowRef = 4;
function generateNextPatternValue() {
if (patternLeng... |
Outline
I have a form that needs validation. The problem is that the software requires custom validation that depends on multiple parameters.
I decided to pass the object into a function which will dynamically give the object the functions it needs to be validated.
Then once the validation is completed, I remove those ... |
The purpose of this code is to check for errors in my code for a custom shell.
In a previous answer, they say that my code didn't have error-checking.
You need to check the result of every function that might fail
POSIX arithmetic expansion
So I've been asking about how to do it.
https://stackoverflow.com/question... |
I have created a PHP class to print into html easily from an array or object.
Using this class, you can get rid of multiple echo blocks or ugly concatenation while working with data arrays to transform into html.
class PrintEasy {
/**
* Print single data item with html
* Include variable names within a [... |
My today's goal was to create a little advanced mouse clicker in Bash for Linux powered by xdotool. This clicker implements 15 pixel random range in which it clicks for some users not wanting to get caught for some cheating. But that is not the idea. It is just part of it. It may have multiple uses.
There may be multip... |
To get more familiar with the multi-threading aspects in the Rust language I decided to multi-thread my earlier implementation of The rusty Sieve of Eratosthenes.
I have to say that it is probably in a worse state than the code in that question and it has been written a couple of days ago already, it just wasn't put up... |
Is this code missing any "Kotlinisms"?
I've just started learning Kotlin so I'm not yet familiar with the Kotlin way of doing things.
The program will guess a number you are thinking of.
package challenges.difficult
/**
* Created by jbarnes on 04/06/2016.
* Challenge: https://www.reddit.com/r/dailyprogrammer/comment... |
The question I am attempting to solve (and have solved successfully):
What is the greatest product of four adjacent numbers in the same
direction (up, down, left, right, or diagonally) in the 20×20 grid?
(In case you need a link to the challenge.)
The purpose of this code review to to see if there are some obvious ... |
The code works perfectly fine for me (compiled it in BlueJ and Eclipse) but I was wondering what other more experienced programmers thought of it. I'd specifically like to know if it could be shorter or be made more resource efficient.
/**
* This program is just a simple addition calculator that can use whole numbe... |
In a zsh I want to loop over all files in a configuration files' directory (/etc/myapp/) to source them. The files should be sourced in order and are named with two leading digits 10-early 40-middle 99-last. A user without write permission to /etc should be allowed to extend the list of files and override the global on... |
I programmed in Java before, but I feel that I lack the "true way" of programming (OOP concepts, design, algorithm), so I started to learn all of these but I need your opinions and suggestions so I can improve my skills and to be sure that I got all the concepts right. I know that there are multiple ways of doing some ... |
I am new to programming (less than a year), and I would like to improve.
I solved a problem on CodeWars and copied both my solution and the top voted solution below. I listed specific questions after my solution.
I would like to know, what would be considered the better overall solution in a real production environment... |
This is a follow up for the 2D Gravity Simulator-like Game question.
Since then I have developed my javascript skills further, and now I'm using ES6 mainly. Note that even through this code uses the EaselJS library, the question is principally about its design so no EaselJS skill needed.
Also I wanna avoid posting a b... |
I am looking to see if my implementation of the removal/deletion method in a binary search tree is sufficient, readable, and runs in \$O(\log n)\$ time. It's been awhile since I've written a data structure and wanted to see if I still had it.
The basic structure of my BST is a Node with 3 pointers. A pointer to its par... |
I'm currently trying to optimize this class I have for fractal generation. The equation is meant to be pluggable; I have used z => z*z + c so that it's not using the Complex.Pow method (eliminating a method call per iteration). Without changing it from the Complex data type, how else can I optimize this method, and is ... |
I wrote up merge sort code for some late night snack. I have gotten it working, but was just looking learn if I was missing anything in terms of efficiency. Could this code be significantly improved in terms of efficiency (space/time/unnecessary checks)?
package com.komal.sort;
import java.util.Arrays;
import java.util... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.