instruction stringlengths 71 71.9k |
|---|
I understand there are a few similar tools available for testing speed but that's not what I'm looking for. I'm looking at seeing how long it takes to request a site's HTML. However, I'm getting slightly odd results.
The strange results are incredibly slow internet speeds so I'm confused about whether I'm doing somethi... |
This is a follow up from my previous post: Basic API wrapper around a Restful service
I'm writing a basic wrapper around a restful service that returns a list of Stores. Naturally, I want to make it completely testable (that's a major requirement!).
I have split out my TopmanClient class so that just deals with the res... |
I mostly just want to make sure I've understood the specs correctly with this code, but here goes:
var nums = document.getElementsByTagName('x-number');
var observer = new MutationObserver(replaceNumerics);
var config = { childList: true, subtree: true };
observer.observe(document.body, config);
replaceNumerics(); // i... |
I enter in the IMDb link and YouTube trailer link in the command line to a movie and the first main program loads all the info about the movie. The second main program uses an IMDb link to the movie and loads the actor's name and birthday.
Would it be better to write these programs as a class of some sort and use met... |
I'm trying to rewrite my old project in Reactjs. As I am a beginner and this is my first app, I need some assistance in understanding what is the best way to do this in the React way and how I can improve myself and this demo project.
Here is a working demo of it.
ListManager.js
import React, { Component } from 'react'... |
I need to create unique nonces for cryptographic purposes in a library that I am writing. If the nonces ever fail to be unique, the consequences may be up to and including remote execution of arbitrary code (by means of allowing injection of untrusted input into an unmarshalling operation).
While my particular applica... |
While extending the functionality of my polymorphic_callable<> type, I designed a way to obtain a result through a reader type that is set by a writer type; this is very similar to what std::future<> and std::promise<> do, but in a non-multi-threaded way.
Since that other question is already very long, I've decided to ... |
Challenge
Conceal a binary code within a word.
Specifications
The first argument is a path to a file.
The file contains multiple lines.
Each line is a test case represented by a space separated word and a binary code.
For each test case, print the binary masked word.
The mask alters the word according to the following... |
I am using below code to write list item to a file. I want only 2 fields from the list. Is there any direct way without looping through all the items to do that? Here serversToshutDown is a SharePoint ListItemCollection.
using (System.IO.StreamWriter file = new System.IO.StreamWriter("F:\test\Test.csv"))
{
foreach ... |
I have been using the following script for face recognition as a security feature:
main.py
from itertools import izip
from PIL import Image
def compare(self,pic):
i1 = Image.open("pic1.jpg")
i2 = Image.open(pic)
size = i1.size
i2 = i2.resize(size)
assert i1.mode == i2.mode, "Different kinds of imag... |
I gave myself a small project to work on and at first I wanted to use the MVC approach, but I got confused as to which part of my code should go into which class. I did some research and still don't quite understand how I should go about it.
This is the GUI I made:
I created the View class:
public class LevelUpView ... |
Currently I am using the gem activerecord-import to seed more than 55,000 records into my database, and it works fine. However, it takes too much time. I am wondering if there are any other ways to shorten the import time. Any suggestions would be appreciated.
ocean_routes_columns = [:origin_location_id, :destination_l... |
I had a task to create a VBA macros which will take a matrix data set with products in rows and persons as a columns (on intersection we have an ordered qty for each material for each person) and convert it into a CSV file for Advantix to load. As I'm new to VBA, I spent a couple of days investigating the forums and se... |
I am trying to implement a algorithm for the GCD of two numbers in a functional approach. Can this be improved further, also with regards to performance?
def gcd(a, b)
return b if a ==0
return a if b == 0
return b if (a%b == 0)
return a if (b%a == 0)
(a > b)? gcd(a, a%b) : gcd(b%a, b)
end
|
I'm working with some simple geometry problems featuring rectangles and circles. My code is as follows:
# Working with simple geometry problems featuring rectangles and circles
import math
class Point():
"""Represents a point in 2-D space."""
def __init__(self, x=0, y=0):
self.x = x
self.y = y... |
I am working on Django Rest Framework for backend to develop android app. My project is about Food Delivery System.
My app has user login and registration feature. I preferred oAuth2 for token based authentication. I did the user registration part. When a user registers, a new token is created for that user.
But I want... |
So, in my first attempt I created a code that generated all fibonacci numbers and appended to a list. This list I then traversed to get the even numbers and added them up. It worked, but took like 5 complete seconds to work.
Then I decided to not create a list and add the even numbers as I'm generating them. It looked ... |
I have created a program to search for a file in the computer. But I feel it can be improved. Can anyone help me with this?
filesearch.py
import win32api
import os
import io
from fuzzywuzzy import process
def filesearch(self,*args):
drives = win32api.GetLogicalDriveStrings()
drives = drives.split('\000')[:-1]
... |
I decided for educational purpose to make a generic sort like the one in the standard library as an exercise for my self in learning more about how to do generic programming in C and so I would really appreciate it if you guys could tell me how I could have done a better job and what other various improvements I could ... |
I'm working on refactoring some existing code to be a bit more extensible and am wanting to create a generic factory API for starting D3 charts.
Currently, my factory looks like this:
import { select as d3Select } from 'd3';
const protoChart = {
width: window.innerWidth,
height: window.innerHeight,
margin: {
... |
I have a c# application(mvc) that allows a user to upload an excel sheet containing an account number key and amount value to be passed as parameters to a proc that then validates those records, the proc then return an error or warning if any are found. My issue is that the BI team implemeted a proc which I cannot modi... |
In response to a recent SO question, I answered with the following code, and was wondering if anyone had any input on it. I'm always looking for an opprotunity to learn!
import java.util.HashMap;
import java.util.Map;
import java.util.Stack;
public class WordFinder {
public static void main(String[] args) {
... |
I've inherited a piece of legacy code that's pretty huge, and I've no idea how to go about breaking it into smaller pieces, and how to make the DB queries more efficient.
The project is built on a vanilla Python back-end with no ORM, hence raw SQL queries, the purpose of the function is to totalize the data of an insur... |
Today I didn't pass the test task for the position C++ junior/middle developer. What i did wrong?
Please help improve myself.
Task:
Description.
Write a template class - an array of any type of data, and tests to
demonstrate the work with this class. Should be implemented all the
methods also acceptable to exten... |
I wrote this queue object to handle async functions in JavaScript.
I'm not sure if this is a correct approach.
Is this steady enough to run on nodeJS or it may fail/fault?
var queue = {
callbacks: [],
start: function(){
this.returnVal = this.callbacks.shift()();
},
next: function(returnVal){
... |
I wrote this to calculate the diameter of a binary tree. Are there any cases for which this code might fail?
import java.util.*;
class Node {
int key;
Node left,right;
public Node(int item){
key=item;
left=right=null;
}
}
class BST {
Node root;
int diamet... |
I have a text such as
string text = "Hi [img-2] tst[img-3] test ttteessstt grawr[img-1-800]tet";
I want to find img tags in the text and get their id (second value) and possibly the third value if it exists.
string text = "Hi [img-2] tst[img-3] test ttteessstt grawr[img-1-800]tet";
var th = new TagHandler(null);
var... |
Re-use
Given that both the Langton's Ant and the Game of Life use a grid, I decided to code a generic grid_diplayer code and use it both for GoL (Game of Life) and Langton's Ant to put into practice the principle of code re-use.
Rules of Game of Life
Rules of Langton's Ant
Pure logic
The code inside the ant_logic and l... |
I am working on a batch file for doing date/time maths. One challenge is to determine the (proleptic) Gregorian year from the given number of days that have elapsed since day zero (that is, 1st of January, 0 AD, 00:00:00 o'clock), particularly when regarding leap years.
As per definition, a year is considered as leap y... |
This program tells me what lessons I have tomorrow then emails them to me.
This program works fine, but I was wondering whether there is a way to simplify the script or make it more efficient. I have removed my email and password and who it is to for privacy, but it does work.
import smtplib
import time
import datetime... |
I have been learning Java for a few months now and have created a basic calculator application in Android Studio for a school project. Since this is my first attempt at programming, I am sure that my code is not as succinct as it could be.
public class MainActivity extends AppCompatActivity {
double no1;
double no2;
do... |
This function accepts a String (either "right", "left","up", or "down") to do 4 similar but different things. I'd like a more elegant solution to this problem. I sense that there is one, but I can't think of it. Maybe by using a a few smaller functions? Maybe by using a dictionary?
private function addAndRemoveTil... |
I'm a beginner with C.
The below is the implementation of circular buffer using linked list. Please review my code and suggest any improvements to make it efficient or to improve in coding style.
#include<stdio.h>
#include <stdlib.h>
struct link_list
{
int item;
struct link_list *next;
};
struct link_list *re... |
I have never used std::shared_ptr before and I don't really know how this smart pointer actually works but I decided to create one to verify my knowledge. Here is my code :
namespace myStd
{
template<class T>
class shared_ptr
{
public :
shared_ptr() : refCount(nullptr), t(nullptr) {}
... |
What do you think about this way to make logging available across the application without passing log object around? Let’s say we have something which allows us to write things this way:
class Program
{
static void Main(string[] args)
{
using (new Log("c:\\a.txt"))
AsyncContext.Run(() => Ma... |
I consider myself a beginner at Java but this question was an easy one. My only concern is if there is a more efficient way to write this program. I'm very open minded. I don't care how advanced your answer is, I'm willing to learn.
public static void main(String[] args) {
long limit = 1000;
long sum = sumO... |
I've been studying data structures and have taken a stab at implementing a singly LL in JavaScript. Please review and advise on any additional improvements and optimizations:
function Node(val){
this.data = val;
this.next = null;
};
function SinglyList(){
this._length = 0;
this.head = null;
};
//Add
SinglyL... |
#!/bin/bash
#assigning variables
start="14:00"
duration="150"
title="Exper. Lab"
year="2016"
start2="17:30"
duration2="230"
title2="Calc1"
# Here I refer to dates that the event occurs on piping the variables into gcalcli (Google calendar command line interface) creating a repeated event on my Google calender
for mo... |
I needed to convert some Ascii text to binary in Hex format 0x00FF....
I've written an EncodeHex and a DecodeHex function to do the conversion.
I've avoided using concatenation in favour of performance.
I'm assuming that assigning the results of CByte("&h80") to a byte array, and then using StrConv to convert the array... |
It is a 1.5 hour coding test, started the moment when the question was sent by email. My solution was done under the strict condition. I was not told anything before the test.
The question is about counting word occurrence in natural language processing. Paraphrased, it asks:
Given an input document and a range k (wi... |
I'm trying to practice some C++ and I wrote a simple queue to solve the Producer-Consumer Problem.
class Queue
{
public:
Queue() : mutex(), cv(), queue(), process(true), consumer(&Queue::dequeue, this)
{
}
~Queue()
{
process = false;
consumer.join();
}
void enqueue(int i)
{
std::lock_guard<std::mutex> lo... |
I want to get records in batches. But mongoid doc says to avoid using skip due as it can be expensive. I wrote this method to iterate through a large number records efficiently.
module Mongoid
module Batches
def find_each(batch_size = 1000)
return to_enum(:find_each, batch_size) unless block_given?
fi... |
Here is a short python snippet to ingest train data:
x_train = []
y_train = []
for x,y in train:
x_train.append(x)
y_train.append(y)
x_train = np.asarray(x_train)
y_train = np.asarray(y_train)
The variable train is a list of 60000 (x,y) tuples.
|
I have a Makefile, which should when calling make just call make in a list of subdirectories. The subdirectories should not be automatically detected but are fine to be hard coded (Tool1, Package2, Submodule3 below). Furthermore, if I call make Tool1, Tool1 should be built (i.e. the directory names should be recognised... |
function executeQuery() {
$.ajax({
url: '../include/activity.php',
success: function(data) {
// do something with the return value here if you like
if(data.error == true){
window.location.href = "login.php";
}
}
});
setTimeout(executeQuery, 3000); // you could choose not ... |
Background:
I am currently in the process of abstracting and refactoring out EF for Dapper with Dapper.Contrib and the entity class definitions from EF are currently being generated by a T4 template. I have not swapped out the entities entirely for generic POCO base classes as yet as the EF implementation is functionin... |
Everything is working fine except timing.
it takes lot time for my file containing 1000 pages and having 100 pages of interest.
import re
from PyPDF2 import PdfFileReader, PdfFileWriter
import glob, os
# find pages
def findText(f, slist):
file = open(f, 'rb')
pdfDoc = PdfFileReader(file)
pages = []
fo... |
I am new to Spark and Scala and I have solved the following problem. I have a table in database with following structure:
id name eid color
1 John S1 green
2 Shaun S2 red
3 Shaun S2 green
4 Shaun S2 g... |
I am pretty new to coding and I wanted to know how to use header and source files to organize a C++ project. I could not yet find out how I should use header and source files to still have my project work - I first thought I could just include .cpp files but I heard it is considered bad practice. I want to learn this f... |
Here is a simple filter function I have:
function filter (attributes, data, include) {
if (include) {
let res = {}
if (typeof attributes === 'string') {
res[attributes] = data[attributes]
return res
}
if (attributes.length) {
attributes.forEach(att... |
I'm new to Python, and just started to learn the principles of Object Oriented Programming, this does not judge strictly.
This code is fully working but confused some elements:
I don't understand what the __init__ method needs to return.
I don't like self. in get_parse that much.
Initially, I did it in order to be ab... |
I use the following MY_ROUND macro for rounding:
#define MY_SIGN(inVal) (((inVal)>=0)? 1 : -1)
#define MY_ROUND(inVal,numDig) (((double)(int)((inVal)*pow((double)10,numDig)+MY_SIGN(inVal)*0.5))/pow((double)10,numDig))
Here inVal is the input double to be rounded and numDig is the number of digits (precision) to round... |
Is there a way to improve this code? Any suggestions are highly appreciated.
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define DEBUG
#undef DEBUG
typedef struct Node
{
int data;
struct Node *next;
} Node;
typedef struct LinkedList {
Node *head, *tail;
int size;
} LinkedList;
LinkedL... |
This is a follow-up to the previous question located at Singly linked list implementation in pure C
Any suggestions on design and optimization are highly appreciated
LINKEDLIST.H
#ifndef NYO_LINKED_LIST
#define NYO_LINKED_LIST
#include "stdbool.h"
#include "stdio.h"
#include "stdlib.h"
typedef struct Node
{
int d... |
In a parser written with Parsec 3.1.11, I have a performance issue with parsing (or better, skipping) the unreachable branch of a if-then-else statement.
The syntax to be parsed is as follows:
_if (condition) {
# block of statements
} _else {
# block of statements
}
The _else branch is optional and only statically... |
I wrote the following function to convert List[Int] => List[List[Int]].
Its intended purpose is to extract 1, followed by its non 1 followers, into a group.
input: List(1,2,2,1,3,3)
output: List( List(1,2,2), List(1,3,3) )
Function
def leadingOnesGroup(xs: List[Int]): List[List[Int]] =
xs match {
ca... |
I have JavaScript code that activates a button and deactivates another if a select is changed.
HTML
<select name="list" id="list">
<option value="">choose</option>
<option value="1">1</option>
<option value="1">2</option>
<option value="3">3</option>
</select>
<input name="refresh" t... |
I have one writer thread and 10 reader threads of a byte array. It is important to synchronize writes and reads over a "row" (16 bytes).
There are a lot less locks than rows, e.g. in the current configuration 1024 (chunkRows) rows have one lock which makes the overall operation faster, but also consumes less memory.
He... |
I use NLog everywhere and I really don't like writing the inserts everytime. You need to write the same variable three times: two for the insert and one for the parameter for example:
<target xsi:type="Database" name="Log" dbProvider="System.Data.SqlClient" connectionString="...">
<commandText>
INSERT
... |
I am relatively new to classes. This one uses one.
I am pretty sure this is not the correct way to do this. But I also do not know the correct way.
You can use the certified_secure function when you make an instance of crawler that has the URL of hackthissite.org.
Do I have to many comments? Are they too verbose?
#! us... |
This code finds the next obstacle in the player's path, then moves it. I am trying to make it more efficient, because this code runs for each frame, and it lags a bit. It does work though.
There are 8 blockers, which are basically obstacles. We subtract from the players rotation until the rotation is equal to one of th... |
So I'm making a 2d shoot'em up game as a way of learning canvas, and larger-scale programming than what I'm accustomed to. I'm a purely front-end web dev, I can't say I'm very experienced in this.
Anyway the way I spawn my enemies is like this : at xyz gameTime, a spawner object is pushed into the game. This spawner ob... |
Unrelated to code:
I have only been programming for three weeks, and this is my first project.
About the code:
Uses a preset grid.
It was all done on a single page. This, I realise, was a mistake, and I have fixed that since.
I used an int array for the grid. I did first think maybe a Boolean array would be better, b... |
I need to calculate some dates like yesterday, this week/month, last three/ten days etc.
To make it a little bit easier and don't think about the Date weirdness all the time I created this helper:
var HumanDate = function() {
var date = new Date();
this.day = function(numOfDays) {
if (numOfDays === undefined... |
I'm trying to design an application that binds a phrase or word to some item, for example image, and saves phrase-item pair in the database. Then it receives a text, and if it contains binded substring, corresponding item should be returned.
It should return only one item (first match), and longest substrings should t... |
I wanted to use the Try helper from @DmitryNogin's General Retry Strategy #2 but each attempt to implement it revealed another thing that is missing.
In my review I mentioned that it would be useful to be able to log the exceptions but later I came to the conclusion that perhaps it would be better to implement somethin... |
I've made a simple one page site to practise using Bootstrap. Could you please look at the HTML & CSS and check for possible improvements?
Here's a page.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link... |
I wrote a little Compose function, which takes a variable number of arguments of type function and then calls each of those in order, passing in the value of the previously called function.
My function works just like I want it to, however since the function provides a way to program functionally, I figured it's applic... |
This is my first attempt at PHP PDO. I needed to get data from two tables in my MySQL database. I'm pleased to say the code works, and I was just wondering if what I've done is correct.
<?php
// MySQL Database Connection
$db = new PDO('mysql:host=localhost;dbname=database;charset=utf8mb4', 'root', '');
$db->setAttribu... |
I wrote an update() function to make an entry the first element in an array.
var arr = [
{v: 1},
{v: 2},
{v: 3},
{v: 4},
];
function update(e) {
var i = arr.findIndex(o => o.v === e.v);
if (i === 0) return;
if (i > 0) arr = [e].concat(arr.slice(0, i), arr.slice(i+1));
if (i < 0) arr = [... |
I have this little convenience method that takes an String array and returns an String where the values are separated by a provided separator (comma, pipe, etc).
For instance, if given an array with values "abc", "def" and "ghi", and a for separator we passed " | ", the end result would be "abc | def | ghi".
This is t... |
I am trying to get to grips with native JavaScript and wean myself off jQuery, so as an exercise, I wrote the following to check or uncheck checkboxes depending on which link is clicked.
Could this have been written more concisely? Does it follow what you would consider to be best practise?
<ul>
<li><a href="java... |
This question is a continuation of: Sending email using libcurl - follow-up
Does this code have any problems? Can I improve it?
#include <string>
#include <sstream>
#include <iostream>
#include <ctime>
#include <algorithm>
#include <random>
#include <curl/curl.h>
class EmailAddress
{
public:
EmailAddress(const ch... |
The code below is an attempt at a solution to an exercise from the book "Cracking the Coding Interview."
I believe that the worst case time complexity of the code below is \$O(n)\$, where n is the length of each string (they should be the same length since I am checking if there lengths are equal) and the space compl... |
I haven't done any research into how you actually write a genetic algorithm, so this is my best guess. What I'm really curious to know is two-fold:
Have I created a genetic algorithm?
If I have, how can I continue to explore the subject more?
I hope this code and docstrings are enough explanation for how the code wor... |
I just want some feedback to improve readability and structure for this implementation of Hangman. The goal was to write it in a purely functional way. However, coming from an imperative background, I found it difficult to organize functional code.
function Hangman(word, revealed = word.replace(/\w/g, '_'), errors = ... |
This is an excerpt of a part of a (very large) program that I'm writing. This particular section handles the creation and management of chat channels.
However, I think that this code is rather complicated and not as clean/easy as it should be.
package com.lolfakename.chat;
import com.lolfakename.LocalUser;
import jav... |
I need to import 2 .s19 files to Excel and then compare across 6 Columns and store the output to a txt file. I have my data from column A to F. My current program doesn't store the data using a dictionary or hashtable. It takes too long to complete as there are around 31k lines in the list 1 and 32k lines in list 2. I ... |
I've done plenty of corrections of the previous code. Dangling pointers seem a fixed problem (correct me If I'm mistaken). The swap/reverse functions are going to be changed soon due to high time complexity. Also the LinkedList_Find() function is not enough specialized for different types of data, such as Person, becau... |
Please criticize as thoroughly as possible, even the smallest thing will be very useful for me.
I'm trying to create a safe and easy system to change for future projects. I am aware that it should have a lot more functionality (check email, access attempts, notification by email, etc.), but this is what I have at the m... |
I'm trying to get hired by some company and they gave me a simple remote test to take at home so they can judge my coding skills.
It's a really simple problem based on the website HackerRank. It's a mini game where you have to keep track of the score of a tennis game (0-15-30-40-ADV).
This is really basic and I managed... |
The primary purpose of this program is to practice catching if the user enters data that does not correspond to expected input. Note if the user enters their name as "123", this is valid as it can be used as an identity, however if users enter only spaces (i.e. " ") or just a newline char then their input will be re... |
Problem statement:
Two singly linked lists join at a common node, making a Y shape. It is guaranteed that the common tail does not loop back. Find the junction node. Linear time, constant space.
It is an exercise for my students; nothing competitive.
This is what's provided:
list.h
#ifndef LIST_H
#define LIST_H
#i... |
In order to only show relevant information to my users I want to disable the whole panel when all fields inside that panel are empty.
Currently I do this hacky method to get to this result:
if resource.phone.present? or
resource.fax.present? or
resource.email.present? or
resource.website.present?
panel ... |
I'm solving this problem from codeforces. I've a solution which has complexity of O(n²). But the time limit exceeds on some of the test cases. The problem statement is:
High school student Vasya got a string of length n as a birthday present. This string consists of letters 'a' and 'b' only. Vasya denotes beauty of th... |
The other day I stumbled upon this question on Stack Overflow about the lack of a get method on the Set and loved the suggestion of using a Map<E,E> to back the Set. I decided to try this out. Since this is quite a generic object that could serve a lot of purposes, I would like to know if there is something weird with ... |
I've written this script to practice (not necessarily memorize, but familiarize myself with) the definitions of a lot of words.
import csv
import random
WORDS = 5 # Number of words
CHOICES = ["A", "B", "C", "D", "E"] # Number and labelling of choices
with open("wordlist.csv") as csvfile:
wordreader = csv.re... |
This is the first python script I've written. It's used to create a local backup of git repos from BitBucket. It works, but I'd like to make it more pythonic if possible.
"""
Script to check BitBucket for all repos accessible by the supplied user and clone,
tar and gzip each one (skipping unmodified and those explici... |
I'm trying to implement a c program using pthreads which prints "1 2 3 4 5" in an infinite loop. I have used conditional variables and mutex to synchronize the pthreads. I'm able to print "1 2 3 4 5" without race condition using conditional variables and mutexes. But the problem occurs when I try to make it an infinite... |
I am trying to compute the surface density profile, given the spherical density profile in 3D for different parameters in order to interpolate and have it as a function of them to use later on for some gravitational lensing modelling. However, looping through all parameters and evaluating the integral over the 2D Radiu... |
Joining a project with some crazy LINQ sorting statements and after refactoring by the team using a custom comparer we found out that it is so slow for some data that you actually think it is an infinite loop.
How to fix this performance issue but still maintaining the sorting requirements?
private static IEnumerable<P... |
Purpose:
Given a target folder, and a list of target sub-strings, determine if the folder (or any of its' sub-folders) has a filename which contains any of the target substrings.
N.B. This class uses Early-Binding and requires a reference to Microsoft Scripting Runtime
Properties:
RootFolder As Folder
String... |
Currently I have a very general purpose A* algorithm, which I've submitted as open sourced at https://github.com/kd7uiy/AStar . I've been trying to speed it up for the last month or so, and while I'm making steady progress, I'm struggling to see anything major that I can do to speed things up at this time. I'm using th... |
I am trying to use Entity framework along with UOW in business class where I want to use this layer across multiple types of applications like web, webapi and Windows Services. So I cooked something from the online resources. Can some one figure out any potential performance or fallback?
Main reason I am trying to writ... |
I have a Django view that ends with this...
return render(request, 'define/see_all.html', context)
I have mocked the render function and
@patch('define.views_func.render')
def test_get_define_see_all_complete(self, mock_render):
"""Testing that the queryset returned properly"""
things = AllThings(group="Word ... |
This question refers to this problem on lintcode. I have a working solution, but it takes too long for the huge testcase. I am wondering how can it be improved? Maybe I can decrease the number of comparisons I make in the outer loop.
class Solution:
# @param strs: A list of strings
# @return: A list of strings... |
Today on Stack Overflow the following question came
https://stackoverflow.com/questions/39393112/find-out-if-string-contains-english-words-only
The question itself has following prerequisites:
A system dictionary that contains all the words of the English language
With the following requirements
The input is a text ... |
I've been studying data structures and have taken a stab at implementing a doubly LL in JavaScript. Please review and advise on any additional improvements and optimizations. I'm more interested in feedback particularly regarding the implementations of removeAt(), contains() and getItem() methods as they share similar,... |
I am managing large CSV files (files ranging from 750 Mb to 10+ Gb), parsing their data into PSObjects, then processing each of those objects based on what is required.
I wrote the following script to churn through these files line by line, filter based on one of the data fields, then close the file. The script work... |
I made this variation of a Caesar cipher. Any tips on improving, either method or underlying algorithm? Don't worry... I promise not to use it to encrypt anything of value.
#########################
# #
# caesarED By: 1 0 3 E #
# 0 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.