« first day (1647 days earlier)      last day (2370 days later) » 

12:00 AM
RELOAD! There are 4630 unanswered questions (90.4842% answered)
 
Pretty good.
I'm just coming out of about a month-long period where I had no motivation, so that's been nice.
 
0
Q: Python read/write pickled file

user3680510import gzip import cPickle import io # save zipped and pickled file def save_zipped_pickle(obj, filename): with gzip.open(filename, 'wb') as f: cPickle.dump(obj, io.BufferedWriter(f), -1) # load zipped and pickled file def load_zipped_pickle(filename): with gzip.open(filename, '...

 
12:27 AM
-1
Q: Sending & receive SMS using C language within the server

ShashidharI want to write a C program(only) which can send SMS and display the received SMS. As I'm a beginner,unable get the logic. Can anyone help in this...please... Any support would be appreciated.. Thanks & regards, SASI.

 
12:40 AM
0
Q: Does this Bing Image of the Day python script work on windows?

BoredIf you're on windows can you please test it out and tell me how it goes. I'm working on a school provided computer and I have not fully tested this. # -*- coding: UTF-8 -*- from subprocess import call from os.path import expanduser from os.path import isdir from os.path import isfile from datet...

 
1:37 AM
If you don't want to call it, don't call it. Presumably you don't want to call it because it would make your program incorrect; this is what code review and tests are for. Perhaps you have a leaky abstraction - should this `shared_ptr``be a private member variable of some higher-level class? — GManNickG 15 secs ago
 
2:23 AM
anyone else had the issue where msvc spuriously fails to find/open it's standard library headers?
 
 
1 hour later…
3:42 AM
0
Q: Scanner/Lexer in Java

Nathan MerrillI wrote a scanner/lexer to parse my language. Some notes: I'm scanning files written in UTF-8. I avoided regex for two reasons: It feels far easier to simply handle codepoints one at a time than to get regex to handle Unicode properly. As far as I can tell, there's no efficient way for me ...

 
4:08 AM
0
Q: Sudoku solver recursive solution with clear structure

Jianmin ChenProblem statement Similar to Leetcode 37 Sudoku solver, the algorithm is to determine if the sudoku board can be filled with ‘1’,‘2’,…,‘9’. A sudoku board is represented as a two-dimensional 9x9 array, each element is one of the characters ‘1’,‘2’,…,‘9’ or the '.' character. The dot character ...

0
Q: Computer Programming code

DsquaredWrite a computer program for: Sarah Martin has been working for Quality Builders for four years. Last year, Sarah received a 4% raise, which brought her current weekly pay to $250. Sarah is scheduled to receive a 3% raise next week. She wants you to write a program that will display, on the compu...

 
Questions without any errors are off-topic on StackOverflow. Perhaps you would like your working code to be reviewed at CodeReview. — mickmackusa 58 secs ago
 
5:12 AM
 
Working code is best posted on codereview.stackexchange.com. — Paul Rooney 56 secs ago
@PaulRooney the code for the classes as a whole was posted on codereview and I got valuable feedback but not for this bit. I asked here rather than there because in part I want to understand why the two versions are not equivalent and I thought that kind of question is more in SOs bailiwick. — Jaldhar 9 secs ago
 
6:15 AM
Monking
 
0
Q: Generating a list of powers in Elm up to some limit

Ray ToalI'm looking to generate a list of powers in Elm, up to a certain limit. I've written the following tests: [ test "works for negative limit" <| \_ -> equal (powers 2 -5) (Ok []) , test "works for 2 up to 63" <| \_ -> equal (powers 2 63) (Ok [1, 2, 4, 8, 16, 32]) , test "wo...

 
6:57 AM
0
Q: How can I return generic type T (not base class)?

TimelessI have many message class, all of them inherits from message base class, now I want to get message object from byte array based on the type byte, and return the actual type from the method. private static readonly GGMessageFactory FactoryInstance = new GGMessageFactory(); public static GGMe...

 
7:38 AM
Monking.
 
8:11 AM
0
Q: Simple lexer in C++

gruszczyI haven't written anything in C++ in a couple of years, so I have both forgotten a lot and also wasn't exposed to the modern C++. I am working on a toy programming language and while other parts are pretty large, so probably hard for a review, the lexer is fairly isolated. I would appreciate advi...

 
8:28 AM
0
Q: PDO connection improvment (multiple db)

user8707308Hello Code Review family, I create a little PHP script and I want to improve it ! $DB_ARRAY is an array with multiple db data (0=>[0=>'user', 1=>'password']). write_log is a function of which you will certainly have understood the interest. There's my code : foreach($DB_ARRAY as $key => ...

 
8:38 AM
Monking
7
Q: That's a lot of monkeys

LyricLyThe infinite monkey theorem states that, given infinite time, a machine sending an endless stream of random characters will always type any given text. That sounds to me like a great idea for a challenge. Process In order to monkey-ize a string A, the following steps should be taken: Take an...

@hoffmale Once, right after an update. Rebooting the computer usually works.
 
Well, I did try that... and it seems it helped, but Resharper is still confused :/
oh well, at least it compiles now
 
Some offtopic code review that does seem pertinent (feel free to disagree): Don't use a numbered system for classes, variables and methods. Give them a meaningful name. Just by name alone, I don't know what num01 and num02 are. But I would immediately interpret X and Y as a set of coordinates. Once your codebase expands to business level complexity, or you need to revisit code that you've not touched for a long time, you'll understand why clear naming is needed in order to not have to figure out from scratch what's going on. — Flater 7 secs ago
 
@hoffmale Might need another reboot then :-)
 
8:53 AM
nah, that issue needs fixing by jetbrains
 
If you have working code that you would like to improve on this question might be better placed at codereview.stackexchange.com. — nnnnnn 13 secs ago
 
9:18 AM
This isn't Code Review, and it's unclear what your question exactly is. — CodeCaster 56 secs ago
@CodeCaster - not asking for a code review, just asking how to restructure the regex.replace so that it's optional rather than mandatory. — John Ohara 11 secs ago
@HB - This would be off-topic on code review. Don't suggest it spuriously. — StoryTeller 57 secs ago
I think Performance is part of codereview @StoryTeller codereview.stackexchange.com/help/on-topicH B 21 secs ago
@HB - This isn't about improving the performance of working under-performing code. A questions that simply has "performance" in it, is not an automatic fit to code review. — StoryTeller 41 secs ago
 
10:11 AM
Monking
@RMunroe I would wonder why a Thermostat is running Android ...
 
@Vogel612 IoT thermostat.
 
I'd expect something Linux-y that doesn't have that huge overhead of Android
like... LLD?
 
Now you can call your thermostat to ask the temperature and it will speak to you.
 
@HB Basically the Code Review site tends to frown at artificial "example snippets". They prefer complete, working examples of the code as whole. Users can ask for a general review or ask the review to focus on certain aspects, such as RAM memory use, coding style etc. — Lundin 43 secs ago
 
@Mast add a few kernel modules to LLD and it can do that, too .. and I wouldn't even need a SIM-Card
 
10:34 AM
@Vogel612 You can probably run it from an Edison, Raspberry or whatever the latest in that kind of hardware is nowadays. So, no, you don't need it. But Industry has a nag for going with what they know, and they know mobile phones. So I wouldn't be surprised if there are thermostats with Android.
 
@Mast We're lucky EA isn't building theromstats. "Hey Thermostat, please increase the temperature by 5 degrees" - "Sure thing Bob, I will adjust the temperature over the next couple of days; to speed up the process please purchase an InstantAdjustPackage™ for $1.99!"
 
1
Q: Sudoku (Kudokia) game logic

Kacper KutarniaThere is an issue with updating lists even though I have not updated them anywhere in the program. Anything you could do to help me solve this bug would be very much appreciated. from tkinter import * from itertools import count import math import random master = Tk() def boardcreation(): ...

 
@Zeta And simply stop the usage of the thermostat if your internet connection drops for half a second.
 
11:07 AM
How to learn system design? is there some project or can you guys come together and create a real world example if that is possible? :)
I am more than happy to collaborate
 
@CodeYogi What kind of system?
 
@CodeYogi: Design, implement, reflect, repeat ;)
 
For example I need to build a spotify clone, not exactly just the basic functionality
there is some text/document/book which can help me?
 
@hoffmale Step 0: Collect requirements and check whether something already exists that fulfills them.
 
I hear a lot of DDD, CQRS etc but I can't find anyone around interested
 
11:11 AM
Also, curse a lot during reflection, since you forgot something.
 
^^
 
:)
 
requirements are always changing, so it's more of a dynamic process most of the time anyways
 
0
Q: Wrong Output when I enter r= -1?

Octavius Balangkit#include <stdio.h> int main() { const float p = 3.14159; float area; float r; while (r > 0) { printf("\nEnter radius:"); scanf("%f", &r); area = p * pow(r, 2); printf("The surface area is:%f", area); } if (r < 0) { printf("...

 
cool, I will try to create some basic requirements and post it here? because I have never created one
 
11:14 AM
@CodeYogi Are you trying to practice for some interview or something?
 
@hoffmale Sure, but you have some kind of baseline at least. Like "my program should be able to play music on-demand from a local file storage via a web-based interface, that enables users to add their wishes. If there aren't any whishes, play a song from a related playlist. Users can only add whishes, never delete or re-order them, unless they have special priveleges". That might change at any point and at any time, but it's always hand to have at least some kind of checklist.
 
im not arguing against that
 
@SimonForsberg not exactly, I want to understand things and have passion for learning although as a side effect it would help me in cracking interviews too :)
 
@hoffmale I'm just adding a little bit more detail for Yogi ^^. Design will yield new requirements or make old ones obsolete, and the new requirements will need design changes. At some point one simply has to stop worrying and start to implement.
 
@Zeta I agree but what if the project is managed by me only?
 
11:17 AM
Just make the damn process transparent, or your coworkers will scream at you.
 
@Zeta: Also, if you're permanently worrying about the perfect design architecture, you'd never get anything done ;)
2
 
@CodeYogi Well, if you figure things out, let me know.
 
Its not about just perfection, its like when you need to take decisions then it helps if you have some experiences
 
Design, implement, reflect, repeat... It's always this neverending circle
but especially if you need to make experiences
 
@CodeYogi Then you have to find out how you can organize yourself best. That's not only a feat for developing, but also for daily life, TBH. A software project doesn't differ too much from a do-it-yourself carpentry in that regard. You plan your cupboard, buy or rent the tools, get the wood and and glue and act on your plan.
 
11:20 AM
e.g. how bad are singletons really?
no way to know unless you try it
 
You may always worry that the cupboard won't be perfect. But if you don't start to finally make one, you won't fail or succeed, and both experiences will evolve your carpentry features.
 
@CaptainObvious broken
 
@CodeYogi Just keep in mind that you will have to make decisions on the way. If they turn out to be wrong, you've learned something. If they turned out to be right, you've learned something too. If you don't make any decision at all, you just turn in circles. If you want to prevent an endless design circle, make a deadline. But organizing one self is a case-by-case subject. Still, we're here if you need help with decisions.
@hoffmale Premature design optimization is the root of all non-started projects.
 
also, after you get your connection working, and other issues in this code, please take time to read about the usefulness of PDO wrappersYvesLeBorg 9 secs ago
 
@CodeYogi: Also, if you have a working result, feel free to post it on codereview ;)
 
11:27 AM
@hoffmale but practice is important, in job there is normally a big project and you to look only at a smaller part of it
I want to create small project end to end, it may have flaws
 
step 1) design it yourself
 
@SimonForsberg I am about to finish that QnA project would post it soon
 
step 2) implement and rework some of the less good design decisions
step 3) look and the result (and have others look at it), so you can see what went wrong and how to avoid that stuff, and to see what went right and why that did so ;)
step 4) repeat the process on the next revision/project
There's no end to learning processes, you just get better over time
 
@hoffmale that is really motivating, thanks
 
Last night I learned how not to do cmake...
I don't think I'm on the good side by now, but at least now it compiles ;)
once I've gotten 1 or 2 more changes in might might sent those files up for review, so other can tell me how I did things wrong - and how to fix them ;)
 
11:55 AM
0
Q: Python Blackjack Game - Updated

James CorbettWell, I'm back again! But this time with a more advanced, slightly more completed program for my Blackjack project. It's come quite a way since I first posted about it, and I'd like to thank those who offered their help and suggestions to improvements to the program! Now, below is the current ve...

0
Q: Implementation of database access class [PHP]

Ian FakoI programmed a class for database access for my REST service. According to my understanding it should be implemented as singleton, because there can be a lot of simultaneous requests. Is there everything okay with this approach? Is there a way to handle the getData... functions better? They bas...

 
12:42 PM
@CaptainObvious Closed.
@CodeYogi The only way to get experience, is by practice.
 
12:56 PM
I'm in 2 minds about whether this should be answered here or on code review section. There's quite a number of simple improvements for efficiency to be gained, making it a good candidate there i think, but it's also not working as you intend. — roganjosh 23 secs ago
 
0
Q: Bash - Compile C++ File Function

VlastimilAs I am starting to be tired of reverse-searching in history for the C++ compile command, which I'm using - details on my flags are written here, I defined the following .bash_aliases function: function compile-cpp { if [ -z "$1" ] then { echo "Need a file to compile as argu...

 
1:12 PM
1
Q: Understanding how to change the pointers and order linked list implementation python

MissComputingI have the following linked list implementation which I now have working perfectly. I don't however, understand how I can demonstrate, for teaching purposes, the fact that a linked list has nodes that contain "next pointers". In the following implementation could someone a) tell me how to change...

0
Q: Stack-based state machine

nuke_birdIs everything alright with this code? What can I add to it? state.h: #pragma once class State { public: virtual void update(float dt) = 0; virtual void draw(float dt) = 0; }; state_machine.h: #pragma once #include <memory> #include <stack> #include "state.h" using StateRef = std::...

 
@jester I wouldn't consider the for loop case to be good practice (and I always flag it in code reviews). Adding braces (and proper indentation) always makes code easier to read. — UnholySheep 18 secs ago
 
@CaptainObvious Looks to be not fully implemented. And is asking us to write code for them
 
1:32 PM
I removed the questions that are answerable on CodeReview (otherwise your question will be closed for cross posting reasons which is banned ... in a moment I will answer you) — Billal BEGUERADJ 52 secs ago
 
0
Q: Beating the queue

LudisposedInspired by this question on CodeReview, and because I'm never able to beat the queue. I'm just too slow I guess.. :( I made a little python utility that reads the queue's information every 30 seconds and opens the link in your browser if we can review something. from bs4 import BeautifulSoup...

 
I think the OP is looking, when he inserts 4, 3, 2, 1 to have 1, 2, 3, 4. Because we have, in this case, a simply linked list (not a doubly one), there is no way to loop back (apart from a hack, as I explained on CodeReview), and I think pre-pending achieves the desired behavior. If the OP says this is not what he is looking for, I will deleted this answer and try to re-answer @StefanPochmann — Billal BEGUERADJ 45 secs ago
 
2:00 PM
0
Q: Can I place a JSP code after HTML code completion

Manoj RamananI have placed a jsp code after HTML end tag inside a Bootstrap modal window.is it considered a good coding practice or it is bad.please help me with this .

 
2:29 PM
0
Q: Code for a Connect Four Game

J.BlackboroughI have a load of code for a connect four game in python. I am very aware that the code doesn't work though. I have a feeling it is a mixture of problems including the code for the board and my own incompetence. If you could help fix the code so that the game works, including loops that would be ...

 
Another important point is to find the code issues as soon as possible, executing the SonarQube in the early stage of the code development (during the code review process) when it's easier/cheaper to fix the problems. — Marcelo Ávila de Oliveira 59 secs ago
Yeah, i'm agree with you, that's the reason i was thinking to run SonarQube as pre-merge operation to ensure the quality before merge the code back to the master, moreover using GitLab i think i will propose to get rid of Gerrit as i'm starting to consider it a duplication in my team flow having GitLab which have his own code review flow... But my research work is still in process, so feel free to add comments/feedback! And thanks again — ivoruJavaBoy 38 secs ago
 
0
Q: Scoring poker hands

Martin BuchmannJust for fun I solved another Project Euler problem dealing with poker cards. I think it is also part of other programming puzzles which can be found in the web. While there is not much mathematics in it, I had some problems to find a good solution with respect to data representation, initially. ...

 
3:01 PM
Monking
 
0
Q: Implementing a TTY loading / waiting animation

Richard NeumannI implemented a class to animate waiting for processes: class TTYAnimation: """Text animation for interactive TTY.""" def __init__(self, message='', animation='–\\|/', end='', template='{}: {}', interval=0.1, file=stdout): self.message = message self.ani...

 
Greetings, Programs.
 
3:32 PM
0
Q: Should I include my testing code?

Nathan MerrillI recently posted a large chunk of code. It feels like a tall order to code review. I've written a bunch of tests to test my code. Would those tests be useful to the reviewer? I'm not looking for a code review of my tests, but rather looking to minimize the burden of the code reviewer. In e...

 
4:09 PM
0
Q: Python3 Linked List implementation with insert

JeffI am looking for some comments on the implementation of a singly-linked list in Python. What can I do to make it more reliable and readable? Create some helper function. from itertools import islice, tee def pairwise(_iterable): "s -> (s0,s1), (s1,s2), (s2, s3), ..." a, b = tee(_iter...

 
@CaptainObvious Stolen from one of my answers.
 
4:37 PM
if you really want to simplify/shorten your code (and check for bugs, etc) then suggest posting the question/code at: https://codereview.stackexchange.com/user3629249 54 secs ago
 
4:55 PM
Zonking
 
Shouldn't this be asked on Code Review? Seems to me the question is about improving working code. — icecub 44 secs ago
 
5:08 PM
@icecube Thankyou for your suggestion, my apologies if this is not the correct place to post this question, I was not familiar with code reviews and will take care in future to post to the correct forum — Sameer Ali 39 secs ago
 
5:19 PM
I suggest you to move this question to codereview.stackexchange.comMichael IV 22 secs ago
 
5:32 PM
1
Q: Why are we still unable to flag off-topic -> Code Review?

icecubLogically speaking, it would seem to me that SO and CR go hand in hand. So everytime I come across a question that would be a better fit for CR, I find it odd that I can't flag the question to migrate to CR. Before asking this question, I did my research here on Meta and found a few posts regard...

 
5:55 PM
-2
Q: linq groupby time complexity

alexhuangI'm having difficulty analyzing the time complexity of the following algorithm which is utilizing c#'s linq-to-object's group by implementation. Which i am assuming to iterate through the entire collection it needs to do the grouping on. foreach(var grpA in results.groupby(x => x.A)) foreach...

 
6:11 PM
Questions regarding the improvement of otherwise working code are better suited to Code Review, but be sure to follow their content guidelines. — jmoerdyk 56 secs ago
 
0
Q: Present data for each time period

SaiI'm working on a query where I'm trying to show the data for different time periods. I'm not really sure if this is the proper way to extract the information. Query select 'MISC' as Label, 'MISC 12 months' as Label, min(created_at), count(*) FROM services WHERE services.service_uuid = 'c4e5c...

 
@D.Ziaber 1) Yet you show no efforts at solving the problem in your question. 2) If you have a solution, and want to improve it's performance consider asking on codereview.stackexchange.com. 3) SO is not a forum, hence asking for "clues" are too broad. Here you are expected to ask a specific question. — Algirdas Preidžius 15 secs ago
 
was that question about the PG SQL query for time periods deleted by OP or removed because it was off-topic?
 
6:32 PM
0
Q: Check if num X is divisible by num Y (Ruby)

Brian RuffI'm trying to write some code that will figure out if any two given numbers are divisible by each other. Here is what I currently have. Is this right? If so, how could I improve it? puts "Enter number one" num1 = gets.chomp.to_i puts "Enter number two" num2 = gets.chomp.to_i if num1 % num2...

 
I'm voting to close this question as off-topic because it belongs on Code Review. — suspectus 38 secs ago
@suspectus the second variant is incorrect, and therefore off-topic on CR. Please read codereview.meta.stackexchange.com/questions/5777/… before advising users to post their question on CR. — Zeta 13 secs ago
 
7:09 PM
@GrimaWormtongue Here we go again.
@SamOnela If you're talking about this question, it was removed by the author itself.
 
@Mast okay -that was my guess
 
7:25 PM
0
Q: Unit testing SQLAlchemy models

Richard FeynmanI have developed two SQLAlchemy models which I would like to test. Book class represents, well, a book. Course represents an online course (MOOC). Later in the application, these objects will be placed inside the set() object, therefore __eq__ and __hash__ methods are implemented for both of them...

0
Q: Four to One Game Server

DairThe two player game four-to-one works by leaving four stones on a table. Each player may remove 2 or 1 stones from the table. The first person who cannot take away any stones loses. I created a web page that allows you to play this game against a computer that plays that plays the game perfectly1...

 
7:48 PM
Brute force solutions almost never meet the time requirements of these programming challenges. If you have a working solution (other than it being too slow) you can try asking for help improving your solution over at codereview.stackexchange.com/help . Note that I have linked you to their help page. Definitely read the help pages before asking. — user4581301 36 secs ago
 
8:03 PM
codereview SE might be a better place for working code improvements — depperm 17 secs ago
 
8:34 PM
If you just want tips on how to speed up your working script. This question would be best at Code Review. Stack Overflow is moreso for people who are having issues with a specific programming problem. — ShanayL 42 secs ago
if your code works correctly without errors, then submit here for speedup suggestions codereview.stackexchange.com — jsotola 51 secs ago
 
2
Q: Update pass-through query from a form (an alternative to stored procedures)

WilsonI've adapted a script from the book Microsoft Access Developer's Guide to SQL Server that I use to update a pass-through query via a form. One way to pass parameters to a pass-through query is to modify the QueryDef object's SQL property in code before running it, concatenating the parame...

0
Q: Mapping Index to a String

It'sPeteAll, Please excuse my potentially noob-ish question. I haven't touched strings in C (or C in general) in a while, and I seem to recall there being different ways you can return a C string from a function (as discussed here: https://stackoverflow.com/questions/25798977/returning-string-from-c-fu...

 
9:02 PM
@BoristheSpider: Thanks for the code review! :) I'm still working on the getBytes part. It's a place holder since some inputs come in as UTF-8 strings, and others as Hex. So they way I go from String to byte[] is different in each case. I haven't thought through that abstraction yet. — gridDragon 50 secs ago
 
9:22 PM
Holy carp
 
All Atom packages that provide code review, interpreting, or compiling are going to reference an external binary that actually understands how to read the code. If there's no existing linter program for GAMS, you'd have to start with that, which is a much larger project. — Holland Wilson 5 secs ago
 
I was wondering why Firefox is so slow now suddenly
 
@skiwi Did you check about:performance and about:memory yet?
 
> about:performance may currently by slowing down Firefox.
 
And about:memory will probably give up.
 
9:26 PM
0
Q: Simplified Encryption API - Trouble with Parallel Inheritance Hierarchy

gridDragonI'm working on an encryption library to simplify how my team uses encryption for api credentials and receiving encrypted messages from other teams/projects. This code is wrapping java.security and BouncyCastle implementations. These classes are just simplifying the calls to those libraries. But ...

 
@Zeta It pushed it over 6GB
There's over 1 GB worth of strings
Minimize memory usage dropped it from 5.8GB to 5.6GB
 
Maaaaaaaybe it's time to restart FF?
 
no the idea is to close duplicate tabs
 
9:42 PM
Maybe it's time to call it a day
 
10:11 PM
Since this seems to be an issue of specific typos/simple coding errors rather than conceptual issues, it probably belongs on codereview.stackexchange.com — mac9416 27 secs ago
Have you considered posting this to codereview.stackexchange.com instead? — Pablo Oliva 27 secs ago
 
10:49 PM
Didn't we discuss this over email? Also, look at the last question I linked - it has the same code, and in my answer there I made suggestions already about fixing those loops. Stackoverflow is not a great way to get code review - especially since your question is about paging, and not loops or optimization. — Colin Alworth 34 secs ago
 
0
Q: Manual C code optimisation

Will CWhat manual code optimizations could I apply to this code to make it run faster in an environment where compiler optimizations are not desired (compiled with -o flag)? Arrays are size 512x512. for(iy=0;iy<Ny;iy++) { for(ix=0;ix<Nx;ix++) { if (ix==0) { pudx = (u[1][iy] + u[Nx-1][iy] - 2.0*u[0]...

 
11:22 PM
0
Q: Rock, Paper, Scissors (Ruby)

Brian RuffJust looking for any tips to improve the code. In particularly easier ways to change the main logic of the code so that it's shorter. puts "Let's play rock, paper, scissors" #scores compScore = 0 humanScore = 0 until compScore == 5 || humanScore == 5 puts "Select your weapon. Rock, pap...

 

« first day (1647 days earlier)      last day (2370 days later) »