Reputation
9,349
Top tag
Next privilege 10,000 Rep.
Access moderator tools
Badges
16 37
Newest
 Nice Answer
Impact
~213k people reached

2d
comment How to draw pictures directly into JS program?
There are libraries like Snap.svg that will allow you to use javascript to create a svg drawing. That svg generated can be thought of as the "image equivalent" of the javascript that you wrote to generate it and can be directly inserted into html pages without the javascript.
Jul
2
comment Is a number used only once and directly bound to a function parameter a magic number?
Magic numbers are by definition parameters deemed constant throughout your program. If you can replace 0.5, 0.2, and 100 with constants, than it should make just as much sense to use the magic numbers directly in your function and not as parameters. If that doesn't make sense in your case, then they aren't magic numbers but should remain function parameters.
Jul
1
comment Java: using final keyword only on method parameters that expect immutable objects?
Could be useful styling practice within a small team, but this is hardly practical on a larger scale. I personally would much rather prefer javadoc explicitly stating as such since I'll take clear and verbose over unclear and compact anyday.
Jun
30
comment China Style - How to code faster?
It is absolutely wrong to rush code development. If you were a hair stylist and not a programmer, it would be evident that being rushed is likely not going to make your client happy, but then that complication is a lot harder to see for a layman. The principle difference in this metaphor is that messing up a client's hair is a lot cheaper to fix. Find another job if at all possible.
Jun
30
comment how to open a 5.8GB CSV and create filters of the necessary data?
You need an editor that won't attempt to load the entire file in memory or you need to write your own.
Jun
30
comment Is this too much work for a Gateway to do?
@user3124380 Then I think what I said still applies. It is a good habit to "show" as little as possible in an interface.
Jun
30
comment Is this too much work for a Gateway to do?
It's hard to say what would be best for you with so little information, however, if Gateway is supposed to be a controller, then traditionally, it should be relying on another class to retrieve item information. The controller, knowing that only the existence is necessary, would respond only true or false.
Jun
30
comment interpretation of the statement in java
@user143252 A reference contains a virtual memory address which when mapped, corresponds to an exact position in physical memory. Not even the java virtual machine knows the physical address. The operating system handles mapping the virtual memory address to physical memory address. Suffice to say, it is a bit more complicated than you make it sound, but lets just say that you have everything necessary to read the contents of memory.
Jun
29
comment Fastest way to gather Provider data
First of all, if you want to put them all on one page, either your dictionary is too small to merit creating a search algorithm to fish for this information or you shouldn't put it on a single page. Pick one.
Jun
29
comment How do I design a subclass whose method contradicts its superclass?
I bet that took everything to not put the open brace on its own line. ;)
Jun
29
comment How do I design a subclass whose method contradicts its superclass?
No, of course. I just like to guess a programmer's language based on how they style pseudocode.
Jun
29
comment How do I design a subclass whose method contradicts its superclass?
@gsmendoza Absolutely, in particular example 2. I see your point. The example is to summarize the problem here. Consider though that if you're using such a property to determine how to use that instance, there is another error at play here. Ideally, you shouldn't care about whether it is right-handed or left-handed when you use an instance of Scissors. The subclasses should take care of these details.
Jun
29
comment How do I design a subclass whose method contradicts its superclass?
@gsmendoza The lesson here is that defaults aren't bad things when they properly reflect the class that has them. To say that all scissors are right-handed unless overridden is conceptually wrong and only risks to confuse any programmers reading it. However, it isn't that you can't do it this way, just that you shouldn't. This is also a property of a class, not a defining characteristic, so you shouldn't even need to create a subclass for it (at least in this particular example).
Jun
29
comment How do I design a subclass whose method contradicts its superclass?
I agree. If "right_handed" doesn't determine behavior, it is a property and not a defining characteristic of that class. Though even if it were, it is definitely a WTF moment in code review when you create a default value in the base class to avoid creating a separate class. If it defines behavior, while it may be more verbose, it is actually less complicated overall in my humble opinion.
Jun
23
comment Drawing concentric circles without gaps
Can you draw only circle borders? If not, why can't you simply draw white and pink filled circles, starting with the outer and moving inwards?
Jun
19
comment String Rearrangement Algorithm in Visual Basic
Could you provide an example of program usage as you would want it to work? For example, "How many trapezoids? 4 What is min length? 5 Output: x" Perhaps show a diagram? I'm still having difficulty understanding how your program should work.
Jun
18
comment String Rearrangement Algorithm in Visual Basic
Oh, I see, you meant output. What do the Ms and Rs signify?
Jun
18
comment String Rearrangement Algorithm in Visual Basic
If I had to read that twice to understand, then maybe you should re-evaluate how the user provides the input. If the user has to think about how to write the input, then you're not gaining any advantage.
Jun
10
comment How to pick a random move/action/element non-probabilistically?
I agree. Maintaining the list means not having to perform the search all over again, hence you really only need to do this once. You wouldn't search for all available cards before drawing a random card from a full deck, you'd remove a random card from the remaining cards to choose from.
Jun
10
comment address and pointer of a char and int
The printing of a char * gets handled in a special way, which is why you see "abc", otherwise you would see only "0x0018FF3C". I can see why this would be confusing because it is inconsistent with the rest, so just know that. Printing out any pointer, so long as it isn't overloaded will result in printing a pointer only.