« first day (253 days earlier)      last day (2477 days later) » 

12:33 AM
Hey, @ChrisW! First time here?
 
@Jamal You are correct on your comment to me. However, C99 should be the standard that everyone is gravitating towards, so I used that in my review.
I read this in the C book I just got.
 
@syb0rg: Gotcha. Much like those who write C++ should adhere to C++11.
 
@Jamal Yes. There was an even newer standard released in C (C11), but so few people even use C99...
I didn't even know that C11 existed until I read this book.
 
It might also explain why has very few questions.
...okay, one question.
 
As I read more and more of the book, my reviews will point to the new standards.
Hopefully that means that more and more people will start using them.
 
12:49 AM
0
Q: finding names of un-named list elements

ricardoI have a naming problem: lists with un-named elements. I wish to get the names of the elements in the list, without going back upstream to where the list was created. An example is modelList below: ## naming problem lmNms <- c( "mod1", "mod2", "mod3", "mod4", "mod5", "mod6") lapply(lmNms, ...

 
@Jamal Hi, yes.
 
Sorry that you ended up coming at a time of low activity. This room is usually full of discussion.
 
Well, I lurked a bit, yesterday. Saw syb0rg's post above so took a stab or two at answering.
 
Oh, okay. I must've missed you then.
 
1:21 AM
All I deduced from lurking is that you used to edit many posts, and that people 'star' a lot of the comments.
6
 
@ChrisW Other chat rooms don't star as much as we do?
 
No-one stars as much as we do....
 
I used to think of them as bookmarks: e.g. important/pivotal comments in discussions about the direction of the site, which you might want to refer back to, or which a newbie might visit.
 
Ok, off to bed ;-) and a movie.
 
@ChrisW We usually star the funny stuff. The "bookmark" comments are stuff we usually pin.
2
 
1:28 AM
@ChrisW: You lurk well. :-) And that is correct; I am cutting down on editing.
 
I didn't know 'pin' functionality existed.
 
It does. Messages can only be starred by room owner(s) and moderators.
 
my bad
 
@Malachi ??
 
Star stamping everything.
2
 
1:42 AM
Nerds, saturday evening and you're all on chat....
5
 
It's not my fault that my robot half is connected to the internet...
 
@rolfl: You're on chat, too. ;-)
 
You don't think I didn't realize that?
 
Oh I know.
 
1:55 AM
@syb0rg 'Pins' expire after 14 days, apparently. As far as I can tell (not being familiar with 'pins'), there's nothing pinned at the moment: the messages on the sidebar are starred.
 
@ChrisW The top message in this chat room is pinned.
 
The "potato chips" message?
 
Yeah.
 
0
Q: Show a double with text in WindowBuilder?

HaroldI'm fairly new to Java coding and I am trying to get a number from a double to display into a gui textbox from windowbuilder. The code I'm having trouble with: txtCounter = new JTextField(); txtCounter.setText(counter); //Error here Jtextcomponent not available for Double txtCounter...

 
 
2 hours later…
4:05 AM
0
Q: SignalR Chat + Navbar Implementation

RobViousI've been trying to ramp on SignalR. Here's the goal: Navbar connections to support navbar notifications like "someone poked you" Chat connections for when users are in the Chat page multi-tenant support based on the domain of the request I decided on in-memory approach to user <> connection...

 
4:23 AM
0
Q: Which code is more efficient to use?

puretppc1) private void button1_Click(object sender, EventArgs e) { string name = comboBox1.SelectedItem.ToString(); } 2) private string name; private void button1_Click(object sender, EventArgs e) { name = comboBox1.SelectedItem.ToString(); } I'm not very familiar with the details of prog...

 
4:36 AM
0
Q: New code for dynamic stack in C

2013AskerNot long ago I posted some code for a dynamic stack for review. Now I wrote a new version, hopefully a better one. Please take a look and let me know how to improve performance and increase code quality. Thanks. It works by storing pointers to the content. If there's not enough memory, it will ...

 
5:31 AM
0
Q: Forcing user to enter an integer

0x1A4I am new to C++ and would like to know the most efficient way of forcing a user to enter an integer. Here is my function that I have created. Please show me the best way and explain why it's better than this. int getInt(){ int x; while (true){ cout << "Enter an int." << endl; ...

 
 
3 hours later…
8:05 AM
0
Q: Refactoring Project Euler Problem 1

Aseem BansalI wrote this function for project euler problem 1. prob001 :: (Integral a) => [a] -> [a] -> a prob001 a b = sum [x | x <- a, product ( map (x `rem`) b ) == 0] The use is like this GHCi> prob001 [1..999] [3, 5] 233168 But I am not at all satisfied with it. The list comprehension looks like ...

 
8:29 AM
0
Q: feedback for exercise 4-11 in K&R

Ionut Grt.I know that there is one more topic about the exercise 4-11, but the difference is that I solved this exercise and i just need some feedback on my solution. So, I'll explain how it works on an output like "3 4 +\n", for example. The static variable c is initialized with the value ' ' so the condi...

 
9:26 AM
0
Q: Would it make sense to copy (some) tag wikis from SO?

ChrisWueThere are a lot of good tag wikis on SO and some of these tags apply to CR as well. So I was wondering if it would make sense to copy them from SO? I guess the excerpt might be different to state why or which questions should be tagged as such in the context of CR but the tag wiki could easily be...

 
 
1 hour later…
10:49 AM
0
Q: Efficiently find which datacenter my machine is in along with its full node?

user2809564After getting some valuable suggestion on my previous post here. I added couple more things to it which I am not sure how can I add it efficiently so opening a new thread here. In our company we can have a machine hostname as - dbx111.dc1.host.com dbx112.dc2.host.com dcx113.dc3.host.com Her...

 
 
1 hour later…
11:51 AM
0
Q: Need help with php login, admin php login

Kevin SoumeI need help with a login code, possible with mysql and there's a admin login there you can give users admin, ban, remove users, and things like thate, i will need open source so i can edit osv. Thanks and btw people can register, and a forum, oh and in the register people will need to give: Email...

 
 
1 hour later…
1:14 PM
1
Q: Help me pick a good name for a class

leonideveloperSorry for my English. In several places I have some code that looks like the following code. The only difference in the type of listener. public class CustomFragment extends android.app.Fragment { SomeListener listener; @Override public void onAttach(android.app.Activity activity) ...

 
@Jamal I don't know why but I can't even suggest an edit to http://meta.codereview.stackexchange.com/a/141/34757 ... would you edit its first two lines, to replace them with the following.

That's described:
- On [the About page](http://codereview.stackexchange.com/about) (in the "Get answers to practical, detailed questions" section)
- And in more detail in [What topics can I ask about here?](http://codereview.stackexchange.com/help/on-topic) in the Help Center.
 
 
1 hour later…
2:22 PM
0
Q: Edit a question to add comments to the code?

Wayne ConradIn this question, an edit to the code (by other than the asker) added this block of comments to the code: // duplication // || // \||/ // \/ try { listener = (SomeListener) activity; } catch (ClassCastException e) { throw new ClassCastException(...

 
 
1 hour later…
3:23 PM
0
Q: Python Unit Test Best Practices

user2054936I'm a Java/C coder getting started with some Python for a side-project. I've written some unit tests for a recent side-project I'm working on, but I have a sinking suspicion I'm just writing Java-code, translated into Python. I've posted a small sample of some unit-tests I wrote. I'd really ap...

 
3:36 PM
0
Q: Math Skills Game Advice

AlienArraysI think my code works pretty well, although I'm biased. http://jsfiddle.net/AHKb4/2/ Basic Overview: I'm working on building a math skill game. Where the objective is to drag and drop div's to a container. Each div will have a value, likely set with classes. Each container must equal theSumNum ...

 
 
2 hours later…
5:39 PM
0
Q: Slideshow with appending images or just CSS background

RikardThis is a conceptual question but I think more in the scope of CR than SO. I am going to make a slideshow. Is it better to use appending images and fade in/out or use CSS with transition on background property and then just use element.style.background = 'url(' + newImageUrl + ')'; I am curio...

 
6:22 PM
Support a fix for a chat bug:
3
Q: Formatting bug when newline is present in chat

syb0rgI recently noticed that when there are new-lines in the same chat message. For example: *Test* **TEST** This won't produce the expected output: Test TEST It leaves the message as it is with the Markdown text included. Here's proof if needed. Is this status-bydesign, or a bug?

 
@ChrisW: That's because edits cannot be suggested on per-site metas.
I'll make those changes shortly.
 
7:00 PM
Holy mother of being overly-paranoid of duplicating code
1
A: Help me pick a good name for a class

Simon André ForsbergIt seems to me like what you have done here is to create an entire class to avoid duplicating one line. (Or OK, 5 lines if counting the try-catch statement) I don't agree with the need to create a class for this. Especially not a generic one, since this line of code: return (OtherType) whatNeed...

 
And thanks for editing that title.
 
@Jamal You're welcome. I think both the question and my answer deserves an upvote because of that
 
7:24 PM
0
Q: How can I improve this C++ 'evolutionary AI' implementation?

electroLuxFor the code sample that I am asked to submit with most of my job applications (usually Gameplay Programmer), I created this console application in which I attempt to figure out what is the best loadout for a mech to win a match within the simple turn-based combat system that I came up with. Sinc...

 
8:08 PM
@Corbin: Any thoughts here? I've also just touched on the try/catch, though I wasn't planning on saying much about it.
0
A: How can I improve this C++ 'evolutionary AI' implementation?

Jamal#includes: <time.h> is a C library; use <ctime> instead. Consider omitting <conio.h> as there could be some portability issues. It's also not widely used in C++, especially since you have <iostream>. Add <cstdint> for std::srand()/std::rand(). Add <exception> for std::exception. Everything e...

 
8:43 PM
@Jamal hmmm, am I missing something, or should that run() not even throw?
also, Add <cstdint> for std::srand()/std::rand(). is wrong
it's declared in cstdlib, not cstdint
oh, and in your mention of C++11's nullptr, might be worth mentioning that if he's using C++11, he might also want to consider using C++11's PRNG facilities instead of rand() (though for this application, rand() is sufficient...).
 
@Corbin: Oh yeah, I meant cstdlib. I keep getting them confused. Thanks!
Or, to keep it brief, mention <random>?
 
hmmm that's weird... the code never actually uses rand()
but he's seeding with srand
yeah, might just be worth mentioning the random header and then linking to an SO post or somewhere explaining how to use the typical mersenne twister stuff
 
If he's not using randomness in a useful way, then I can just reference that header.
 
yeah
it doesnt seem like he's using randomness at all actually, so might be good to just point that out
 
@Corbin: Done. Also, the OP is still insisting on using <conio.h> for input, but I may not make a note about that in the answer. I've mentioned enough.
 
8:57 PM
hmm, as long as he's correct that there's not an easy standard way to do it and he's aware that it's non portable, you've done more than enough imo
 
Yes, I've mentioned the portability, and he doesn't seem to be referring to pauses (none are in his program anyway). However, does there even need to be a "press any key to continue" output in the catch?
 
i wonder if std::cin.get() is line buffered...
it's actually in run() that he's using conio
 
There's also std::endl everywhere, plus the ignore seems useless if there's no prompt for input afterwards.
Ah, I see it.
 
_getch is the conio stuff
 
I've never used the library anyway, but I probably don't need to start, while I'm still writing C++.
 
9:02 PM
i haven't either, but the non-namespaced call seemed out of place to me so i looked up the conio declarations to check
 
9:27 PM
It's just that he only quoted his main() functionality.
 
@ChrisW Ah! Didn't realize he had omitted that much of his code
 
I was wondering why he didn't use classes at all, then went looking for the definition of Population class.
 
@Jamal might find this interesting too, since I think he updated his review to incorrectly mirror my missing of the use of rand()
Ah yeah... I just glanced through the code for the most part :). Makes sense though. I hate when people don't post all of their code :/
although there's enough code there to review by far
 
@Corbin: I've just now noticed it, too. Went straight to the embedded code as usual. :-) Still, it's best to only review what's on the post, not what's behind the link.
 
yeah. and having to call an init() function is very C like rather than C++... but meh, there's never a very pleasant way to initialize random seeds
 
9:32 PM
@Jamal That's a small (not 'real world') amount of code to review.
 
Ah, so he does use rand. I think my point still stands, considering he doesn't use it in that one file (main.cpp).
It's still something. Including all of that in the post would've definitely raised an autoflag.
 
You don't write much code during an real-time interview; but a 'sample' project or a 'real-life' project (therefore a real-life code review) might be much bigger than I've yet seen posted on this site. Yes it's probably/normally up to the OP to choose which small portion of the larger project they wants us to review here.
 
9:50 PM
0
Q: Why is this error being thrown? (Python 3, Pygame)

PipIn my game, pertinent code found here, and also at the end of this post, this error is being thrown when evaluating: Traceback (most recent call last): File "C:\Users\Benjamin\Documents\GitHub\Tarbeyon\level.py", line 60, in <module> level.parseLevel() # Building the level File "C:\Users...

0
Q: How to improve the current contact form

LoaiI have just started learning who to build websites, and been experimenting how to create a contact form. Here is what I currently have - Can anyone suggest and recommend ways enhance my current contact form system? JavaScript: $("#contactForm").submit(function (event) { /* stop form from ...

 
10:04 PM
@Jamal You're suggesting I include snippets of "that linked code": I assume you mean of mz1net.com/code-sample not of en.wikipedia.org/wiki/Double_dispatch ... the problem is that my criticism consists of naming things which he is not using in his code (e.g. inheritance); so there are no really relevant "snippets" to illustrate when I'm saying?
 
Yes, for his linked code. And by "if possible," I meant if it's relevant to your answer. If not, that's fine.
 
Perhaps on this site it's less important than on most others to create a 'permanent' Q&A: we're really/mostly trying to help the OP individually/specifically, not so much the 'long tail' of future readers. I agree/confess though that I'm bending if not breaking the normal rules by reviewing code that's located off-site.
@Jamal Do people ever post relatively long fragments from review? You said something about, "Including all of that in the post would've definitely raised an autoflag."
I think I read that all y'all have a github account for your weekend coding competitions? A wild idea might be, exceptionally, to let people post their longer projects there for review.
 
@ChrisW: Sometimes they do, and it could even discourage review of all that code. It could still be broken into separate questions if possible.
You may propose that on the Meta post if you'd like.
 
10:41 PM
0
Q: Three similar functions, how can i reduce repetition?

user1895420I have 3 functions which look like this(simplified): public void functionA(List list) { // there is some functionA specific stuff here foreach (Object O in list) { if(O.a()) functionD(); } } public void functionB(List list) { // there is som...

0
Q: Review code on Github?

ChrisWSomeone might sometimes want a review of a longer length of code: for example this question references some code stored here on their private web site. It isn't necessarily feasible or desirable to copy too much code into the question text on the main site. (reference) However if we're to revie...

 
10:53 PM
0
Q: Recursive Calculation of Second Order Derivative

VesnogI am writing a code to do some numerical task using the routines of Numerical Recipes book. One of my objectives is to calculate the second derivative of a function and I have a routine that calculates the first derivative of a function in a nice manner within a specified accuracy. However, I wou...

 
11:32 PM
0
Q: Relative prime numbers

DanialVTwo integers a and b are relatively prime if and only if there are no integers x > 1, y > 0, z > 0 such that a = xy and b = xz. I wrote program that determine how many positive integers less than n are relatively prime to n, but my program work too slow because sometimes number is too big. ...

 
@Jamal glimpse these comments please in case you want to add something.
 
@ChrisW: Ah, I hadn't noticed that. Thanks for pointing it out.
 

« first day (253 days earlier)      last day (2477 days later) »