« first day (426 days earlier)      last day (3588 days later) » 

1:06 AM
0
Q: perl apply list of regex to large data set

Mos NoI have a script that is standardizing a large amount of data in the database. The standardization involves applying over 500 regular expressions to the data. Here is quick pseudocode: Load the records from the database for each record for each regular expression ##predefined list of 500 regul...

0
Q: Should ALL divs float left?

user46988I'm designing within an application that I inherited. I have done a lot of work to "consolidate" the CSS which was extremely overworked through much copying and pasting without a lot of strategy behind it. One curious thing I found was to style ALL divs as: <style> div{ float: left; } </style>...

0
Q: Connect 4 Game For AI Agents

redmintThis connect 4 game will be used for implementing game-playing AI. Sample players are supplied. One takes user input, and the other plays randomly. Right now it's set for a human player to play against a randomly playing agent, but in the future I plan to try out algorithms such as Minimax and ha...

0
Q: Product of corresponding elements in 2 arrays

prateek Given two arrays suppose A and B, of length N and length k respectively. If we move B over A and take the sum of product of corresponding elements of A and B, then find the minimum of those sum of products. For eg. if A=[2,3,4,5] and B=[1,3] Then moving B over A, we get 3 possible values [...

 
1:40 AM
0
Q: How to implement flatten as an extension on an Array?

gotnullThis is the best I've been able to come up with: extension Array { func flatten<T>() -> T[] { let xs = (self as Any) as Array<Array<T>> return xs.reduce(T[](), +) } } It works, but I'm not sure if all those ugly casts are required. Is there a better way? For comparison, here is th...

 
2:09 AM
What does it mean to "flatten" an array?
Or actually... should this question just be closed as it's copy & pasted from StackOverflow?
1
Q: How to implement flatten as an extension on an Array?

gotnullThis is the best I've been able to come up with: extension Array { func flatten<T>() -> T[] { let xs = (self as Any) as Array<Array<T>> return xs.reduce(T[](), +) } } It works, but I'm not sure if all those ugly casts are required. Is there a better way? For comparison, here is th...

1
Q: Implementing flatten() as an extension on an Array

gotnullThis is the best I've been able to come up with: extension Array { func flatten<T>() -> T[] { let xs = (self as Any) as Array<Array<T>> return xs.reduce(T[](), +) } } It works, but I'm not sure if all those ugly casts are required. Is there a better way? For comparison, here is th...

 
Hey guys, I think this one slipped through:
1
Q: Unity DI Composition Root vs XML

Andy Danger GagneI'm having trouble figuring out the best approach with DI. After doing more research, Mark Seeman recommends using the Composition Root approach. In my example, I am using XML configuration to design my mappings which allows me to drop any new dll that implements an interface without having to pe...

I answered, but the answer and the question it's under feel more like a Programmers post.
I also voted to close
 
Two more tags bite the dust. Two left (I believe) to consider: and
Whew. Dodged a bullet there.
-2
Q: Would like an explanation as to why this was declined

AelphaeisIs Singleton appropriate for storing application scope data in WCF? Was just curious as to why the flag was declined for the no evidence reason since I myself was asking to move my own post and I didn't want to re-post because I didn't want to cross post. I don't really want any action anymore....

 
2:27 AM
1
Q: Did I implement my string formatting code correctly?

Chris_FAs a small exercise I have written some string formatting and printing functions in C++11. I would like a bit of code review, not so much on the merits of using this over something like std::stringstream or boost::format, but simply whether or not my implementation makes sense. I especially would...

 
TTGTB
 
Goodnight!
 
3:19 AM
accepted answer but not upvoted
-_-
 
I have upvoted the question not too long ago, so the OP should now know to vote.
Although, he has done the same thing on Math SE...
 
3:46 AM
0
Q: Need Tips For Improving JS-code

user3803875I have two identical objects on the page. So get more of the same lines of code :( Can anything be easier (merge)? Thanx Sample: for(var i=0;i<ticks.length,i<ticks2.length;i++) { var tick = ticks[i]; var tick2 = ticks2[i]; var tickCenter = tick.offsetWidth / 2 var offset = (i - current...

 
> This also appears to be example code, which is off-topic on Code Review.
except when it's not :p
 
Well, I did say "appears," meaning I'm not confident about this particular case.
 
i meant except when it's not off-topic
just poking fun at our very unusual definition of "example code" :p
 
Ah. Yes, that is true. :P
 
codereview.stackexchange.com/questions/56070/… <- tempted to start marking these things as duplicates
(anything that can be answered with "extract the repeated code into a function and call it")
 
3:51 AM
Heck, any legitimate way to get some things off the unanswered list. It's still increasing, though that's best solved with more reviewing.
 
someone will answer it, i'm sure, but i feel like anwering stuff like that encourages asking stuff like that, and is basically rep-scumming
hmm maybe if i answer with a comment
 
Just be glad we're not a prime target of "try this" answers. :-) I pretty much "mentally downvote" all those lazy answers on SO.
 
lol I have given some of those, but sometimes it's all you can do given the question
e.g. Q: "I'm using mysql and joins are slow, what can I do?" A: Try a subquery, mysql's optimizer is garbage.
 
Even a short sentence would be nice, but eh, maybe I'm a little picky. But I tend to show less mercy on SO for other things.
 
the weird thing is if i go looking (googling) for answers i sometimes find very good SO Q and A
 
3:56 AM
0
Q: Generic Makefile

user2941616I decided to setup a generic makefile to compile SFML programs, as I'm going to be making a bunch of small apps over the next few weeks playing around with it. I'm still new to writing makefiles (still weaning off of using IDE's), but I'm pretty happy with how it turned out. ####################...

 
but when i just sit there and look at the front page, it's horrible
 
Ugh, always. I use a different page to look for potential non-answers to flag. It's better than piling up more close flags that will just sit there for months.
 
you know i've never used any review queues or anything like that to find potentially bad stuff there to clean up
never had to leave the front page to find it, and never really wanted to see it in the first place ;)
 
It is indeed a drop in the bucket, but it's an okay time-killer. Sometimes there's even spam in there.
 
yeah i've found astroturfing a few times
never any straight up spam though (replica watches, viagra, etc)
man i'm stuck on this thing i was doing, think i'm gonna need to dump it and start over =/
was harder than it looked
the goal was to make all these asserts pass:
function assert(value, message) {
    console.log(value ? 'pass' : 'FAIL', message || '')
}

TEST_CASE('See if this works right', '[stuff]', function(){
    var x = 2, y = 4;
    assert(x == 2 && y == 4, 'initial values');

    SECTION('halving a good time', function(){
        x /= 2;
        y /= 2;
        assert(x == 1 && y == 2, 'halved values');
    });

    SECTION('double the fun', function(){
        x *= 2;
        y *= 2;
        assert(x == 4 && y == 8, 'doubled values');

        SECTION('up high', function(){
it's harder than it looks
basically each "leaf" section needs to run once, and the whole thing needs to be run from the start for each leaf
 
4:44 AM
How did I miss this question? It only had one other answer, which received a downvote from someone else.
http://codereview.stackexchange.com/questions/51837/optimize-a-parallelized-program-to-optimize-train-schedules
Any thoughts, @Yuushi?
 
4:57 AM
let me take a look
 
It's a zombie, too! I've just noticed.
 
heh, the point about having unorganised imports is even more poignant here
shoving it into vim and sorting the #includes shows that stdlib.h is included twice
 
Yep, it is. I missed that the first time (go figure).
 
This function signature is really confusing
inline double maxArray(double *arr, int size)
which is actually returning the position of the maximum element
 
He's mixing vectors and dynamically-allocated arrays. I don't even.
 
5:04 AM
doubly so because it's leaking
int *rand = new int[AnzahlSchattenzuege];
never freed
 
Crap, I didn't mention that.
 
uses rand, never calls srand
 
That, too. Shall I put them in, or could you come up with another answer?
@Yuushi Oh wait, it gets worse. He uses <random>, but still uses rand().
 
nah, you can add this stuff :)
yeah, there's a comment: // has to be replaced to c++11 random
 
Okay. :-) Perhaps someone else will be able to optimize this, perhaps after the code gets improved.
 
5:07 AM
This program can't possibly work
maxArray returns the maximum position
double max = maxArray(rand_val, size);
//cout << max << '\n';
if (max < best_max)
{
  best_max = max;
  memcpy(rand_best, rand, sizeof(int)*AnzahlSchattenzuege);
}
but then is used as the maximum value
missing <cstring> (for memcpy)
read_input isn't defined anywhere, only declared
 
Done
 
(although maybe they just didn't paste it in)
 
I could still mention that this whole thing is broken, but maybe all these points will communicate that. :-)
 
yeah
it's sloppily written
 
It may even get closed, but we'll see. I have to leave soon, so I can't test it further right now.
 
5:23 AM
morning @all
 
g'day
 
Morning!
 
6:26 AM
Blue cheese monster is back up in Blue Cheese room
and I am going to bed finally.......
 
0
Q: Refactor repeated statements and lengthy conditional statements

user3675188case 1 self.read_codec_info(fname) repeat 2 times, how to make it better ? codec_infos = [fname, resp] if len(self.read_codec_info(fname)) > 0: codec_infos += self.read_codec_info(fname) case 2 There are many variables and strings seems repeated many times. qpercent, quant, ...

 
6:45 AM
0
Q: How Can I Better the Readability of Inline Test Data?

ByteBlast[TestCase(new[] { 1, 2 }, 1, Result = 2)] [TestCase(new[] { 1, 2 }, 2, Result = 1)] [TestCase(new[] { 1, 2, 3 }, 2, Result = 2)] [TestCase(new[] { 1, 2, 3, 4 }, 2, Result = 2)] [TestCase(new[] { 1, 2, 3, 4 }, 10, Result = 1)] public int TotalPageCountIsAccurate(int[] testSequence, int pageSize) {...

0
Q: Tidying up total beginners Ruby code

Dave GordonThe following code works but is a mess. But being totally new to Ruby I have had big problems trying to refactor it into something resembling clean OOP code. Cod you help with this and explain what you are doing? require 'nokogiri' require 'open-uri' require_relative 'db.rb' # Not used re...

 
7:01 AM
> You've earned the "trusted user" privilege! Learn more about it in the help center.
2
Yaaaay
monking btw.
 
gratz @Vogel612
to do with karma?
 
thanks.
this also means I just need one more k to win the race.
 
a race?
 
well, who out of @Marc-Andre and me gains rep faster.
i go for the 5k and as I was ~1k ahead Marc is racing for 4k
 
:)
I was just a lit playing in trying to get an abstract viewmodel but what do change with the getparam of the page
I reduced all the zul pages to one, but still need x(number of catalogs) viewmodels to that one page
have an abstract viewmodel that all the implementations have to extent and I would like to remove that
just have one prob
public abstract class abstractviewmodel<T extends AbstractCatalog>
the generic is holding me back
I need a var of T in th eclass
 
7:14 AM
why not:
<? extends AbstractCatalog> varname;
or rather:
AbstractCatalog varname = new T();
 
yeah but if I want it as viewmodel the <T extends AbstractCatalog> has to disappear cause that's init by the framework
it's working now cause the actual viewmodel is now
public class CountryVM extends AbstractViewModel<Country>
so I can define T
but I want to lose the CountryVM (have a mapper in AbstractViewModel to the actual class with the get param)
 
you know it:)
 
can't make sense of what you want right now :(
 
I can understand, it's for me already a big thing
and you don't know ZK also
 
7:38 AM
Monking @all
 
Monking @Nobody
 
monking @Nobody
 
7:57 AM
0
Q: Username , Password and UserType Validation

Jeeva MahendranI have two tables in the database 1.Credentials(userid, password, usertype) 2.Customer(customername,userid(foreign key)) I need to validate username,password and usertype and create a sessionvariable for customername. I have organized the code and it works fine, but I need to know how can i m...

 
8:18 AM
0
Q: Catch-style unit testing in JavaScript (phase 1)

DaggI decided to port my favorite unit testing framework, Catch, to JavaScript. So far I'm focusing on test cases and sections. I'll add assertions in phase 2, and output in phase 3. The goal for this phase was to get all the assertions in the following test code to pass: function assert(value, mes...

 
I have the feeling that this answer is somewhat... incomplete.
1
A: CodeIgniter Active Record Subqueries

crashcoderuse this $this->db->where('`store_id` NOT IN (SELECT `store_id` FROM `user_store`)', NULL, FALSE); Check this

aaand new user put down :/(
and what exacly is the benefit in doing so? You saved 16 characters.. and lost readability, extensibility and easy changing of the variables you have. I don't think this is a good change.. — Vogel612 44 secs ago
 
0
Q: Ways to search all diagonals of a 2D M x M Array C#

TheJackalI've started writing a piece of code to help me search for an object in all the objects found in the diagonals of an M x M 2D array. Though the code works, I'd like to know if there is a way I can improve on it or there exists a different technique I could use to achieve the same result with fewe...

 
@Vogel612 that question was bound to attract junk answers =/
 
@DaggNabbit still feeling bad for putting a new user down..
btw. I could try to protect it, but it's too young.
 
in my mind, writing an answer just to suggest one stylistic thing that nobody can agree on anyway is not what CR is about
 
8:27 AM
that's not even stylistic IMO...
 
heheh
what is it?
 
I bet @konjin would have a link to some best practices...
 
that's the thing though
one camp says single var declaration is best practice, the other camp says it's not
 
fuck JS...
 
lmao
 
8:29 AM
better go back to and
 
JS itself isn't that bad, it's everyone's trivial opinions and crappy code that make it bad
 
there everyone (ahem) knows that one variable has one line and one type....
hopefully.
 
it would be so simple for language creators to "forbid" multiple variable definitions
 
yes it would
the reason people like it is because JS has no block scope, and if you make a rule like "one var keyword per function" you kind of force people to declare the variables at the top of the scope, so what you see is more like what you get
(Crockford style)
 
but that would be too easy right??
 
8:32 AM
I disklike this C like style of declaring variables at the top
 
then it would be exactly what it says on the tin...
 
it "leaks" details of the coming lines too early
 
@Nobody then you'd be in the "node style" camp and just declare stuff wherever
 
@Nobody and when you read it later, you keep thinking "that variable.. what is it there for"?
 
@DaggNabbit: Not wherever but as late as possible
 
8:33 AM
well, yes
 
ASAP vs ALAP
 
but the thing is all variable declarations are hoisted so really you declared it at the top, you just wrote it later
 
@DaggNabbit: I am not sure I understand this correctly
 
the variable exists in the whole function, even above where you declared it
 
in JS
 
8:34 AM
yes
 
okay, I was talking in general not specifically about js
 
@DaggNabbit so.. you can assign to it, before it is declared??ß
 
yes
well no
 
that's somehow like asp-classic without Option.Explicit
 
but it's declared at the top, not where you wrote "var foo"
 
8:36 AM
urgh..
 
lol
 
what difference does it make when it is declared then?
 
it doesn't
 
well yes it does..
 
so why should we bother?
 
8:37 AM
that's why it's a trivial stylistic thing
we shouldn't
 
if it isn't, initializing equals declaring,....
 
we should just do whatever feels right and not worry about what people say
 
and when you didn't give the type, then you have runtime type inferring, and that causes overhead.
 
@Vogel612 you still talking about JS?
 
@DaggNabbit JS has no types...
 
8:38 AM
ik
 
right now it's asp classic..
 
where everything is a String...
 
@DaggNabbit: What is the stylistic advantage of declaring all vars up front? (in JS)
 
blast from the past
@Nobody that it better represents what's actually going on
 
8:39 AM
but why should one care about these language internals when they don't matter?
 
they shouldn't
but sometimes they do matter
 
when?
 
search SO for "infamous loop problem"
 
JS this.
 
@Nobody people coming from other languages sometimes expect a block scope when you declare things as if there is a block scope
when you don't, they don't get confused
 
8:41 AM
what are advantages of non block scopes?
 
performance, that's it
but ES6 will have "let" keyword for block-scoped variables
basically my opinion is that both styles of variable declaration have advantages and disadvantages and neither one is a real winner (in JS) so as long as the code is consistent there is no reason to mention it in a review; it's just pushing a personal preference
 
btw. Why the heck don't people write answers when they comment on something?ß
 
because they are lazy or think the question will generate too much noise anyway or think it doesn't deserve an answer? In my case sometimes all 3...
 
most of the times I only leave a comment it is because I have no time for a full answer
 
@DaggNabbit that was kinda.. not what i was talking about I think...
 
8:56 AM
@Vogel612 well you lost me then ;)
 
I am not sure..
still not enough Coffee.
 
lol
i wonder where my obligatory 3 upvotes are on my latest question :p
the vote mafia must be asleep
 
here you got one ;)
watching a movie and doing nuthing, but gotta shut down..
laters.
 
thanks vogel... cya :)
 
0
Q: Which place is worth to travel in China?

user83011Would you like to know which cities are worth your visit and taste by heart? We select the following 10 cities with their own characteristics in terms of the geographical environment, scenic spots and culture and arts and other aspects. Surely it will be an unforgettable journey for you from the ...

 
9:48 AM
Monking
 
Monking @CodeX!
@CaptainObvious Wow, look at the things I miss when I write an answer...
 
I was told that in this instance || is to be used instead of &&
if(isset($_COOKIE["Cckiuas"]) || isset($_SESSION["loggedin"])) {
Do something
}

Don't i want both to be set? ie. &&?
 
You've earned the "Reviewer" badge (Completed at least 250 review tasks. This badge is awarded once per review type) for reviewing "First Posts".
@CodeX It depends on what $_COOKIE["Cckiuas"] and Do something is.
 
Oh, right, its to verify a login
 
Well, if a user is logged in when only one of them is set, then that seems to me like it's enough. However, if you believe a user should have both set, then use &&
 
10:01 AM
I thought so, i got given bad advice there
Ive noticed that PHP MySQLi info around the net is overall pretty terrible
Everything is a mix of everything else
 
wouldn't surprise me
 
It would be nice to put together some kind of php mysqli info box where you can get useable code that does things the right way, clean and simple
Id imagine id get hammered for it though as there is php.net
Anyway here is my latest "learning project"
 
Inspired by WordPress?
 
Little bit of wordpress, little bit of e107, little bit of drupal
Its how i learn code
just make stuff
I have a pagination script that allows other query strings to be held with it so you can "sort", "limit" and change page all at the same time
That was one of the biggest headaches i came across
Then i heard about jQuery dataTables.. :/
@SimonAndréForsberg Do you have an iPad?
If anyone has a an iPad / Tablet can you please see if my site displays ok on it, webcodex.co
It should work on all the latest browsers, phones etc
BBL
 
10:35 AM
@CodeX Nope, I have a Samsung tablet though.
Yeah, it looks alright.
 
11:02 AM
Monking
 
Monking @skiwi
 
So... that should be enough sleep to catch up with exams and getting up early this week
 
It's never enough sleep..
 
Monking @skiwiVogel
 
The upside of downvoting nonsense answers quite regularly is that I'm always getting at least +1 rep every day
 
11:13 AM
@All someone has a clue why I can't see the deleted "which place is worth to travel to in china" question??
nvm...
not logged in for whatever reason.
 
Monking all! Does anyone know of a good c# tutorial on multithreading?
 
you sure you wanna go for that??
 
@Simon:
@mkalkov - I used the wrong word. I used remove instead of retain. Let me fix that. — rolfl ♦ 1 min ago
 
No. Not really, but I'm curious about it @Vogel612.
 
I used to code c++, ages ago though
 
11:21 AM
Yay, some other people at India finally realised that when I mail them to ask for the documentation, that I really want to have the documentation.
3
Monking @rolfl
 
Mostly memory hooks for game hacks
 
@rolfl I'd still expect it to remove all the items. a->b->c->d->e->f->g. If you loop that list with retain zero, remove one: Remove a, remove b, remove c... etc. Why would not all items be removed?
 
Unfortunately I cannot read their minds and read what the input the web service is supposed to have.
 
Y u no psychic @skiwi?
 
@skiwi SOAP or REST?
or none of the above?
 
11:25 AM
@DaggNabbit Usually SOAP services with wsdl's, but this one was a REST service
 
@skiwi I can't wait until something like Swagger catches on, REST really needs some kind of WSDL-like thing
 
@SimonAndréForsberg Simon, because the descriptiokn of the problem is contradictory to the title, and I am apparently tired.
The title is "Delete M nodes after N", I expect, if N is 0, that M nodes after N will leave N
Let me go and delete my answer, because, apparenly, my answer answered his title, not his description.
Just migrated:
1
Q: Username , Password and UserType Validation

Jeeva MahendranI have two tables in the database Credentials(userid, password, usertype) Customer(customername,userid(foreign key)) I need to validate username, password and usertype and create a session variable for customername. I have organized the code and it works fine, but I need to know how can I m...

 
@DaggNabbit I should check that up... I don't know too much about web services, though I've been larning greatly last two weeks since I've started needng to use them
@rolfl You are missing keys ;-)
 
@rolfl duplicate, requesting merge ;)
 
@rolfl I updated the title and added some boldness to the description to make it clearer. To be honest, I was fooled myself at first.
 
11:35 AM
@Vogel612 ...
HAHAHA
 
stolen from @ckuhn203
 
Awesome..
 
check the "title" when you hover it
from here actually..
 
I'm still laughing about this.
Hungarian notation doesn't even deserve a proper burial. — BeetDemGuise 18 hours ago
 
@skiwi Swagger is mostly useful if you're publishing your own RESTful web services, but you can also write your own Swagger description for someone else's service. Works like a WSDL as far as being able to easily generate client code in pretty much any language. Also does a very nice job of bridging REST's "verb noun" HTTP methods / resources to "noun.verb" class methods that feel more natural as an API.
 
12:02 PM
@SimonAndréForsberg Thanks for testing
 
Someone's having a bad day...
13
Q: Java Name Hiding: The Hard Way

gexicideI have a problem with name hiding that is extremely hard to solve. Here is a simplified version that explains the problem: There is a class: org.A package org; public class A{ public class X{...} ... protected int net; } Then there is a class net.foo.X package net.foo; public ...

I actually chuckled for a bit
 
Is there a way to see the value of a $_SESSION in a browser without code?
 
Look what I just spotted in my code!
if (requestType == RequestType.UNDEFINED || requestProtocol == RequestProtocol.UNDEFINED) {
    //ignore
    //TODO do not ignore
}
@CodeX I doubt
 
But you can set a session in firefox for example right?
Hmm actually, scrap that last question
 
I'm not too familiar with stuff abou tsessions outside php for ex., but a browser surely saves the session somewhere
 
12:07 PM
Ok. At least I have about a year to learn how to do this... yikes.
 
In firefox you can get a session manager to "save" the session and restore etc but thats only if you can login initially
Cookie problem, setcookie( 'Cckiuas', $usercookie, time()+3600, '/admin', '', '', true);
Anyone see whats wrong here?
 
12:20 PM
0
A: Java Name Hiding: The Hard Way

kiwironYou may have a point, but the problem is easily solved by using longer package names - e.g. com.mycompany.myproject.net;

ahem. NOT!
 
not?
 
cpt. O strikes again in the comment from OP below:
no! Longer package names do not help since packages do not nest. The package still starts at com, if com is hidden, then I cannot start at mycompany. In addition, the problematic package names are in libraries, I cannot change them. — gexicide 2 hours ago
 
so? I see his comment as valid. The problem is that he is using two classes where he can't change the names
 
0
Q: jQuery - Merging single line methods

Muhammad RajaI am adding click events to list items, and then calling a method for each, each method doesn't do much other then calling another method, I think it can be improved, $("<li>", { text: ArrayRes.Key_SomeText1 }).on("click", Method1).appendTo($("#someList")); $("<li>", { text: ArrayRes.Key_SomeTex...

 
@Nobody correct. now If you change the package name (or insert random chars to make it longer), the class still gets hidden, because the classname itself stays the same..
 
12:25 PM
hm are we talking about the same: do you feel your answer solved the problem? I don't because the OP is not capable of changing the packaging of these classes
 
@Nobody well it's not my answer, and I don't feel that it solved the problem. your not? seemed to imply you don't agree with my NOT
 
And again I was too fast. I somehow attributed the answer to you which made the following chat a bit confusing ^^
okay, so we agree on the fact that this answer does not help
where I thought you were not (because I thought it is your answer)
 
lol, please compare user icons...
 
the other one does not get displayed in my browser
 
I am 19. That guy looks slightly older....
 
12:32 PM
So...
2
Q: How to implement flatten as an extension on an Array without type casting?

gotnullextension Array { func flatten<T>() -> T[] { let xs = (self as Any) as Array<Array<T>> return xs.reduce(T[](), +) } } It works, but I'm not sure if all those casts are required. Is there a better way? For comparison, here is the implementation in one of the swift extension librari...

3
Q: Implementing flatten() as an extension on an Array

gotnullThis is the best I've been able to come up with: extension Array { func flatten<T>() -> T[] { let xs = (self as Any) as Array<Array<T>> return xs.reduce(T[](), +) } } It works, but I'm not sure if all those ugly casts are required. Is there a better way? For comparison, here is th...

 
yaaaaay...
flagged the SO question for migration to here, including a merge.
 
12:50 PM
I also kind of wish people would stop upvoting the question here until it's improved. Or is flatten an extraordinarily common place programming term in relation to arrays that I'm just completely oblivious to?
 
I am not sure at all about the questions, or the migrations.
It is upvoted on SE, has an accepted, upvoted answer. It is on-topic there, apparently.
 
I'm not sure what should be done.
 
Well I flagged for migration, but also added that it could just as well be done the other way round..
 
But in regards to SO/CR, I don't quite see how any question could be identically duplicated and be on-topic in both places.
It appears to be gone from CR now.
 
@nhgrif rolfl killed deleted it..
> The StackOverflow answer is fine. - rolfl♦ 2 mins ago
 
12:55 PM
Yup.
 
So is flatten a commonplace programming vocabulary term I should know? A word that means the same thing in every context of programming with arrays?
 
No.
It can mean different things in different places.... but, there's nothing specific about flatten in the context of 1D arrays
It is common to 'flatten' a 2D (rectangular) array.
 
I think his question was about 2d (not necessarily rectangular) arrays.
 
With 2D arrays, yes, you often flatten them for memory access advantages.
Array 2D = new int[rows][cols]
 
So... while I understand that CR graduating from beta is somehow tied to upvotes, I wish we would pay a little more attention to what we're upvoting.
 

« first day (426 days earlier)      last day (3588 days later) »