|
JawnV6 posted:I can think you're an incorrect jackass without signing up to defend code I didn't write in a language I don't use. You've been calling a lot of people names lately.
|
# ? Apr 2, 2014 08:57 |
|
|
# ? May 16, 2024 15:20 |
|
Deus Rex posted:Is Postgres the only SQL DB that can do indexes on expressions? I wasn't that surprised to see MySQL was lacking them, but SQL Server is supposed to be good I know you can do filtered indexes on SQL Server, which would at least speed up groupings based on time periods (like the aforementioned fiscal years, etc). I'm not much of a SQL wizard, though, so there might be other options as well. shrughes posted:You've been calling a lot of people names lately. Take the meds, shrughes.
|
# ? Apr 2, 2014 13:44 |
|
Athas posted:<ghc tuple horror> So one fix to this could be to give tuples a sugar, much like as is done for lists currently, so that n-tuples are actually n nested 2-tuples (i.e. a heterogeneous list) . This would lead to something like the following code: code:
|
# ? Apr 2, 2014 13:59 |
|
Deus Rex posted:Is Postgres the only SQL DB that can do indexes on expressions? I wasn't that surprised to see MySQL was lacking them, but SQL Server is supposed to be good
|
# ? Apr 2, 2014 14:59 |
|
AlsoD posted:So one fix to this could be to give tuples a sugar, much like as is done for lists currently, so that n-tuples are actually n nested 2-tuples (i.e. a heterogeneous list) . This would lead to something like the following code: Or just do it the c++ way with something like (x, ...xs) and recurse on xs.
|
# ? Apr 2, 2014 15:17 |
|
AlsoD posted:While the type and pattern definition will still need to be recreated for each tuple length, you save the boilerplate for all the other instances. What do you think? Apart from the fact that you will no longer be able to distinguish (a,(b,c)) from (a,b,c), this is not a bad idea. I've had similar thoughts before.
|
# ? Apr 2, 2014 15:17 |
|
Deus Rex posted:Is Postgres the only SQL DB that can do indexes on expressions? I wasn't that surprised to see MySQL was lacking them, but SQL Server is supposed to be good The closest equivalent in SQL Sever is to create a computed column on the table and index that. Plorkyeran posted:You can't index the expression directly, but you can create a view with that expression and then put an index on that.
|
# ? Apr 2, 2014 15:28 |
|
Subjunctive posted:I'm sorry if you thought I was impugning you, rather than your argument. Code with a lot of non-caller-controlled dependencies is IME (very large systems, but in a bunch of domains) fragile and hiding it doesn't help things. PFA can be ugly, though mostly in OO situations you isolate that to initialization. DI systems are, I find, much harder to reason about than ones built around fully-parametrized components that you can test piecewise and incrementally, and I'm surprised that in an embedded context the time and space overhead isn't problematic for you! I've worked in DI environments (the apps I most recently managed at work are built around it, and they do OK), I just find it to be like the general OO action-at-a-distance ick. "Oh, you called this method and it didn't work? Did you call this other invisibly-related one first? Does it have leftover state from a previous thing?" IME if you have the caller responsible for all dependencies, then interface polymorphism is impossible without every possible dependency of every possible implementation of a particular interface passed through it. In practice this means that either the interface ends up with the parameters needed by existing implementation or that interfaces get some sort of God Object parameter that they can use to do everything anyhow. Changing the dependencies of a function or method used widely throughout the system with interfaces tightly tied to implementations breaks huge swathes of code that were nominally coding to the interface since they've suddenly gained new transitive dependencies that their callers have to provide. Besides, there's plenty of shared mutable global resources that people use all the time without passing them as parameters. Anything managed by the operating system in general is likely going to be shared, like log files, network sockets, synchronization primitives or just memory in general. The caller isn't providing the space for the next invocation record, nor is it providing the heap. Expecting the caller to actually provide those would be completely insane but that doesn't make them any less global. Spooky action at a distance can still cause them to fail (stack overflow) and there are systems that don't have those resources and simply allocate everything statically at compile time so no recursion is allowed. The reason those resources work is because they're managed through a shared protocol, something which DI contexts give a solid foundation for over "less complicated" ad hoc implementations.
|
# ? Apr 2, 2014 16:15 |
|
Deus Rex posted:Is Postgres the only SQL DB that can do indexes on expressions? I wasn't that surprised to see MySQL was lacking them, but SQL Server is supposed to be good
|
# ? Apr 2, 2014 16:31 |
|
Today I embarked on a quest to understand why my Menu Start-parsing script failed to retrieve .exe paths for MS Office programs. Turned out the rabbit hole is pretty deep.code:
pre:C:\Windows\Installer\{90120000-0030-0000-0000-0000000FF1CE}\wordicon.exe quote:The HasDarwinID flag is enabled which means the shortcut contains a DarwinDataBlock: Well, how to decode this then? After some more searching I found this: quote:The string starting with 26,... is a component identifier. The first and 20 characters are a GUID encoded in base 85, and the middle portion, up to the > character is the feature identifier. For Windows versions below Vista you can include both the product id and the component id, but Vista and higher don't accept a path that contains the product id tag/guid. All versions accept a path consisting of just the component id tag and component id. Okay... Base85? No problem! Only all my attempts to decode it failed to produce any usable GUID. More searching! Oh, it seems MS is using its own, non-standard implementation! So now I can retrieve the exe path in just few easy steps:
Who comes up with this stuff?
|
# ? Apr 2, 2014 17:32 |
|
How does source control work C++ code:
|
# ? Apr 2, 2014 17:46 |
|
I finally got access to one of our repos that another team has been working on, specifically adding a webservice to access functions in an existing application. Pretty straightforward stuff right? Heh.code:
It is like an experiment in finding the optimum worst way to implement an xml based web service.
|
# ? Apr 2, 2014 20:23 |
|
AlsoD posted:So one fix to this could be to give tuples a sugar, much like as is done for lists currently, so that n-tuples are actually n nested 2-tuples (i.e. a heterogeneous list). Having recursive heterogeneous lists is nontrivial. Duplicating some code 15 times is annoying, but that's far simpler than 5 type system extensions to express nested 2-tuples. And if you have tuples more than 15 long, your program is probably a complete mess anyways.
|
# ? Apr 2, 2014 20:27 |
|
Scaevolus posted:Having recursive heterogeneous lists is nontrivial. I see, well I take back what I said. The longest tuple I've ever used was a 4-tuple because I wanted to use unboxed vectors of my type (vectors of tuples get converted to tuples of vectors) and didn't want to add such an instance myself. Even then it was cumbersome to use and I ended up having to use newtypes for all 4 different components (which were Ints at heart) because I kept getting them mixed up.
|
# ? Apr 3, 2014 01:11 |
|
omeg posted:Today I embarked on a quest to understand why my Menu Start-parsing script failed to retrieve .exe paths for MS Office programs. Turned out the rabbit hole is pretty deep. The horror here is that you're reinventing MsiGetShorcutTarget() and MsiGetComponentPath(), although I have no idea how you'd get at this functionality from PowerShell.
|
# ? Apr 3, 2014 04:21 |
|
pseudorandom name posted:The horror here is that you're reinventing MsiGetShorcutTarget() and MsiGetComponentPath(), although I have no idea how you'd get at this functionality from PowerShell. Now I feel stupid. I've looked through the Msi* functions but I missed the one that gets info from a shortcut. Still, the implementation is
|
# ? Apr 3, 2014 11:22 |
|
For old-schoolers only (this is PL/I code!):code:
Amberskin fucked around with this message at 11:41 on Apr 3, 2014 |
# ? Apr 3, 2014 11:37 |
|
I would love an explanation, if you've got the time and patience.
|
# ? Apr 3, 2014 15:58 |
|
pokeyman posted:I would love an explanation, if you've got the time and patience. That abomination tries to convert a BINARY FIXED(31), which is simply a 32 bit signed integer, to its CHAR (string) representation. PL/I can do it as easily as assigning the integer value into a "picture string' value (the field PICDE10 in that code). But this guy didn't do that. He wrote a loving loop to increment a third variable (a decimal one, COUNTER) by one for each value between 1 and the value to convert. Then he substracts one, because the loop limit is not correct and assigns the decimal to the picture variable. So a simple assignement, which in the mainframe compiles to ONE loving MACHINE INSTRUCTION is implemented using a loop incrementing a decimal counter. Its like if to convert an long to a float in C you code this: code:
Oh, did I tell you IBM charges $$$ according to your CPU usage?
|
# ? Apr 3, 2014 16:14 |
|
That's absolutely wonderful. Thanks for writing it out.
|
# ? Apr 3, 2014 16:45 |
|
pokeyman posted:That's absolutely wonderful. Thanks for writing it out.
|
# ? Apr 4, 2014 14:14 |
|
Not code, but "documentation". Click to enlarge and read. (CakePHP... when you unzip it.)
|
# ? Apr 4, 2014 14:46 |
|
PrBacterio posted:Is it odd that I don't find the fact that people can't even read PL/I, and therefore needed a translation, wonderful at all? It makes me feel even older than I actually am ... I wouldn't take it as an age thing, I just hadn't before experienced the joy of trying to read some PL/I. Now I've torn down that wall and am a better person because of it.
|
# ? Apr 4, 2014 17:08 |
|
One of my least-sophisticated clients emailed me to complain today: Client: The CI build you set up for us for our SQL database projects passed, but it failed when we deployed because of a bad database reference. Why didn't the build fail for this? Me: Well, the default behavior is to emit a warning for that, not an error, because you might be referring to a column in another database that's not a part of your solution. Client: That should be an error! Me: We can turn on "treat warnings as errors" if you want, but you currently have over 5000 warnings when building. Client: Nevermind. All of their stuff throws thousands of warnings when building. They love warnings. They even had me turn on static analysis so they can get even more warnings. They currently get over 10,000 warnings on every build of their application, plus dozens of totally ignored test failures. Of course, their tests are lovely and useless anyway, so it balances out.
|
# ? Apr 4, 2014 17:12 |
|
10,000 warnings about what?! Unused variables? Unreachable code? That's insanity!
|
# ? Apr 4, 2014 17:45 |
|
Amberskin posted:Oh, did I tell you IBM charges $$$ according to your CPU usage? Oh, nice! It's almost like you paid for this guy's work twice!
|
# ? Apr 4, 2014 17:48 |
|
code:
|
# ? Apr 4, 2014 17:55 |
|
ManoliIsFat posted:10,000 warnings about what?! Unused variables? Unreachable code? That's insanity! I find very few developers pay attention to warnings. It drives me nuts.
|
# ? Apr 4, 2014 18:05 |
|
ManoliIsFat posted:10,000 warnings about what?! Unused variables? Unreachable code? That's insanity! Yes, both of those. Also every Code Analysis / FXCop violation. Some are minor, some are major, but they want to be warned about everything even though they have no intention of actually changing any of it.
|
# ? Apr 4, 2014 18:28 |
|
HFX posted:I find very few developers pay attention to warnings. It drives me nuts. I've gotten the project I took over down from 800+ to 4 over the last few months. Imagine the day, when a warning is actually a warning!
|
# ? Apr 4, 2014 18:52 |
|
pokeyman posted:I wouldn't take it as an age thing, I just hadn't before experienced the joy of trying to read some PL/I. Now I've torn down that wall and am a better person because of it. Well, you just read horrible PL/I code The MULTICS source code contains a lot of well written PL/I http://web.mit.edu/multics-history/
|
# ? Apr 4, 2014 19:11 |
|
HFX posted:I find very few developers pay attention to warnings. It drives me nuts. A somewhat-new coworker took it upon himself to fix every last warning (we had about 200) and then campaigned to have warnings as errors turned on. He succeeded, but I swear it's bitten us in our asses more than anyone else. Still, it's really nice to see a totally green build mail every morning.
|
# ? Apr 4, 2014 19:26 |
|
Dessert Rose posted:A somewhat-new coworker took it upon himself to fix every last warning (we had about 200) and then campaigned to have warnings as errors turned on. the horror is coming from inside the house
|
# ? Apr 4, 2014 19:36 |
|
ManoliIsFat posted:10,000 warnings about what?! Unused variables? Unreachable code? That's insanity! If you use the strictest Code Analysis settings, it can be pretty anal about a lot of stuff. We've turned it up fairly high and I've had to scatter a fair amount of suppression. "Yes I know that variable is named FooUri but is of type string and yes it's okay"
|
# ? Apr 4, 2014 19:41 |
|
Dessert Rose posted:A somewhat-new coworker took it upon himself to fix every last warning (we had about 200) and then campaigned to have warnings as errors turned on. Why did it bite you in your rear end?
|
# ? Apr 4, 2014 19:43 |
|
Turning incorrect and misleading code that works by coincidence into code that doesn't work at all while trying to fix warnings is pretty common. It's nearly always worth it in the long run, but fixing hundreds of warnings is very likely to cause some short-term pain.
|
# ? Apr 4, 2014 20:24 |
|
Plorkyeran posted:fixing hundreds of warnings is very likely to cause some short-term pain. Very true, especially if you're doing weird poo poo at runtime with reflection.
|
# ? Apr 4, 2014 20:40 |
|
johnduhart posted:
Sometimes that's coping with a horror, where resetting a value causes the system underneath to reprocess something (I think a goon wrote up a description of SpriteKit gems including that one). In that case it should include an exasperated comment at the least, so horror indeed. img-timeline but: 1337JiveTurkey posted:IME if you have the caller responsible for all dependencies, then interface polymorphism is impossible without every possible dependency of every possible implementation of a particular interface passed through it. In practice this means that either the interface ends up with the parameters needed by existing implementation or that interfaces get some sort of God Object parameter that they can use to do everything anyhow. Yeah, you're right about widely-implemented interfaces, especially where the construction of the implementation isn't relatively centralized. (In an OO environment I don't consider construction parameters to be action at a distance, since it's inherent in any use of an object. Some don't consider any member field to be a-a-a-d, and I can see that position.) That's a case where PFA doesn't work as well by a long shot. It's pretty common in our code base to see DI at the module level, and then PFA where possible to dependencies or inner objects. You're right that PFA can result in ugliness in some cases that exceeds that of DI's boilerplate or whatever. It probably doesn't help that most of the DI-heavy systems I've worked with are C++ and Android-Java, where the cognitive or runtime overhead can be pretty unpleasant. (In the latter case we wrote a transformation pass to replace the DI hooks with direct allocation for space+time performance reasons.) Thanks, that was a helpful thing to point out.
|
# ? Apr 4, 2014 21:12 |
|
At one of my old jobs I had turned in my two week notice and my boss said I should stay around for the whole time in case anybody had questions about the stuff I was maintaining. I wasn't getting assigned any new tasks, so to stave off boredom I started poking around in test fixtures and found that we had about 600 end-to-end tests that were failing. The product was basically an API for reading and writing Word and Excel files, and those tests were all based around manipulating a stable of several thousand random documents found on the internet, opening them, reading data, saving them back out and verifying integrity. Over the course of my remaining days I tracked down about a dozen bugs that accounted for all those failing tests. It was incredibly gratifying to walk away from that codebase with every test fixture lit up green. Practice random acts of kindness to your codebases when you have the chance. It can take a long time to deal with thousands of warnings or failing tests but you can make it through to the other side.
|
# ? Apr 4, 2014 21:17 |
|
|
# ? May 16, 2024 15:20 |
|
Subjunctive posted:Sometimes that's coping with a horror, where resetting a value causes the system underneath to reprocess something (I think a goon wrote up a description of SpriteKit gems including that one). In that case it should include an exasperated comment at the least, so horror indeed. This is what I would have figured. The SpriteKit guy was talking about how he had to set some other value like .alpha to a slightly different value every time he wanted some other change to commit, because whatever he was trying to do wasn't properly triggering a redraw and there wasn't a public method to initiate a redraw. I could imagine the setter method for "PDConfig.DeviceType = vDevType" causes some side effects that may/may not be exposed elsewhere. Not having a comment explaining this behavior isn't great, though.
|
# ? Apr 4, 2014 21:19 |