« first day (1664 days earlier)      last day (2338 days later) » 

12:00 AM
RELOAD! There are 4721 unanswered questions (90.3847% answered)
 
 
1 hour later…
1:09 AM
0
Q: setting label in Java button listener

Danny Boris OvHow can I avoid so many if statements? //Radio Button toggle if (five.isSelected() == true) { one.setSelected(false); private class JButtonListner implements ActionListener { //As my code has 4 options (1,5,+,-) to change the label, i have done 4 if else statments. is it poss...

 
 
1 hour later…
2:26 AM
0
Q: simple login user authentication

user4221591I've created a simple User Login page. Here User is authenticated [username, password] and if it is a valid user, values like username, name and role of the user is stored in the Session. And according to the role of the user, the user is redirected to different pages. This is a simple code, bu...

 
 
1 hour later…
3:31 AM
0
Q: using python 3 stacks to ensure symbols match in correct pairs and the types of symbols match as well

Ewurama Minka Akuokodef spc(sym): stk1=myStack() stkall=myStack() sym=sym.split() for i in sym: if i not in stk1: stk1.push(i) else: stkall.push(i) print(list(stk1)) print(list(stkall)) for j in stk1: for k in stkall: if j==k: ...

 
4:00 AM
possible answer invalidation by Jamal on question by stephenlcurtis: codereview.stackexchange.com/posts/173481/revisions
@HovercraftFullOfEels I found the multithread code here: codereview.stackexchange.com/questions/112949/… so I guess it's the prime numbers? — Amee Jay 30 secs ago
 
4:18 AM
0
Q: Computing mean and median

Muhammad KamalI have written a program to compute mean and median. Please review my code and give suggestions. Note: I am self learning programming by reading "Programming: Principles, and Practice" by Bjarne Stroustrup. Currently, I am on chapter 4. #include <iostream> #include <vector> #include <algorithm>...

 
if your code works, i can only repeat my suggestion that you ask the question on Code Review. See, for example, codereview.stackexchange.com/questions/150436/…rici 40 secs ago
 
5:11 AM
If you're looking for a review of working code, check out codereview.stackexchange.com - but don't cross-post (delete the question here) and make sure to read their help center to ensure you're on-topic there too. — Blorgbeard 59 secs ago
 
5:32 AM
Monking
 
6:10 AM
Monking
 
0
Q: Java: Find a substring which could be rearranged to palindrome

eshi14Problem statement: To find maximum length substring in an input string which could be arranged into a palindrome, only even length palindromes are expected. Input is one line String which contains only integers. Output is the length of the substring which could be arranged in pallindrome. Eg. I...

 
6:25 AM
0
Q: simple Tic-tac-toe in python 3.6.3

khashayari'm self learner python trying to improve my skills by writing some simple programs in different ways, i wrote a Tic-tac-toe using functions instead of while loop, i know it might not be a good idea in python my questions are:1) how to write a check win function, using loop? 2)how to write a tie...

 
possible answer invalidation by Jamal on question by Manya: codereview.stackexchange.com/posts/181050/revisions
 
7:08 AM
You may have better luck with questions like "are there more efficient ways" on the dedicated code review site, codereview.stackexchange.comvektor 37 secs ago
 
 
1 hour later…
8:33 AM
Monking
 
8:49 AM
0
Q: Reducing array to average readings

LukeTaking the payload below, I need to output the average of each reading. For example the readings for 2 are 1, 4, 7. 1+4+7/3 = 4 Final result should be [ [2, 4], [4, 5], [6, 6] ] My effort so far seems to work. const payload = [ [ [2, 1], [4, 2], [6, 3] ], [ [2, 4], ...

0
Q: Django Rest Framework ListAPIView - many if-s in get_queryset()

user3115655Please review my DRF ListAPIView code. There are a lot of if statements. I wonder if it's good approche to put these if-s in get_queryset(). How can I improve this? class ReportList(ListAPIView): serializer_class = ReportSerializer permission_classes = [IsAuthenticated, ] def get_qu...

 
9:02 AM
Monking
 
0
Q: Which code of block hierarchy is better?

denismasterI'm trying to write some code to create hierarchy of different types of signed blocks with data. I've write some code, but I don't know which is better practice. There're 2 variants above, please, help me, which one is better. First variant: public interface ISignable{ Signature Signature {ge...

0
Q: c++ combinations of mixed vectors

skualitoI have the following code to generate all combinations of a mixed string and double vector. i need some restrictions like to exclude combinations if all members have the same d value or if several members have the same s value. #include <algorithm> #include <cassert> #include <iostream> #include <

 
9:18 AM
The only way for you to prevent downvotes is to delete the question. Or improve it so that people don't want to downvote. I suggest you delete it though, since "improve my code" is too broad for Stack Overflow, and you have posted on Code Review. — Blorgbeard 32 secs ago
 
9:59 AM
I think you should post this on Code Review seeing how this is working code. — Dev-iL 27 secs ago
And what is your question? Remember: StackOverflow is a place to ask about problems with some code, not for what can be made better or is this good. You may however post this into codereview.stackexchange.com — HimBromBeere 41 secs ago
Plz have a look at it now if my explanation works so may be if you have time you can provide me an answer otherwise i will drop this qurrey on code review as i have never used code review before so may be it takes some time and you are right this code needs some changes for handling and storing stuffs.Thanks a lot in advance. — Peter 45 secs ago
 
10:36 AM
1
Q: Add code to optimized script XML2SQLITE

NicoleI need to implement this in my current grep sed -i "s%^0%0/%g" grhost cat grhost | cut -c1-3 > grhost2 sed -i "s%.\{4\}%/%g" grhost pr -mts, grhost2 grhost > grhostfinal sed -i "s/,//g" grhostfinal cat grhostfinal | cut -c1-4 > grhostfinal1 cat grhostfinal | cut -c5 > grhostfinal2 awk -Wposix '{...

 
10:50 AM
0
Q: PHP code to update database record sort order

Edson Horacio JuniorI wrote this PHP method to update database record sort order after moving a specific record with jQuery UI Sortable in a website. That sort order is stored in a column named order. I'd like to know if this is SOLID approved or should I split it in more methods, maybe separating the logic that se...

 
11:09 AM
Welcome to Stack Overflow! Please take the tour, have a look around, and read through the help center, in particular How do I ask a good question? and What topics can I ask about here?. - For comments on working code codereview.stackexchange.com is the appropriate site. — Timothy Truckle 56 secs ago
I'm voting to close this question as off-topic because it rather belongs to codereview.stackexchange.comTimothy Truckle 24 secs ago
 
11:23 AM
I thought it was allowed to ask why someone downvoted your question/answer. Isn't it?
 
@Belle sure you can ask but as votes are a private thing don't wonder if you don't get an answer.
 
I know :) on other communities they allow it and I think it's a good thing. Someone else could explain too. But my comment got removed shortly after asking. It was the only comment on the question. There's 3 upvotes and 3 downvotes (so score of 0) and I was wondering why some people like it and some don't.
 
@Belle FWIW the comment doesn't really add value to the question itself ...
that's probably why it got removed
 
So you're not allowed to ask why people downvote the question so you can improve it? Great.
 
@Belle Looking at your question, it looks like you question _was_/is off-topic. And so people probably down voted due to that. But I don't know PHP so it could be something else too
 
11:40 AM
I spent hours a few days back trying to make it on topic. It went in the reopen queue but it got even more downvotes then. And now my comments asking for clarification got removed.
I'm leaving. This community is too frustrating. Sorry. Bye.
 
11:50 AM
@Belle good luck on your future endeavours :)
 
Thank you. Best wishes to all of you. Goodbye.
 
@Belle Your second sentence starts with "It throws Exceptions…", and some people will stop there, downvote and close.
As I don't know PHP that well anymore, I'm not sure whether that's the problem, but "I have extended Exception to print non-200 responses" doesn't look like unexpected behavior.
 
12:23 PM
0
Q: Identify and extract URLs from text corpus

Thirupathi ThangavelI'm working on a project that requires POS Tagging of paragraphs. The text contains lot of URLs which contain various punctuation marks such as . ?. This affects the accuracy of the sentence tokenization. So I decided to clean the data by removing/replacing all the URLs. And thought regular ex...

 
12:43 PM
 
 
1 hour later…
1:57 PM
2
Q: Increasing the efficency of code Pandas

edyvedy13I have a dataframe in pandas like this Date cell tumor_size (assume it is three dimensional) 25/10/2015 113 [51, 52, 55] 22/10/2015 222 [50, 68, 22] 22/10/2015 883 [45, 23, 67] 20/10/2015 334 [35, 23, 76] What I want to do is ...

 
2:32 PM
Monking
 
2:46 PM
Monking
 
You'll probably be better posting this on codereview.stackexchange.com. — Andy 39 secs ago
 
0
Q: Lag Lead Enumerator

OrdinaryOrangeI had a requirement to do a look-ahead and look-behind when enumerating though and IEnumerable. So I knocked this up. Works, but there are some smells. Needing two separate extension methods to deal with Value Types and Reference Types. I just could not get it to work any other way. The List<ob...

 
I'm voting to close this question as off-topic because it's a code-review request and should be on codereview.stackexchange.com. — Some programmer dude 16 secs ago
 
3:23 PM
well then you might want to write some algorithm first yourself and then move that question to Code Review to get help and hints on how to optimize it. — Igle 37 secs ago
 
0
Q: AngularJS Null coalescing operator filter

JustCartyI am relatively new to AngularJS and am coming from a PHP background. One of the new features for PHP7 was the Null coalescing operator. In short, it checks if a value is set and if it is then it shows one value, otherwise it shows another. I wanted to do a similar thing in AngularJS since I wa...

 
Questions like this where your code works and you are looking to optimize it only are better asked on codereview.stackexchange.comcharlietfl 55 secs ago
 
3:40 PM
-1
Q: javascript, why get json err?

tony checkTicker() function checkTicker() { var dao = new XMLHttpRequest(); //dao.open("GET", "https://api.fanyi.baidu.com/api/trans/vip/translate?q=hello&from=en&to=zh&appid=20171120000097357&salt=1435660288&sign=bcd4bc3fe3b120dddea66560f8533891",true); dao.open("GET", "https://pol...

 
@Malachi Then it wouldn't be random.
But yes, you can generate a list of 0-N integers and use the Fischer/Yates sort to get unique "random" numbers.
 
4:01 PM
1
Q: Compare variables and return the relation of the first ones that are not equal in C++

mindm49907I have a C++ function that is called frequently within a loop. It compares the variables v_1, v_2 and v_3 with type double of two objects a and b of a class MyClass in the following way: // a, b are objects of a class MyClass // v_1, v_2 and v_3 are class variables of type double bool compare(M...

 
Well done! But if what you want is code review, I recommend using codereview.stackexchange.com — Filipp 37 secs ago
 
-2
Q: My program is not writting to file and im not sure why

HuseyinAtimdef RegisterMenu(): print("***REGISTER***") global First global Last global Age global YearGroup global Username First = input("Please enter your first name: ").lower() Last = input("Please enter your last name: ").lower() Age = input("How old are you?: ") ...

 
4:39 PM
This is better ask at Code ReviewJens 37 secs ago
We don't address "just doesn't feel right" or "has a crude feeling to it" here. If your code were working as desired, then those would be issues you could take up over at Code Review. We do address questions about why your code doesn't work correctly, but you need to be specific about such problems, and you need to present an Minimal, Complete, and Verifiable example to demonstrate. — John Bollinger 10 secs ago
Better ask at Code ReviewJens 45 secs ago
If this is working code you'd simply like some feedback on, see Code Reviewjonrsharpe 1 min ago
 
2
Q: Equivalent of Python's dict.update for STL maps in C++

5gon12ederdict objects in Python have an update method that can be used to extend one dictionary with all items from another, possibly overwriting entries that already exist. I find this function very useful from time to time. The associative containers from the C++ standard library (std::map and std::un...

 
1019
Q: Why does man print "gimme gimme gimme" at 00:30?

Jaroslav KuceraWe've noticed that some of our automatic tests fail when they run at 00:30 but work fine the rest of the day. They fail with the message "gimme gimme gimme" in stderr, which wasn't expected. Why are we getting this output?

lol
 
@Hosch250 I meant something like it wouldn't spit out the same number twice... Fischer/Yates......
 
4:56 PM
Before you ask at Code Review, you should create a complete class with a main method and several example inputs and outputs. And, most importantly, describe the purpose of the method better because it's not very clear. It looks like it could return up to 20 digits: 4 from the first loop plus 4x4 from the second loop. — DodgyCodeException 50 secs ago
 
0
Q: ATM Python Machine

James Sharrock-StudentI have a problem where I have split the euros up into notes but for example for 51 euros I need to make it so where it says 1 50 euro note then 2 20 euro notes it should take away the 50 so there is only 1 dollar left so there should be 0 20 euro notes pls help code below: pounds = float(input("...

 
5:11 PM
Yes CodeReview is nice, but prepare a bit, autoformat your code and such. — Joop Eggen 56 secs ago
 
5:22 PM
Optimizing existing, working solutions is often too broad for Stack Overflow. If you want your existing work reviewed, you can try Code Review(codereview.stackexchange.com), but note they do have strict guidelines for questions. — Erik von Asmuth 16 secs ago
 
5:42 PM
This question belongs to codereview.stackexchange.com. — Xaerxess 19 secs ago
 
0
Q: Suggest better approach for maze implementation

DkkI am trying to implement a maze in python maze where the in the function addCoordinate x and y denote the x and y coord of grid and block type zero means open and 1 means wall and printMaze function prints the maze with * for wall and empty space for open spaces.My implementation seems to be work...

 
@Xaerxess no, it doesn't. It asks for a new feature or alternative variant, which is off-topic on CR. If it gets cleaned up and explains what the code does, it might be on-topic. But it really needs to get cleaned up first. See also this guide. — Zeta 42 secs ago
 
6:29 PM
Looks like you are asking for a code review. — Eugene Sh. 55 secs ago
This question belongs on codereview.stackexchange.comnaomik 39 secs ago
 
6:56 PM
1
Q: Compute all permutations of a String (may have duplicate characters)

linuxNoobI was attempting to implement a java solution, the end result turned out to be slightly more verbose that I would have liked. Is it ok to use StringBuilder the way I have? I am more looking at improving it from a Data Structure and Algorithms standpoint rather than an OO standpoint although I do ...

 
Gao
7:09 PM
People are inflating the score of this low quality question:
2
Q: Add code to optimized script XML2SQLITE

NicoleI need to implement this in my current grep sed -i "s%^0%0/%g" grhost cat grhost | cut -c1-3 > grhost2 sed -i "s%.\{4\}%/%g" grhost pr -mts, grhost2 grhost > grhostfinal sed -i "s/,//g" grhostfinal cat grhostfinal | cut -c1-4 > grhostfinal1 cat grhostfinal | cut -c5 > grhostfinal2 awk -Wposix '{...

 
7:25 PM
0
Q: Advice on good practices, best effort test case included

ZacariazI've decided to do something about my horrible coding and have thus made a test case for review. I'm not sure how this site works exactly, there are so many rules and they don't seem at all clear, not to me at least. Regardless, I'm going to try. Also, the real point of this is to find out if I'v...

0
Q: Constructive feedback on my MOD class

ommI would like some constructive feedback on my MOD class that I have made it works fine but there are some aspects I would like to improve on: 1) Why doesn't my code handle multiple clients concurrently. 2)What adaptions would you recommend that would allow my MOD class to handle multiple client...

 
@Gao Voted to close as unclear (as well as applied DV)
 
7:41 PM
0
Q: Is this function secure to generate user ids on a random forum website?

Joe Scotto/** * Creates a UID * @return string 64 Character UID */ public static function createUid($length) { $bytes = random_bytes($length / 2); $uid = bin2hex($bytes); return $uid; } Will the above code be random enough to generate user ids for a website where people can create posts? ...

0
Q: Selection sort time in Python, and plotting it on a loglog plot

jane431I have come up with the following code for the time necessary for selection sort to sort lists of randomly chosen elements of length \$2^i\$ for i = 1,...,10: ivalues = [] sorttimelist = [] for i in range(1, 11): ivalues.append(2**i) mylist = list(range(2**i)) random.shuffle(mylist) prin...

 
I feel that's topical at this point
 
@Malachi I know. And that's the very definition of a non-random number...
So, let's say you need 5 random numbers.
You can populate a list [ 1, 2, ... 99, 100 ]
Then, when you get a number, you can do rand.NextInt(0, list.Count)
That gives you an index, so you do myList[generatedNumber], where myList is the pre-populated list and generatedNumber is the random number.
That gives you a value. Then, you remove the value at that index from the list.
So, if the random number generator gives you the same number twice, you get that number the first time, then that number + 1 the second time.
But, it's perfectly ridiculous to want a "random" number that isn't random...
 
7:59 PM
Unless you implement something like randomly picking something up until the pool is empty.
 
That's the very definition of the Fischer/Yates shuffle.
 
Kaz
8:20 PM
Hi guys!
 
0
Q: CRUD in JSP AND SQL

tamzoroI would like to simplify my code when I add an entry. All is OK for 1 table. (table = "ecole") I can add an entry without problem. None error... My problem is that I will wish to add a table second in my system CRUD who has as name "nom" but this is complicited in my code... :-( Do you have an ...

 
8:57 PM
0
Q: Is this a good way of making a slideshow in javascript/jquery?

DavkkI am new to javascript and jquery and I would like to know if I can do things like this here: https://jsfiddle.net/coffqfwm/3/ (function ($) { let pointer = 0; let slides = document.getElementsByClassName('mySlide'); for (let i = 0; i < slides.length; i++) { slides[i].style.left = 100 * i +...

 
9:27 PM
Good catch! Code review in action :) — serge.karalenka 32 secs ago
 
0
Q: Meaningful response to the user after his uploaded CSV was processed?

OlegA user uploads a CSV to the server to be inserted into the database and I would like to return a meaningful response to this user. My thoughts : { inserted : x records discarded : y records } I believe also that I should specify what records were discarded because of the inconsistent fo...

0
Q: Configuration Handler in C#

VoiD HDJust to quickly explain what this is and what it does: it's a config handler that loads a file that has configuration data in INI format, key=value that sort of format. I then just store it all inside a double string dictionary and take items from the dictionary when I need them. Questions: Is...

0
Q: Mersenne Prime Finder (Python)

Please Help-MeThis program generates prime numbers: prime = int(raw_input("Prime seed:\n\t ")) stop = int(raw_input("Iterations: \n\t")) for i in xrange(0,stop): prime = 2**prime - 1 print prime These numbers grow incredibly quickly, and it takes a very long time for python to generate the numbers. Does ...

0
Q: Infix to RPN converter using the Shunting-Yard Algorithm

CarcigenicateI need to be able to parse simple equations in an app I'm writing, and decided to try writing my own parser. I ended up using the Shunting-Yard Algorithm to convert from infix notation to RPN as the first step. Later, I'm going to write something that can RPN equations. I did a lot of manual stu...

 
9:50 PM
possible answer invalidation by Wood Glass on question by Wood Glass: codereview.stackexchange.com/posts/180989/revisions
 
10:03 PM
This would be better over on Code Review1201ProgramAlarm 45 secs ago
 
10:49 PM
0
Q: Having Trouble Even Starting C++ Craps Game

KBO1218Im having trouble getting this program even started this is the instructions: Write a program that simulates the game of craps. These are the rules: A player rolls two dice. Each die has six faces. After the dice have come to rest, the sum of the spots on the two upward faces is calculated. ...

 
11:39 PM
0
Q: Using readdirSync to add routes dynamically

per.eightIn express I am currently using the following code to add routes dynamically. fs.readdirSync(routesDir).forEach((file) => { if (fs.lstatSync(routesDir+file).isDirectory()) { let dir = file; if (fs.existsSync(routesDir+dir+'/route.js')) { app.use(`/${dir}`, requi...

 
I'm voting to close this question as off-topic because this question belongs to codereview.stackexchange.comGusman 31 secs ago
If you post on codereview, you should make sure to read their help center first to make sure your question is on-topic there. — Blorgbeard 11 secs ago
 

« first day (1664 days earlier)      last day (2338 days later) »