I am defining a subclass of a the python dictionary object mpCmd where every item is converted to a lambda. The intended usage is that every item in the dictionary can be called with a single list argument (row) that will return a value based on row. Integers and optionally strings are consider...
Well Java uses the left hand side to infer the type on the right hand side, sacrificing var but gaining the that you don't need to supply the new Func<int, int>
I'm posting on here after being redirected from StackOverflow. I didn't know that there were separate sites for different kinds of Q&A code reviews :P
Anywho, I'm currently trying to solve something from TalentBuddy:
"-Your task is to write a function that sorts all the words in the string alph...
@Mat'sMug Delegates sound like an interface with only one available method, and no need to implement the interface in specific classes as it can be automatically detected.
actually I don't even think I know what a lambda really is. it has to do with delegates, but there's expressions, too... going to have to re-read that chapter in details :)
private void foo(IntUnaryOperator func);
int x = foo(new IntUnaryOperator() {
@Override
public int applyAsInt(int value) {
return value + 2;
}
});
//vs
int y = foo(x -> x + 2);
Note that I used Function the whole time there, but it should've been an UnaryOperator strictly spoken.
I wrote a bunch of indented code in Notepad to paste into CR but when I hit Ctrl-K it removed all my indentation and justified all to the left... any clue?
The code in my post appears to have improper indentation, but the indentation in the editor differs. There is usually a different amount of indentation between the two, which must be so because there are tabs used in the code. I'm afraid others will assume that I'm unaware of proper indentation...
@Phrancis Are you using tabs or spaces? To be formatted as code on SE sites, there has to be 4 spaces added in the front. Normally, that should be fine.
@skiwi Good work, I myself have implemented tons of features today (at least it feels like it). I only have one ignored test right now, and that's mostly because I'm not sure what the correct behavior is. All other tests are working fine
I have given an assignment where I have to escape a labyrinth. The goal is to find the shortest way. I have done some research and there seem to be two strategies to solve the problem: the Depth-first search and Breadth-first search, where the first starts at the root (Starting point in maze) and...
Well it's still not taking it for some reason. Oh well. The OP used a bunch of back ticks in their code, that may have something to do with it... http://codereview.stackexchange.com/questions/48528/delivery-geolocations-query/51255#51255
= ? means equals any value. I could also have phrased WHERE START_DATE` IS NOT NULL OR START_DATE IS NULL` maybe that would perform better, what are your thoughts?
@Phrancis I rolled it back. MySQL is weird with those backticks, some columns if they are a reserved words need the backticks. but I don't think that we need them there
Where Start date is anything including null? why have a Where statement say that, usually a where statement is for restricting the recordset
Figured as much, thank you @Malachi. That's a good point, make any edit you feel are warranted. TBH their CASE statement seemed so bizarre and convoluted that's probably why I wrote it like that, not thinking that SELECT would implicitely return NULL if the MAX() function was applied to a NULL record.
when they start doing weird stuff like "WHERE ColumnName = ? " that is weird
most of the time SQL is SQL, there are differences in how the different engines run and also minor differences in Syntax and sometimes big differences in what you can and can't do on the different engines
The problem I have is to find the sum of 2 linked lists. Each linked list node contains 1 digit that represents a number.
My algorithm works but I was wondering if there is a more efficient (speed and memory wise) to solve this problem OR maybe some minor tweaks I can do to reduce space and runt...
I'm using C# in .NET 4. The class holds a 2-D array of double that's required to be flattened (business requirements). I also know the dimensions of the array. I wish to sort the array by the (virtual) first column. Obviously I have to unflatten it, at least partially, in order to do this, right?...
Well this has been a good day, knocked out about 4 SQL zombies, rep went from 11 to 123 and earned 7 bronze badges. I'm going to celebrate with a cold beer - TTQW!
I created a script to hide a menu during user inactivity and when the position of my page is left < 2.
I would like to know if I use a good method regarding the performances. It's not too heavy ? Should I optimize my code ?
var interval = 1;
setInterval(function(){
var posx=$("#page").offs...
I am trying to make a small game, while simultaneously learn about the ever so popular model view controller. The game is this, there are 3 players(green, purple, yellow) and they have to try and build a path of arrows to the blue square. The first player to make the path go to the blue square wi...
I have to list the number of documents related to items in a hierarchical tree.
The specification states:
The tree will only ever be 2 levels deep.
The higher level items will list not only the number of documents in it's folder, but also the total count of documents in the child folders. Th...