« first day (705 days earlier)      last day (3610 days later) » 

19:01
What did he do this time?
hehe
I don't know what to think of him
Sometimes I like him, sometimes he's just doing dumb stuff
0
Q: Number Finder in C++

NealCBesides the fact that I use using namespace std; how can I make this code more efficient? #include <iostream> using namespace std; int main(int argc, const char * argv[]) { int number1=100001; int number2 = 100001; int tries=0; cout << "Please enter a number between 1 and 100000: "; cin >>...

@CaptainObvious Why do people delete their question so early?
Was about to comment this:
> Your approach of letting the computer "guess" the inputted number is not effective, it can take forever for the computer to do this. The fact that you are printing to sysout inside your loop is a big slow-down. But you do have a potential infinite loop here. If you would help the computer out by telling the computer if the value is higher or lower then it would be more effective, and more interesting (sort of like an inverted )
@JeroenVannevel lol I had to think about that for a second before it hit me...lol
In my current Java project, I'm having to populate a JTable with values from an ArrayList. I guess Oracle doesn't have a tutorial about this.
19:15
Ah, thanks. I couldn't find it from Google.
A JTable is 2d though, ArrayList 1d, how are you going to fill it up?
@Jamal That's funny, that was exactly how I found it.
"java jtable" - second result.
how do you mod people feel about more than one comment flag on a thread, if one is on the question's comment and another is on an answer's comment and there is a different reason for both?
I was expecting an exact tutorial about it, actually.
I don't want to bury you guys in flags.
That's fine with me, or you can have one mod message for both posts to explain how the comments should be purged.
19:18
@Lyle'sMug Flag each comment individually
@Lyle'sMug Don't worry, I already buried them with flags four months ago, they survived!
@Jamal "How to Use Tables" is not something you consider a tutorial?
@SimonAndréForsberg I mean adding values from a container. But I am looking through this for what I need.
Incoming JAVA question!
0
Q: Assigning and validating IP address in JAVA

still2blueI am in the process of writing a program that will take IP addresses and subnet masks and validate the information. If the information is not valid, they will be displayed as invalid or be assigned a default value. I am really running into a problem trying to validate whether it is an assignable ...

0
Q: Assigning permissions to new role without RBAR

bluefeetI'm currently faced with a dilemma in our SQL Server environments. We need to migrate our existing logins, users and roles to a new login, user and role with the same permissions as the old. I've been tasked with writing a stored procedure that will accept 3 parameters: Database Name Old Role N...

@CaptainObvious Taking a break from SO flags, I see. :-)
@CaptainObvious Hmmm... Mod from SO asking for review ;-)
19:30
About time SO folks learn the good way to code!
Ahhh true, but if so. A code review will be like the right door, commadot.com/wtf-per-minuteMKroeders 1 min ago
Incoming meta!
0
Q: Is it too easy to post your code for review?

Simon André ForsbergOur current situation: We are getting 34 questions per day We are getting more and more unanswered questions We are still on a mission I feel that we multiple times per day get questions that are a form of "I wrote xyz, how can I improve it?" often with very little explanation about the code ...

I'm voting to close this question as off-topic because it belongs on the CodeReview StackExchange. — Dave Newton 29 secs ago
@nhgrif - appears I have some iOS apps...... ;-)
4
Q: Is it too easy to post your code for review?

Simon André ForsbergOur current situation: We are getting 34 questions per day We are getting more and more unanswered questions We are still on a mission I feel that we multiple times per day get questions that are a form of "I wrote xyz, how can I improve it?" often with very little explanation about the code ...

19:44
@JerryGoyal - I do not have the time to really think about it too deeply. All I would way if this was for code review I would not look at it twice. It is unreadable. Very difficult to understand. Not maintainable. — Ed Heal 19 secs ago
@DaveNewton Most of the "better fit on Code Review" questions tend to be closed as "too broad" or "primarily opinion-based" on Stack Overflow, which is more preferred than "off-topic because it belongs on Code Review". The "belongs on another site" close reason, migrates the question, not closes it (and there are several reasons why CR is not in that list). If you want to discuss more about this, you are very welcome to chat with CR regulars in The 2nd MonitorSimon André Forsberg 41 secs ago
Todays close reason on Stack Overflow:
Not again - somebody writing stupid code - cannot be bother to look up one of the duplicates — Ed Heal 19 mins ago
If he cannot bother look up one of the duplicates, how does he expect the OP to bother doing that?
@YePhIcK - People trying to allow such code are damaging software quality. I would have thought that the answer is not to try to figure it out but to mention in the interview situation that code reviews are important and making code readable. Perhaps that is where the interviewer was trying to lead the interviewee — Ed Heal 1 min ago
@EdHeal If you cannot bother look up one of the duplicates, how can you expect the OP to bother doing that? — Simon André Forsberg 8 secs ago
0
Q: Excel VBA - Get Folder Names

Anurag SinghI need to get folder names with the path for which I need to search the directory in a server with about 6000 folders. I have the following snippet of code to run through the folder and get the folder names with path. It works fine in a local directory but when I run the same code on a server dir...

0
Q: Binary Tree :: Deleting a Node With No Siblings

GrendanThis problem is to be solved using level traversal logic only. Just when I thought I had covered all the cases and nailed it, this program crashes on running and I can't figure out why. Kindly help. Basically, I'm required to delete all the nodes that don't have a sibling, i.e. the single child...

20:04
Moderator Note I've purged the comments, if you feel the need to continue the off-topic conversation please take it to chat. — bluefeet ♦ 1 min ago
Thanks, bluefeet!
@rolfl Hmm?
> Well I currently use jdom in a project with robovm and since that is constrained to what the jfxports JDK has implemented, a dependency on the streaming api would break that. However, I am happy with 2.0 and it is not clear to me how long it will take until jfxports have support for that API, so maybe not a big thing to base decisions on. Just thought, I'd mention it, since robovm gets a bit of buzz these days.
RoboVM is awesome!
talking about the next major release of JDOM having a Java8 dependency.... The robovm folk use JDOM
@SimonAndréForsberg This comment (from Ed Heal) is even more stupid than that. Closing things as duplicates is actually sort of good. Sometimes, things get posted then closed as duplicates because whatever search terms the duplicator used didn't bring up the other question/answer. Linking them as duplicates increases the number of searches you can perform and get to the same answer.
It may be the case in this specific situation that the duplicator didn't even google first, but nonetheless...
20:10
@nhgrif exactly.
I don't downvote duplicates unless I try searching for some of the search terms I'd guess at base on their question and can't find the question it's linked to as a duplicate.
Maybe the duplicate linking needs to be separated from the closing function?
And in fact, does it make complete sense to close Question A as a duplicate of Question B always? Sometimes people argue that the two questions aren't even related at all, but they get closed as duplicates because an answer to B could be verbatim posted to A and answers it exactly. Maybe we should vote "This question has already been answered", and pick an answer, which would still close the question and link the questions, but make the selected answer show up on the page for question A?
Also, no need to cross-post to Code Review, especially as this is a bug - it's a much better fit here. — FreeMan 1 min ago
Hmm. I know there are question bans. How are these enacted? Is it based on up/down votes on questions? Or is it based on questions being closed?
0
Q: guessing number for computer

Optimus05its a number guessing game, and there is one problem. Its a guessing game for the computer. I can not figure how to add the option where "is the number High, low, or correct?" ANY Suggestions? also I remove the def main(): because it would not read the rest after "won the battle" thanks! from ra...

If you have no questions with net negative votes, but all of your questions get closed as duplicates (and only for the duplicate reason), will you eventually be question banned?
20:19
@nhgrif I don't think so.
@nhgrif The duplication feature could use some work indeed. Sometimes I'd like to see "This question has the following duplicates: A, B, C, D..."
Primarily, I think it would be good if the duplication feature had less of a negative connotation attached to it.
And I say this primarily in light of the stupid debate going on at MSO about some "Swift" questions being closed as duplicates of "Objective-C" questions.
@rolfl Dilemma?
@skiwi Not really, there's an interesting feature request that has made me think a Java8 solution would be good.
XML is a bear when it comes to document fragments. It gets complicated really fast.
But, there is a request to process XML documents with what amounts to a streaming source.
an open element tag, then many child elements sequentially, and a possibly-never close element.
20:29
So wait, how do you have an iOS app?
@rolfl Sounds perhaps for Streams ;)
Since the document is never complete, JDOM will never complete the parse, and return a document.
exactly, streams
SAXBuilder.stream(source, delimeter, filter).foreach(child -> doSomethingWith(child));
0
Q: Python Dice Rolling simulator

Macgyver DuarteI am a beginner at python, taking an introductory course. My professor just assigned a program to us. However, when he assigns he has a problem with not really going too much into what needs to be done and only gives you the most tiny bit of information to go on. If you try to approach him he act...

@nhgrif No, now I have code that is used in the building of iOS apps (and perhaps runtime, I am not sure).
Ah, I see.
20:32
A component of an app... not the whole thing.
So... as a developer, I am right in arguing that my (or any developer's) salary should not be based on the success of the product, but rather how well I deliver code according to the specifications I am provided, right? I mean... right? Unless I'm self-employed...
@nhgrif "salary" has a specific meaning, and in that context, yes, you are right.
The alternative is "incentivized pay", or "equity-based", or "options", or something.
I'm not talking about any bonuses or anything (of which there are none).
No one where I work gets paid anything but a negotiated salary.
^^ and that is what makes it a salary
> a fixed regular payment, typically paid on a monthly or biweekly basis but often expressed as an annual sum, made by an employer to an employee, especially a professional or white-collar worker.
So with that in mind, it wouldn't make sense for anyone to accept anything less than what they could get on the open market unless there are other factors in play (like the schedule if more flexible and I need that, or the atmosphere is better, etc)
But you definitely shouldn't be accepting less than what you can make on the open market on the pipe-dream promise that "when the product becomes successful, everyone will make more" (a verbal "promise" and nothing more than that)
I have to make a big decision within the next couple of weeks... and I'm trying to make sure I'm making the right one.
20:39
Is it a startup environment?
@nhgrif Never trust verbal promises
Well, they're trying to claim it as a startup. Is there a time limit on claiming yourself to be a startup?
Still primarily VC funded?
What is VC?
Venture Capital
20:44
I think part of the issue is that there aren't enough reviewers in general and certainly, some languages suffer from this more than others. So, rather than "Do we need to make it harder to ask?", we need to ask ourselves "What can we do to attract more reviewers?". Personally, I don't answer as much as I used to because I simply don't have the time to anymore. — RubberDuck 40 secs ago
I don't know. I don't know enough about the exact details of the financial situation on the revenue end.
Might not be a bad idea to take a look at their public financial statements
Nor do I even necessarily know exactly what Venture Captial means completely. I mean, I get the basic idea.
Will they necessarily have public financial records?
I know approximately how much revenue we get from our paying clients.
Meh, they're the people who give you X million
In Belgium all companies are forced to keep a bookkeeping and disclose it
I'm sure the US requires it too
@nhgrif It's not your product, it's the company's product. So, yes. You're correct. Unless you have an actual percentage of ownership of the company, your pay should not be dependent on the success of the product.
20:46
not sure about the disclosing though
The company was started by a guy who owns two other companies. He needed ERP software for his two companies, and didn't like anything available on the market, so he started his own software. Eventually, they spun that off into its own company.
ERP is not cheap. And his two other companies get unlimited licenses to the software without paying... so there's a gray area in terms of actual revenue, but I don't think its relevant.
I haven't been here since the beginning, not even close, but I'm starting to think that for an entire ERP system, there were never enough people here that you'd actually need to support paying customers of an ERP system.
@nhgrif If you're going to look into financial records then I'd first double check that they are not actually counting that as revenue
I know what the (approx.) revenue is and it doesn't count anything from the other two companies.
But I'm not even sure any of that is relevant.
Given that all employees are either salaried or hourly (except sales people who are commission based), our pay shouldn't even take revenue into consideration.
If it's genuinely a nice attempt then they might as well use options
I think the problem is we've got a chicken-egg situation.
20:55
How do you mean?
My argument is that we barely have enough to support our current customers, and we can't really take anyone new on (because I'm not going to work 100 hour weeks), while the otherside of the table is arguing that there's not enough revenue to justify paying the amount I'm talking about for new hires (nevermind my own salary) (I have taken on all the responsibilities of my old boss, in addition to ones I already have, so I now have more responsibilities than he ever had, but we've not negotiated
my salary since this change.
And it's possible that the decision makers might be out of touch with how much developers cost in today's market.
2
@nhgrif More than probable.
Good luck buddy, I'll drink a beer for ya.
I mean, it's actually a no-lose situation for me.
It's not a no-lose situation for some of my co-workers or my company.
So, unless you really really really like the place, you should just be getting paid at least as much as you expect to be paid conform the current market
Or at least... in the ballpark.
And when salaries are discussed with potential candidates, we should also be in the ballpark.
21:03
True yeah
Between in-house libraries, database structure, and just learning the big complicated software from a user-perspective, there's a massive learning curve.
The larger the learning curve, the more expensive turnover is...
And among other things, the farther your salary is below market value, the more likely turnover is...
I just pretty much reverse studied a subject... or however you want to call it, I think Artificial Intelligence by our study books is very very complicated, gave up most hope. We were allowed to bring a piece of A4 paper with notes though, so I looked through an older exam + solutions and I actually do manage to understand most of it, there's still hope!
Hiring someone new every 12-24 months for $X is more expensive than hiring someone for 60 months at $2X.
Because minimum it's 3 months before you get anything productive out of the person.
0
Q: Function to rotate bitmap image

EdeniaPresenting you an implementation of the "shear and transpose" method of rotating a bitmap image. It works.. but it works slow, which is fully understandable. It is understandable due to the evident lack of optimization. Notwithstanding it doesn't interact with the VGA or any library for that matt...

@nhgrif I think the average time of service where I work is more than 10 years.
21:09
So, it's really not even about my salary. Because if my coworkers aren't also paid competitive wages, then they will be regularly getting raises just by working any where else, and that means we have to go through the hiring process again, and I have to help people learn all of this stuff all over again.
So then... if a developer weren't purely salaried, but instead had some sort of incentivized/equity/options based pay figured in, then at that point you have to weigh risk vs reward, right? It would only make sense to take that choice if you were confident that these incentives/options/etc would pay out.
@nhgrif I meant to say "signed" thanks for pointing out my error
(and Monkernoon @ all)
DoAlert might have too many arguments. There's no possible way to write clean code when you have a method that takes 10 arguments, made worse by the fact that four of them are closures. — nhgrif 1 min ago
@nhgrif Why 3 months?
Because it's a huge complicated system with lots of interconnected parts?
When we hire new developers, we try to put them on stuff that has as little interconnectivity as possible, but that doesn't always work.
Even if we always managed to do that, it's not always going to be something that we actually need to be done.
Part of the problem is the short-sightedness of previous developers. Things aren't very well documented. Things aren't as clear as they could be.
I've tried as best as I can to get some things put into a frame that can be more quickly picked up by new people, but given that there's roughly 12 hours worth of "this has to be fixed immediately" problems in any given day, I don't always get a lot of time to work on this.
And efffectively, I'm the only developer who is even allowed to touch our COGS stuff.
What IDE do you use, Simon?
@nhgrif For Java? Primarily IntelliJ IDEA
Okay. I've never used that. I have no idea how complicated it is. For me, generally, IDEs are the most complicated software I use on a daily basis.
Would you consider yourself a master of that IDE?
I manage to do alright, but I'm definitely not a master of it.
21:37
Now, imagine if it were at least 10 times more complicated (from an end-user perspective).
One of our clients have been using the software for 2 or 3 years now, and they're only using like 4 of the modules.
Out of (approximately) twenty.
Part of that is that they don't need some of them, but part of that is they're not ready to be trained on using the other modules.
And if you don't understand what the software is supposed to do, it's pretty difficult to make it do what it's supposed to do.
3
@sᴉɔuɐɹɥԀ I'm more interested in the farmers, who might actually be being honest.
@sᴉɔuɐɹɥԀ The laserz guy might even really be a CERN scientist or something lol
Ugh, that Riot API. begindate as url parameter causes a 404, beginDate works
^ Poor JSON parser in their backend
it's a 404 too instead of a 400
Do ate's also have a littleind?
21:49
huh?
"beg ind ate" seems the most natural way of parsing "begindate" to my eye.
and "beg ind" also looks kind of like "big end"
You know what... if I have to exaplin it, it obviously isn't funny, so...
Did I miss the star-fest?
Hey, is anyone in here backing "Code Explanations" or whatever it's called on Area 51?
^^ I did. I think Simon too.
Think either one of you guys can explain what sort of questions aren't a good fit for Stack Overflow, but would work there?
I could see something like if you fork a repo because you are interested in it, but parts of it you are not sure what is going on and would like some help
@nhgrif Honestly, I don't think Code Understanding will do very well.
22:03
Or, you walk into a new job and inherit a code base (assuming the licensing allows) and need help, etc.
but it will be interesting to see
I have no clue what questions will show up there
@nhgrif When Code Review was created, Code Review questions was a good fit for Stack Overflow.
I would expect a lot of the questions there would come from beginners
TTQW
0
Q: C#/.Net 4.5 - Number Guessing Game

Clayton Egan-WyerI'm currently enrolled in an introductory C#/.Net 4.5 course and one of the things I want to focus on is the quality of my code. This is the first assignment our instructor had us do, the ever-popular number guessing game. The requirements our instructor set out for us were: On startup, the p...

I had a piece of Visual Basic source code I puzzled over a long while today. It would have made a good Code Understanding question I think.
Is ther a @Mat'sMug around? codereview.stackexchange.com/questions/86441/… <--- this is working, or not?
22:23
I've retracted my close vote, buy I strongly recommend you edit your post to make it clearer that it just appears to hang and actually works, since questions involving non-working code tend to quickly get closed on this site. — Mat's Mug 2 hours ago
hmm...
I have modified the code as well to handle error and enable cancel key but status bar doesn't update after some time and pressing escape also doesn't get me out of the loop. — Anurag Singh 24 mins ago
I'm voting to close this question as off-topic because it belongs on Code Review. — Ian Kemp 1 min ago
^^ question title: PHP MVC - Is my controller to fat?
"Does this code make my controller look fat?"
It's highly entertaining to here a 5 year old exclaiming the following.
> "Whooo! Fourty-four ladies, that's me. Getchya cold cuts, getchya cold cuts!"
So every question that has code inside is code review? — Speedwheel 18 secs ago
Anyone speaking really good spanish here?
22:32
@Speedwheel I think Ian was recommending you post this to Code Review. It might be on-topic there. I recommend you read the help center. This question might receive better answers there, assuming everything here is working as intended. — nhgrif 31 secs ago
@JeroenVannevel translare: qe?
translate qe?
ARGHHHHHHHHHH
translate: qe?
it's qué
ARGHHH!!!!
translate: qué
translate: qué
(from Spanish) What
22:37
And it doesn't work for me because?
translate: show me your boobs
I was going to say "me", but, obviously, not.
Your translator is dead
translate fr: show me your boobs
(from English) me montrer vos seins
We must have the same translator.
22:38
wrong language though
but we're closing in
Well, it does not know afrikaans.
what about spanish?
translate es: show me your boobs
(from English) Muéstrame tus senos
translate: Muéstrame tus senos
(from Spanish) Show me your breasts
almost symmetrical.
oh wow. That's actually a lot better than google did
I had to actually read language rules online to get to it
There is a reason that translate: is a mod-only tool, apparently
22:39
I used the less formal muéstrame tus tetas though
I hesitate to ask the context - you went to a sumo-wrestling tournament?
What does the translating of the tool?
bing translate
Because sumo wrestling is so popular in Mexico.
@rolfl She helps me with Spanish from time to time, I stresstest her bed in return.
fistbump
22:42
left hanging
awkward chuckle
leaving chat
2 mins ago, by rolfl
I hesitate to ask the context - you went to a sumo-wrestling tournament?
stress-test indeed.
@JeroenVannevel There's a formal and informal way to say "show me your boobs"?
LOL
2
@SimonAndréForsberg Tetas = tits
22:43
@SimonAndréForsberg Yes, one is for business settings.
2
0
Q: Struts2: User must pass through action first before rendering JSP

ohtphMy action classes would often have an action field variable that was assigned a value inside the execute() method: public class MyAction extends ActionSupport { private static final long serialVersionUID = 1L; private String action; @Override public String execute() throws Exce...

0
Q: PHP MVC - Is my controller to fat?

SpeedwheelI think I put too much code in my controller that was supposed to go in the model. This is a part of my controller, I'm not gonna paste everything since there is a lot of code. public function ajaxUsers() { if($_GET["action"] == "listUsers") { if(!isset($_POST["search"])) { ...

0
Q: Finding the sum of some numbers in a tuple, in a list, in a dictionary, then divide it by three

user70034I need to find the sum of some numbers in a tuple, in a list, in a dictionary in a pickle file, then divide it by three, display the key and result, and repeat for every key and value in the dictionary. I keep trying everything and the only thing I think will make the code work is: for key,value...

Is stress-testing a bed anything like stress-testing a server?
2
Well, there's one thing I have to say about the 2nd .......
the regulars know what they can star, and what not.
2
wait... what?
Did I miss the star-fest?
5
Not yet
22:45
@rolfl I'm slightly surprised that my message was not starred, actually.
Surprised, but thankful.
@nhgrif I knew you were going to say that
I've edited your question to remove a lot of unnecessary details and focus your question on a single topic. I know it may sound harsh, but readers don't really care how new you are to a topic, and mentioning things that you aren't going to ask about doesn't help anyone. Questions should describe your situation and the problem you're having, and nothing more. For future reference, when you have working code and just want to improve it, consider Code Review as another resource.Good luck with your coding! — skrrgwasme 1 min ago
So... there's a reason people downvote a lot on Stack Overflow...
Never leave traces of slightly offtopic subjects in the starwall
-1
Q: iTunesConnect error for archive uploaded from xcode 6.3: contains invalid version of Swift

SamI built and uploaded my app to itunes connect using the release version of xcode 6.3 last night but it was rejected as "invalid binary". The email from app review said I was using an invalid or beta version of Swift. I would really appreciate any help or ideas about how to work around this probl...

Everyone knows that
22:47
"The email from app review said I was using an invalid or beta version of Swift"... which... he is using...
That question needs one hundred downvotes.
You're asking the guy who keeps ranting that we don't downvote enough @SimonAndréForsberg. I don't think I can objectively answer that. — RubberDuck 2 mins ago
Do I really "keep ranting" that, @RubberDuck?
Aren't I the one that keeps mentioning that?
I think the bad-quality questions is a problem, but I am not sure how to solve it.
With downvotes.
No. I did @SimonAndréForsberg.
22:49
Assuming reality matches StackEgg, that would be one way to increase quality.
oh, you're asking the guy...
I didn't read "asking"
eye-fart.
Yeah. I really don't think we downvote enough. Particularly regulars who should know better by now.
Although, tbh, I've seen a lot more downvotes since the graduation announcement. So, well done all.
By the way, Objective-C and Swift are both not on that list, so goob job me.
Nahhh.... noone writes any code that works in it .... ^^^
2
shhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
22:54
Interesting.
Angular.js, Python, Algoritm, and PHP.
Well, I guess it's time to learn Python...
And study up on our algorithms boys.
That's the thing that hurts. If we lose one or two reviewers, we can possibly lose answers for entire languages.
Or multiple languages?
I mean, Martin R and Bazola occasionally post Apple domain answers.
Possibly. Yes.
@rolfl Damn, konjin did a really good job keeping the JS ones down.
I mean, nobody writes clean PHP, so who cares, but... =;)-
We need new blood that answers.
Not just posts a question and vanishes into the ether.
We need to convince people that they need Code Review just as much as Code Review needs them.
Seriously, the knowledge I have gained from reading and answering Code Review questions, it's a lot I have learned.
2
23:17
Any mods around?
Sorry about the zombies, but I am feeling overwhelmed and swamped right now.
I plan on picking a C# zombie that involves something I don't know yet and answering it several times per week this summer.
Preferably one per day.
Zombies are a natural part of a site maturing. We can't kill them all.
@Duck: I've found a lot of use for out already
We should be glad we have zombies then?
Certainly the TrySomething idiom
I need to clone a video of myself onto myself.
I think I will take a video of myself writing a paper.
23:23
@RubberDuck Then how many can we kill? 97%? 98%? 99%? 99.99%?
Some of the trouble is no one knows the language that some are in.
@Hosch250 What's up?
0
A: Calculating and generates a report card for a student

BeckThis is what I have so far. I've implemented the ability to take in weights from the user, a bonusPoints module and a classInfo module as well as removed the using namespace std and completely rewrote the assignmentScore module. I'm using a single function to grab the weighted value in each of t...

I think it should probably be a CW answer.
I meant to flag it after I posted that comment, but forgot.
Note, this is not an answer, but a new question requesting help to resolve code that does not yet work. It is not a candidate to be a new Code Review question because it is not working. Since this is a question, it is also not a candidate to be a "self answer". Please see What you may and may not do after receiving answersrolfl ♦ 6 secs ago
and gone
Thanks.
23:32
Stack Exchange is not a network of forums.
If it works and you're only looking for suggestions on your code, it belongs on CodeReview — Vince Emigh 20 secs ago
@JeroenVannevel it has it's uses, but a beginner should think of it as a "last resort" and "only if you know what you're doing"
Admittedly, I've had bad experiences with undocumented out params.
@RubberDuck no argument there
Luckily most people don't even found out about out until they know what it's meant for
@SimonAndréForsberg I think more importantly, how many can we reasonably kill.
I have some idea of what out is, and I am planning on testing it soon.
I mean, this is on my list of things to check, and I will probably check it out soon because it won't take too much time.
23:36
Yeah. I chased around some really difficult code for a long time before I realized that MS neglected to doc their out params that completely solved the problem in a sec.
Uh, is an "out" parameter somehow different than passing by reference?
If it wasn't COM code, I would've found the answer quick.
In C# it is.
How so?
162
Q: When to use ref vs out

ดาวSomeone asked me the other day when they should use the parameter keyword out instead of ref. While I (I think) understand the difference between the ref and out keywords (that has been asked before) and the best explanation seems to be that ref == in and out, what are some (hypothetical or code)...

ref is for in and out. Out is just out.
23:38
out is more for when you are specifically planning on assigning a value to it, right?
Out is for when the current value is irrelevant if I understand correctly.
@nhgrif ref and out are both true pass-by-reference, they just differ in what they're used for
In one class today, I was reading about programs that grade essays.
Seems a little unnecessary perhaps.
@RubberDuck That's an indirect result but I'd argue that the main purpose of out is that you get an outer reference to a value from the method
slight nuance difference
the in vs out is correct though
@nhgrif It's very helpful for the TrySomething idiom
e.g.:
23:41
What...
User user;
if(repo.TryGetUser(42, out user))
{
	Console.WriteLine (user.Username);
}
else
{
	Console.WriteLine ("User not found");
}
And your correct @Jeroen. I was taking the simple route.
Apparently, someone wrote an essay to be tested by a one of these programs, and stated that the rising costs of college were because of TA's who got paid exorbitant amounts, got access to private jets, vacations, and other ridonculous things.
the method itself returns the result of the action while the out parameter returns the possible value
It scored an A.
23:43
Why is this different than by ref?
Popular examples are int.TryParse. This won't throw exceptions while int.Parse will
Also, what is actually returned?
Out enforces that the value gets set.
@nhgrif ref doesn't require that the value is being set inside the method
@nhgrif bool
In the TryGet idiom, it's a bool
23:44
So... C# is trying to be like Objective-C and doing it poorly?
Why is it poorly?
Maybe... What's the Obj-C way?
My computer is installing updates. When it is done and I'm off phone I will demonstrate.
In C#, you can do an input loop and int.TryParse the value(s) until you get a valid set of input(s).
I'm not a fan of the TryGet/TryParse idiom personally, but once in a while it comes in really handy.
But then again, I don't like
23:48
I prefer it to try/catch blocks.
if (DoSomethingIsSuccessful(someVar))
Write your try/catch once and be done.
if (!TryExtractUsernamePassword(Request.Headers.Authorization, out adminEmail, out password))
{
	return Unauthorized();
}

User user;
if (!_userRepository.TryLogin(adminEmail, password, out user))
{
	return Unauthorized();
}
It's pretty sexy
@RubberDuck I used it just yesterday, bool HasTypeHint(out string hint)
23:49
Yeah. That's useful ^^
I guess I've just seen too much bad procedural code.
CodeModule.Find(startLine, endLine, startCol, endCol)
Supper time, BBL.
Just return a Selection struct.
selection = CodeModule.Find("string")
grumbles
You don't write try/catch blocks in Objective-C.
If you are writing Objective-C try/catch blocks, you are almost certainly doing it wrong.
If you're writing try/catch blocks in VB6, you are almost certainly doing it wrong
RELOAD!

« first day (705 days earlier)      last day (3610 days later) »