« first day (1679 days earlier)      last day (42 days later) » 

12:00 AM
RELOAD! There are 4808 unanswered questions (90.2820% answered)
You could try asking this question on codereview.stackexchange.comBrian Rogers 30 secs ago
Q: Hangman, Python 3. How to print the blanks before a incorrect answer?

Anthony AnzaloneI need this to print the "_" before you guess a letter, currently it doesn't show until after the first guess Not really sure how I am supposed to do this. import random import string def print_guesses(guess_list, correct_answer): print_string = "" guess_list = guess_list.upper() ...

Q: Hack video game (xbox one)

user155327Hi can somebody please give me a format of how to hack into a game and give certain units somebody's paying me to hack their account.

@CaptainObvious HAMMERTIME!
12:21 AM
Q: linear search on array

anitstudentSo I've recently used this block of code where I check an array for the correct answer that was received from the browser and sent to the mobile device/application. It's a quiz app. private void setCorrectAnswer() { //iterates till it finds the string that is equal to qAnswer(Correct Answer)...

@Mast let me get out my parachute pants!
12:37 AM
"And to sneak in a third question, is this design even best practice?" This question is off topic for Stackoverflow. Question should be asked on codereview.stackexchange.com .. But Singleton database class should be a much better design because you reuse the class and so you reuse the MySQL connection. — Raymond Nijland 5 secs ago
1:24 AM

swordi need an example multi threading / multiprocessing application(like count words in string) in c# running in sequence and in parallel to understand the difference thank you how can it work in parallel?? Console.WriteLine("Original text: " + text); Console.WriteLine(); Console....

2:02 AM
@CaptainObvious I would love this too, but for python3, mainly a django implementation.
possible answer invalidation by Jamal on question by Seanny123: codereview.stackexchange.com/posts/182271/revisions
Q: Spiralling Advent, Get To The Point

h.j.k.Advent of Code Day 3 Challenge Part 1: Each square on the grid is allocated in a spiral pattern starting at a location marked 1 and then counting up while spiraling outward. For example, the first few squares are allocated like this: 17 16 15 14 13 18 5 4 3 12 19 6 1 2 1...

Q: Using the RAII design pattern in VBA to automatically restore settings

ChrisBUsing a technique described in this StackOverflow answer by @David Murdoch I created a custom class with methods to speed up Excel (Activate turns off screen updates and set the calculation mode to manual) and to restore it to normal settings (Shutdown). When the object reaches the end of its li...

2:25 AM
Your code is pretty good, so I think you would benefit a lot by submitting it to Stack Overflow's Code Review. In particular, it is best to use lexical file and directory handles, "${\File::Spec->catfile($dir, $file)}" is much cleaner as File::Spec->catfile($dir, $file), and "$file" should be $file. There is more, but a comment is not the place to identify or explain it. — Borodin 14 secs ago
Q: Implemented heapsort algorithm in Java

Bahodir  BoydedayevI am learning algorithms by using Java. Here is an implementation of heapsort. Let me know if anything is wrong and and suggestion to improve the algorithm. public class HeapSort { public int arr[]; public HeapSort(int[] arr) { this.arr = arr; } // to make a heap pu...

Q: A scroll to top button with fixed positioning that fades after a few seconds?

JAT86I have this JavaScript code that works as a top-of-page button when clicked. The button is hidden by default and only appears when the user scrolls 500px or more from the top of the page. But I am not that confident in this code as I am a beginner in JavaScript. Is there a shorter way of doing it...

Q: Scala type matching map

PhoenixI was working with some complicated generics system, and I found the need to make an abstraction for a typesafe mapping between K[T] and V[T] where T is the same for individual pairs. In the case where the key or the value is T itself, we use a trick: type Identity[T] = T, and set the parameter ...

possible answer invalidation by Seanny123 on question by Seanny123: codereview.stackexchange.com/posts/182271/revisions
2:49 AM
The question in the current format is more suitable for codereview.stackexchange.com. If you want to keep it in stackoverflow, edit the post and ask a question and then post your own answer. Then it would be more useful for feature readers. — Reza Aghaei 18 secs ago
3:00 AM
possible answer invalidation by Jamal on question by Ziezi: codereview.stackexchange.com/posts/179971/revisions
Did not know about codereview. Thanks for mentioning it. I'll go ahead and do that. — user2334522 45 secs ago
3:31 AM
Q: Encrypting messages to be sent over a socket

Ryan SchaeferI recognize the importance of properly implement cryptographic functions. Since this is my first time using them I really wanted a second opinion on my method. Therefore, I was wondering if my method of sign-then-encrypt as implemented would be a valid method of safely achieving those results. i...

4:26 AM
Q: OCaml safe uninitialized array

Gregory NisbetOne of the annoying things about OCaml arrays is that every cell has to be initialized when the array is first created. I'm trying to implement an array in OCaml that distinguishes size (the current number of elements in the array) from capacity (the maximum size that the array can grow to). At...

1 hour later…
5:26 AM
Q: Good Practice with Angular4 syntax and Testing Query?

Sandeep ChikhaleI am a newb in Angular 4 code. I have written a component.But has following queries? Used member variables of class and modified variables within functions. Is this right approach or I should implement it as (input => FUNCTION => output). This will make testing function easy to test. How to tes...

5:52 AM
PS My "Need help.." post was my poor attempt at a code review request. As you can probably tell I am a bit of a novice in this world but I persevere because I can see major benefits in cracking this particular chestnut :) — Chris 18 secs ago
6:02 AM
Q: Class hierarchy for informative exceptions in ASP.NET core

maxspanI have a base class called ExceptionPlus(please suggest a better name). Which is being inherited by multiple child class like BusinessNotFoundException, ArgumentInvalidException etc. My question is the way the child classes and base classes are implemented are not very OOP. Each child class has ...

Q: Java Swing actions

NkRajI'm trying to connect an SVN to GUI, By selecting the bundle name it should call the other method.But the flow is not going like that. Kindly help in this.`JComboBox bundle = new JComboBox(appName); bundle.addActionListener (new ActionListener () { public void actionPerformed(ActionE...

Q: Python palindrome function; is it possible to write it without using string conversion?

Sean ValdiviaI hope this question is okay to ask on Code Review; this is a little function I wrote in Python 2.7.12 that checks if a number is a palindrome. It works fine but I'd like to know if there is a purely mathematical way to do it without using string conversion. Here is the function: def is_palindr...

6:17 AM
Q: Where to put simple update function?

herondaleI have this function inside one of my Model classes (and several others similar for the other totals): public function refreshCartTotalWeight(CartTable $cartTable, $cartId) { $cartTotalWeight = $cartTable->getCartTotalWeight($cartId); $cartTable->updateCartTotalWeight($cartId, $cartTotal...

Q: Implementation of similarity measures [ hausdroff distance/dice ]?

user1234I would like to find the hausdroff distance and dice coefficient after segmentation.i had used bicubic interpolation in the segmenting algorithm. But I'm getting wrong value always.Can you help me to correct my code. hausdroff distance i'm getting is 322.dice coefficient is .1286 i=rgb2gray(...

6:35 AM
Q: Multiple Depth logic structure

SowI intent to constuct a nested data structure by namedtuple from collections import namedtuple BinaryDay = namedtuple('BinaryDay', ['AM', 'PM']) QuaternaryDday = namedtuple('QuaternaryDday', ['Moring','Afternoon','Evening','Night']) OctonaryDay = namedtuple('OctonaryDay', ['Sunrise', 'Sunshine', ...

6:49 AM
Q: Basic PHP Calculator. Mostly need feedback on the client-side JS

Jamison SasserCalculator.html is mostly a big button array made in bootstrap !DOCTYPE html> <html> <head> <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js"></script> <script src="https://maxcd...

1 hour later…
8:02 AM
I'm still a little uncertain as to why you have changed the code from how my array loop was running, i would have thought it better to insert your improvements into the suggested structure. However, if it runs more swiftly for you then who am i to say. Afraid pastebin didn't preserve my formatting but here is a starter for 10 at a new question possibly for code review pastebin.com/a5MY6JGb Remember to be specific (quote directly software message, sizes/numbers of items), say what you have tried and what the result was. Make it easy for people to help you. — QHarr 17 secs ago
8:12 AM
Q: Call of Duty Black Ops Console Memory Hacker

sand_storm_of_code.txtAre there better ways to implement what I have done - a Console Memory Hacker for the game Call of Duty Black Ops single player mode. Comments, Performance, Style, anything. And, it needs Multi-Byte Character Set in properties to run without errors. #include <iostream> #include <Windows.h> #incl...

This question would be better posted on codereview.stackexchange.comScriptable 50 secs ago
8:27 AM
8:48 AM
Q: JavaScript - Improve a sequence of if() conditions

Mouad EnnaciriI have this loop that iterates and assigns a variable to true depending on the different conditions for (const element of actionsReferences) { if (element === 'accept') { this.showAcceptButton = true } else if (element === 'reject') { this.showRejectButton = true } else if (element...

Q: JavaScript calculator using inputs value

user155355I’m trying to make a simple calculator with 3 inputs in JavaScript but it doesn’t work. For now my code is: <html> <input placeholder="Number" id="Number F” class="Number F" onchange="calculator()"> <input placeholder="/ , * , - or +" id="Number O" class="Number O" onchange="calculator()"> <i...

Q: CodeFights: A Simple Tetris Solver

LudisposedLong time no Codefights, link to the challenge Tetris game Description Let's play Tetris! But first we need to define the rules, especially since they probably differ from the way you've played Tetris before. There is an empty field with 20 rows and 10 columns, which is initially empty....

9:20 AM
@Peilonrayz Monking Peilon
@Ludisposed How's goes things?
Good, been struggling with C# problem at work for a while now, but finally was able to figure it out. :)
@CaptainObvious Also did some Python Tetris, it was fun...
How are you?
I suck such so much at C#, however I appreciate the typings library now. I was looking at you post, from what I've seen so far, it looks pretty good, :)
I've been trying to set up a local PyPI at work... But otherwise just been chilling
9:35 AM
What kind of package, are you deploying?
It took a while, but I'm actually starting to enjoy C#, once you go LINQ it is not that bad actually.
I mostly work on odd-jobs at work, mostly between a large variety of REST APIs, so it's nice to be able to package all that up. It's also nice to be able to deploy a package from PyPI, rather than by hand
From what I've seen LINQ is really nice, kinda like a better itertools, with much nicer syntax
Yes that seems quite nice. I have never dabbled with PyPI before
9:53 AM
I'm voting to close this question as off-topic because questions about refactoring working code belong on codereview.stackexchange.com (but be sure to check their help first to make sure the question is well-formulated per their rules). — T.J. Crowder 28 secs ago
10:08 AM
Q: How can I get error during making a new directory if the directory exists?

Mohamad Reza Salehi SadaghianiMy script works very well. It finds the current path, zip all files and move the zipped file to another directory by changing just the parent directory form whatever it is to 'D' and at the end deletes all files in the original directory. But it does not produce any error if the path exists. I u...

I think this is better suited on CodeReview.SE, or you'll at least get a more in depth answer there. The only real issues I see with your setup is that (a) you won't be able to access your data any other way than by calling the MVC backend without having to duplicate your code (b) You have no way to avoid the SaveChanges(), e.g. when you decide mid-method that you don't want to save anything and return an error. But this is easily solved by e.g. having a boolean variable that can prevent SaveChanges() from being called. — Flater 28 secs ago
10:27 AM
Q: How to scrape multiple pages from a website?

Rawhide(Very) New to Python and programming in general I've been trying to scrape data from more pages/section of the same website with Scrapy My code works, but it's unreadable and not practical start_urls = [ 'https://example.com/Python/?k=books&p=1', 'https://example.com/Python/?k=books&p=2', 'ht...

Q: Creating a simple unit of work with Entity Framework and no repository

kolin(I posted this on stackoverflow but thought, in hindsight, it might be better here) I've been trying to implement a .net MVC Unit of Work API (rather than creating a separate repository), but it doesn't feel right. Am I going about this the correct way? Following advice from here . BaseContr...

10:42 AM
Looks good but make sure to be consistent with numbers used e.g. If it is 175 budget holders it should be that number throughout the entire text (not 170 as it is currently is Lines 27,48 and 54 or v.v.). Remove my comment still left in (specific number required) - Line 54. What does Valued the source data mean? Lines 37 and 56. Maybe expand a tiny bit on what that means. Then when posting to code review make sure to indent code and use highlighting and spacing as appropriate. If you let me know when posted i can have a look and help with editing. — QHarr 17 secs ago
11:00 AM
Q: Router for quering MySQL results in NodeJS

CadmosWhat should I consider in order to refactor the following code ? It seems very close to proudly become a Pyramid of Doom: router.get('/:id', function(req, res) { getId = req.params.id obj = {} db.con.query('SELECT * FROM employees where id=?', getId, function(err, results) { ...

Q: Looking for help based on best practices and coding style. (First Python Module)

Vera PerroneThis is a follow-up question to My last question. From then on, I think that I have improved quite a lot thanks to a large amount of feedback I received from my last post. This will be the last time I ask for feedback based on this code. I am looking for any feedback on best practices or coding s...

11:14 AM
Q: Array 3 fix 34 coding bat not working

gnanagowthaman sankar Return an array that contains exactly the same numbers as the given array, but rearranged so that every 3 is immediately followed by a 4. Do not move the 3's, but every other number may move. The array contains the same number of 3's and 4's, every 3 has a number after it that is not a 3, and ...

Q: Entity Framework MVC updating db using a repository method

kolinI have inherited this code from a legacy project, and it is throwing a New transaction is not allowed because there are other threads running in the session. error. Now I know the problem here is mainly that i'm not using a using statement in the repository, so the connection is stuck open. ...

Q: PHP & MySQLi Login Script - Is it safe from Injection?

Stan HoweI've been geeking up on MySQLi prepared statements to avoid potential SQL injection and I have managed to modify my legacy code (previously just using mysqli_real_escape_string). I am looking for some advice regarding if this code template is safe enough to use as I will be looking to update the...

Ok. Let me know when posted to code review (with VBA tag) and i will have a look. — QHarr 57 secs ago
Two things: (1) can you provide the rest of your code; and (2) you should submit this on Code ReviewAustin Hastings 59 secs ago
11:31 AM
Oh dear. I haven’t had time to try and test with your workload estimates. Sorry. Will have a go in my lunch break. Meanwhile, perhaps post to code review if you feel comfortable with question as is. — QHarr 52 secs ago
Next dumb question.. do I copy pastebin link into code review? — Chris 44 secs ago
11:53 AM
Q: Excel Slicer Macro Speed Issue

ChrisSituation: I am trying to print off reports for selected budget holders (selected from a Budget Holder Table), using the budget holder name to feed into a slicer which then updates various pivot tables. Objective: The objective is to populate efficiently the slicer with a single budget holder...

12:09 PM
1 hour later…
1:15 PM
Q: Stack Smashing Error

KelvinCan anyone help me to solve my error. This is my university hardware project. Thank You very much.When I delete the part that need to write the guess number into the file. The error is gone #include <stdio.h> #include <time.h> #include <math.h> #include <stdlib.h> #include <ctype.h> #include <st...

This question appears to be off-topic because it is a code review request. This might be better suited to the Code Review Stack Exchange site. Before posting there be sure to read their FAQ to ensure that your question meets their guidelines. — John Conde 28 secs ago
@AustinHastings: Code Review is for improving code that's already working properly, not for fixing broken code. — Pieter Witvoet 13 secs ago
@Peilonrayz Only moderators present in a room can be pinged
But I can yell at the other mods to also be more present here ;)
1:50 PM
"i'm have some requirements for number of lines in my function" - this is the sort of thing that should NOT be taught to students. In the real world, working, easy to read and understand is the prime directive. The sort of code you have written would not pass most code reviews. — Neil 7 secs ago
2:02 PM
@SimonForsberg Oh, I thought that wasn't the case... Thanks :)
Q: How to write this correctly?

Zhi VI am interested in how to handle errors/exceptions/retturned data correctly. For example, I have a script which creates, updates and deletes products data. Here is method that receives data from an API, processes and decides what to create/update/delete. private function importProducts($brand...

2:19 PM
Q: C++ How do I print a vector of tuples?

Kenneth DionisiSo I'm trying to set up a program where I take integers from a text file and insert them into a vector where the integers are set up as tuple. For some reason, I'm not getting the right results. I'm not sure if it's because my text file is in the wrong place, but at the moment I want to print the...

2:30 PM
Questions asking for opinion based answers are discouraged on StackOverflow. Please post it on codereview.stackexchange.com . — Rahul Bharadwaj 30 secs ago
Q: Convert a JS DataTable to an array of objects

MaximeAn API provides data as some sort of data table, column and rows. I have written a function to get JS Objects from this DataTable. function processAggregateData(data) { dataRows = data.data[0].rows var returnArray = []; for (var i = 0; i < dataRows.length; ++i){ returnArray....

Q: An API consumer in Python

cortical_ivI built a minimal working model of a consumer of a RESTful api in Python 3. It only consumes one end point in this example. It is using the api from a video game (Destiny 2) to collect data about all the members of a clan (a clan is basically a team that likes to play together). Some features ...

I'm voting to close this question as off-topic because this question belongs to codereview.stackexchange.com. — j_4321 10 secs ago
2:48 PM
Q: Spring WebSocket console application

Console EngineerThis is the code which i do not now if it is ok because i think it is not enough scalable if i decide to implement adding more then one chat room. This is my first try to implement some simple chat console application. Hope if this is not ok, someone will correct me in the comments. @Servic...

3:01 PM
Perhaps this question is better suited for codereview.stackexchange.com its seems a little off topic or broad here. — Jon 47 secs ago
Loading everything into memory isn't really advisable here but since you went LGPL I can't code review. — Charlie Clark 37 secs ago
3:33 PM
Q: Word Count in C#

swordhello i'm not a developer(researcher) I have coded a very simple "Word Count"in serial some one can help me for the parallel i need to do some compare in my article in the time of execution and the difference between sequence and parallel and many other thinks thank you for the help i will be ver...

Q: Updating values in json file with jq

JerryI'm trying to update this json with the output from a command , Example json: { "Templateversion": "2.0", "core": { "1234": { "123abc": { "key": "value" } } } } I want to update the value field with a previously obtained value from a function. Here is my scr...

Sorry, you you just "can't code review LGPL" if it is against your religion or something like that. Nothing legaly stops you from reviewing LGPL or contributing LGPL code, and that is pure FUD. What LGPL obliges you to is that if you the software in a private project, and modify it, (not the linked parts, just the software proper), you have to publish back your modifications. "Code reviewing on git hub" is already "published", so LGPL makes no difference. That said, the project is not mine. — jsbueno 31 secs ago
I'm voting to close this question as off-topic because it belongs to codereview.stackexchange.comJean-François Fabre 24 secs ago
3:57 PM
Hi David, welcome to StackOverflow. I think this sort of question would be more at home on the CodeReview stack exchange. — Joey Harwood 41 secs ago
possible answer invalidation by Stan Howe on question by Stan Howe: codereview.stackexchange.com/posts/182326/revisions
Q: Separating paging, sorting and filtering

iantukicin my ASP.NET MVC application I have a service that had a method for paging, sorting and filtering of Vehicle Makes: public class VehicleService : IVehicleService { private readonly DbContext _context; public VehicleService(DbContext context) { _context = context; } ...

Q: Avoid duplicate use of method?

jasonbradberryHere's an abstraction of some code I'm working on. I'm using the exact same method twice, once on page load and once via an event listener. Is there a better way to write this to avoid duplicating the use of the method? // This runs on page load var form = document.querySelector('.form'); var x...

@Duga rolled back
@CaptainObvious Example code.
4:47 PM
Q: Leftover change amount using modulus operator (JavaScript)

Quantum_CompassI am a long time viewer of SE, but this is my first time using it. I am working on an assignment that requires me to convert any number of pennies into the appropriate amount of Quarters, Dimes, Nickels and remaining pennies. I have most of the JavaScript down, except that when I run the program...

Q: Java GUI Tip Calculator has problem displaying elements of GUI

user155393I'm building a tip calculator, and the GUI won't display the elements. I have no experience with GUIs and I'm just learning how to use them, but I'm getting hung up on flowlayout and layout management. package com.company; import javax.swing.*; import java.awt.*; import java.awt.event.*; impo...

5:03 PM
If it works but you want to see if it could be cleaner, you should request a review on codereview.stackexchange.comStephen Ostermiller 34 secs ago
I'm voting to close this question as off-topic because it belongs on codereview.stackexchange.comStephen Ostermiller 18 secs ago
possible answer invalidation by Ryan Schaefer on question by Ryan Schaefer: codereview.stackexchange.com/posts/182287/revisions
5:20 PM
@StephenOstermiller in the future, please don't use Code Review as a reason to close a question. Evaluate the request and use a reason like too broad, primarily opinion-based, etc. Please see the section What you should not do in this answer to A guide to Code Review for Stack Overflow usersSam Onela 33 secs ago
5:45 PM
Q: Super beginner: Awfully written Selenium script that books a room

AladdinPerzonI have a lot to learn in Python, and now I am adventuring in automating tasks with Selenium. Specifically, to just quickly explain the purpose of the script I have created, I have made a script that books a room at my school that I use to study in. Rather than doing this manually I figured this c...

Q: Traveling Salesman Solution

T145This problem has been heavily studied, and at last may have a potential solution. The concept I have come up with was made entirely on my own, but is close to some other theories that will be referenced. The Theory My first step was to think about the problem differently. The classic TSP (Trave...

Q: Parse atom RSS feed with xml.dom.minidom python 3

Ricky WilsonI had to parse a blogger RSS feed but I didn't have access to any third party modules like feedparser or lxml. I was stuck with the task of writing a library to parse RSS feeds, challenge accepted. I started by writing a RSS class and then an Entry class. I then realized that my classes only had ...

Q: Javascript: Traversing through single large array to convert single array into array of arrays as per condition

learnningprogrammingI have a huge fileList array where many elements of array start from sub-** pattern. I want to group these files belonging to same sub-**(for e.g.: files which start with sub-01) into one subject specific array. Thus after creating all these sub specific array they can be pushed to a large array ...

6:14 PM
Q: Split groups into unique sets

GregFI have a data.frame of people broken into households where I have a set of mostly unique keys (for household, and then person within household), but sometimes it looks like 2 (or possibly more) households were given the same key. small_example <- tibble::tribble( ~hh_id, ~per_id, ~ref, 1, ...

6:36 PM
If your program works, you may want to post to Code Review for a code inspection. — Thomas Matthews 9 secs ago
posted on December 08, 2017 by CommitStrip

7:21 PM
Q: Console Based Snake Game

dalearnThis is a simple program where the goal is to visualize a virtual game to be played by an AI. For the purposes of this post, the playGameManually() function was added as a way of testing the rest of the code. The program was built around an open ended framework that allows each element to be mo...

If your code works, that's great. If it doesn't work you'll need to try and identify the flaw. If you're stumped on where the flaw is, but you've narrowed it down to a particular malfunction, let us know. For algorithmic theory there's the CS site and for code-review there's the code review site, each of which are geared towards more specific aspects of coding. — tadman 34 secs ago
Are there any Pythonistas around?
@Kaz @Mast?
you could try me, but I may not be of much help
@Kaz Usually.
7:33 PM
@Mast I'm trying to build a continuous-stream API call thing. Except I know nothing about how to write asynchronous code in Python.
Do you know any good tutorials on the subject?
@Kaz Don't write it yourself. Pick a library.
@Kaz Is this what you're looking for?
@Peilonrayz learned me a trick about coroutines the other day and this smells like a situation to abuse such knowledge.
That API does exactly that.
Welcome to The 2nd Monitor @AbhikBose
@Mast maybe. I'm not sure. I'll try to use it and see what happens.
Q: Advent of Code 2017 - day 8 solution

GolfWolfToday I solved the Advent of Code - Day 8 challenge in Haskell. Although the code runs fine and produces the correct results, I'm sure there are lots of improvements to be made, as I am a Haskell beginner. The Challenge The challenge is to build a "CPU" that can parse and execute instructions s...

@Kaz Sounds like my usual tactic :-)
@Mast Put very simply: I want to send this server 10 different requests every 2 seconds. Which will return numbers. And have my code update some variables in real-time based on whatever the most recent responses were.
This sounds like something that can probably do that?
7:44 PM
10 requests all at once at the same port? Or 10 different requests, not exactly at the same time at different ports? Or a combination?
@Mast 10 requests at basically-the-same-time to the same public endpoint.
What I envision is some *thing* which sits there, firing off the same request every 2 seconds, and listening for responses to come back, and feeding back whichever one has the most up-to-date timestamp. And then 10 of those running in paralell.
I'm not saying that python is gonna suck at this, but...
But it sounds like you want something like Node.JS instead, yea.
python makes this a lot harder than other programming languages
Well, Python is the one I'm learning at the moment ^^
7:50 PM
Nvm, confusing the client with the server.
So, basically, all you want is a server asynchronously handling incoming requests by sending back a simple response? That's relatively easy actually.
Q: Is tornado an async webserver?

EugeneI am learning to write a backend server that can handle thousands of connections. I take a look on some sample code, but find it is still writing in sync logic. For example: (take from http://www.tornadoweb.org/en/stable/gen.html) @gen.coroutine def get(self): http_client = AsyncHTTPClient...

@Mast Basically. I have calls to a REST API. They weren't time-sensitive, so I just ran them sequentially. Now, I want it to be as close to real-time as the server will respond to me.
request bundling, eh?
@Vogel612 Pretty much.
Q: Validating data using up to four kinds of validation rules

billynoahSometimes I end up with a function that requires checking multiple conditions to determine outcome and the logic can get to be too much to handle on a single line. Here's an example of how I currently handle this: function validateType($type,$data) { if ( (isset($this->validationRules[$typ...

Q: Effective way to find two string are anagrams

YsurfMy approach for checking anagrams is: step 1: Remove all the space from Both input string. step 2: Sort both the string. step 3: Return false if length differ. step 4 : Return true if all char matches. #include<iostream> #include<set> #include<string> #include <algorithm> bool anagrams(std:...

that does sound like a good place for asyncio
7:56 PM
I was right? Bloody genius.
in principle you'd want to aggregate all the results before sending the next round of requests, just to not have to maintain an update-time for each of the fields you're updating
@Vogel612 the update-time is pretty important. This is financial market data. I definitely need to know what timestamp my data corresponds to.
if you maintain it anyways then you can decouple the requests from one another
@Vogel612 I would definitely like to do that.
FWIW an alternative to the corouine solution that asyncio uses would be "Continuation Passing".
some people refer to that as callbacks, but I found that to be somewhat misleading
8:23 PM
I'm voting to close this question as off-topic because it belongs on codereview.stackexchange.comJosh Beam 22 secs ago
8:38 PM
@JoshBeam in the future, please don't use Code Review as a reason to close a question. Evaluate the request and use a reason like unclear what you're asking, too broad, primarily opinion-based, etc. Please see the section What you should not do in this answer to A guide to Code Review for Stack Overflow usersSam Onela 56 secs ago
Q: Determining goal with knn from scratch in R

StaceyI am trying to write knn from scratch in R for a dataset that looks as follows: Gender Grade Age Type Grades Sports Looks Money Goal boy 5 11 Rural 1 2 4 3 Sports boy 5 10 Rural 2 1 4 3 Popular girl 5 11 Rural 4 3 1 2 Popular I have a tes...

Q: Benchmarking TreeSet in Java against a van Emde Boas tree based integer set

coderoddeVanEmdeBoasTreeIntegerSet.java package net.coderodde.util; import java.util.Collection; import java.util.Comparator; import java.util.Iterator; import java.util.NoSuchElementException; import java.util.SortedSet; import java.util.Spliterator; /** * This class implements a {@link java.util.Sor...

8:53 PM
Q: Collate Votes by District

chemicalI have a function that is taking in a list where each element is a vote in JSON format. I am then building and returning a dictionary that looks like this: { "District A" : { "Match A" : { "Candidate A" : { 0 : 10 1 : 20 } } } Each element in ...

Q: Bash OpenSSL file decryption script

VlastimilTonight, I tried to write a Bash OpenSSL file decryption script. Encryption script will follow in highly similar manner, so I think it's not necessary now. Let's suppose we have an encrypted large file using: openssl enc -aes-256-cbc -salt -in somefile -out somefile.enc You correctly noticed ...

Q: Create a 2 dimension matrix from array of strings

MohamedBThe purpose is to create a 2 dimensions matrix from an array of strings, ex: String[] arrayOfStrings = new String[] {"1 2 3","4 5 6"} Then the output matrix would be Integer[][] matrix = new Integer[][] { {1,2,3},{4,5,6}} The transformer should be enough generic that is can produce matrix o...

9:11 PM
@CaptainObvious border-line not "working" per requirement??
9:53 PM
Q: python Snake game , pygame

Mateusimport pygame import sys import time import random import collections import itertools def main(): """Snake v 1.38""" score = 0 # Initial score speed = pygame.time.Clock() direction = "RIGHT" # Initial direction snake_position = collections.deque([100, 50]) # Initial snak...

Q: Langton's Ant cellular automaton in Ruby

Dmitry KudriavtsevI wrote a Langton's Ant cellular automaton simulator in Ruby using object oriented principles. This code works. It requires the drawille library. I would like to get feedback on what I could do better here, from optimizing the display to cleaning up code. I'm also wondering what I could improve ...

Q: Electronic Components in Java

Dexter ThornI've been watching digital technology in the last few days. This has aroused my interest. I would like to realize a program that simulates basic components of circuit technology and their functions. I have developed a small approach on how to implement the elements of circuit technology on an obj...

10:08 PM
Q: Checking if a variable from the db is null or not using php

AaronI am using Laravel on my backend. I am gathering data from my db and then display a string based on if the field is empty or not. I am using Jquery on my front end. After hours of hacking around I found a solution that works, but I am think there has to be a better way. Here is a snippet of my...

If your code works correctly, and you are only looking to improve performance, consider asking on codereview.stackexchange.com. — Algirdas Preidžius 39 secs ago
11:11 PM
you may want to try asking this question on codereview.stackexchange.comMarcin Orlowski 49 secs ago
I'm voting to close this question as off-topic because it belongs at codereview.stackexchange.comPeter 24 secs ago
Q: C++ Unlimited Health Hack for Call of Duty Black Ops

sand_storm_of_code.txtThis is an unlimited health hack I made for Call of Duty Black Ops in single player mode. It replaces a small section of assembly with no operation codes. I was wondering how my coding and commenting style are, and whether there is a better way to write this. #include <Windows.h> #include <iost...

11:29 PM
@Mast ^^^
Got the correct replacement capacitors for my monitor.
Or slow allocation if you're storing all 10^6 inputs. Python is indeed fast at times, but allocating 1e7 ints still requires a lot of free memory the "system" executing your code may not have, forcing it to fall back on swap memory, which is much slower than physical RAM on traditional hard disks. You might consider having all of your code reviewed since I/O might not be the only problem here, if it is a problem at all, but SO isn't the site for that: codereview.stackexchange.comChrono Kitsune 55 secs ago
I agree that the "feel free to offer suggestions" portion would be more relevant to being on CodeReview, but that was not the root of my presence here - I have a question of location for a test and was seeking help in writing it. [CodeReview specifically states "... asking for advice about code not yet written are off-topic, as the code is not ready for review."] — David 35 secs ago

« first day (1679 days earlier)      last day (42 days later) »