|
The Laplace Demon posted:The code in all it's glory. Leaving aside the quadruple pointer, the most infuriating thing about this is the attitude of "hey guys my code don't work! here it is whats wrong?"
|
# ? Mar 17, 2014 09:12 |
|
|
# ? May 17, 2024 18:21 |
|
Smugdog Millionaire posted:What's this use case where you can tolerate occasionally incorrect multiplication as long as you know exactly how long it will take? This is from a while ago, but I believe it's part of a filter to reduce hysteresis for a real-time weighing scale (truck drives over scale without stopping, weight is logged). I think they're slowly being replaced by far more powerful hardware and higher level languages (like C ) for the drivers, but in the meantime it'll probably keep my dad in work until he retires, since he's one of like 10 people worldwide who have experience with the older hardware and are still working.
|
# ? Mar 17, 2014 09:35 |
|
Incursion is a roguelike that is quite good (and buggy) that is being opened up by the developer It's beautiful.
|
# ? Mar 17, 2014 20:17 |
|
How not to write a method header:code:
|
# ? Mar 19, 2014 23:22 |
|
it is posted:How not to write a method header: I take it that arguments are passed to the function twice, but the 2nd time it's all in upper case?
|
# ? Mar 19, 2014 23:24 |
|
They are not the same variable. They are related, but different variables. Apparently 1-word arguments are acceptable.
|
# ? Mar 19, 2014 23:28 |
|
They are not acceptable.
|
# ? Mar 20, 2014 00:03 |
|
For a company that involves specialized software for every facet of it's business, the company I work for is really poo poo at actually developing software. Oops looks like someone was making changes three months back and the thing they were doing didn't work at all, why bother fixing it up after you've done the work and have it moved to production? Let's just leave it sitting in Sourcesafe where its hard to tell if something at least a month old is in production or not from looking at the history and it might get accidentally carried in to production from another change. Oops turns out it was something incredibly simple to catch if we had any automated testing like a barcode on a printed document not being up to the specification or even just not being there at all Too bad we don't have a QA department, wait poo poo we do but they're not interested in developing any actual methods or automated procedures that can catch something as simple as a barcode being wrong. Nope, they'll make you wait days for your change to be deployed to production while they do other things though, or they'll make you wait all that time and then reject you on a minor issue that doesn't affect any customers and that they'll admit had nothing to do with your change. Time to have our waterfall-y process take a half day to a day to have the change moved back to them so they can sit on it for another couple of days until they reject it for whatever the hell they want that they didn't tell you about before. It's bizarre going online and reading about software development that involves modern version control and dependency injection or inversion of control or agile methods while this place doesn't even have the notion of a unit test.
|
# ? Mar 20, 2014 00:23 |
|
it is posted:How not to write a method header: You sure you aren't looking at obfuscated code? Maybe someone copied something off the web that was obfuscated.
|
# ? Mar 20, 2014 00:51 |
|
I'm guessing ported fortran linear algebra library.
|
# ? Mar 20, 2014 02:34 |
|
I'd like to think the lowercase letters are the slugs of the upper case letters. etl is an abbreviation for "eat the lazy".
|
# ? Mar 20, 2014 03:43 |
|
Etl = export, transform, load. Basically copying from one kind of database to another. I have no idea how the sets of arguments are different from each other. They are called from the command line, and this method only uses the capital ones, and ignores the lowercase ones. Some of them use all of them and some of them use only the lowercase ones. Some of them include only the variables they use, some include all of them. It was written by a human. It builds a SQL query to populate SQL database tables from NoSQL database connections. Fun!
|
# ? Mar 20, 2014 08:39 |
|
I saw a homemade bubble sort implementation in a production application today, I'm going to go out on a limb and say that VB.NET has a built in sorting function and one that is a fair bit better than bubble sort.
|
# ? Mar 20, 2014 18:05 |
|
piratepilates posted:I saw a homemade bubble sort implementation in a production application today, I'm going to go out on a limb and say that VB.NET has a built in sorting function and one that is a fair bit better than bubble sort. It does and it is.
|
# ? Mar 20, 2014 18:08 |
|
PHP with lambdas, generics, and type checking. Oh my! http://hacklang.org/
|
# ? Mar 20, 2014 19:21 |
|
PHP didn't have lambdas already?
|
# ? Mar 20, 2014 19:32 |
|
Found deep in a decompiled Microsoft.SharePoint.Linq assembly:C# code:
|
# ? Mar 20, 2014 19:48 |
|
Otto Skorzeny posted:PHP didn't have lambdas already? 5.3 finally added anonymous functions, but the syntax is hilariously verbose since you have to explicitly capture variables.
|
# ? Mar 20, 2014 20:15 |
|
Plorkyeran posted:5.3 finally added anonymous functions, but the syntax is hilariously verbose since you have to explicitly capture variables. I'm impressed. Training wheels without the bike indeed.
|
# ? Mar 20, 2014 20:19 |
|
Otto Skorzeny posted:I'm impressed. Training wheels without the bike indeed. Unicycle? Seems like Facebook has some supersmart people who cannot move off PHP for legacy reasons. PHP with types and the same 'near-instant' reload time sounds pretty cool though. Although I am looking at the code and I have no idea why it is, "public function foo(): string" with the type defined after the function name, when everything else is, "public string $bar = 'hello world';" I guess it is following the tradition of PHP not being consistent with its naming?
|
# ? Mar 20, 2014 20:23 |
|
Otto Skorzeny posted:I'm impressed. Training wheels without the bike indeed. And you have to explicitly use references if you want to actually close over the variables rather than just copy them at "closure"-construction time. Hack's lambdas have the same copying semantics, but they're at least more concise about it.
|
# ? Mar 20, 2014 20:55 |
|
Strong Sauce posted:Seems like Facebook has some supersmart people who cannot move off PHP for legacy reasons. PHP with types and the same 'near-instant' reload time sounds pretty cool though. PHP has some underappreciated virtues; Keith Adams gave an interesting talk on this topic a little while ago. But even before Hack, what we wrote in at Facebook didn't feel like writing PHP anywhere I'd done it before. The generators alone made for a pretty big shift when working with asynchronous operations like data access. quote:Although I am looking at the code and I have no idea why it is, "public function foo(): string" with the type defined after the function name, when everything else is, "public string $bar = 'hello world';" I guess it is following the tradition of PHP not being consistent with its naming? The Hack site discusses it a bit: http://docs.hhvm.com/manual/en/hack.annotations.usingtypes.php hacklang.org posted:Hack decided to annotate the return types at the end of a function/method declaration instead of near the beginning found in languages like C#. This was done mainly for readability purposes. But there are other reasons to have them positioned the way they are because of closures and searchability. With respect to closures, if the return type is annotated at the beginning of a function, PHP could interpret the return type to be a constant string, thus ignoring the return type altogether. With respect to searchability, searching for "function foo" will produce more useable results than having to use wildcards or some other mechanism to find all the functions named foo(), regardless of return type.
|
# ? Mar 20, 2014 21:07 |
|
Edison was a dick posted:I think it was going to be Tcl. There was an article about it on the 20th anniversary of the language, but I can't find it any more. Tcl was roughly the threat, yeah; it was very much tied up in the dynamics of Sun's Java license, which was of course the future of the web at the time. There was an edict to write something that was Java's little brother, or Brendan probably would have made it a little more Lispy. That said, closures and first-class functions and such were pretty high-falutin' for a little-brother language of the day. Improving the language after ES3 became basically impossible due to standards politics and browser market share dynamics, but we managed to push some things into Firefox that are finally coming to ES6 5+ years later. I love the language, but I've seen more horrible things written in JS than anything else in the last 20 years, for sure. Peril of being accessible and part of computing's most widely deployed platform, I guess, but still...rough on the appetite. Edit: oy, triple-post. Sorry.
|
# ? Mar 20, 2014 22:28 |
|
quote:With respect to closures, if the return type is annotated at the beginning of a function, PHP could interpret the return type to be a constant string, thus ignoring the return type altogether what?
|
# ? Mar 21, 2014 03:44 |
|
hacklolg posted:With respect to searchability, searching for "function foo" will produce more useable results than having to use wildcards or some other mechanism to find all the functions named foo(), regardless of return type edit: I recant. Apparently I'm syntax prejudiced. Woodsy Owl fucked around with this message at 10:35 on Mar 21, 2014 |
# ? Mar 21, 2014 04:11 |
|
Suspicious Dish posted:what? PHP code:
|
# ? Mar 21, 2014 04:12 |
|
byephp
|
# ? Mar 21, 2014 04:14 |
|
Woodsy Owl posted:Or you could not have a retarded syntax and just search for "foo(" or "foo (" Sure, if you want to find all the call sites too, which is usually pretty noisy. This is about finding the function definitions themselves, which is a pretty common task when working with a large system. These guys actually have worked with the language at substantial scale for some time, and they come from pretty solid PL backgrounds. The syntax doesn't really have pieces in it just because they couldn't be bothered to think about it.
|
# ? Mar 21, 2014 05:41 |
|
Woodsy Owl posted:Or you could not have a retarded syntax and just search for "foo(" or "foo (" How dare you say that about scala? (Hack is not the first or only language to have this style of function type annotation)
|
# ? Mar 21, 2014 06:36 |
|
Plorkyeran posted:PHP treats unrecognized constants as if they were string literals, because PHP is just that awesome. Perl does this as well. Except sometimes they're treated as subroutine calls.
|
# ? Mar 21, 2014 15:22 |
|
piratepilates posted:I saw a homemade bubble sort implementation in a production application today, I'm going to go out on a limb and say that VB.NET has a built in sorting function and one that is a fair bit better than bubble sort. I had a circumstance a few years ago in which a bubble sort was the best choice for the problem.
|
# ? Mar 21, 2014 15:50 |
|
fritz posted:I had a circumstance a few years ago in which a bubble sort was the best choice for the problem. Please explain in more detail because that sounds very interesting.
|
# ? Mar 21, 2014 16:04 |
|
fritz posted:I had a circumstance a few years ago in which a bubble sort was the best choice for the problem. I would love to hear more about that circumstance, if only because it sounds like the makings of an awesome interview problem. Were you primarily constrained by code size? Did you get a transaction fee for every swap?
|
# ? Mar 21, 2014 16:05 |
|
Bubble sort's O(n) on lists where elements are no more than one position out of place, so if you have a very good reason to believe that's the case it can be optimal.
|
# ? Mar 21, 2014 16:19 |
|
Subjunctive posted:I would love to hear more about that circumstance, if only because it sounds like the makings of an awesome interview problem. Were you primarily constrained by code size? Did you get a transaction fee for every swap? Bubble sort isn't terrible if the list is close to being sorted, i.e. each element isn't too far from its intended location. Probably not terrible on very small inputs, either. (Making quicksort/merge sort use one of the O(n2)-algorithms once they reaches the smaller cases (Think 7-8 elements or fewer; very small inputs) usually should improve performance. I wouldn't be surprised if Bubble sort actually performs decently well in those circumstances.) Also, there's this, I suppose.
|
# ? Mar 21, 2014 16:19 |
|
Plorkyeran posted:Bubble sort's O(n) on lists where elements are no more than one position out of place, so if you have a very good reason to believe that's the case it can be optimal. I thought insertion was still better in small/mostly-sorted cases, but my theoretical grounding in CS isn't really very strong. I dimly recall that the various JS engines use insertion below a certain element count threshold, but it's been a while since I looked. Thanks!
|
# ? Mar 21, 2014 16:32 |
|
I guess the more general case where bubble sort is optimal is where long lookups are expensive since you're only comparing adjacent items. That probably will never happen on modern computer hardware. Maybe there'd be some niche application on massively parallel architectures that only have direct access to local memory? But I don't think even that setup is used much anymore.
|
# ? Mar 21, 2014 16:43 |
|
Subjunctive posted:I would love to hear more about that circumstance, if only because it sounds like the makings of an awesome interview problem. Were you primarily constrained by code size? Did you get a transaction fee for every swap? There's the Sweep and Prune algorithm for doing collision detection on animated spatial data. The short description of it is that you sort your object bounds on all 3 axes every frame of your animation and only do detailed collision detection and resolution if a pair of objects have their bounds intersect on all 3. Bubble sort is pretty common here: you can do it while sweeping over the data and the swap operation is exactly when the order of two objects might change and you need to update your potential intersection list.
|
# ? Mar 21, 2014 16:54 |
|
Subjunctive posted:I thought insertion was still better in small/mostly-sorted cases, but my theoretical grounding in CS isn't really very strong. I dimly recall that the various JS engines use insertion below a certain element count threshold, but it's been a while since I looked. Insertion sort's a much better choice as the secondary algorithm of a general-purpose sorting algorithm. It's slightly worse in the best-case-for-bubble-sort scenario, and better in most cases.
|
# ? Mar 21, 2014 17:10 |
|
|
# ? May 17, 2024 18:21 |
|
..btt posted:I guess the more general case where bubble sort is optimal is where long lookups are expensive since you're only comparing adjacent items. That probably will never happen on modern computer hardware. Maybe there'd be some niche application on massively parallel architectures that only have direct access to local memory? But I don't think even that setup is used much anymore. Apropos the topic of this thread, I bet someone out there is sorting by deleting and inserting rows in a remote database. They're probably not trying to pick an optimal sort for their use case, though.
|
# ? Mar 21, 2014 17:20 |