|
Career paused to raise kids?
|
# ? Aug 28, 2015 15:53 |
|
|
# ? May 26, 2024 20:06 |
|
Suffering to maintain legacy software can be fairly lucrative... But unfortunately for them, I don't think there are that many people whose business model relies on keeping Win ME installations running.
|
# ? Aug 28, 2015 16:44 |
|
DHL, why can't you respond with the same response to the same request? Why do you "Yes, we're shipping to this destination - here are the prices" one time, and in a second you do "Nope, shipping here is not possible"
|
# ? Aug 28, 2015 16:50 |
|
loinburger posted:I'm working on a Java/Spring application and discovered that some of my "singleton" constructors were being called twice (I added an ActiveMQ persistent queue, and JMX was giving me an InstanceAlreadyExistsException on its BrokerService). It turns out that we're creating two copies of the ApplicationContext and hence two copies of the program's internal state because, well, just because. Spring you say? Then obviously you should make use of the AbstractSingletonProxyFactoryBean. It's right there in the description: "Convenient proxy factory bean superclass for proxy factory beans that create only singletons." No need to thank me. Pavlov fucked around with this message at 18:42 on Aug 28, 2015 |
# ? Aug 28, 2015 18:39 |
|
Hahaha gotta love Java, 5 design pattern names in a single class name.
|
# ? Aug 28, 2015 18:51 |
|
Pavlov posted:Spring you say? Then obviously you should make use of the AbstractSingletonProxyFactoryBean. It's right there in the description: "Convenient proxy factory bean superclass for proxy factory beans that create only singletons."
|
# ? Aug 28, 2015 19:27 |
|
Sedro posted:Oh boy, that's so convenient! It was probably posted here already but someone made a game of this. Good grief i went 0/9 before i gave up ;_;
|
# ? Aug 28, 2015 19:30 |
|
Sedro posted:Oh boy, that's so convenient! It was probably posted here already but someone made a game of this. "Ha ha it shouldn't be that hard to pick the made up one"
|
# ? Aug 28, 2015 19:30 |
|
Sedro posted:Oh boy, that's so convenient! It was probably posted here already but someone made a game of this. You are a saint.
|
# ? Aug 28, 2015 19:34 |
|
code:
|
# ? Aug 28, 2015 21:01 |
|
substitute posted:
Somebody using their college's project templates in production code?
|
# ? Aug 28, 2015 22:00 |
|
LeftistMuslimObama posted:Somebody using their college's project templates in production code? Yes, all over the place and for about 6 years. But this fuckhead consultant (which is putting it generously) is finally gone! We (mostly I) will still have to deal with all the lingering garbage though, until a large group of flagship sites are completely redone. Hoping that happens next year.
|
# ? Aug 28, 2015 22:29 |
|
Pavlov posted:Spring you say? Then obviously you should make use of the AbstractSingletonProxyFactoryBean. It's right there in the description: "Convenient proxy factory bean superclass for proxy factory beans that create only singletons." When I first inherited the project we had about a dozen godawful class names that were shadowing godawful Spring class names, and we were using both our classes and the Spring classes in the project so you couldn't tell which was being used without looking at the imports. The only one I never bothered to properly fix is the PropertyPlaceholderConfigurerCustom which used to shadow the PropertyPlaceholderConfigurer. loinburger fucked around with this message at 23:02 on Aug 28, 2015 |
# ? Aug 28, 2015 22:59 |
|
loinburger posted:I'm working on a Java/Spring application and discovered that some of my "singleton" constructors were being called twice (I added an ActiveMQ persistent queue, and JMX was giving me an InstanceAlreadyExistsException on its BrokerService). It turns out that we're creating two copies of the ApplicationContext and hence two copies of the program's internal state because, well, just because. Pavlov posted:Spring you say? Then obviously you should make use of the AbstractSingletonProxyFactoryBean. It's right there in the description: "Convenient proxy factory bean superclass for proxy factory beans that create only singletons." EDIT: Seriously though, just add another layer of abstraction to getting an "instance" of your singleton and handle the single initialization there, i.e. create a SingletonProxyFactory™ and make it a Spring Bean for convenience. And since all this initialization logic is independent of what the class does, let's pull it out into an Abstract class. (disclaimer: I have no idea how an AbstractSingletonProxyFactoryBean is actually used). The Laplace Demon fucked around with this message at 07:09 on Aug 29, 2015 |
# ? Aug 29, 2015 07:02 |
|
The Laplace Demon posted:I have no idea how an AbstractSingletonProxyFactoryBean is actually used. I'm pretty sure it's part of a suite of tools used to cause EE developers bloody their heads against their desks.
|
# ? Aug 29, 2015 07:14 |
|
The Laplace Demon posted:
The problem is that as far as I know the two ApplicationContexts we're creating can't talk to each other during initialization - if I used a [...]ProxyBean to proxy the singleton creation then I'd just wind up creating a separate [...]ProxyBean for each ApplicationContext and I'd still have two sets of singletons. Ideally we'd just create a single ApplicationContext, or barring that we'd create two ApplicationContexts with disjoint sets of beans so there wouldn't be any name conflicts or wasted duplicate resources; however I don't yet know what the justification was for creating the two ApplicationContexts in the first place and so I don't know which solution we should go with. In the meantime I've created separate configs for the two ApplicationContexts, the differences being that their ActiveMQ broker names, queue names, database directories, and ports are different.
|
# ? Aug 29, 2015 07:25 |
|
and now for the latest iteration of Javascript Owns™: https://jsfiddle.net/Ly351fnw/ Definitely added a list length checker to that one
|
# ? Aug 30, 2015 02:58 |
|
What do you think Math.max() should return?
|
# ? Aug 30, 2015 07:12 |
|
vOv posted:What do you think Math.max() should return? Agreed, when there are no items there are two possible approaches that make sense. That is one of them, the other is throwing.
|
# ? Aug 30, 2015 14:19 |
|
Hammerite posted:Agreed, when there are no items there are two possible approaches that make sense. That is one of them, the other is throwing. Javascript doesn't throw for divide by zero, or trying to work with NaNs as if they are numbers (so 5/NaN = NaN.) It's really obnoxious when trying to do numerical stuff in javascript.
|
# ? Aug 30, 2015 14:51 |
|
Douglas Crockford said that the sticky NaN was one of JavaScript's best features.
|
# ? Aug 30, 2015 15:20 |
|
Bruegels Fuckbooks posted:Javascript doesn't throw for divide by zero, or trying to work with NaNs as if they are numbers (so 5/NaN = NaN.) It's really obnoxious when trying to do numerical stuff in javascript. 5.f / NaN == NaN though, that's how it works. Normal operations always produce quiet NaNs. It's fine to say "double precision IEEE754 fp was and remains a poor choice for all of JS's arithmetic", but it's senseless to kvetch that it implements it correctly in this case.
|
# ? Aug 30, 2015 15:29 |
|
Coding horror: Whenever I reach for max(x, y), it's because I want to use the value of x, but I want it to be y at maximum. Shortly after I usually realize my error.
|
# ? Aug 30, 2015 15:35 |
|
Vanadium posted:Coding horror: Whenever I reach for max(x, y), it's because I want to use the value of x, but I want it to be y at maximum. Shortly after I usually realize my error. The word you're looking for is 'clamp'
|
# ? Aug 30, 2015 15:39 |
|
Well, it's really just "min" but it always seems backwards to me
|
# ? Aug 30, 2015 15:42 |
|
Vanadium posted:Well, it's really just "min" but it always seems backwards to me
|
# ? Aug 30, 2015 15:52 |
|
Yeah, I usually write an absolutely confusing function for this.JavaScript code:
|
# ? Aug 30, 2015 16:01 |
|
Blotto Skorzany posted:5.f / NaN == NaN though, that's how it works. false
|
# ? Aug 30, 2015 16:02 |
|
A figurative ==, obviously any comparison with NaN will return false
|
# ? Aug 30, 2015 18:16 |
|
Blotto Skorzany posted:A figurative ==, obviously any comparison with NaN will return false except of course NaN != NaN, which will return true
|
# ? Aug 30, 2015 19:17 |
|
Suspicious Dish posted:Yeah, I usually write an absolutely confusing function for this. Same except I call it "bound". Or "Bounded" if it's an extension method.
|
# ? Aug 30, 2015 19:18 |
|
NihilCredo posted:Same except I call it "bound". Or "Bounded" if it's an extension method. It's called saturate
|
# ? Aug 30, 2015 22:24 |
|
b0lt posted:It's called saturate Not really. saturate(x) is clamp(x, 0.0, 1.0) in shading languages. Well, in the shading languages that have a saturate function and in ARB, anyhow. It's not a very well-chosen name -- I would have expected saturate it to make a color more saturated, instead of less -- but it's the one we've got. Those are the standard names in graphics so it's probably best to stick with them in that context to not confuse people. In contexts that aren't graphics then you can call your equivalent functions whatever, really.
|
# ? Aug 31, 2015 01:03 |
|
Xerophyte posted:Not really. saturate(x) is clamp(x, 0.0, 1.0) in shading languages. Well, in the shading languages that have a saturate function and in ARB, anyhow. It's not a very well-chosen name -- I would have expected saturate it to make a color more saturated, instead of less -- but it's the one we've got. https://en.wikipedia.org/wiki/Saturation_arithmetic
|
# ? Aug 31, 2015 01:10 |
|
When I was some scrub teenager I needed a clamp function and named it "clamp" never having seen such a function before, so that seems like the right name to me.
|
# ? Aug 31, 2015 01:14 |
|
I've seen it as clamp before in a graphics library too.
|
# ? Aug 31, 2015 02:05 |
|
I like "mid" because it's only three letters and fits nicely with min and max.
|
# ? Aug 31, 2015 03:13 |
|
Plorkyeran posted:I like "mid" because it's only three letters and fits nicely with min and max. Mid sounds like it gets the mean or median of a set of values.
|
# ? Aug 31, 2015 03:34 |
|
Dr. Stab posted:Mid sounds like it gets the mean or median of a set of values. Getting the median of three values is exactly what the clamp function does
|
# ? Aug 31, 2015 03:36 |
|
|
# ? May 26, 2024 20:06 |
|
Mid is how you get a substring in a string given beginning and end indices in VB6. That's now burned in my brain. You can use it still today in VB.NET or maybe even C# too.
|
# ? Aug 31, 2015 05:12 |