« first day (352 days earlier)      last day (3668 days later) » 
00:00 - 20:0020:00 - 00:00

12:16 AM
0
Q: Tetris code for pieces and map

2013AskerI'm making a simple tetris clone and would like to know how's my code for the map and pieces. I'm using x, y, x_before, y_before, t0, t1 to allow smooth movement. colors.h #ifndef TETRIS_COLORS_H #define TETRIS_COLORS_H typedef enum { DARK_CYAN, DARK_RED, DARK_BROWN, DARK_MAGENTA, DAR...

 
12:36 AM
0
Q: Short Java FizzBuzz using recursion and parameters

riistapublic void fizzbuzz(int count, int max, String fizzer) { fizzer += (count % 3 == 0) ? "fizz":""; fizzer += (count % 5 == 0) ? "buzz":""; fizzer += (count % 3 != 0 && count % 5 != 0) ? count:""; if (count != max) { fizzer += "\n"; fizzbuzz(count+1,max,fizzer); ...

 
0
A: Finding alternating sequence in a list of numbers

Jeroen VannevelIt looks like you're doing a lot of things when it shouldn't be that complicated at all. Take a look at this quick sample I threw together that does the same thing as yours (except for that deletion requirement, I have no idea what that means). public static void main(String[] args) { int re...

Am I correct in my assertion of my code's complexity analysis?
 
@JeroenVannevel Yup, O(n) time, O(1) space.
 
@Corbin cheers
 
0
Q: Lift ball which leads to shortest height

JavaDeveloperThere are n balls kept on a table and connected by same singe connected string (which can be cyclic or maynot). Write the code to select a ball such that after lifting the whole structure from that ball height will be minimum. (algo+code+ mathematical proof of correctness) Note, I do understand ...

 
all sorts of new people in here today! Welcome all you new people @JeroenVannevel
please feel free to wander all my posted answers and vote on the good ones
I need to overtake @syb0rg on the reputation board
 
12:54 AM
0
Q: Is this the correct way to write and control Perlin noise for 1D?

dragonsSo im reading this tutorial and it's the first time I try something this new. http://freespace.virgin.net/hugo.elias/models/m_perlin.htm Here is my attempt: import sys import math import pygame import random pygame.init() windowwidth, windowheight = 900, 500 windowsurface = pygame.display.set_...

 
 
2 hours later…
3:19 AM
@rolfl is now in second place
 
Yup.... ;-)
 
3:54 AM
@Malachi You're getting closer ;)
@BlueBug Now that you have a CR account, wherz teh codez to reevu? :)
 
 
3 hours later…
7:07 AM
0
Q: Alphabatising, hand-check

GeekyDewdI would like a hand check done on this, to understand exactly how the computer is changing each variable. 1 Module main() 2 // Constant for the array size 3 Constant Integer SIZE = 6 4 5 // An array of strings 6 Declare String names[SIZE] = "David", "Abe", "Megan", 7 "Beth", "Jeff", "Daisy" 8 9 ...

 
 
1 hour later…
8:10 AM
Monking
 
 
2 hours later…
10:07 AM
Monking
 
0
Q: Refactor ref params to return type

tesicgThe old signature of my method looks as following: public int GetBillStatus(int orderID, ref string transactionID, ref string message, ref string payer, ref double total) { ... } Returning int can have more values such as: -1, 0, 1, 2, 3. I could create new type that contains ref values, ...

 
11:00 AM
0
Q: Login Form in HTML

FreezeI am a beginner and I have made Login Form in HTML. I'm pretty sure it will look horrible to any developer, but hey, that's why I've posted it. I'd like a general review of this. I'm especially concerned about the quality and enhancements of this form. <!DOCTYPE html PUBLIC "-//W3C//DTD...

 
11:17 AM
0
Q: DataGridView Pagination

NewbieProgrammerBelow is the code for DataGridView pagination (which I copied from some other site). I have implemented this in my application (C# win form), which is going to be used by my client and this DataGridView will eventually have to load up thousands of records. I need to make sure if this DataGridVi...

 
12:13 PM
Monking CRitters.
 
Hey :)
 
Today a holiday day in France?
 
morning
 
Hey Jaroen .... still working on some commenting issues from yesterday :(
Have not forgotten.
 
@rolfl Yep. But the whether is bad and I don't have anyone to see today :/
 
12:16 PM
Ah man. So how would I know if this code is good enough or not? I am still new at this, so I don't really know. — NewbieProgrammer 1 min ago
Good question .... but can't help.
 
@rolfl I saw the comment, thanks for looking into it. Any way I should have handled it differently?
 
No, you did fine. I am disappointed your answer is deleted....
.... but I didn't read enough to know whether your answer is actually that broken?
 
It didn't feel relevant anymore after the changes
 
OK.
 
It would just confuse new readers with the updated situation
 
12:18 PM
I don't want you to think that is the 'norm' on Code Review.
 
stealthily sneaks into room
 
Haha, don't worry. I've spent enough time on the internet by now to know there are outliers like that
 
I saw you sneak in ... it was not that stealthy ;-)
 
Doorknobs are loud when they bounce into places :(
 
@Doorknob It seems that CR vs. PCG revolves around the fight between a mug and a doorknob...
 
12:21 PM
Lol, that's a fairly accurate description
 
Mug covers doorknob makes doorknob ineffective.
 
Monkey throws mug away.
 
Doorknob smashes out of mug and breaks it in two.
:P I'm going to eat breakfast now, brb
 
ditto.
 
Mornin`
 
1:03 PM
monking
 
@Mat'sMug in response to this answer
2
A: In place quicksort

Mat's MugVB6/VBA is a "bulky" language to read - If...End If, Sub...End Sub, While...Wend; compared to curly braces languages (Java, C#, etc.), VB6/VBA code, by the nature of its code block delimiters, makes pretty crowded code, even when written cleanly. Give it some breathing vertical space: Public Su...

don't let it breath or reproduce.
 
0
Q: Insertion Sort implementation in java

VIckybI have implemented Insertion sort in java .Please review it. public class InsertionSort { public static void main(String[] args) { int[] values = new int[args.length]; for (int i = 0; i < args.length; i++) { values[i] = Integer.parseInt(args[i]); } for (int i = 0; i < v...

 
> Oh, and Code Review stole our ad idea in return for us stealing their blog idea, so now we're even. ;)
from here :P
 
@Doorknob if it helps you sleep at night we will let you think we are even, even though we are better than you guys over there. our code is cleaner.
BRB gotta REBOOT
should take about a minute maybe 2
less than 2 minutes
and that was even with updates
 
1:24 PM
@Doorknob - seems like you are answering your own questions there....
0
Q: Code Golf Blog - Phase 2 - Define the Scope

DoorknobThe general reaction on phase 1 of the blog idea was "maybe, depending on what content we write there." So, let's figure that out! From the "official" blog guidelines on this step: Is the blog about the site? Is it about the site’s topic? Is it about the industry around the topic? Keep in mi...

And no upvotes yet?
 
1:35 PM
@rolfl A mostly-holiday: offices are closed, but the local market day happened as usual for a Monday.
 
@Doorknob looks like you are the the only long term user there? I will upvote for you
 
1:50 PM
0
A: Code Golf Blog - Phase 2 - Define the Scope

MalachiWe could blog about How new updates to languages (like the new Java 8) will affect Golfing in those languages. With this it would help everyone to stay on the cutting edge of Code Golfing.

figured that I would help out the Gophers
here is an accepted answer with only 1 vote, this question needs more attention.
1
A: Email script security

Malachiif you are asking about the Password being inside the server side code, that shouldn't be a security issue, because this information doesn't leave the server. I don't see a Security issue there. PHP Code is Never available to Client Side. so anything that you write in the code is not available...

another question with 1 accepted answer with a score of 1
1
A: Better way to use a Condition (CancellationToken)

MalachiEDIT I think this is what you are looking for, it will only check once inside the using block, if you want to dispose the form if that first Queue.TryTake(out TextureData, 300)) is false then add to the else of that statement. if you really want to test it at the last second you could do it lik...

another that needs more attention
1
A: Same records between two tables

Malachi Depending on how unique the Data in both tables is, which I think they will be the same where they match, you could probably leave out all the AND statements in your WHERE statement and just go with something like this SELECT * FROM player WHERE player.id in (Select person.ID FROM person) I d...

Question has more upvotes than accepted answer
6
Q: Plain CSS buttons in different sizes

Alex GarrettJust a plain button, in different sizes. I wanted to achieve exactly the same styling cross browser for both anchors, inputs and buttons. I'm just wondering if this could be improved. Markup <!DOCTYPE html> <html> <head> <title>CSS button</title> <link rel="stylesheet" href...

♪♫♪ Pimpin Ain't Easy ♪♫♪
BTW.Work
 
@Mat'sMug - interview time ..... ;-) ? Good luck!
3
 
2:06 PM
I should game less and do useful things more...
 
new user posts
1
Q: Performing a special multiplication on two square matrices

adam levinI have a function called "mult2" that takes in two square NumPy matrices and returns a matrix that is the result of a special multiplication: p=P(1,344) PI,PIT=[],[] for i in xrange(344): PI.append(p**i) PIT.append((p**i).transpose()) def mult2(a,b): C=np.sum((a*b)**2,axis=1) CE...

Both the question and the answer
 
When is Simon back? :o He's been gone for some time now, though don't exactly know how far he's into his 10 day holiday
 
I managed to write a curried function in C++11. That was really unreadable at first.
Now it's almost readable.
 
already a downvote on the new user post with no explaination
http://codereview.stackexchange.com/a/47781/38054
 
Strange for that downvote @BenVlodgi, Why would anyone downovte that?
 
2:21 PM
@skiwi I'm sure there are good reasons, as it is his first time posting, but I mean the no-explaination
it doesn't help them get better
 
True that, though I didn't see much wrong with that answer
 
Neither did I.
 
Upvoted it
 
I thought it seemed nice as well, but I don't know python
 
Though
    CE1E2 += np.sum(API[index]*PITB[index]*API[index]*PIT[index]*b, axis=1)
    CE2E3 += np.sum(a*BPI[index]*PITA[index]*BPI[index]*PIT[index], axis=1)
    CE1E2E3 += np.sum(np.matrix((API[index]*PITB[index])**2), axis=1)
That is a bit rough on the eyes
 
That I can agree on
 
@konijn That's ok since the question wasn't more readable in the first place.
 
Agreed, that is why I +1'd it regardless
 
GCC 4.9 should be available this week.
3
 
0
Q: Reading a file and store them to array

Vinoth KumarThis is my code for reading a file with delimiter. Any suggestion to improve my code efficiency? I am not satisfied with using array data structure? is any other data structure can be used instead of array? bool read_file(char *p_file_name,char *file_content[FILE_NO_OF_ROWS][FILE_NO_OF_COL],con...

 
2:54 PM
0
Q: Could not execute this Akka actor based test code

Balaram26I am new to Scala Akka actor. Based on the akka tutorial example on their website,i coded a similar example with just printing messages with the time they started. But the code does not get executed in my eclipse IDE. import akka.actor.Actor import akka.actor.ActorRef import scala.collection.mu...

 
3:05 PM
Why is the unanswered list showing answered questions ?
 
I guess that those are actually the questions with no upvoted answers.
 
^^^ answer is only an answer if it is upvoted, apparenly.
That is relatively well known ...... for example, if you click the 'unanswered' link between 'Badges' and 'Ask a question', you get answers with no upvotes.
Currently 606
But if you press the 'no answers' link/tab, you get just 571
 
Ah! I had no idea, most interesting
 
@rolfl Do you perhaps have a minute to help me with generics? I don't think it warrants an SO question
 
Sure.
 
3:10 PM
I have the following structure:
public abstract class Pile extends AbstractCollection<Card> implements Collection<Card> { }

public class Deck extends Pile {
    public Card take() {
        States.requireNonEmpty(this, "deck");
        return take(0);
    }
}

    public static <E> Collection<E> requireNonEmpty(final Collection<E> collection, final String name) throws NoSuchElementException {
        Objects.requireNonNull(name);
        if (collection.isEmpty()) {
            throw new NoSuchElementException(name + " must be non-empty");
(last excerpt is from States class)
I would like to be able to call return States.requireNonEmpty(this, "deck").take(0); in take(), however that doesn't seem to work
 
Camembert.
 
I thought that as I return a Collection<E>, where E === Card, so I have a Collection<Card>, of whom a known subtype is Deck, that it should work then
 
Funny, most of my not upvoted answers are for pieces of code that were really good, and where I could just explain why the code is really good
 
@Morwenn GCC 4.9 is already available, I think it was released about a week ago.
At least, that's what I read on Hacker News.
 
@syb0rg It was probably the release candidate. The final one was scheduled for tomorrow.
 
3:19 PM
@skiwi requireNonEmpty returns Collection<E> so since .take() is a self defined method, it is not present in Collection<E> and thus can't be called onto it. The only way I see it work is if you make it return Pile, unless I'm missing something?
 
The official page says "As of this time no releases of GCC 4.9 have yet been made.".
 
@JeroenVannevel Maybe I have been thinking the wrong way around, as what you are saying seems to be logical...
 
@Morwenn It was probably a release candidate then... when I tried to install it to my Mac with brew it still thought it wasn't the full release.
In case you all haven't seen:
1
A: Recording audio in C

syb0rgThings you could improve Portability Right now you have a pretty large dependency staring right at you on the first line. #include <alsa/asoundlib.h> With that one declaration, I now know that your "library" is tailored to a specific sound architecture. Try running your code on Windows o...

 
@skiwi - change:
  public static <E> Collection<E> requireNonEmpty(final Collection<E> collection, final String name) throws NoSuchElementException {
to be
 
public static <E, C extends Collection<E>> C requireNonEmpty(final C collection, final String name) throws NoSuchElementException { }
I think?
 
3:22 PM
public static <E, C extends Collection<E>> C requireNonEmpty(final C collection, final String name) throws NoSuchElementException {
What you said.... yes
 
Ok, I think we are on one line there
I was thinking the wrong way around I think
 
generic methods need to be generic methods ;-)
 
Now I'd like to get rid of all my bloated JUnit test code...
@Test
public void testRequirePositive_int() {
    int result = Arguments.requirePositive(1);
    assertEquals(1, result);
}

@Test(expected = IllegalArgumentException.class)
public void testRequirePositive_intIAE1() {
    Arguments.requirePositive(0);
}

@Test(expected = IllegalArgumentException.class)
public void testRequirePositive_intIAE2() {
    Arguments.requirePositive(-1);
}
This is just too bloated for a simple method
But I don't think JUnit offers better capabilities
 
0
Q: how can I make this code faster and more efficient?

J_mie6I would like to submit a portion of my code for Code Review, and I have done my best to comment the code (and include essential parts that may aid understanding of the program) for your convenience! Any optimisation that would increase the speed of the running of the program would be appreciated!...

 
Good question ^
 
3:29 PM
The amount of loops there...
 
That's why it is a good question ;)
 
Annotations with default method bodies... I thought default methods were new to Java 8
24
Q: @interface default declaration usage in Java

OscarRyzI have just discovered this feature. Declaring an interface using the "@interface" syntax allows you to put a default value. public @interface HelloWorld { public String sayHello() default "hello world"; } This is something new for me. How is that default value suppose to be used. I c...

And who even decided to call annotations in Java @interface...
 
That is not a default method.....
it is a default value for an annotation that does not have a default value.
 
3:46 PM
It looks weird to me, but probably because I am new to it
 
in The Nineteenth Byte, 2 mins ago, by Malachi
@Rusher Real Programmers......CodeReview FTW ...... JK
 
0
Q: Trying to understand recursion in F#

user1206480I'm new to F# and the way recursion works. I need help visualizing just exactly how the below code is building and returning a list. I understand the principle of recursion but the way this F# code is written makes me believe that if i = max then an empty list is returned. let createImmutableLi...

 
Hmm, I am wondering if my unit tests can be written shorter, would that be on topic for CR?
(the amount of boilerplate code seems to be simply too much)
 
4:12 PM
0
Q: ksh script comments

java_mouseCould you please review my script? #!/bin/ksh T=/bb/bdap/bin/cms/tools U=$T/upgrader mv $T/conbase_updates $U/conbase_updates.br.drqs$1 cd $U grep "^BR" config.alpha > config.br ./ConbaseUpgrader config.br conbase_updates.br.drqs$1

 
"The 2nd Morningtor"
 
@skiwi it should be well on topic...
 
4:27 PM
this question is one vote away from a nice question badge and my answer is one vote away from a nice answer badge.
9
A: Reservation Form in HTML

Malachi You are missing ending paragraph tags your tags should be lowercase I think that Uppercase is normal for straight HTML, but I suggest using something other than straight HTML, I suggest XHTML or HTML5, and in that case everything should be lowercase. be careful with your indentation. when yo...

 
Freeze!
4
 
Welcome to the 2nd Monitor @Freeze!
 
Hi
 
@Freeze Welcome
 
Hi Guyz
 
4:30 PM
BTW.Work
 
Guess, Who am I?
 
Freeze?
 
hello @Freeze
 
@Freeze @syb0rg's cyclops chat bot?
 
@rob0t went rogue?!?!?!
 
4:32 PM
Nope
 
@syb0rg it reproduced
 
o_O
more new users posts
2
Q: A source Code Counter

cluttonThis is from my project codecount I use personally that is very similar to cloc.exe or SLOCCount. The part that I am questioning is where I am calculating when I am in a comment block and have deep nesting, I basically am replacing the sections with blank. I would like to deal with fixed format...

 
@Vogel612, how's your TCG going?
 
@Freeze Are you a sockpuppet of a regular?
 
Nope
 
4:35 PM
renamed.
 
Nope
New Account, New Rules, New Beliefs
3
 
welcome @Freeze
 
Thanks :)
 
@Freeze Yoda?
 
thank you Santa..
 
4:39 PM
Nope
 
You've earned the "Nice Answer" badge for Reservation Form in HTML.
 
@Freeze kleinfreund?
 
@Freeze Do you have a github account?
 
@syb0rg 607 Rep to catch you
 
25 more upvotes in before I have a silver tag badge.
 
4:46 PM
@skiwi No Not Github
 
@Freeze Is this something you want me, as a moderator to look in to?
 
I'm just Freeze!
@rolfl Nope
 
@syb0rg: I have answered this older question not too long ago. Perhaps there is more to say?
4
Q: Improving Hangman game

apprenticeI'd like to know how this program can be improved. Any comments or critiques are most welcome. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <errno.h> #define MAX 10000 #define FOUND 1 #define NOT_FOUND 0 #define DEAD 0 #define LINUX void starMaker(char ...

 
OK, then.... you can be just 'Freeze'.
 
@Jamal The ternary return could be simplified further:
return (strchr(starWord , '*')) ? FOUND : NOT_FOUND;
to
return (strchr(starWord , '*'));
@Jamal The return type of main should be declared, not assumed by the compiler as an int.
 
4:51 PM
200 told me that the int is implied here for some standard of C. Is that correct?
 
It is implied, but will almost always generate a warning in compilers. It is always recommended to declare it.
 
Visual studio throws an error on typeof(IEnumerable).Name while LINQPad can execute it just fine.. Why, VS, why?!
2
 
@Freeze So what was the old account then?
 
@JeroenVannevel Because, VS.
What is this?! My unit tests correctly ran in one try
 
@Jamal int i could be declared inside the for loops for lowest scope possible.
 
4:54 PM
MSDN is offline, but I am correct when I say there is a non-generic type IEnumerable, right?
Intellisense only displays the generic one
 
MSDN is offline ...... say it again ..... ;-)
 
@Jamal Some other minor nitpicks with the code. Otherwise, pretty good advice.
 
@syb0rg I told you
 
@Freeze Did you have the old account deleted?
 
@syb0rg Regarding strchr(), doesn't it return a pointer? How would it be the same as returning FOUND or NOT_FOUND?
 
4:58 PM
Yup
 
I still think that the answers on questions hould also be possible to reviewed...
Not that that ^^ would be easy to integrate in an UI though and that it would not create a big mess
@Freeze What programming languages do you know best?
(The investigation continous...)
 
@Jamal Ahh, you are right. My bad. However, you could do:
return !(!strchr(starWord , '*'));
But that might be considered bad form :P
 
Double negation looks weird
 
@syb0rg Yeah, I don't like that. :-) I'll just add the things you've mentioned. I didn't bother reading every bit of code since, as I've mentioned, it's sort of hard to follow.
 
oooh, IEnumerable is in System.Collections instead of System.Collections.Generic. Silly.
 
5:05 PM
@Jamal I thought I remembered it returning the index of the character instead of a pointer to the first character, and then returning 0 if it didn't contain the character. Maybe that was a function I wrote though...
 
Hmm, on university we have a teacher who two times has engineer in his formal name?
 
VB
 
evening all
 
@chillworld Good evening.
@Jamal Apparently the double negation I just did is a trick to convert some value to a boolean.
46
Q: Double Negation in C++ code

Brian GianforcaroI just came onto a project with a pretty huge code base. I'm mostly dealing with C++ and a lot of the code they write uses double negation for their boolean logic. if (!!variable && (!!api.lookup("some-string"))) { do_some_stuff(); } I know these ...

 
1
Q: Unit tests for an argument-checking class

skiwiI am wondering if my current unit tests could be written better, I am most interested in whether it is possible to make the code look more concise, as currently it a boiler-plated mess. I have full access to Java 8, if that would help by making it more concise. The Arguments class itself: publi...

 
5:09 PM
@Jamal And apparently, it is also part of the C standard:
33
A: double negation in C : is it guaranteed to return 0/1?

MatYes, in C99, see §6.5.3.3/4: The result of the logical negation operator ! is 0 if the value of its operand compares unequal to 0, 1 if the value of its operand compares equal to 0. The result has type int. The expression !E is equivalent to (0==E). So !x and !!y can only yield 0 or 1,...

Hey @janos
 
hey @syb0rg how's it going?
 
Good, I'm just finishing writing up a resume for an internship.
 
Janos, you're hammering away at those Java questions .... I need to start getting ahead of you....
 
@skiwi why = static {
assertTrue(true);
}
 
@chillworld What @rolfl said there ^^
 
5:12 PM
> The static { assertTrue(true); } is there to prevent Netbeans from removing the import if it would be unused in some test class.
See, I read the question ;-)
 
lols
2
didn't read the last part
just had quick look at the test class
 
I think it might be refactorable by using lambdas... But really need to look into that more at some point, it shoudl also be possible without lambdas
 
haha @rolfl, sometimes, but I'm not around that much anyway ;)
 
0
Q: Prototypal inheritance - struggling

user1189880I have the following example in javascript which I cannot decide is correct and idiomatic of javscripts prototypal inheritance nature. var HR = HR || {}; HR.Employee = { addProperty: function(key, value) { if (this.hasOwnProperty('properties')) { if (! this.properties....

 
mod duties have halved my answering time at least....
 
5:15 PM
^ off-topic
 
I'm glad if I can fill in sometimes ;)
 
@Jamal What's off topic?
My whining about mod duties?
 
@Freeze No voting?
 
@skiwi, not a fan of this : Objects.requireNonNull
 
@chillworld Why would you not be a fan of that?
 
5:19 PM
in Mine oppinion better to use AssertNotNull
 
@rolfl SE's above question.
 
it gives a nullpointer => assert gives other error, so you know its something you code when you see the error
 
@chillworld AssertNotNull is for unit testing, the Objects.requireNonNull is for the actual runtime implementation
 
@skiwi no you can use assertNotNull :)
 
0
Q: Lazy man's IEnumerable extension verification method

BrandonI often find myself doing this (or similar) with Lists and other collection types: if (someList != null && someList.Count > 0) //take some action on the list so I got lazy and wrote the following extension methods to do it for me: public static bool IsNullOrEmpty(this IEnumerable self...

 
@skiwi why do you mind if Netbeans removes an import that you're not using anyway?
 
@janos Because static imports behave annoyingly, I cannot 'quick import' it, I would need to retype the whole import once it got removed
And I always use ctrl+shift+I (if I recall correctly), which automatically imports all neccessary imports ánd removes all unnecessary ones
 
hm that's too bad. it's just unnecessary code. but I see your point
 
0
Q: Using linked list to make a simple version of word/sentence predicting software (e.g T-9)

a.b.cHey Guy/Gals, I want to develop a simple program using linked list/trees for predicting words or sentences WITHOUT using file handling because i haven't been taught file handling yet ! what i want from my program is 1- Predict words or sentences as i inout character array 2- ...

 
@janos skiwi is correct that netbeans doesn't autoimport that import, it reacts really stupid with static imports
 
5:27 PM
In Eclipse I use Assert.assertTrue instead of static imports, because I don't know a shortcut that adds static imports easily, and Assert.assert<ctrl+space> works better
 
brb
 
@SE: Very off-topic
 
0
A: Tetris code for pieces and map

syb0rgOverall this looks very nice. It's easy to read, and is very refined. A few notes: You can remove the Map from the first line of your structure. typedef struct { Color *blocks; int rows; int columns; } Map; Your function map_delete() only performs one action, freeing the memory ...

 
5:43 PM
1
Q: Get nested type name without namespace

p.s.w.g Suppose I have a nested class structure like this: namespace My.Namespace { public class Foo { public class Bar { public class Baz { } } } } I need to get the nested type name of Baz without the namespace, i.e. Foo+Bar+Baz in a generic method. ...

 
5:57 PM
Bye
 
Goodbye @Freeze
 
@StackExchange someone want to check my answer on this one, it is rather simple but I think it is what the OP is looking for
 
0
Q: How do I optimize this JavaScript code further?

TitoHow do I optimize this code further? Goal is to edit "js-tab" in one place. These are the 2 references I tried to follow: 1) http://css-tricks.com/how-do-you-structure-javascript-the-module-pattern-edition/ var ToggleTab = { init: function() { this.tab = $(".js-tab"); this.bindEvents...

 
@chillworld To come back onto your assertNotNull: Assertions are semantically meant to indicate internal errors in your code. Asserts must never evaluate to true, if that happens, then there is an error in your code or in your assertion.
An example of an assertion is the following:
public void doSomething(final Object input) {
    assert(input != null);
    System.out.println(input.hashCode());
}
With that code, the assert will trigger, the remedy to that is to first throw an NPE, for example with Objects.requireNonNull(input);
And that's exactly why assertions are used in test cases
 
6:13 PM
59
A: when to use assertion vs Exception

Gregory PakoszOut of my mind (list may be incomplete, and is too long to fit in a comment), I would say: use exceptions when checking parameters passed to public or protected methods and constructors use exceptions when interacting with the user or when you expect the client code to recover from an exception...

 
@StackExchange This could use a better title.
Recursion? Neither the OP nor your answer uses any recursion. — lvc Mar 9 '12 at 7:43
 
Archaeologist?
 
I think that I just hanged myself with that answer
Meeting time
 
Hmm, a new version of the Java8 got released? I see someone is running 1.8.0_05
 
0
Q: Character Sprint Spaghetti Code

RAOI finally managed to get the code to work properly. It makes the player object move faster if the user double taps the arrow key with a few 'ticks' (new frames) after the 1st stroke. - User presses and has a limited time to press again to sprint the object. If the time runs out the user has to tr...

 
6:36 PM
[join 20 people in this room now]
hi @all!
 
hi @Mat'sMug
 
How was it ?
 
wasn't an interview, was just a silver plate with a job on it. questions like "what amount would make it a no-brainer for you to come work with us?"
10
 
@Mat'sMug nice
 
@Mat'sMug When do you start?
 
6:40 PM
@Mat'sMug And you answer was exorbitantly high?
 
.... and will you have time for CR?
 
3-4 weeks probably. I have a serious daycare problem now...
 
@Mat'sMug No VB6 anymore? Are you leaving your good old language-friend?
 
@syb0rg nothing they can't afford; @rolfl I'm sticking around, you're all stuck with me for a while!
@skiwi I don't know what meta-law exists, that makes it a 100% probability that I'll have to write at least some VBA no matter that ;)
 
Take notes/pictures of the current folk's faces when you hand in your notice ... ;-)
2
 
6:44 PM
@rolfl sure will ;)
 
@Mat'sMug good to hear!
 
We have a new leader:
user image
2
 
@Mat'sMug I approve this message
 
0
Q: java.util.concurrent bounded resuable resource implementation

dtoestrying to code following requirements with lockfree in most-used-code-path that is to get a resource from pool. Same resource should be used n (maxUsageCount) number of times and then destroyed and create a new one. If there is an error with a resource, it should be marked stale by client. Stal...

 
@Mat'sMug I was thinking of a SO-specific one:
> SO help you fix your code? Now get it reviewed on CR!
3
.... or something like that, but prettier (I don't do pretty....).
 
6:56 PM
@Mat'sMug tell me I didn't make an ass of myself with this answer.....codereview.stackexchange.com/a/47808/18427
 
Or.... your code works now? Let Code Review help to make it work better!
 
if that's the ad we're going with, I think we should keep the bottom part with the logo and "tough questions, smart answers." in all subsequent ads.
 
@Mat'sMug I agree, I like that part. but I don't want all new people thinking that the questions have to be complex
 
Someone has downvoted a lot of the ads on that meta post.
 
yeah, I got a -5 on my @$$
3
 
7:00 PM
You did ... apparently it is fat.
 
I still think "tough questions, smart answers" could take a funny meaning with "Does this code make my ass look fat?" on top.
 
^^^ true ... ;-)
Also, as an aside:
Well, as above, your suggestions (and precompiling the regex statements) have effectively cut the run-time down by 81%! so a great improvement. This leaves another check consuming 85% of runtime so I will post that one too in a separate thread — J_mie6 50 secs ago
@skiwi - you were wondering about inlining performance .... ^^^^^
 
@rolfl "SO helped you fix your code? Make it better on CR!" or "Push it to its limits on CR!" or "Optimize the heck out of it on CR!"
2
 
@rolfl Nicely done!
 
@janos Put it in a pretty pic, and I'd vote for it ;)
@syb0rg Thanks.
 
7:15 PM
too bad I don't do pretty pics ;-) or any pics, for that matter
 
@Malachi I have a SQL question for you
normally in C# I would do a query to get an object, then do my various checks on that object, but in SQL instead I always just do a select on the data with the specific pramater I care about. So I end up doing like 10 selects
but each of the SELECT has different WHEREs just to check to see if data like that exists
what I wonder is, can I grab a record, hold it, and then do multiple checks on its columns
 
back
@skiwi, I gues syb0rg have the same oppinion like me on that :)
 
@Malachi I wonder why OP needs the type's name
 
7:30 PM
@Mat'sMug it does seem incredibly strange
 
Give Greg some rep love:
1
A: How do I optimize this JavaScript code further?

Greg BurghardtI've always been partial to writing JavaScript classes that take a root element: function TabController() { // Maintain reference to "this" in event handlers this.toggleTab = this.toggleTab.bind(this); } TabController.prototype = { $element: null, constructor: TabController, ...

 
:)
 
@rolfl That's interesting :)
 
afk
 
Basically give the JVM the smallest chunks of code possible to work with, it will do the optimizations yourself and better than you would've been able to do it yourself anyway
 
7:46 PM
0
Q: Rails preventing ajax view duplication

Igor PantovićI have a website where people can write articles and publish/unpublish them. This is done via single button on the page: <a id="publish-button" href="#" class="btn btn-default <%= 'btn-success' if @article.published? %>"> <span class="glyphicon glyphicon-globe"></span> </a> As you can see,...

 
It's actually a unit test for a serialization class. The sample file contains XML that gets loaded, wrapped in some more XML to create an 'envelope' which specifies the type name, and then that entire XML is passed on to the serializer which is supposed to parse it and generate the desired type. The serializer expects the envolope to specify the message type as "urn:message:My.Namespace:Foo+Bar+Baz". The goal is to verify that T can be deserialized with this tool, without having to encode the entire envelope in my sample file, because I will be using the same samples for other tests. — p.s.w.g 5 mins ago
 
Hello @undergroundmonorail
 
a PCG spy? ;)
 
7:59 PM
1
Q: Can this architecture of base + derived classes be coded more efficient?

Mike de KlerkI've got some architecture in my code similar to this. It is about the Construct method in the base class in the example below. This method contains the logic for constructing a building, which is the same in every building. Yet different buildings may want to do things differently, like a differ...

 
00:00 - 20:0020:00 - 00:00

« first day (352 days earlier)      last day (3668 days later) »