« first day (844 days earlier)      last day (3176 days later) » 

1:00 PM
The question is the baseline.
 
0
Q: Adding multiple elements to list in dictionary

PerrolocoSo I made this method to set parameters from a text file: def set_params(self, params, previous_response=None): if len(params) > 0: param_value_list = params.split('&') self.params = { param_value.split()[0]: json.loads(previous_response.decode())[...

 
Morning
 
Zak
Okay, thank you.
 
Greetings
 
1:01 PM
@EthanBierlein 'ello
 
@Zak You're welcome. You are free to vote any way you like, but if you are downvoting based on his readability compared to yours, make sure it is of equal quality or worst than the question. Different people see things differently.
 
@CaptainObvious unwritten code?
 
Zak
It's not just the readability, I can't think (and I'm trying) of a single aspect of his code that is an improvement over mine. Except it's much shorter (because it doesn't do a lot of things it should).
 
Explain that part
But remember
Reviewers aren't required to actually provide code
 
Zak
So. His code goes Put sheet1 data in array (using hardcoded references), put sheet2 data in array. Match lists and print each match to the worksheet individually.
mine does all of that, in almost exactly the same way
except mine is extracted into methods
does not use hardcoded references
and only prints to the 3rd worksheet once, instead of 700 times
and also does some important data validation / formatting stuff
 
1:06 PM
What you told me that his code isn't doing is the content of your comment.
 
Zak
Basically what I'm saying is that his answer offers an implementation that doesn't do any single part of the process better than the equivalent part in my code, and also employs several bad coding practices (E.G. hard coded references) which mine does not.
it's not bad, it just doesn't provide, IMO, anything that would be useful as a way to improve the question as it stands
 
If it doesn't do what it is supposed to, it is broken code
 
seems more a codereview.stackexchange.com question — Ortomala Lokni 49 secs ago
 
Zak
@IsmaelMiguel it'll do what it's supposed to, if the data is put in exactly the right columns
 
Complain about the best practices
 
1:13 PM
Thanks @Santas, I just got the [bronze-badge:]
 
Zak
I'm about to
I'm just trying to be careful not to say, effectively, "My Code is better than your code"
 
That is a good decision
In my opinion, if you want to say something about someone's code, compare it to the question
 
@IsmaelMiguel That's your problem. Downvotes are anonymous and you know that.
 
Zak
Okay, what do you think, does it strike the rigt tone?
0
A: Aggregating 2 lists by matching UniqueIDs

RaystafarianI'm having a little bit of trouble following it through without comments, but from what I understand you might e better off using a Microsoft query to 'join' on the "primary key" - you can take a look at this answer on superuser. Otherwise, it seems, to me, that your process is doing a lot more ...

 
@Mast I know. But I'm just saying that if you downvote, it will be good to explain why. So it can be fixed.
 
1:17 PM
@Mast I personally just suck it up and get over it.
"Oh man a DV, better get all worked up!"
Nah, just get over it.
Some people are just trolls.
I've DV'd more than once with no explanation, because I just didn't think the answer/question was at all appropriate/correct/whatever.
 
Zak
Sure, but that's not the case here
 
I don't mind downvotes.
I hate not knowing why
 
Zak
I fully believe that he's written an answer which he feels is useful (and something I easily might've written just a week or 2 ago) but is not actually good code
and I certainly don't want to downvote someone who's trying to help without providing an explanation on why I don't think their answer is a good one
 
You could of-course write your own answer.
Which may be an even better idea.
 
Zak
I asked the question because my code's already as good as I feel I can make it
I can't exactly go, "this answer is not actually an improvement, but at least it's not worse than the original, like Raystafarian's"
 
1:23 PM
Oh
It is your question
 
Zak
ah, yes
 
I was thinking it was someone else's question and that you had an answer
 
Zak
ah, right
no
 
Oh
I only downvoted 2 answers to my questions
 
Zak
you can see why I was reluctant
 
1:25 PM
I can
 
@RubberDuck it's not about the IoC framework.. it's about DI. A small project can totally go with poor man's DI, but that entails a composition root and no newing up of dependencies in constructors. OP had 2 constructors there, one of them was never called in the app - the 2nd ctor was only there for testing - that's the smelly part :-)
Monking!
 
Greetings
 
@Mat'sMug Hello
 
Anyone have any comments for my Vector2 stuff that @Mat'sMug didn't point out? If not I'm giving him the check.
 
@EBrown Just a quick question
public static Vector2F Subtract(Vector2F v1, Vector2 v2) { return v1 - v2; }
public static Vector2F Subtract(Vector2F v1, Vector2F v2) { return v1 - v2; }
Can't that be a simple override to the - operator?
Also, is that an utility class?
 
@Quill var DELAY = 15 * 1000; //30,000 milliseconds - nice going @Malachi...
2
 
LOL
4
 
@SimonAndréForsberg LOL! He forgot How to math?
 
@IsmaelMiguel I have both.
 
1:36 PM
It isn't even a Friday release.
 
@EBrown I believe that block should be more like this:
public static Vector2F Subtract(Vector2F v1) { return this - v1; }
public static Vector2F Subtract(Vector2F v1) { return this - v1; }
If I'm wrong, please correct me
TTQH
 
The original API calls for Subtact(Vector2F, Vector2F).
The idea is to duplicate it in good form.
Unfortunately, that does mean duplicate on the public members.
 
@IsmaelMiguel you can't do this with a static method. This can be done with an instance method only.
5
 
@Mat'sMug I disagree with that. Without an IoC, having a composition root makes your code an awful mess. That ctor isn't solely for testing purposes. You can still use it if you decide to implement a second IFooBar class. The default ctor is simply a convenience method. It would have zero impact on moving to an IoC later.
 
@Zak I see you've encountered the effect of @Duga:
in The Whiteboard, 3 hours ago, by Duga
Maybe programmers.se? — Zak 17 secs ago
 
Zak
1:51 PM
oh yes, I figured that one out a few days ago
very useful script
 
@Duga is not a script!
She's a program
 
@RubberDuck you're seeing things from a legacy app POV. From a DI POV, having 2 constructors makes no sense, one of them is not in use. If the composition root is the only place things get new'd up, then your code is no more of a bloody mess than what it would be with an IoC container. In fact, newing things up at the composition root is pretty much the only way introducing an IoC container will have zero impact on your code later on...
@SimonAndréForsberg lol
3
 
> Script: an automated series of instructions carried out in a specific order.
Program: a series of coded software instructions to control the operation of a computer or other machine.
 
@SimonAndréForsberg Should that not just be var DELAY = 15 * 1000; // a while?
 
Zak
I'm deeply sorry. @duga you are the most beautiful, most efficient, most sublime and glorious program I've ever had the privilege of meeting
7
 
1:59 PM
I've done poor man's DI for a small console app recently at work; the code is no different from what it would be if I added a reference to Ninject or any other IoC framework.
 
Zak
so, update on my day as a SysAdmin
 
@Mat'sMug I have to build an ECS system for this project, that's going to be fun.
 
Zak
it's not a windows update
 
@EBrown what's an ECS system?
 
9
A: Entities and the things they do

Carl LethAny time you see things like "Size", "Gender", and "Home" in the same class, yes, you've gone overboard. This class violates a number of object-oriented design principles. You want reusable logic that keeps flexibility to throw your monsters like rocks and cast spells on your rocks that turn th...

 
2:00 PM
@EBrown would be much better yeah
 
@Heslacher Yes, I was in a rush and I only copy-pasted
 
@SimonAndréForsberg No C# ones there, I'll be posting the first C# ECS questions fairly soon. :)
 
@EBrown good good. 30 more questions in the tag and I'll get another taxonomist badge.
plus, I am interested in ECS in general
 
@SimonAndréForsberg I don't know that I'll have that many.
I'm currently reading about it, trying to make sure I do it right the first time.
 
@EBrown ah, so that's why I haven't seen that tag yet!
 
2:04 PM
I never knew anything about it until that answer was posted.
 
I've done ECS a few times and I still don't think I'm doing it right
 
@Mat'sMug Indeed, but you'll start seeing it/them when I get started on it. :)
I really think it's an interesting idea.
Been reading a bit about it at work.
Though atm I have to find a couple references for a job application.
 
so an "ECS system" is an Entity Component System system
 
@Mat'sMug Yeah.
 
very systematically systemic
4
 
2:05 PM
The idea being you separate out your properties into their own components and systems, to isolate code.
 
this is a great Q&A on the subject:
111
Q: Role of systems in entity systems architecture

bio595I've been reading a lot about entity components and systems and have thought that the idea of an entity just being an ID is quite interesting. However I don't know how this completely works with the components aspect or the systems aspect. A component is just a data object managed by some relev...

 
@EBrown Seperate properties from what, their class?
 
@Mast Yeah. So that systems can be auto-magic.
 
@EBrown enums should have a default value, typically notated as None = 0. That way you don't have to work with Nullable<Enum>
 
@Mat'sMug which is why I refer to it as "ECS approach" instead ;)
 
2:07 PM
@JeroenVannevel Things to really badly if I do that, unfortunately.
 
por qué?
 
Because of how I use the Direction enum.
 
@EBrown Sounds interesting.
 
I borked it a bit, and the direction has to have a valid value everywhere except that one spot.
 
Zak
So, I called our external IT support people (who are effectively our SysAdmins). They haven't got a clue either.
 
2:08 PM
@Mast Reading about it, it's definitely an interesting topic.
 
Zak
IT's an oddly specific thing to break, global variable scoping.
it should be fundamental to the language
it shouldn't be a thing that CAN change
 
It may be a bug
Not on your code
 
Zak
maybe, but there hasn't been a microsoft update
 
Really weird indeed
 
@EBrown I don't have a project to incorporate it into ATM, but yea.
 
2:10 PM
@EBrown you can't enforce an enum having valid values like that, any more than using a default value
 
@JeroenVannevel Essentially, I cannot have a None value because of the class in this question.
@JeroenVannevel Well, the problem is that Direction is used for rendering.
So that it's persistent.
Otherwise, I have to have a rendering bit for when Direction is None.
 
If you'd use ((Direction) 555) would also be valid code with invalid values
 
@JeroenVannevel Should that not RTE?
 
wut?
RTE?
 
Runtime Exception
 
2:13 PM
ahh
Nope
Works like a charm
 
enums are int's in disguise
 
(by default)
 
Yes, but shouldn't that be an invalid cast?
 
yes, by default
nope
 
Feel free to try it yourself:
void Main()
{
	MyEnum a = ((MyEnum) 555);
	((MyEnum) 1).Dump();
	Enum.Parse(typeof(MyEnum), "5555").Dump();
}

enum MyEnum
{
	X = 0,
	Y = 1,
	Z = 2
}
Each of those work
 
2:14 PM
@Mat'sMug perhaps I am. God knows I see enough legacy code these days.
 
@JeroenVannevel Interesting.
 
I need to get that Michael Feathers book. And you need to get that Mark Seemann book ;-)
 
Doesn't seem to break things, though.
Well, 555 does because my enum is actually a byte in disguise.
 
@EBrown why would you do that?
 
@Mat'sMug lol. Trade ya!
 
2:17 PM
@Mat'sMug Because it only has 4 values.
public enum Direction : byte
{
    Up = 1,
    Down = 2,
    Left = 3,
    Right = 4,
}
 
Actually, no I won't. I reference Micheal Feather's book at least once a week these days....
 
No [Flags]?
 
Nope.
 
Oh wait
 
It only supports those four.
 
2:18 PM
@EBrown I'd make that a [Flags] enum and use base-2 values so that the enum could be used like Up | Left
 
@JeroenVannevel values don't match up
 
That's okay. You shouldn't have flags since they can't be combined
 
@Mat'sMug That's an invalid combination.
 
for now
 
The direction can only be one of those four values.
 
2:18 PM
....for now
rule#1: rules change. code doesn't. </dreamworld>
 
@EBrown Can you change those to be 1,2,4 and 8?
If you want left and up, you can use bitwise operations to check if the bit is set
 
@IsmaelMiguel You literally just repeated everything @Mat'sMug and @JeroenVannevel said.
 
@EBrown Why?
 
@Mast Because that is the rule. We're only designing four-direction spritesheets.
 
Wait for it.. He'll tell you all about how I'm on ignore
 
2:23 PM
I offered to support 8, but the other guy only wanted four.
 
@EBrown Wut.
 
@EBrown Sorry. I don't know about Jeroen. I have him on ignore
4
 
@JeroenVannevel lol
 
But what Mat said seems different
 
Called it
 
2:24 PM
@JeroenVannevel Foresight
 
@EBrown You should support 9. A perfect square.
 
@Mast experience
 
@JeroenVannevel Yep. Lol
 
@IsmaelMiguel 9 a perfect square?
 
@Mast The sprite designer doesn't want to design four extra directions.
 
2:24 PM
Only if you're in 3D
 
@EBrown don't forget IN and OUT
 
@EBrown Ah, he made a non-generic sprite.
 
@Heslacher IN and OUT?
 
Fully 3D ;-)
 
Oh good grief.
THIS IS NOT 3D lol
 
2:27 PM
for now
 
Zak
Dear lord kill me now, I'm actually, willingly, contacting Microsoft Tech Support
 
Here's the problem: if I change this to a Flags enum, I have to support 8-direction movement.
 
no you don't
 
And then, somehow, it's going to end up with Up | Down somewhere.
 
but you can
 
2:28 PM
And then wtf do I do?
 
@Mast 3*3. Or 3^2
That is a square
 
You can still do Up | Down now, even without the [Flags]
 
@EBrown A cube is 3*3*3
 
The values just won't make any sense and you enter unknown territory
 
It has 3 dimentions
A square has 2 dimentions
 
2:29 PM
@JeroenVannevel Yeah...or I can just assume anything non-specified is Up.
 
@JeroenVannevel except with the current values that will make no... wait, what you said.
 
@IsmaelMiguel No shit, captain obvious.
 
Right now, Down | Left will return 3. Which is Left. Did you intend that?
 
The problem is, if I add a None value, how would I write the rendering to not have problems?
 
But a square doesn't need 9 directions.
That's a cube.
 
2:29 PM
@EBrown Position 0
 
Draw it out and you'll see.
 
@JeroenVannevel The difference is that right now Down | Left is specifically unsupported.
 
But you can't know that
 
@Mast I was defending my point
@Mast Watch this:
 
If you receive the value 3, can you tell if it's Direction.Left or Direction.Left | Direction.Down?
 
2:30 PM
123
456
789
A quare
 
@EBrown None should just refresh
 
@JeroenVannevel It's Direction.Left because Direction.Left | Direction.Down is an unsupported configuration.
 
@IsmaelMiguel No, you're stating points everybody knows which do not support your theory.
 
Therefore, I do not have to support it.
 
@IsmaelMiguel Of which you only have 8 directions.
The 5 in your diagram isn't a direction.
It's lack of direction.
 
2:31 PM
I was interrupted
But that is correct and was my point
 
@IsmaelMiguel Never seen a quare in my life.
3
 
So you need 8, not 9.
 
His enum would have 0,1,2,4,8
@EBrown You have now
 
@IsmaelMiguel Why?
That's still not 9 by the way.
That's 5.
 
So now, my enum would look like this:
 
2:33 PM
It depends on how you use it exactly but by using [Flags] (or just using 2^x values), you would turn that into an unsupported result. Instead of a random actual value
 
public enum Direction : byte
{
    None = 0,
    Up = 1 << 0,
    Down = 1 << 1,
    Left = 1 << 2,
    Right = 1 << 3,

    UpLeft = 1 << 0 | 1 << 2,
    UpRight = 1 << 0 | 1 << 3,
    DownLeft = 1 << 1 | 1 << 2,
    DownRight = 1 << 1 | 1 << 3,
}
 
no need to define UpLeft & other combinations
 
Sure there is.
 
@EBrown Bitchifting wins another fight.
2
 
You don't need the extra ones
and if you do, at least define them as UpLeft = Up | Left
 
2:34 PM
^^
 
Or is it Up & Left?
 
@JeroenVannevel |
 
@JeroenVannevel pretty sure it's |
 
Also, is that new to C#6.0?
Because IIRC that wouldn't work before for me.
 
nope
works in C# 1.1 AFAIK
 
2:35 PM
@EBrown what is?
 
@JeroenVannevel Being able to use named enum values in enum bit-combinations.
 
no idea about that
 
37 secs ago, by Mat's Mug
works in C# 1.1 AFAIK
 
Also in NET 1.0 btw
 
guys (& gals) -- anyone with close vote privs actually, I'd like a community decision on this post:
3
Q: Factory with raw pointers

eripI'm designing a Factory in C++ with raw pointers, but I'd like to use smart pointers when possible as is recommended with the Factory pattern in newer C++. Unfortunately my compiler is a bit old (gcc 4.4.6) and not all of the features of C++11 (let alone C++0x) are available to me. I cannot use ...

 
2:37 PM
@Mat'sMug Seems fine to me.
 
He seems adamant about it working on his system
and I like his beard
leave it open
 
@JeroenVannevel @Loki is adamant it isn't working on his.
He's one of our C++ experts.
 
Loki didn't specify the conditions under which he compiled it
the OP did
that makes me lean towards the OP
 
the code looks like it should compile at face value
 
'night
 
Zak
2:40 PM
night
 
night!
 
night
 
'night
 
It's 4:40 PM here...
 
I'm on a night train
2
 
2:41 PM
#just2ndmonitorthings
 
#Starwall
#ThisAin'tTwitter
3
 
@Mast Why would they give us stars if we are not to use them?
 
@EBrown s/stars/nukes
Still true?
 
@Mast sure.
 
2:42 PM
@Mast Because that's not the most shallow argument ever.
 
@EBrown Just saying your statement isn't really saying anything.
No chat room is so star-happy as The 2nd Monitor
7
 
Well, just eliminated one magic number.
 
@SimonAndréForsberg LOL Debug code...oops
 
should be moved to code review — Wouter Huysentruit 38 secs ago
 
What's the point in having stars if they just get deleted?
 
2:50 PM
 
not a Friday release, but it is a "Next" release. so it isn't stable yet either, right?
even thought they all had that line of code in them
 
Sorry the delay
 
1
Q: Singleton-ish RMI Server

CalprattIn this program there is a single remote server which performs miscellaneous work. Because there is only one server, it seems like a singleton pattern could fit well. The problem that a distributed program introduces is that every client will have its own version of a static variable. Therefore...

 
Ish?
 
@Mat'sMug That's a code-smell...lol
 
2:58 PM
@Mat'sMug What?
 

« first day (844 days earlier)      last day (3176 days later) »