« first day (1420 days earlier)      last day (2598 days later) » 

12:00 AM
RELOAD! There are 3630 unanswered questions (91.5227% answered)
 
12:20 AM
0
Q: If Testing if button is touching function work

Fire the BulletI made a function that tests if a button is overlapping and I was wondering if it works. public bool IsTouching(Button B1, Button B2) { if(B1.Location.X > B2.Width - 7 - B1.Width) { return true; } if(B1.Location.Y < B2.Location.Y + B1.Height){ ...

 
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 25 secs ago
 
No one to talk to but Duga & Captain? Sad forever.
6
 
0
Q: Wrapper for GMP in C++

Tomasz MadryI'm writing a C++ high precision library based on GMP, sample code(files which have to be added to project): //biginteger.cc #include "biginteger.h" #include <cstdlib> #include <iostream> #include <tuple> #include <gmp.h> void biginteger::deleteBiginteger(){ std::cout << "sprzatam bigintegera";...

 
12:45 AM
0
Q: c++ singleton using templates

BPLIs this a good Singleton implementation? Is there anything I should be aware of? If it's so, how can it be improved? template <class T> class Singleton { public: static T& getInstance() { static T instance; return instance; } protected: Singleton() {} ~Single...

 
1:07 AM
@RubberDuck sad ducky?
I'm here off and on but we were super busy at work last couple hours because a customer app is down lol
 
1:22 AM
I'm voting to close this question as off-topic because review of functional code is off-topic for Stack Overflow. Your question may be on-topic for Code Review. — Makyen 23 secs ago
 
@Phrancis hiya!
That doesn't sound fun.
 
2:15 AM
Not much fun indeed
Authentication issues, again lol.
 
0
Q: ssh login in python

sakshiI want to login on multiple servers using ssh command in python . It asks for password.Is it possible that I can provide password through some variable in python script and it doesn't ask the password in interactive mode ? regards Sakshi

1
Q: Splay tree using shared and weak pointers

Antonhaving fun with shared pointers in a splay tree... please let me know what to do about code readability, and if you have any tips on speeding up my code let know about that too.(however I am aware of unique_ptr and will implement that next, this is for practice). main.cpp #include <iostream> #i...

 
2:50 AM
hi
 
@morbidCode hi!
 
3:10 AM
0
Q: customSignupForm code to allow signup for only the invited user

pythonLoverI am developing a feature where the user has to request for invitation if he/she wants to sign up on the site. When the request is accepted by the admin, the user gets to sign up, otherwise it shows them an error saying they are not invited at this time, and saves a email so we can follow up with...

 
3:44 AM
monking
 
4:04 AM
1
Q: Calculating speed from a Pandas Dataframe with Time, X, and Y columns

NJMI'm trying to calculate speed between consecutive timepoints given data that is in a '.csv' file with the following columns: "Time Elapsed", "x", and "y". The ultimate goal is to get the data into a format where I can plot "Time Elapsed" vs. "speed" I'm fairly sure that my implementation is doin...

 
@Phrancis hi! Seems quite over here...
 
@morbidCode It is right now, depends on the day. The bots/feeds fill in a lot of the "chat" lol.
 
@Phrancis I see. It's nice you're here though XD. Do you mind helping me understanding a diagram?
 
4:27 AM
@morbidCode I can try :)
 
4:38 AM
Thanks! I am reading about the environment model in SICP. My eyes are destroyed so I have trubble understanding the diagram in figure 3.1
https://mitpress.mit.edu/sicp/full-text/book/book-Z-H-21.html#%25_sec_3.2

I am trying to follow this statement:

"Figure 3.1 shows a simple environment structure consisting of three frames, labeled I, II, and III. In the diagram, A, B, C, and D are pointers to environments. C and D point to the same environment. The variables z and x are bound in frame II, while y and x are bound in frame I. The value of x in environment D is 3. The value of x with respe
 
It's very low resolution, I can imagine it's hard to see
Environment A points to frame II, which contains z:6 and x:7
From frame II there points C up to frame I
Like wise, B (right side) points to frame III, which contains n:1 and y:2
From fra7me III there points D up also to frame I
Frame I contains x:3 and y:5
I have no idea what any of it means, but I hope it describes it closely enough
 
@Phrancis thanks! As far as I know, It's describing how lexical scope works.
 
5:00 AM
@morbidCode Looks interesting, though admittedly I get lost quite easily in this CompSci stuff :D
 
5:22 AM
@Phrancis me too. But I like it for some reason. Better than the software Engineering stuff I encounter everyday.
 
It is indeed interesting, been reading that page a bit
 
5:34 AM
@Phrancis I highly recommend it. If you're interested, here a video related to this book. youtube.com/…
 
5:47 AM
Welcome to Stack Overflow. Is there something wrong with this code? It looks like working code you want critiqued, which actually belongs on [codereview.stackexchange.com] — TemporalWolf 40 secs ago
In general, questions where the code is working but you wonder if you could "do it better" should probably be on codereview.stackexchange.comAustin Hastings 24 secs ago
 
6:11 AM
Monking
 
Monking
@morbidCode That's fascinating, thank you for sharing, I'll bookmark these lecture series
 
6:45 AM
0
Q: Simple Java array stores and shows not repeated elements entered by user

newbieI made a new version of this which was actually not behaving correctly, because it showed duplicated values, it just didn't add them again, this is the link to that program, someone point at correctly I think that the problem didn't state that student should use an ArrayList, but an Array, so I m...

 
Monking
Isn't this question asking for two reviews?
 
6:57 AM
0
Q: js code to check string can be made from other code running slow

dagda1I am trying to solve this puzzle. The premise is that if I am given a string like this: give one grand today I can find a match of each word in the following string but I cannot use the same word more than once give me one grand today night My code looks like this: var ransom = "g...

0
Q: Code is comprised of one class that will utilize turtle graphics to draw fractals

ThomasTaylorSo, I have my code here: import turtle class fractal: """A class containing methods that will replicate various fractals. Attributes: num: An integer representing the number of iterations t: A turtle graphics object imported from Turtle.py """ def __init__(self, num, t=turtle.Turtle(...

 
7:25 AM
Isn't such request more suitable for codereview.stackexchange.com? — Gnqz 38 secs ago
Does the code work? Then it's definitely more suitable for the codereview site. — Some programmer dude 32 secs ago
 
8:09 AM
0
Q: Is this lock-free fifo queue implementation Okay?

ShadowStarstruct __fifo_node_t { void *next; }; typedef struct __fifo_node_t fifo_node_t; struct __fifo_list_t { void *next; void *tail; }; typedef struct __fifo_list_t fifo_list_t; static inline void __fifo_list_push(fifo_list_t *head, fifo_node_t *node) { fifo_node_t *pr...

 
8:22 AM
0
Q: How to distribute responsibility between objects?

MehranI have a problem and I want to know what is the best way to solve it. Problem: I have a Binary Decision Tree. Each leaf node has an object (called Matrix) that stores some information and performs some calculations. At some point during execution, I want to ask Matrix if I should split the leaf...

 
awright ... time to vote!
Monking, btw.
 
8:54 AM
If someone really wants to do a code review on my code snipplet, see linkKrümel Monster 48 secs ago
 
Monking
 
@CaptainObvious I think the OP completely missed the focus point of the challenge (Hash Tables/Maps). Working on my own JS solution which will be very different, so I will post a question later
If JS' Map are implemented like typical/good hash maps, this should be way faster (and way cleaner)
@CaptainObvious What language is that??
Looks like it could be Java, but doesn't look like your typical Java
 
9:15 AM
0
Q: Md5 hash whose hex values are near the digits of pi?

self-learnerI was asked to find a string whose MD5-hash has the same first 10 hex numbers as pi has in its decimal representation, i.e. hash start like 3141592653. Is there a faster way to do this as the program I found online and changed a bit? md5.h /* MD5 converted to C++ class by Frank Thilo (thilo@un...

 
code review can also be a useful place for things such as this i would imagine (not posting there myself).On topic though: there is currently no such way to enforce method calls. Most components bypass this requirement by throwing exceptions on other methods if a method, which should be called upon initialization is not called yet. I sure would love it if this feature existed though - you can raise an issue on github.com/dotnet/roslyn though — Dbl 54 secs ago
 
@CaptainObvious iffy... see comment
TTGTB
 
0
Q: JAVA - count words from file

user3313798I would like to find all words form file separated by spaces or punctuation marks. I suspect that my regex is bad. What shoud be a valid regex? Main: http://pastebin.com/pAMMQPeg Class: http://pastebin.com/yrDrsF2e

 
@Phrancis pretty sure it's java ...
 
9:38 AM
This is probably a better fit for Code ReviewThomas Schremser 14 secs ago
Here is my LinkedList on Code Review maybe it helps you codereview.stackexchange.com/questions/138142/linked-list-in‌​-cfubo 24 secs ago
 
@Phrancis I'm not concerned with any particular language. Let's assume it is java. — Mehran 7 mins ago
 
Thanks, I was not aware of Code Review portal. Will submit there. Thanks a lot. — Joan Dimko 42 secs ago
 
@Phrancis hrngh ... this makes things difficult...
 
@Vogel612 regarding the first code in your answer : codereview.stackexchange.com/a/158383/29371 would you mind if I correct it to valid C# ?
 
@Heslacher no, why would I? Thanks for that :)
 
9:47 AM
Done
 
@Phrancis ... whatever: VTC'd as hypothetical
aaand DVLR
and 25 tabs remaining open ..
 
10:21 AM
0
Q: C# queue implementation using linked list

Joan Dimkonamespace QueueDataStructure { internal class Node { internal int value; internal Node next; } public class Queue { private Node head; private int size; public Queue(){} public void Enqueue(int n) { if(head...

 
Monking
@Phrancis Put the final nail in the coffin. @Jamal I think we'd all be fine with it if you'd closed it, the wasn't a right fit anyway.
 
Monking!
I'm about to do a presentation on Java
uuurggh
bit nervous
 
0
Q: PHP Regex Input Sanitization

VringarThis is a helper class I wrote to check the user input I get from a form to register for a WiFi. I create an instance of this class every time the form is send, pass it the $_POST and then use the $cleanarray to generate some HTML and send an e-mail to the user. I am particularly unhappy with my...

 
@CaptainObvious can someone approve the edit as well ? Unregistered user
 
@Heslacher Seems I'd already rejected it.
 
10:36 AM
;-(
 
I should probably write a proposal for SE sometime to fix this anonymous edits crap.
If an anonymous user changes the question of another anonymous user, how are we supposed to know who wrote it?
Names aren't unique and are easily spoofed.
 
11:01 AM
Heyho everyone, question throw in: I'd like to discuss a piece of code and problems I see with it with somebody which delves more into why this kind of implementation isn't a good one/it makes no sense to use it - does that belong here?
(Also why are people answering to captain obvious, isn't that a bot? Does it post stuff to threads if you answer it?)
 
@Isofruit If the code works as intended and is written/maintained by you it should be ok.
We are answering to captain so others will notice about which question we talk.
 
Don't do that... you don't need to delete the project only because some commit was sent straight to the branch without code review. Forget about this commit and just move on. — Marcelo Ávila de Oliveira 44 secs ago
 
11:17 AM
@Heslacher It's somebody elses code, a fairly small recursive method (about 7 lines of actual code) which I thought through, made a picture to to visualize myself how it works step by step for a small example problem and tested it using a test main method. I just have an opinion on that code (due to it being the solution to one of the exercises I'm currently doing, I'm currently learning about algorithms) and am not sure if I'm correct with that opinion or not.
 
possible answer invalidation by Xirux Nefer on question by Xirux Nefer: codereview.stackexchange.com/posts/156759/revisions
 
Well, then its bordering off topic (not your code) IMO
 
Where would I ask for somebody to discuss it with ideally? (Please not stackoverflow, I'm lacking the rep for the chat there and don't really have the options to gain it. I'm not knowledgeable enough to answer most of the questions there, neither do I have questions that belong there due to either being about functioning code from myself or code-design)
 
What language are we talking about ?
 
java
 
@Isofruit Smells like off-topic.
 
If this code is working it's off-topic here. Try Code Review instead. (But please make sure to clearly explain yourself. Don't just copy and pasted this question; it's not very clear.) — Chris 50 secs ago
 
11:55 AM
@Kinduser I disagree. It fails to answer OP's question and instead provides a different solution. This isn't Code Review. — James Donnelly 6 secs ago
 
12:17 PM
This would probably be better suited to CodeReview SE. Do consult with their On-topic page before posting this there. Also remember, cross posting is frowned upon. If you believe this is better suited on CRSE, delete this post and take it over there — NSNoob 46 secs ago
 
12:55 PM
Probably better on Code Review Stack Exchange: codereview.stackexchange.comRichard Critten 33 secs ago
Did you try creating a list? That would be more effective I think codereview.stackexchange.com/questions/41525/…SQLserving 51 secs ago
 
-1
Q: Naive lock free work stealing queue

benlongRecently, I read a article about work stealing queue Job System 2.0: Lock-Free Work Stealing – Part 3: Going lock-free, and this is my c++11 naive implementation based on my understand of c++11 memory order model. is this implementation correct, any comments welcome. :D #include <atomic> clas...

 
1:20 PM
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: Different method to calculate blob area in OpenCv
 
0
Q: Chrome Extension Code: LOL Link Sharer

gdad-s-riverI made a hacky version of a chrome extension to compliment a weekly literary/arts publication. The extension helps me curate links from my publication's readers since there's only so much I can curate and read/watch. Users sign in through google and can share the link of the opened tab to me. ...

 
possible answer invalidation by Xirux Nefer on question by Xirux Nefer: codereview.stackexchange.com/posts/156759/revisions
 
@Duga its ok
 
If this code is working and you're looking for ways to improve it, then it probably belongs at codereview.stackexchange.com (after you read the posting rules there). — jfriend00 20 secs ago
possible answer invalidation by BPL on question by BPL: codereview.stackexchange.com/posts/158679/revisions
 
1:55 PM
 
0
Q: Socket.io Node.js Object Oriented Code Structure Approach

IDontEvenfollowing application: Users can join Rooms. A Gameroom has a queue where they can queue for a game. If enough people queue they get thrown into a game lobby. Rooms implement chat functionality which should be used in Gamerooms and Lobbies aswell. Right now I am passing the io Object to the inst...

 
2:13 PM
Greetings, Programs.
 
2:41 PM
0
Q: My code is a wrapper for encryption and decryption using OpenSSL

waynemystirI am a beginner when it comes to cryptography and OpenSSL. I have written a short wrapper of some functions in OpenSSL as well as a test of this wrapper, copied below. Specifically, this code intended to be used as a means of encrypting and decrypting data using either RSA or AES. I would really...

0
Q: Rolling two dice until they match

jackmasterlooterThe following code works as expected, but I need to convert the while loop to a do-while loop in order to make the code shorter for an assignment for my computer science class. Any and all help is appreciated. from __future__ import print_function import random print("HERE COMES THE DICE!") r1 ...

 
 
1 hour later…
3:48 PM
urk ... learning for that damn programming exam is terrifyingly boring ...
> Java has Semaphore and Monitors
you guys missed CountDownLatch ...
> Use the synchronized keyword at method level to prevent deadlocks
Wrong ... use a private shared lock object instead, because I can easily deadlock the whole class by locking onto it's class-object with synchronized(TClass.class)
> Java's threadsafety mechanisms are bad because a synchronized method continues execution after calling notify
Well... that's because you're apparently not capable of using the mechanisms correctly....
There's so much egregiously bad stuff in there ...
 
4:15 PM
Use codereview.stackexchange.com for questions about improving code — Sergey Berezovskiy 30 secs ago
 
-1
Q: Array data mutations best practice?

MonteCristoIs it always a good idea to create a new instance of an array when performing any operations on an array by default/habit? Quite often when I see these kind of operations on the web they don't always try to minimise side effects. or it's not always a huge problem unless developing large applicat...

 
@atm you can try this over at the software engineering or code review exchanges (you'll need code for the latter). SO not really that great a place for it, see stackoverflow.com/help/on-topicpvg 43 secs ago
 
4:43 PM
Hi guys, I'm doing some C# and making my child classes have the same static 'creator' functions of the parent. But, I don't like how WET I'm making my code, as I have a lot of static functions. Do any of you know a better way to do this?
 
4:53 PM
@Peilonrayz Constructors?
 
@EBrown I'd then have ambiguous constructors, :/
 
Monking!
 
Monking
@Vogel612 Less competition on the job market /s
 
I have a bit of a conflict of interest removing that answer:
0
A: Perf wrapper for Excel VBA

sysmodI do what Mat said: "You could even wrap that toggle behavior in a class, encapsulate the state [...] and use the Class_Terminate handler to revert back to original state, that way the calling code couldn't even "forget" to toggle it back:"

 
5:04 PM
I'm working on a proof of concept of a chatroom using websockets at work, finally got it mostly to work, except when one client closes the room, everyone gets disconnected :D
 
Meh.. converted to a comment anyway.
@Vogel612 let me guess... and they want comments all over the code saying what and how?
@Peilonrayz that sounds like a violation of some OOP principle.. base class doesn't/shouldn't know about it's derived types...
 
@Mat'sMug It works the same way in both the Parent, and Child, and so doesn't violate any as far as I know...
 
IDK.. perhaps it's the static factory methods then. Static and inheritance don't play well together
Why not just used parameterized ctors?
 
I don't know fancy words, ): I don't use stuff cause I don't know it's there, or the pattern...
 
ctor is just a short for "constructor" =)
 
5:19 PM
-2
Q: Advide on Factory pattern with DI implementation

Jorge A.I am looking on ways to improve the following code: public interface IExample{ void Do(); } public interface IExampleA: IExample {} public class ExampleA: IExampleA { IDependencyA _dependencyA; IDependencyB _dependencyB; public ExampleA(IDependencyA dependencyA, IDependencyB dep...

 
Unfortunately I don't know more than just that word, ):
I think the static factory method will work, however, :)
 
Monking!
 
Monking
 
5:42 PM
I've been missing out on JavaScript's Map object, it's quite nice
They're kind of like Java's HashMap except the keys and values can be of any type within the same map, and there are no NPEs ;)
 
@Mat'sMug well... somewhat. There is a guideline for grading that requires comments, but at least my TA was sensible aboit it and said 'write a comment for the rules, I think the rules are dumb, but I got to grade according to them... give me something and then I can leave you alone about it'
 
so everyone enabled flash to get their fedex discounts, right?
 
1
Q: Task-Based Multithreading Library - Implemented using Fibers

RichieSamsThis is a library I wrote to enable task-based multithreading. It allows execution of task graphs with arbitrary dependencies. Dependencies are represented as atomic counters. Under the covers, the task graph is executed using fibers, which in turn, are run on a pool of worker threads (one thread...

 
@DanLyons lol Flash...
I run into similar problems at work, because my employer's (an ISP) internet speed test is made with Flash, more than half of the time I end up pointing my customer to speedof.me because their device/browser doesn't support Flash
 
If you are sure that your solution works but you are looking for improvements then this question is better suited for codereview.stackexchange.comPshemo 1 min ago
 
5:57 PM
Also, I solved that Ransom Note problem on HackerRank with all passing tests and no timeouts even on the very large test cases :D
 
0
Q: Python value comparing taking too long

harrisIs there any way to make this code run faster. I have to compare values in a text file which is written in the format: 1 1.12345 2 0.12345 3 3.45678... The values are in billions and the code takes weeks to run. As far as I can see, the calculation (subtraction in my case) is the heavy step....

 
Just my two cents. Something I've found regarding immediately handling errors, is how it makes the main flow of the code easier to follow. If everything goes right, most functions simply flow top-to-bottom. We expect them to go right, so reading the expected flow is easy. The concepts of "indent errors, not code" and removing elses further eases the reading of functions. Most of the important stuff is indented only once or twice, so you get a nice left-flushed column to read. Also, there's no curly bracket hell at the end of the function. github.com/golang/go/wiki/CodeReviewCommentsRayfenWindspear 12 secs ago
 
6:17 PM
Best feature of using a debugger to debug already running executable: You'll get a warning if you're debugging different code than you're running
Point in case: I was running an old DLL for two hours today trying to figure out why it wasn't working as expecting, to figure out that I never built & updated the DLL
 
LOL
 
a simpler solution to debugging that is to check the modified date on the DLL :P
 
Well, I was using the DLL in IIS, and I was installing it into the Global Assembly Cache after I changed it
I forgot to press the build button..
 
the real head-scratcher is when you're working with a binary that isn't normally in the GAC, but there's a copy that is in the GAC and you don't know it
 
:D
 
6:23 PM
that's a great way to lose an afternoon :|
 
Now I still need to figure out why it's possible to connect to one IpEndPoint multiple times, I would expect a port is already in use exception
 
Is it the case that all servers normally would only grant one connection per IP/port combination?
 
I think that performance optimalization belongs better to stackoverflow than to codereview. — Bartosz Bilicki 14 secs ago
 
I thought that was the case... now I'm unsure though :D
 
the already in use exception only really applies when you're trying to open up a local port to handle remote connections
you should be able to connect to the same remote port as many times as you want (within reason)
 
6:28 PM
I recall making a mistake in a small Node.js program that caused such an error, but it was the application logic that caused the program to try to open a new connection with the same criteria as an existing one, so it may be a different deal
(and it was on localhost)
 
1
Q: HackerRank "Ransom Note" challenge

PhrancisI have solved the Ransom Note challenge on HackerRank using JavaScript / ECMAScript 6. The challenge goes like this: A kidnapper wrote a ransom note but is worried it will be traced back to him. He found a magazine and wants to know if he can cut out whole words from it and use them to creat...

0
Q: URLEncoder implementation Round 2

Svetlin ZarevHalf an year ago I posted an implementation of a URL encoder for review. I didn't have any time to work on it until recently, but now looking at my old code with new eyes I saw how unreadable the code was. So here comes my second attempt. The "requirements" are the same - no changes to the publ...

 
@DanLyons Hmm okay, if I close the connection from one client-side though, then all client<->server connections are closed
So it seems to be somehow joined
 
> I prefer [*] to '\\* because it looks like a Tie Fighter.
2
 
That's only if I explicitly close it from client-side, it's not the case if the client just drops
 
the server would still be listening on the port, though
 
6:38 PM
@Mat'sMug StarWars++
 
it's a mod's answer to this question
You don't define what "parsing" stands for. You don't describe what parts you're interested in, or what each part means/stands for. "It works", sure, but we have to parse (!) your nasty regex to figure out what it does. I'd suggest you edit your question to better describe what your regex does. Also... have you profiled your Java code to know that the regular expression is the bottleneck? — Mat's Mug 1 min ago
..which kinda baffles me
wow the OP is ...ugh
@JohnnyForbes it's not about how much code you need to write - if you want a golfed-up solution then put up a "challenge" on CodeGolf.SE. If it's about performance, then the amount of code you need to write to achieve it has zero importance. Also keep in mind that readabilty+maintainability vs performance is pretty much always a balance to strike. Write for maintainability first, then optimize for performance. — Mat's Mug 3 mins ago
 
6:54 PM
@DanLyons It still accepts new connections, but all existing ones were killed
@Mat'sMug Looks at first four "parts" Don't complain Mat, it's not that bad, looks at the rest, okay... you're free to complain :D
 
hmm... the connections should be independent of one another - perhaps there's a server-side bug causing it to drop all connections when any are closed
 
@DanLyons Hmm thanks, I'll keep that in mind
I was a bit worried that IIS would join the connections somehow
I'm pretty much taking WebSocket requests as input and redirecting them to a different server
 
-1
Q: Passing array to a function in c

Suyash#include <stdio.h> #include <stdlib.h> void manipulate2(int **arr,int size){ int i; for(i=0;i<10;i++){ *((*arr)+i)=1; } } void manipulate(int arr[],int size){ int i; for(i=0;i<10;i++){ arr[i]=0; } } int main() { int arr[10]; int i; printf("or...

 
I did figure out that I can copy-paste the source code of another website into my chatroom and then the website will be partially displayed
I don't know how or why it works, but it's pretty cool
 
heh not html encoding user input
 
7:03 PM
I wonder if it accepts whenever you drop in images :P
 
the real fun would be when you drop in javascript
 
I did manage to write buttons in my chatroom, that also wonders me
 
7:41 PM
0
Q: Simple linear equation solver

EdwardIn working on a review for Solve a set of "restricted" linear equations efficiently, I decided to reimplement from scratch using the method I proposed in my answer. The application I won't repeat the entire specification here, but in a nutshell, this program is intended to solve a very restri...

 
@CaptainObvious Looks pretty short on first glance, so I guess it could still be simple :P
Though I wouldn't classify it simple being not very experienced in C++
 
8:06 PM
You should probably ask this question on Code Review Stack Exchange. Stack Overflow and Code Review have a fair amount of overlap. However, this question does not state a problem and seems overly broad. In this case, it seems like Code Review is a better fit. — jww 56 secs ago
 
0
Q: Safely open a list of links in Firefox

Baum mit AugenI receive a list of links via http and I want to open them all in a new Firefox window as tabs; that is my script must not touch existing windows. This is the best solution I could come up with: from subprocess import call links = GetListViaHTTP() if len(links) == 1: call(['firefox', '-ne...

 
8:29 PM
0
Q: Is there another better simpler way to implement this methods?

AdamI have implemented the following two methods which are described in a) and b). Is there another better simpler way to implements those methods? a) A static method, nearestPoint , accepts an array of points (objects of type Point ) and one point (an object of type Point ), and returns that point...

 
8:45 PM
Is it bad practice to overload a function by its return type in C++? E.g.,
vector<string> readFile(string name){
    ifstream infile;
    infile.open(name);
    vector<string> contents = {};
    string line;
    while(getline(infile, line)){
        contents.push_back(line);
    }
    return contents;
}

string readFile(string name){
    ifstream infile;
    infile.open(name);
    string contents = "";
    string line;
    while(getline(infile, line)){
        contents += line + '\n';
    }
    return contents;
}
or would it be better to call the first function readFileVector?
 
sometimes I wish C# could compile that... and then I find a way to use generics to make it work.
no idea about whether it's a good thing to do in C++ though
how the heck can the compiler resolve the overload??
 
I don't see how that could compile. Typically overload resolution is done based on parameter types. Maybe C++ allows it though.
 
by observing the requested return type, I think
 
Is there a reason it couldn't always return a vector that you could unwrap?
 
e.g. if it's vector<string> foo = readFile("bar");
@RubberDuck unwrap as in join by newliens?
 
8:58 PM
Maybe. Idk. You're right to think it's got a smell though.
 
void readFile(string name, string* content = null, vector<string>* = null)
^ something like that perhaps? (no idea how/whether optional params work in C++)
yeah.. just make it two methods and move on :)
@RubberDuck still in a meeting? ;-)
TTQW
 
Hey @Mat'sMug: Do you know if it would/will ever be possible to re-order one of those blue Code Review t-shirts? Mine unfortunately got damaged by my friend's young kid, they jumped on my back without warning and hung by the collar :/
 
@Mat'sMug so that would ideally read the file into the string (if provided) or the vector (if provided)?
 
@ConorO'Brien yeah that would be the idea... not sure I'd recommend it though
@spolsky @selectall that article ignores the thousands of detailed answers that actually explain things; makes SO look like a big clipboard.
 
I think I'll go with the readFile/readFileVector method then
thanks!
 
9:13 PM
@rubberduckvba it's awesome to get mainstream attention and most people won't understand a word of that article anyway :)
3
 
@Mat'sMug nah. Over my 40 at the client. Had to go home.
 
I'm voting to close this question as off-topic because SO is for requesting help fixing problems in code. Advice on style and design is more appropriate for CodeReview.stackexchange.com. You need to explain clearly what you're trying to do, not just as "Is this good?" Don't put the explanation in code comments, put it in the question text. — Barmar 24 secs ago
possible answer invalidation by forsvarir on question by Joan Dimko: codereview.stackexchange.com/posts/158704/revisions
 
9:40 PM
@Mat'sMug wow, pretty cool that response, that is
@Phrancis Ouch, that sucks :/
 
10:03 PM
This type of question is best suited for Code Review, here is off-topic. — gp_sflover 22 secs ago
 
10:16 PM
@skiwi Yeah. I might just hang it somewhere for decoration
@skiwi Apparently it's fixable m.youtube.com/watch?v=I2F57TWNWyM
 
1
Q: Unique everlasting session with low collision rate and is set across sub-domains

Vadim CoolThe goal is to try and make an everlasting SESSION without too much or unnecessary scripting for updating of sessions. And at the same time to avoid session collision as session collisions could lead to 2 users trying to make use of the same session. That would not look pretty! And it does happen...

0
Q: javasript help me for this program plz

Iron X-Man a. strong textDraw the flowchart B. Identify the control Instruction if there is any in the algorithm. C. Modify the algorithm to find the MIN number instead of the MAX number

 
10:32 PM
So, I think I discovered one of the most horrendous-looking one-boxes on the chat.se infrastructure... but I shall let you judge it yourself
Other than that, greetings to all.
 
it works! now should I ask it in codereview or here to make sure? — huseyin tugrul buyukisik 53 secs ago
Well if you have working code - I think that is a question for code review. here you usually post when something is broken or you don't know how to make it work. — Evk 15 secs ago
@huseyintugrulbuyukisik If the code works and you want others to review your code and offer suggestions or criticisms, then post it on Code Review. Otherwise, you would post on StackOverflow here if it's broken or don't know how to make it actually work. — Thomas Ward 45 secs ago
thank you then I ask in code review for criticized review — huseyin tugrul buyukisik 42 secs ago
Thank you @jww I agree with all your points and I have posted this question to both codereview.stackexhange and security.stackexchange. I posted here as well because of this question: "I am especially concerned that I have used the OpenSSL library correctly. For example, in my function generate_rsa_keypair(), did I call RSA_new(), BN_new(), BN_set_word(), RSA_generate_key_ex(), PEM_write_bio_RSAPrivateKey() correctly and with the appropriate arguments? Am I using the results correctly?" I understand this isn't a particular problem but I think its a specific question about common code. — waynemystir 19 secs ago
 
0
Q: Script testing a PDF making server

inwenisThe script tests a server rendering PDFs. The server is running as a Windows service. The script does the following: Prepare the test configure server export script variables to xml copy input Run the test with 4 paralel jobs Gather logs and clean up after the test Step 1.2. is needed bac...

0
Q: Java time-to-live collection

PhoenixHere's a class I made in java. It's pretty simple, the description of what it does is in the comment. I'd appreciate any feedback. import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * An unordered, duplicate-allowing collection of items that are added with a * t...

 
10:52 PM
0
Q: Regex - Matching Whitespace & Non-Whitespace Character

Tolani Jaiye-TikoloI just started watching some regex tutorials on Plural Sight just to learn how to write a proper regex expression. So far so good, it's been alright and I decided to test my knowledge on Hackerrank. Although, the tutorial explains how to use PCRE (Perl Compatible Regular Expressions) and ECMAScri...

0
Q: Feedback form secure

Vaishal PatelI Have written a form to collect some feedback, which will be written to a csv file upon ajax post. I still need to sanitise the post data but before I do this I was wondering if I need to take any further security measures here ? and if I am on the right track? My form: <form method="post"...

 
I'm voting to close this question as off-topic because it belongs on codereview.stackexchange.com — MarsAtomic 19 secs ago
 
11:04 PM
0
Q: Is this pseudo `CopyFrom` implementation ok?

huseyin tugrul buyukisik// Foo looks like an array, works like an array // but has both managed(C#) and unmanaged(C++) arrays // for fast communication with some hardware class Foo<T>:IList<T> { public static T[] receiver {get;set;} // initialized in constructor public static implicit operator T[] (Foo<T> foo)...

 
11:18 PM
I'm voting to close this question as off-topic because we seem to agree it's a better fit for code review. — James K Polk 8 secs ago
I'm voting to close this question as off-topic because it seems a better fit for codereview.stackexchange.comStedy 8 secs ago
 

« first day (1420 days earlier)      last day (2598 days later) »