« first day (531 days earlier)      last day (2658 days later) » 

8:00 AM
There was a time, less than a year ago, when I finally understood JOIN and my mind was blown!
So, survey of those present, what was your most memorable beginner moment?
@Phrancis That makes me think hard
I recently learned something new, but I already forgot
> long long long is too long for gcc
I'm right now still figuring out what IDE to use for C++
@EngieOP I am still not past the menu bit
@Phrancis probably my absolutely most beginner moment was when I got told off by Simon on SO about my misunderstandings about types.
8:07 AM
Is Visual Studio Premium, Professional or Ultimate better?
@Vogel612 that sounds like an uncanny coincidence!
Ultimate sounds like it being quite ultimate?
@skiwi none...
they all need resharper to properly work with...
because they don't offer any real refactorings.
Does Resharper work for C++?
I heard it was only in early access and not really working yet
PHP: is there a way to "cast" (Sql Jargon) a date() Unix timestamp as a different date format? Would strtodate() be the solution?
8:11 AM
@Phrancis PHP sucks...
I don't really know how to do advanced stuff in PHP though
I noticed
Do they even have a standard library?
What's a library? ;-)
@skiwi well there's PHP core...
the rest is... frameworks.
@Vogel612 It's something
8:13 AM
@EngieOP Should I meantion that doubles shouldn't be used for money?
@TheFailure please!
@TheFailure Yesh
but you should also be able to explain why ;)
Q: Use different contructors of disposable class

EspoI have a very simple helper class to validate credentials. Sometimes the domain has a value, sometimes not. Depending on this, a different constructor for PrincipalContext must be used. PrincipalContext is disposable, so I am using using. It looks ugly, and recommendations? public class LDAPMana...

Does anyone know how the successor of the Dreamspark platform (free software for students), is called?
8:14 AM
@skiwi e5.onthehub.(some tld)
and it's still called dreamspark...
@EngieOP should get oneboxed with http://
They all link to Dreamspark Premium apparently for my university @Vogel612
and what's the problem with that??
I have an account, but cannot find it for some reason
8:18 AM
@EngieOP I really want to give up on it already (This will take me at least another hour because I am basically rewriting all his code
Secure Download Manager is really the worst downloader
1. I don't know C++ and its driving me insane writing an answer
@EngieOP I should give up
Who here knows C++ well?
lol good luck!
Imma get some sleep. Night @all.
8:33 AM
@TheFailure Morwenn, Loki, syb0rg, ...
@Morwenn, @LokiAstari, @syb0rg I am trying to use a class as a key in an unordered_map and i have override the hash and equal however doing .instert is still not working:
1 IntelliSense: no instance of overloaded function "std::unordered_map<_Kty, _Ty, _Hasher, _Keyeq, _Alloc>::insert [with _Kty=Item, _Ty=int, _Hasher=std::hash<Item>, _Keyeq=std::equal_to<Item>, _Alloc=std::allocator<std::pair<const Item, int>>]" matches the argument list
argument types are: (Item, int)
object type is: std::unordered_map<Item, int, std::hash<Item>, std::equal_to<Item>, std::allocator<std::pair<const Item, i
@Pimgd Do some field work. Start tagging birds. Answer your own question.
Q: Can I compute the mass of a coin based on the sound of its fall?

Vinicius L. BeserraOther day, I bumped my bookshelf and a coin fell down. This gave me an idea. Is it possible to compute the mass of a coin, based on the sound emitted when it falls? I think that there should be a way to do it. But how?

Q: date strtotime() calculation returns 1969 date

PhrancisI have the following code getting $_POST from HTML form: <?php $departureTime = date("l, Y-M-d H:i:s"); // calculate time-traveled time $arrivalTime = date( "l, Y-M-d H:i:s", strtotime( "$departureTime .' ' .$travelTimeOperator // '+' or '-' .$timeAmount ...

How I feel right now
@200_success Like GPS tagging you mean?
8:47 AM
@TheFailure replace "THE WORST CODE EVER CREATED" with something a little friendlier, and you might have a community ad candidate!
@Phrancis Like what?
Or something like that :)
I guess CODEREVIEW.SE is fine since the ad would link back to CR anyways
Never mind
It did
8:51 AM
@Phrancis uhh my nose..
how about "Review Code Today"
WHOA @TheFailure that sure made the font tiny
and make it a bigger font-size..
Maybe try to bring it into Photoshop instead of using a meme generator ;-)
I have gen up on that question for tonight
Too much work
@TheFailure how
A: Partitioning a list to a list of smaller lists

PimgdBug: assertEquals(partition(Collections.emptyList(), 0).size(), partition(Collection.emptyList(),1).size()) fails. That is, there is a special case in which partitioning a list in partitions equal in size to or greater in size than the size of a list to be partitioned does not equal a result ...

That's a valid answer.
8:56 AM
Not that question
I know.
But I'm saying 3 lines can make a valid answer.
Q: Simple TakeOut Menu

ParanovaThis is for my intro level C++ class. This is the assignment: Write a program that displays a takeout menu from which a user can place an order. The program begins by displaying the menu and prompting the user to enter a choice. If the user enters 1, 2, or 3, the program responds by a...

Good answer there @EngieOP
And that as truly horrible
Its even more horrible that (some) teachers actually grade that code as 10 out of 10 points because it "works"
but hey, it's at least not using namespace std;
8:59 AM
@TheFailure writing answer for that one ~5 min
I feel writing code that works should be the minimum requirement (says the guy writing buggy PHP)
I wanted to do a full review.......
Fixing everything
@Pimgd writing an answer, that's awesome and teaches OP to write good code instantly: Impossible
@TheFailure don't do that.. concentrate on the top 5 offenders (at max)
and accept that others can come along and do some of the rest.
Oh.... ok
@TheFailure agreed with Vogel
9:02 AM
OKay for the next question
Nobody could catch everything and retain their sanity, simultaneously, with that bad of code
@Phrancis And thus a valid answer is to say it is bad code, give them the tools to improve, and ask them to follow up.
1x answer
A: Simple TakeOut Menu

PimgdIndent your code, then post a follow up question. Right now, I can't even read it properly. Aside from indentation (see @EngieOP's answer for that), you should give semantic value to blank lines. std::string divider = "******"; int pizza, side, drink, exit, choice, pizzaNum = 0, sideNum = 0, d...

dat analogy though.
> Use too much blank lines and it's. Like. Putting. A. Period. After. Every. Word. And then other programmers don't understand you anymore.
That one?
That's the main reason I dislike the C# braces style..
Because t'is like. Putting a period after the method's name
9:15 AM
"We define doSomething with integer X and integer Y. As adding X and Y together."
Still wondering if Java-styled braces are acceptable in C+_+
Oooh C+_+
That's a new insult
eurgh.. isn't that more like pyt_hon?
@Vogel612 That's such a pyth_off for me
9:17 AM
I am no good with pictures
@TheFailure that's the best until now, IMO...
Did the original have an exclamation mark at the end of the top statement?
Oh... I see my typo now
I meant C++... obviously
Ah it didn't
Are you freaking kidding me... I need a restart to install Visual Studio 2013... And am on Remote Desktop Connection, so not going to risk that
9:19 AM
I find the "We want YOU!" makes me stop reading
Specifically, the exclamation mark
google-fu gives only the variant with exclamation marks for the quick results
uncle sam wants you
I get all of them without exclamation marks
well most of them
@Morwenn! hey, what do you use to develop C++ on what OS?
9:21 AM
@skiwi You mean whichi compiler or which IDE?
This seems to be the original
There's no exclamation mark there...
Well, I am sorry
I'd strip it off
@Morwenn Both would be helpful actually
@skiwi MinGW_w64 32bits for Windows and the latest version of Code::Blocks.
9:22 AM
@TheFailure why would you be...
2 days ago, by Pimgd
@TheFailure get rid of self loathing where you can, it'll come back soon enough anyway
More exactly, MinGW_w64 4.9.1 32bits with POSIX threads and dwarf exceptions.
> Use too much blank lines and it's. Like. Putting. A. Period. After. Every. Word. - @Pimgd
Too many fucking versions.
@Morwenn I tried Code::Blocks but don't think it offers that much extras
@Phrancis Hurray for quotable statements!
9:23 AM
Btw, it is not as simple as stripping off the exclamation point. I had to do the text and the outline separately
Huh you got POSIX working on Windows?
I use visual studio 2013 Ult ;)
> 2516bd1ae Introduced yet another version for MinGW_w64
@Morwenn ah the joys of sentences that change meaning depending on intonation
@skiwi I don't know, but they work better than the vrison labeled Windows threads.
9:25 AM
Alright it's 05:24 and I need to be up in 3 hours. Insomnia be damned I'm going to bed anyways
@Phrancis Night
@Phrancis If you don't go to bed, then you don't need to get up!
@skiwi I like the compiler options in Code::Blocks and the fact that it can handle almost any compiler. Also, there is some pseudo-semantic highlighting (disabled by default though)..
/brb restarting...
I we're lucky, the highlighting module will have been ompletely rewritten for the next Code::Blocks version.
9:27 AM
anyway to define the default type for an enum in C? I used typedef enum <type> { <definitions> } <name> before, but apparently that's wrong
I still hate C++
I don't seem to be easily get over the fact that Java programs so much easier than C++ out of experience
@TheFailure Don't worry, C++ hates you too.
But pursuing graphics development in Java is not paying off much
@skiwi still possible to a point
9:29 AM
The joys of forgetting a semicolon after a class definition... ah, I'll never forget.
You're missing out on graphical libraries though @TheFailure
And the lack of value types is too apparent for graphics
I would still rather use Java over C any day
C is another question indeed
C++ and C
We almost have duck typing in C++ now. That's fun.
9:31 AM
Why am I even on university... I cannot concentrate for a single bit in doing anything on my laptop in a noisy room
Strongly-typed duck typing.
@TheFailure Use the appropriate tool for the job... for big jobs, this may require you to educate yourself in a new framework or programming language
Yeah I know
got some test later today that counts for 2% of my grade though
just not used to the way C++ handles objects
9:33 AM
@TheFailure You mean default deep copy semantics?
Yeah, it's quite silly, I have lectures as well though, but it perhaps isn't worth it
@TheFailure If you have x tests per period, and the results per period are averaged to produce a grade for the whole year or study, it can be 2% for the grade that's on your certificate at the end of your study
@Morwenn ??????
Just so used to Java... :(
@TheFailure think clone()
@TheFailure "The way C++ handles objects" is rather vague :p
9:36 AM
shallow copy is making a new list and copying the values of another list in the new one.
I mean memory management of objects
If you remove items from the old list, the old list changes...
but if you alter the items then both lists change
Deep copy makes an actual clone of everything
But I suppose I will be ahead of people when I go to uni next year
Actual clone?
Is that possible>
@TheFailure yeah, as if you put the whole thing in a clone machine and poof
Technically no
Semantically yes
I mean if you have a pointer* = this in the class
And move it to a new location
Well, copy
9:40 AM
You can't copy the pointer values
Would point to the old object
but you can copy all the actual values and recreate the object structure
Deep copy makes an actual clone of >everything<
Oh ok
one of the methods of deep copying in Java would be ... serialization.
Then deserializing again.
Ok i get you now
9:42 AM
@Pimgd which would be a ... performance intensive thing to do for just deep-cloning something...
all the IO overhead...
Serialize to memory.
It's a trick I've used in an actual project...
We traded performance for faster development.
Either I spend god knows how long writing copy functions
or we just serialize/deserialize the whole thing
But now C++11 has move semantics anayway. When copying a temporary, an object can acquire the resources of the temporary instead of copying them. That avoids copying resources then deleting the original.
@TheFailure ... do you call it cheating when you use a library?
I actually try not to if I can
9:47 AM
Developers are expensive, hardware is cheap
so if you can do it a lot faster by using a simpler, but slower algorithm...
then that's okay, at least until you've got performance issues.
Or you can use a library where people better than you have already written the faster version of the algorithm.
Q: Reverse Message Program

AlexDGrattan# Alex Grattan # 17/10/14 message = input("Enter your message to have it printed backwards:") split_message = list(message.split()) reverse_message_list = [] reverse_message = "" for i in range(len(split_message)): reverse_message_list.append(split_message.pop()) reverse_message_list = [x ...

Q: Small password generator app with GUI

SingularityFXI will appreciate to hear from you if the code below conforms to the generally accepted rules / conventions / best practices and how can it be improved. This is a GUI-based random password generator, which supports internationalization. It consists of 6 small classes: Main classes: Applicat...

Q: How to make this design and code better

Prasanna AarthiGives advice to the user on which trains to take to reach a destination public class TripAdvisor { private Station source; private Station destination; private double cost; /** * * @param path the shortest path returned by the shortestPat...

@CaptainObvious How to make this title design better
10:04 AM
A question... what would you put in a game launcher? When designing it
My soul.
Required fields for now are server ip, port and one more field, but that gives a very small launcher, any clues on what to use to create a bigger launcher?
@skiwi lots of spaaace... and imagination
Wondering if I should make it resizable or lock it down to certain size
10:06 AM
news, patch notes
viagra ads
Add resolution and other video settings there
too many times I've seen my brother get screwed over after having to use a smaller monitor
He played his games 1680x1050
That monitor died
He had to use a 1600x900 one
Resolution, settings, etc. are not an option... yet
And all those games would display black screens.
@JeroenVannevel That sounds reasonable
In this case with JavaFX 8 I imagine the game will go fullscreen, not on native mode
10:08 AM
All you had to do to fix it was click the invisible options to set the video resolution back to normal again
yeah... good luck.
They're all the same
All basically a lot of news, ads and patch notes?
and a tiiiiiny icon to change some settings
I think I can figure out something
Except that I technically have no time for it... But starting an university assignment on Friday evening is pointless either way
I have plans to do work on projects
but I think I will cave in and buy Borderlands pre sequel
and just play all weekend
10:10 AM
I almost wasted 4 hours already here
@skiwi Welcome to Code Review, we hope you enjoy your stay
Except my here was on university... ;)
But it's also easy to use a lot of time on CR!
Sometimes I hope I can go back to those magical times when I know no IDEs, then I could just start learning C++
A 4-6 years ago I was coding PHP... in Notepad++
A: Small password generator app with GUI

Pimgd char[] pw = pg.generate(numberOfChars); for (int i = 0; i < pw.length; i++) { txtPW.append(Character.toString(pw[i])); pw[i] = 0; } What the... Have you seen the String(char[] value) constructor? There's also String.valueOf(char[] data). Those would make your loop i...

Can I start my review with "What the..."
or is that a bit offensive
@Pimgd I think that code deserves a what the...
True, it smells like CorporateFizzBuzz
Also woop this gonna be my first bounty
Q: Inspector interface serializer

Nick UdellI've written some code that allows Unity3D's inspector to display fields that conform to an interface. Unity has some quirks about their inspector, so as a preface they are listed here: If you add a [Serializable] attribute to a class, Unity's Inspector will attempt to show all public fields in...

10:27 AM
What the hell is that code to generate an alphanumeric string
which part
@TheFailure I read that as "alphanumeric song"
First of all those numbers in passGen should be static final
Second of all
... yes?
@skiwi Some 30 years earlier I coded on a sheet of paper.
10:33 AM
I wrote my first code on paper, then entered into the computer. I got 91 syntax errors back for ~80 lines of code.
@Pimgd The default average ;-)
Why not just choose a random element from
private static final char[] characters =
"abcdefghijklmnopqrstuvwxyz" +
@TheFailure cause it has to be configurable... I guess?
@Heslacher Really?
10:34 AM
Then you must be at least 30 years old
Well, define a string for UPPERCASE
Good job!
And convert that to a char[]
Now post it as an answer
First computer I have used had been a Comodore PET 2001
The Commodore PET (Personal Electronic Transactor) is a home/personal computer produced in 1977 by Commodore International. A top-seller in the Canadian and United States educational markets, it was Commodore's first full-featured computer, and formed the basis for their entire 8-bit product line. == History == === Origins and the early models === In the 1970s Commodore was one of many electronics companies selling calculators designed around Dallas-based Texas Instruments (TI) CPU chips. However, in 1975 TI increased the price of these components to the point where the chip set cost m...
10:35 AM
Ranting about something is one of the best ways to find flaws in it.
"Hi! Thanks and +1 for your useful comments! I'm aware about String(char[] value). The idea was to improve security by avoiding creation of String, which is immutable and cannot be destroyed by any means other than GC"
But true
@Heslacher Mine was a Pentium III I think...
@TheFailure interesting reasoning, right?? no it's totally retarded...
It doesnt matter if they know "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Its not something you should be worrying about anyway
Depends how you define using though
10:36 AM
I think the text box uses a string anyway
@TheFailure He's talking about "password123\0" being in memory.
So defeats that
And I checked;
JTextArea uses a Document.
@skiwi Now I am jealous
The next step for our shool had been a Comodore C64. That had been a great upgrade these days.
On the other hand, the first PC I've really "used" was an Intel Core 2 Duo E6600, custom built
10:39 AM
I want a feature
I'm not entirely sure though
To select all of a code block
It was 9 years ago, I had a Pentium IV before that, but I think I mostly played some games on that
@TheFailure there was some meta-question about it..
10:39 AM
It's pretty complicated; but Document turns out to be PlainDocument which holds Content which contains a set of Edits...
Q: Viewing the source code

maaartinusWhen doing a CR, it's important to be able to quickly find methods/classes/whatever in the source. Currently, it's just terrible as you get a couple of small scrolling views and the search takes way more time than anything else. That's specific to CR, as other sites rarely need that much code. T...

I don't think there's ever a full string in memory.
@Pimgd which means, the whole thing was moot
not until it needs to be displayed.
The reason Document doesn't use String is because JTextArea...
it can hold a whole Document...
If you used String you'd blow up your permgen space
You can't just have 10 MB strings
@Pimgd that's not how it works ;-)
permgen is only a problem if you do myString.intern()
10:44 AM
sorry, that's only for interned strings
mixed a few terms
Also, you should know in Java8 there's no permgen.
JTextArea existed long before Java 8
That Java8 thing is just an aside.
but the other string related problems stay...
such as inserting characters into a 10 MB string
that's... not cool.
and "you should know" is not a "Duh, any fool would know" statement, it's a "oh, and people who are familiar with Java memory management are going to take a while to adjust to Java8 because at some point it will become significant that there's no Permgen, and you would be better knowing that sooner rather than later".
10:49 AM
better not be frozen bread
@rolfl what is that "permgen" thing anyways??
It's running out on my JBoss instance after a few 10 deployments...
and then It won't shut down, because the command doesn't get through...
^^^ One of the most common problems in app servers.
Class definitions (what the class-loader loads from the Jar), are stored in permgen. It is a region of memory that can be up to about a max of 128MB by default.
Each time you access a class, it gets loaded there.
If you have an app server, it creates a new classloader for each app, so, if you unload, and reload the app, it has to re-load all the class defitinions.
If you have classes that are common between the apps, they will get loaded multiple times because they come through multiple class loaders.
if your app is ugly and does not GC properly on an unload, it often cannot unload the class from permgen.
Bottom line, you run out fast.
fix would be: GC the classloader's crap on unload.
okaaaay, then we got that one covered! begins searching for a tutorial
@Vogel612 What if the loaded class stores a reference to the main classloader? ;)
then you're slightly fcked, because you can't collect it without shutting down the VM.
10:57 AM
Not sure if that can be solved though from the main classloader's perspective
The loaded class could use a weak reference I assume
why does the loaded class have a reference to the class loader anyways??
To fck you up... I guess
why not allow classes to reference multiple class-loaders, and thus allow collecting them when you unregistered all corresponding loaders..

« first day (531 days earlier)      last day (2658 days later) »