« first day (1231 days earlier)      last day (3736 days later) » 

10:05 PM
@GlenH7 If everyone who had questions for Eric Lippert tried getting him into a chat room he'd never get any work done
I don't expect nor really want an answer from him, it's not his job to google shit for me
 
user55340
Q is a fixed point number format where the number of fractional bits (and optionally the number of integer bits) is specified. For example, a Q15 number has 15 fractional bits; a Q1.14 number has 1 integer bit and 14 fractional bits. Q format is often used in hardware that does not have a floating-point unit and in applications that require constant resolution. Characteristics Q format numbers are (notionally) fixed point numbers (but not actually a number itself); that is, they are stored and operated upon as regular binary numbers (i.e. signed integers), thus allowing standard integer h...
 
and I guess that comment was too chatty. Oops.
 
user55340
0
Q: Is there a more concise and/or readable way to write the following method?

Lawrence BarsantiPreface: I'm starting to learn C# and I don't want to port any of my bad habits from other languages so I'm follow convention wherever possible. Using the default Visual Studio code formatting this relatively simple function requires 14 lines of code. public void add(int[] values, Func<int,...

 
user55340
@LawrenceBarsanti I believe the answer is 'no'.
 
user55340
Unless you want to actually get into 1TBS.
 
10:21 PM
@MichaelT thanks. I actually prefer 1TBS but, like I said, I'm trying to follow the conventions.
 
user55340
    public void add(int[] values, Func<int, int> transform = null)
    {
        foreach (int v in values)
        {
            add(transform(v) ?? v);
        }
    }
 
user55340
That looks about as tight as one can get it.
 
user55340
For readability...
 
user55340
133
Q: If my team has low skill, should I lower the skill of my code?

Florian MargaineFor example, there is a common snippet in JS to get a default value: function f(x) { x = x || 'default_value'; } This kind of snippet is not easily understood by all the members of my team, their JS level being low. Should I not use this trick then? It makes the code less readable by peer...

 
@MichaelT, actually that doesn't compile. "Operator '??' cannot be applied to operands of type 'int' and 'int'".
 
user55340
10:25 PM
Well, I'm not a C# guy, so...
 
haha.. no problem.. me neither.
 
user55340
you might be able to transform that to:
add(transform == null? v : transform(v));
 
@MichaelT @GlenH7 my boss just told me true random numbers haven't been done and I'm having a hell of a time finding one of those qubit-containing RNG devices they sell these days, little help?
 
That works. Forgot about that syntax.
 
@LawrenceBarsanti What? What's the problem with it?
 
user55340
10:27 PM
 
@LawrenceBarsanti This error makes no sense. ?? can be applied to operands of type 'int' and 'int'
 
user55340
 
user55340
 
@MichaelT Right I know the details of them but he was skeptical so I was trying to find the ones you can buy these days for tens of thousands of dollars on the market, I've stumbled across them in the past few years but I'm failing now
 
@JimmyHoffa I'm not 100% sure yet... I'm going to keep investigating.
 
10:32 PM
@LawrenceBarsanti Oh yeah n/m if you're dealing with ints they can't be null, so that ternary check is irrational.
transform will never be null
I was thinking you were getting a complaint of mismatching types across ?? and pasted the error wrong
 
user55340
well, transform may be null, but transform(v) is either an int, or a null pointer exception equivelent.
 
user55340
 
user55340
Btw, there's some "fun" physics for the decay rate vs time of day and time of month-ish.
 
10:56 PM
@MichaelT nah you're confusing C#'s int with Java's Integer
transform(v) is not a pointer at all
C#'s Integer is int? or Nullable<int> which int? is just sugar for.
 
user55340
@JimmyHoffa and that's why I'm not a C# coder.
 
@MichaelT I'm not Java coder, I'm just guessing Integer is the object variant, I know Java also has a value-type form of ints that don't live on the heap
...unless I'm wrong, and Java only have heap-types even for primitives, which I can't fathom is true
 
user20683
Integer is the boxed version
 
user20683
I think Java 5 introduced autoboxing
 
I so hate those terms, boxed and unboxed
If you really know the analogy well it makes sense, if you don't they seem totally unrelated to the technical details of what's happening
I prefer to just think heap and stack; ones reached by pointer the other isn't, I understand the concept "putting things on the heap requires them to be boxed up because you can't just throw a number on the heap! The heap must be completely invariant! So the heap is all 'boxes'!"
but it's kind of a stupid analogy
or one that has been taken way too far at this point
 
user20683
11:06 PM
@JimmyHoffa yeah but I'd argue the majority of programmers out there don't really understand that.
 
@WorldEngineer which is why the boxing analogy is even worse and only helps them continue not understanding it
If you just said "These things are referenced with a pointer, these things are directly on the stack and don't have a memory address" that's more...graspable than the analogy
 
user20683
@JimmyHoffa Which is why C or C++ or similar is so useful to learn.
 
@WorldEngineer Yeah, also because if you're a fan of Strunk & White you will enjoy every page of the K&R.
 
user20683
@JimmyHoffa I prefer (and originally learned from) King's C Programming: A Modern Approach.
 
@WorldEngineer bla bla bla the K&R is a modern english masterpiece, Das Ende; Fin.
 
11:46 PM
@Moo-Juice I wouldn't relate a spelling error to one's coding ability, the guy could have been highly dyslexic but perfectly competent with systems design and logical structure. Alternatively he may have been one bad hair day away from a boating accident, I don't claim to know, just that one's spelling ability is orthogonal to their development ability. Now grammar is a different story, general punctuation and sentence structure is usually well understood by folks who spend their mental capacity systematizing things to begin with. — Jimmy Hoffa 28 secs ago
 
@JimmyHoffa There's a (not so) fine line between someone who occasionally misspells a word, and someone who never capitalizes i, never uses proper punctuation, riddles their Stack Overflow questions with txtspk, and then claims that "im just beeing me".
Keepin' it real. [using best Chris Rock voice imitation]
 
@RobertHarvey Which I think I clarified
I agree, someone who lacks proper communication skills is going to be a failed developer, but someone who spells mountain motnaun as I've seen before doesn't a bad developer necessarily make
 
I didn't read your response that way. I read it as "dyslexics can do it, so you can two."
 
An old architect I worked with couldn't spell anything, his architectural documents were all high quality and perfectly good; he just used spellcheck constantly
 
If you've got a tool to fix it, more power to you. It's why I mentioned Find and Replace.
 
11:53 PM
@RobertHarvey I just think you're agreeing with the poster that the guy must be terrible where the only evidence given is "he spells poorly" - spelling is orthogonal to development skill
 
Like I said, there's spelling, nad then thiers speling.
 
if the guy said his punctuation and sentence structure in documentation was abysmal, full of run-on sentences and improper uses of their there and where, then you've got someone who may lack much ability to break things down and analyze them well if he's failing at grammar that much
@RobertHarvey nad heers Spelling!
 
0
Q: Separation of concerns in a complex reporting Application

marfarmaIn the process of drafting this question, I think I've come up with a workable solution. I'd appreciate your thoughts on my proposed improvements, as outlined under my "Thoughts:" heading, below. Goal: I'm trying to refactor a code base that is the product of several iterations of 'exploratory...

What is all this? Is this really what it takes to get out a report nowadays?
-1
Q: Javascript - While loops with return/break

user3204666I am working on a boolean function that I need to run into a while loop. Then from there it needs to either break if false or return a value from the function. Should be fairly simple but for some reason I can't understand it. Can anyone give me a good example of code.

It doesn't belong on stackoverflow either. Isn't clear ==> belongs on Stack Overflow. Is that the impression that SO gives now? — Robert Harvey 1 min ago
 
@RobertHarvey People get insane when they start doing reporting...
 
@JimmyHoffa In the time it takes him to architect, debug, code and test that thing, I could probably write a dozen reports in Access.
All customized.
 

« first day (1231 days earlier)      last day (3736 days later) »