« first day (482 days earlier)      last day (3466 days later) » 

12:09 AM
You could unregister the click handler, and then re-register it when you want to re-enable the event handling: textBox1.TextChanged -= textBox1_TextChanged; to disable the event, and then textBox1.TextChanged += textBox1_TextChanged; to reinstate it. — Mat's Mug 14 secs ago
does Java have an equivalent?
Depends on the framework, removeClickListener or similar do tend to exist
I think that often in such situations though, there's a 'design' problem somewhere.
true. hence I'd like more context too, to reopen that one :)
@nhgrif I just marked your answer as best for my latest question, and I had marked a best answer for my previous question a couple days ago
12:13 AM
the adding/removing of listener could be factored into a little function.. how dirty is that?
@Mat'sMug Can't answer that without more context :)
how can this work?
12:45 AM
is this CTE correct?
@SimonAndréForsberg thanks for linking your SudokuSharp challenge, I've been getting passive/random +10's ever since! +40 so far this week!
@Mat'sMug Linking it twice paid off then ;)
haha yeah
seriously though, I'm not all too familiar with CTE's, if anyone could check it out and downvote as appropriate and comment to help me fix it if it's wrong, would be great! :)
I don't even know what a CTE is!
it's pretty quiet tonight
I "lost" 80 rep yesterday
And I've already earned 45 rep today
12:53 AM
Why the hell would you group by a date converted into a varchar instead of just grouping by the date?
It's kinda.... sad/depressing/strange/fill-in-the-blank though that my highest upvoted question right now is... drumroll please!
Q: FizzBuzz in Brainfuck

Simon André ForsbergInspired a bit by a previous Brainfuck question and the recent fizzbuzz invasion, I decided to make FizzBuzz in Brainfuck. The code is entirely my own, except for the inclusion of the Printing a number algorithm that I found on StackOverflow. My code is divided into several parts. Setup Const...

And also, why would you order by the date converted to varchar instead of just ordering by the date?
@nhgrif in T-SQL you can't GROUP BY SomeDate if SomeDate isn't part of the SELECT...
I wonder how many upvotes I would get for that Sudoku Solver in BF we've been talking about @Mat'sMug :)
12:54 AM
It is part of the select though.
it's not. CONVERT(varchar, effectivedate, 102) is.
        ROW_NUMBER() OVER(ORDER BY (CONVERT(varchar, effectivedate, 102)) ASC) Rn,
        CONVERT(varchar, **effectivedate**, 102) effectivedate,
        SUM(EuroCurrentBalance/1000000) TotalArrears,
        SUM(CASE WHEN Multiplier > 2 THEN EuroCurrentBalance/1000000 ELSE 0 END) NPLs,
        CASE WHEN ROW_NUMBER() OVER(ORDER BY (CONVERT(varchar, effectivedate, 102)) ASC) = 1 THEN 0 ELSE SUM(EuroCurrentBalance/1000000) - (LAG(SUM(EuroCurrentBalance/1000000),1,0) OVER (ORDER BY (CONVERT(varchar, effectivedate, 102)))) END MonthlyChange
it's passed to a function, the result of that function is part of the select.
so the group by must be by the result of that function.
lame, I know
or did that change in SQL2012?
(starts SSMS)
oh crap
USE [AdventureWorks2012]

      ,convert(varchar,[ModifiedDate],102) dt
  FROM [Person].[Person]
  group by title, ModifiedDate
^^ works
@nhgrif thanks mate, edited - and I learned something today! :)
I'm pretty sure that doesn't work in SQL Server 2005/2008 though.. too bad I don't have access to it anymore
@rolfl would know that, right?
> Of course, Americans could also probably use a little remedial geography instruction, if a poll conducted by the Washington Post in April is any indication.

Only 16% of respondents correctly located Ukraine on a map, and more than a hundred of the 2,066 participants seemed to think the Eastern European country was somewhere near Greenland or, ironically enough, Canada.
WTF, seriously America?
they haven't played enough Risk
and yeah WTF... where do they think Russia is??
1:09 AM
@Mat'sMug Brazil? Alaska?
I'd hope they know where Alaska is... ...
how's your BF sudoku solver coming along?
@Mat'sMug I don't think 3:10 am is the best time to start on that
isn't it? -.-
> We anxiously await a Russian-produced map of Canada that shows an independent Quebec. It seems to be the way diplomacy is being conducted these days.
> "Geography can be tough," it notes snarkily.
A: What are the advantages of graduation?

Mat's MugAnother "advantage" that no one mentioned yet: Beta sites aren't listed at the bottom of EVERY PAGE ON STACK EXCHANGE!

Don't you guys get bored of coding? :P
only when I'm sleeping... and not dreaming in code :)
@Anirudh No offense but... are you nuts?
Do you ever get bored of having fun?
1:28 AM
True Simon
I was just kidding
@Anirudh congrats BTW, your open/closed doors question went hot!
Well, honestly @Anirudh, I don't get bored but I can get discouraged some times.
Ahh yeah!! Thanks Mat...It actually was a good question that was asked in an interview to a firend
I knew attempted it using brute force but there had to be an efficient way...which you guys showed.
tip: arrow-up = edit recent chat post ;)
Ahh right!! Thanks for the tip
1:31 AM
first time in The 2nd Monitor?
Facebook hangover maybe
@Mat'sMug sometime we should really consider pinning that...
Why discouraged? @SimonAndréForsberg
@Anirudh Because sometimes it feels like you code one thing and get two new ideas. IdeaOverflow
But I think Facebook does allow editing of the comments later, which doesn't make sense to me....
1:33 AM
Can one of the moderators (@rolfl, @Jamal or @200_success) tell me which one of my comment-flags was declined in this question ? Unfortunately it doesn't show which comment flag was which...
remember that FB is BF backwards... it's dangerous :)
TTGTB for now
Oh yeah @SimonAndréForsberg sometime one may wish he simply had eternity to himself with those ideas flowing..
'night @sim
@SimonAndréForsberg I can
1:34 AM
@Mat'sMug and yet the concepts of the two aren't that distant from each other
oh, monkey here, then I can get an answer before sleeping
I believe this is Stack Overflow material: it's about the algorithm, not the coding per se. — TryPyPy Jan 21 '11 at 20:27
Ah, alright. I can understand why
I figured it was still relevant, especially given the subsequent comments
I'll try flagging another comment then :)
Well, if there is a meta post, then maybe not ;-)
1:36 AM
My helpful flag amount has increased tremendously recently thanks to me flagging obsolete comments.
SEDE for that, by the way ... ;-)
Jamal hated me for that
@rolfl He hated you for flagging obsolete comments? I hope he's not doing too many of mine then
/me goes to flag comments
2 days ago, by Simon André Forsberg
lol, you know which moderator handles your flags when you flag some comments as obsolete and then moments later the question is Jamalized
@SimonAndréForsberg Not really.... but it was a slog to get to 80.
1:38 AM
@rolfl Ah, that one I have seen before
@rolfl Well, prepare for a lot of more flags because I'm aiming at 500 ! I'm only at 177 right now :)
I think it has increased by about 30 in two days though :)
@SimonAndréForsberg If you get bored... you can always flag crap on SO. ;)
@hichris123 I'm not that bored
@Mat'sMug Lol..if you have a thread of comment and reply to comments going on it's just absurd to let the user change his/her stance after someone had actually replied
Don't know Facebook's Product team was thinking.
It is a secret concern of mine, that when we graduate, all these people are going to have high helpful-flag counts
@Mat'sMug Race you to Marshal badge ?
1:40 AM
Then for elections my numbers will not be great
@SimonAndréForsberg I have 128
@rolfl I am on your side man.
@Mat'sMug 177
@rolfl Well yeah... but you've been a good mod, soooo
No, I have not been gaming things ;-)
1:42 AM
Don't you worry about that, @rolfl. Numbers usually don't say that much. I think that if you run for moderator in the elections, you will most likely get elected. I think you'd be my first choice. (As long as we stop disagreeing with each other...)
same here
I'll frame that one ;-)
that two ;-)
@rolfl s/two/too/
1:43 AM
@SimonAndréForsberg - you know we can only disagree with each other safely because we agree on so much else?
Is it a problem... that I think more than 3 people would be great mods here? (not even including the current team, which I would vote for too)
how many mods would we get as a grad site?
@rolfl Probably yes, thanks to and . I don't think we agree on the tabs-vs-spaces issue though, that might cause a problem ;)
Not as many as would be good moderators.
1:44 AM
Maybe 4.
But no less than 3.
@rolfl Imagine if I would use and instead of .... brrr... scary thought.
I have been to other stackoverflow sites but I think this is a cool place to hangout sans some arrogant, haughty smugs whose sole purpose of being there is to over scrutanize
Anyways, throw new SleepUnderflowException("TTGTB");
We really need to graduate soon.
It is somewhat embarassing being a mod when so many people are capable, willing, and qualified.
@rolfl [status-DENIED]
1:49 AM
@rolfl $10 you'll be re-elected
when are these elections?
when the site graduates out of beta status :)
A: What are the advantages of graduation?

Grace NoteGraduation does five things for you, mechanically speaking. Reputation privilege tables are changed. That answer really explains it so I don't need to go further. Given the rep distribution at current, this is actually somewhat negative since you have a pretty tiny fraction of 5% that surpasses...

@Anirudh Right now, Jamal, 200_success, and myself are appointed, not elected. From this side of things, it is one thing to be a mod, but another to be an elected mod. There's a difference.
what would that difference be?
well, @Jamal was sort-of elected ;)
Q: Code Review is in need of a new moderator

MalachiI know that we are a beta site, but from the looks of it, they only choose moderator pro-tems 2 weeks into a beta site. I think we need to follow the path set forth for nomination of a new moderator, if nothing else to show that we are a growing site and have enough active users to become a full...

1:59 AM
@rolfl I was just curious...as Mod needs to devote a lot of time reviewing things on the site and answering Meta questions maybe. How do you manage all this if you work besides it?
That's a good question. Right now I am with my wife, my parents, I am watching doc Martin. I work for IBM, and spend my days at work, and at night I am online with my team in China too.
I spend a lot of time doing other things, but I frequently 'flip over' to code review, and do things 5 minutes at a time.
Reopen votes please?
Q: Rails app that scrapes forum using Nokogiri gem

Jamie BBuilt website that scrapes a guitar forum's pages and populates Rails model. I'm using rake task along with heroku scheduler to run background scrapes every hour. On the homepage, the forum ads (in the form of a Post Model) are displayed using a dataTables (jQuery plugin), so user can search from...

@RubberDuck I'm writing a in ...
like now, I am closing my laptop ;-)
I just saw the fiddle.
You're gonna beat me to it.
2:13 AM
I have this so far:
HAI 1.2


    IM IN YR FizzBuzzLoop UPPIN YR Counter TIL BOTH SAEM Counter AN 100 BTW Counter runs 0 through 99

      I HAS A Value ITZ SUM OF Counter AN 1

    IM OUTTA YR FizzBuzzLoop
I feel weird saying this, but it seems more appropriate to replace counter with something a little more..... Lulzy
Not idiomatic enough eh
Not quite...
Keep it for teh review ;)
Maybe IM IN YR soda UPPIN YR ....
2:17 AM
Haha right
Bah. I laughed and lost my focus.
@rolfl is lolcode off-topic?
(personally I see no problem with it; it's just another language.. akin to BF in being the esoteric type)
If @Simon can post brainfuck... That^
@rolfl An offshore team for software in china?
I thought that was our Job lol
but IBM is like truly international..so no wonders.
Q: Multifunction select needs refactoring to make it readable

user30586This query seems to have way too many parentheses. SELECT CAST(ISNULL(ROUND(CAST((SUM(product1) + SUM(product2)) AS FLOAT) / CAST(salescalls.visits AS FLOAT) * 100, 2), 0) AS VARCHAR) + '%' AS avrg FROM sales, salescalls WHERE sales.salescallId = salescalls.id

2:32 AM
Q: Reviewing code while alluding to a design question

h.j.k.Wells, for the nth time... Good IO library design Coping my comment in verbatim, with extra emphasis: Wells this is the really really grey area hmms? I took a quick glance at the GitHub project, quite interesting... Obviously the whole project will be too big to be reviewed here (and besides...

@Anirudh IBM has 450,000 employees worldwide.... it's a 24/7 enterprise.
today is fantastic. I've basically just directly been told, by my boss, to lie out of my ass about experience in certain areas.
You don't already? I mean, I am an accomplished C# programmer with a badge and all!
yeah, too bad it has nothing at all to do with programming
hi everyone!
2:45 AM
if it was lying about C#, I could deal with that because I imagine I could pick it up pretty fast
hey @h.j.k.
I clicked the link to the question, saw this comment:
no this comment lol
This question appears to be off-topic because it is about Interfaces and the use thereof, which was designated as off-topic as per meta.codereview.stackexchange.com/questions/2289/…Pimgd 15 hours ago
and then this:
Q: Code Review vs. Help me solve my problem

rolflA question that asks: I don't know how to best solve problem X, can you suggest a way? ... is clearly off-topic on Code Review. A question that asks: I have solved problem X, and this is how I did it. Is it a good solution? ... is clearly on-topic on Code Review. There is a grey are...

that's why I linked to it :)
2:48 AM
yeah i know the design debate (D2) is kind of heating up these days, the question I'm referencing is not that bad a question per se because there's some well-thought out code and documentation in the library
it just so happens that the question itself alludes to the design
the really really grey area :)
i created the question too on Simon's comment as well
on an unrelated note, why are our rep higher here in chat
it's your cumulative on all SE sites :)
i sees
at the end, CR should see the glass half-full (aren't we a positive bunch?) and brighten the grey areas a bit. They do get answers still. The bad ones ought to be downvoted, but the answerable ones are in our collective hands to decide whether we want to answer or not - what's in-scope on this site, where we cast our close votes, is driven by us all. It doesn't make the black any whiter, it just makes more people enjoy their ride.
my take on the question is that it should be allowed on the premise of its quality alone, but i'm not sure if i'm ready to conclude too that I'm just raising the bar very high for design questions
my personal stand on design questions in general is still OT in CR...
if i'm ready to conclude too*
that I'm just raising the bar*
silly me, just edited on my original comment haha
3:03 AM
well the problem with design questions is that the code is inexistent. There is no implementation, just an idea. we shouldn't review ideas.
3:21 AM
Q: Templated Solution for generic thread_pool in C++03

Zachary KrausI built a generic templated solution for calling class methods with pthreads. I than added a really simple thread_pool to the code. I am currently testing the code trying to get the code to crash. For this latest test, I am purposely choosing the wrong version of thread_helper::method to run. The...

@rolfl I have a working piece of code, may I?
3:38 AM
^^ ambiguous
This post is the result of reading through and following the [LOLCODE Specification 1.2](http://lolcode.org/1.2_spec.html), and writing and executing my code on [compileonline.com](http://www.compileonline.com/execute_lolcode_online.php).

My "hello world" was going to be a [tag:fizzbuzz]. I like it because it nicely illustrates the basics of a language - variables, operators, looping, conditionals, and the likes.

As far as naming goes, the specification allows for a wide variety, so I decided to go `PascalCase` all the way, so as to ease up the reading a bit - otherwise the language is *a
I'm serious ^^
I can see, and do it, if it works.
Grab the tag too, if you can.
Q: Spree Billing/Shipping Address Checkbox

Essam Al JouboriI used JS to re-populate the shipping address into the billing address when a checkbox is clicked. I'm wondering whether there is a more concise/better way to write the code below: var checkBox = document.getElementById('order_use_billing'); var shipFirstName = document.getElementById('order_sh...

and boom
Is it sad that that makes sense?
Am I really at the point where makes sense?
3:46 AM
hold on
Q: Down with FizzBuzz... LOL

Mat's MugThis post is the result of reading through and following the LOLCODE Specification 1.2, and writing and executing my code on compileonline.com. My "hello world" was going to be a fizzbuzz. I like it because it nicely illustrates the basics of a language - variables, operators, looping, condition...

funny part: syntax highlighting correctly works with
Q: Interview task to efficiently find compact representation of nodes in tree and find big O time

user246431231232352I recently had an interview problem where I was aksed to find a compact representation of nodes in a tree. As an example, consider the following tree: A / | \ B C D / | \ | \ E F G H I ...

Q: Is [lolcode] reviewable?

Mat's MugDown with FizzBuzz created a lolcode tag. Some (cough) brainfuck (cough) are even further down the esoteric alley. Given our current site rules, I'd tend to agree. I don't think allowing lolcode questions on CR will bring a massive amount of 'em. brainfuck has 13 questions since May 2011. ...

I'll undelete the meta question if any issues arise.
4:06 AM
The answer, I guess, is yes.
Whether the review is meaningful? I think it makes a point.
and I do prefer Loopz
your answer is still impressively valuable
It is only half-tongue-in-cheek. I actually am impressed with what you have done there.
is not going to happen.
well thanks! :)
I thought the if conditions could be less nested, but then I could not figure it out in my head. It is now sleep time.
4:21 AM
Come on , Ideone! Let us compile lolcode!
Q: Java Cannot Find Symbol For circumference And area

ColinI have never posted to stackexchange, so I hope I'm not doing anything wrong. I'm in my school's Compsci class, and one of our assignments was to use subroutines to have the user enter the radius of a circle, then return the circumference and the area of that circle. Here's the code I made to do ...

@CaptainObvious offtopic
2 hours later…
6:34 AM
Q: Client-side XML + CSS architecture

Dave JarvisBackground With the goal of creating a simple architecture, I am wondering about the implications of a client-side rendering implementation. The request architecture resembles: HTTP GET -> SQL -> XML -> XSLT -> CSS + XHTML + SVG The interaction architecture resembles: HTTP POST (Ajax) -> HTT...

6:47 AM
Q: Inline check of array presence before iteration

JohanI usually check if a collection exists before iterating over it: var a1 = [1,2,3], a2; if(a1){ $.each(a1, function(k, v){ console.log(v); }); } I thought a bit about an inline solution and came up with this: !a1 || $.each(a1, function(k, v){ console.log(v); }); Which se...

Q: Find swapped nodes in BST

JavaDeveloperA BST has two nodes swapped. Figure out which two nodes. Looking for code-review, optimizations and best practices. public class SwappedNodes { private TreeNode root; SwappedNodes(List<Integer> items) { create(items); } private void create (List<Integer> items) { ...

Q: phpMailer mass mailing script

JackieI'm working on a script that will be able to send mass e-mails. I'm using cron to run this script. I'm fetching e-mails from queue. I need to ensure that: 1) To one e-mail will NEVER be sent more than one message (It could be executed more than once) 2) One e-mail must have only one recipient ...

7:23 AM
Answered the LOLCODE question... I don't agree with the language's design where the WIN case of an O RLY? statement requires another indentation level
Besides, the meme is O RLY? YA RLY anyway, so why not put that on one line
YA RLY is just { anyway
7:40 AM
Q: Loop Animation on several UIButton's NSLayoutConstraint

burrows111I took the belated plunge to look at Autolayout Normally id Animate based on a UIView's Frame i.e id have used the following: NSArray *sortedArray = [self.buttonArray sortedArrayUsingDescriptors:[NSArray arrayWithObject:ascendingSort]]; for (int i = 0;i<sortedArray.count;i++) { UIButt...

8:29 AM
Q: A platform-independent implementation of "which" in Ruby

konsoleboxI like to know if there's anything that I may have missed in this implementation. The method tries to provide the absolute path of the binary or script which is likely to execute based on the provided path. I carefully based it from how cmd.exe chooses the file to execute. It intends to be platfo...

8:47 AM
Q: ToastUtils - helper class which eliminates the disadvantages of Toast from Android SDK

Leonid SemyonovUsing: ToastUtils.LONG.show(context, R.string.greeting); Code: public class ToastUtils { public static ToastUtils LONG = new ToastUtils(Toast.LENGTH_LONG); public static ToastUtils SHORT = new ToastUtils(Toast.LENGTH_SHORT); private final int duration; private ToastUtils(int...

Q: Could this CSS Stylus loop code be more efficent?

user43251I'm not sure if this could be more efficient because I don't think I should need 2 keyframe loops in addition to the for loop...? Thanks for any tips! for i in (1..19) .l:nth-child({i}) n = (20 - i) height 0 if i >= 10 margin-left ((n * n) * (1.25/n)) + 17 px box-shadow 0px 0px (n+4)px 0 ...

Q: Is this the correct way of handling large images efficiently (to avoid outOfMemoryErrorin Android

Thurul NilnuwanAfter lots of attempts thanks to all the Android enthusiasts, I've found a method to handle large images efficiently in Android Applications in order to get rid of outOfMemory error. But I really need to know is this the correct formal way of doing this. Or Do I need to add some more or any chang...

9:03 AM
Q: Custom exit with only some exceptions in Python

JorgeI want to define an exit code for some exceptions and some exceptions only. I want that the only input is that dictionary with the definition. This is the code: import sys exit_codes = { ValueError:'10', KeyError:'25' } try: raise Some_Exception except Exception as exit_err: if any([is...

@Mat'sMug Why did you remove your meta question about lolcode?
And btw, 9 of the brainfuck questions are about interpreters written in another language
-1, formatting isn't better with spaces, nor without. I agree with consistency, but spacing or no spacing is entirely opinion based. — Josue Espinosa 6 hours ago
Thanks, Santa!
1 hour later…
10:17 AM
Votes needed:
A: ToastUtils - helper class for Android SDK Toast

KaoIMO this class isn't very useful (at least in a current shape). In Toast class I often miss the call to show() Well, it's not a bug, it's a feature. There are many situations when you only want to prepare your Toast using makeText() and show it later with show(). Moreover, you don't fix ...

Lol. @Pimgd I need to stop writing reviews on my mobile.
Q: LINQ XML Parsing

user52092//Load xml XDocument xdoc = XDocument.Load("data.xml"); //Run query var lv1s = from lv1 in xdoc.Descendants("level1") select new { Header = lv1.Attribute("name").Value, Children = lv1.Descendants("level2") }; //Loop through results foreach (var lv1 in l...

I'm bored.. suggest me to code something in PHP?
10:40 AM
Brainfuck interpreter?
FTP file manager?
go write a brainfuck interpreter in LOLCODE
It's been done.
Find an open-source project and contribute to it.
oooor go eat lunch. Also an option.
10:42 AM
Avoid the FSF ones because you have to sign papers first and you won't be able to really contribute before a few weeks.
What's FSF?
Free Software Foundation.
Isn't that like for really experienced programmers?
You know, GNU and their friends. If you really intend to help, you can do some things, but you have to be motivated.
There's always work to be done, and not always hard things, just things that people didn't find the time for.
10:48 AM
Ah I see
I'm a happy person now, and so is @SimonAndréForsberg soon
I've always found that the really interesting projects are in languages like C or C++, so I've never gotten involved.
@RubberDuck So I create my own interesting projects :)
I've always wanted to get into an open source project I could care about though.
That's a good point @skiwi.
I might contribute to Java directly one day
@RubberDuck What do you mean by really interesting?
10:51 AM
@RubberDuck Java also has some interesting projects!
Just anything that's ever caught my eye was in in C. That's all.
@skiwi You found a bug in JDK 8, you have done your part
I really don't like Java. I spent some time learning it once upon a time.
Maybe it's because I don't like building GUIs from code though.
@RubberDuck you don't have to do that
I couldn't ever quite figure out the builder in NetBeans.
10:54 AM
Use JavaFX... Swing sucks indeed
Me neither. I use Eclipse instead :)
Although JavaFX has the external Scene Builder
JavaFX 2.x sucks because of other reasons (Functional code without lambdas... is a pain)
... which I also haven't figured out and ask @skiwi every time about it...
I really do need to find a project to get behind though. It'll be good for my resume.
@RubberDuck In what languages?
11:05 AM
@Mat'sMug It does. I work in SQL Server 2005/2008 every day.
@skiwi - this suggestion just arrived in my inbox:
No idea if it is any good.
Are Java lambdas the same as C++ lambdas, which are basically Objective-C blocks and Swift closures?
@rolfl Thanks for the heads up, I don't know either
@nhgrif I don't know enough of those languages to answer :(
added to favorite tags =D
float (^oneFrom)(float);

oneFrom = ^(float aFloat) {
    float result = aFloat - 1.0;
    return result;
oneForm is an Objective-C block. It takes a float as an argument, returns a float. And oneForm is a variable which can be passed to and fro.
11:14 AM
seems pretty similar
DoubleUnaryOperator oneFrom = aFloat -> aFloat - 1f;
Is most concise you could get it in Java
DoubleUnaryOperator oneFrom = (double aFloat) -> {
    return aFloat - 1f;
Is also legal
That's probably pretty similar to Swift closures.
What's, DoubleUnaryOperator?
There's no FloatUnaryOperator to Java... so using a double there
an unary operator is an operator that operates on a single type, and is this case it's on the primitive double
So... how would you call that?
In Objective-C, or Swift, I'd call oneFrom as such:
float myFloat = oneFrom(10);
So it looks exactly like you're calling just a regular C-style function.
float myFloat = oneFrom.apply(10);
Difference is that in most languages lambdas are first-class functions
Why .apply? Are there other things you could do?
11:17 AM
While in Java they're still objects
DoubleUnaryOperator is a functional interface, that is an interface having exactly one non-default method
Language-wise it's an object
but looking on the performance side of things, they're not as heavyweight as objects are
Hmm, I see.
So in specification similar, usage is a bit different
So you could define any one of these interfaces for whatever sort of lambda you wanted to create, right?
11:19 AM
An interface for a lambda that takes 3 ints and returns an object for example?
Correct, you'd need to create it yourself though
java.util.functions itself defines a whole load of functional interfaces already, to which everyone using Java 8+ has access
DoubleStream.of(1.5, 2.5, 3.5).map(oneFrom).sum()
One of the most common uses of blocks in Objective-C is to use one that takes a bool and returns void.
will give 10.5
That would commonly be written as:
DoubleStream.of(1.5, 2.5, 3.5).map(x -> x + 1.0).sum()
11:21 AM
So, for example, when animating a UIView... the method takes a void -> void block (for the animations) and a BOOL -> void block, where the BOOL passed into the second block marks whether or not the first block completed successfully.
+ (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;
@Simon I guess I'm looking for a C# project. I'm still not the swiftest at it, but I feel like I'm learning enough to make simpler fixes.
@nhgrif That would be a BooleanConsumer, though I've never seen that in Java yet
Where (void (^)(void)) specificies the arguments for the block.
But you can also typedef the blocks so when you specify them they're not so ugly.
typedef void (^AnimationBlock)(void) <-- now animationBlock is a type that refers to a block that takes and returns void.
So now my method could be + (void)animateWithDuration:(NSTimeInterval)duration animations:(AnimationBlock)animations;
@sim because I felt dirty posting a will-be-hot question, linking in chat and on meta all at once. Undeleted now, if you want to answer it ;)
And then I can use it as such:
11:27 AM
@nhgrif wow I've been doing it wrong for a very, very long time </mega-facepalm>
Doing what wrong?
@rolfl Feels like you, me and @skiwi probably know that stuff already...
The only time you should ever convert a datetime to a varchar, that I can think of...
a) you really need to return it as a varchar because that's easier/better than convering the raw datetime in your application
@SimonAndréForsberg I have some of the theory, but I have not 'used' Java8 features properly
11:29 AM
b) potentially you need to sort by only a specific part of the datetime, like the day of the month?
@RubberDuck You can help me improve my Sudoku Solver :)
So, I have been getting some 'heat' on the random C# answer, because in many ways, my answer is similar to @ToppinFrassi :
@BrunoCosta - you seem to be under the impression that I am in some sort of competition with TompinFrassi, or Jeroen. Well, there is some truth to that. Jeroen and I had a lot of good-natured discussion about this problem yesterday in the 2nd Monitor (transctipt) and I invite you (or anyone else) to join us to discuss this morerolfl ♦ 35 mins ago
@Mat'sMug Honestly, I don't really think lolcode is CR stuff, but well... I can't really point at what's bad about it. And I recently posted Brainfuck so who am I to talk? But lolcode for me seems to just be C in disguise.
And how does that make LOLCODE different to ..... FIM++, or C++?
Time for me to put on that fire-proof suit, and grab some breakfast.
@rolfl In a way, exactly that. Lolcode and Fim++ is just C++ but with a completely wicked syntax
11:36 AM
@SimonAndréForsberg That could be interesting.
@rolfl At least LOLCODE reads like code. Fim++ reads like..... a letter.
Q: Is [lolcode] reviewable?

Mat's MugDown with FizzBuzz created a lolcode tag. Some (cough) brainfuck (cough) are even further down the esoteric alley. Given our current site rules, I'd tend to agree. I don't think allowing lolcode questions on CR will bring a massive amount of 'em. brainfuck has 13 questions since May 2011. ...

Does anyone know what synchronizing a pull request means on git/github?
well LOLCODE does have dynamic typing
Q: Is [lolcode] reviewable?

Mat's MugDown with FizzBuzz created a lolcode tag. Some (cough) brainfuck (cough) are even further down the esoteric alley. Given our current site rules, I'd tend to agree. I don't think allowing lolcode questions on CR will bring a massive amount of 'em. brainfuck has 13 questions since May 2011. ...

@RubberDuck I have gotten a review on it, but don't think I have made all the changes suggested
11:55 AM
@SimonAndréForsberg I might be able to find some time to help with that.
@RubberDuck Feel free to fork it and improve it however you'd like github.com/Zomis/SudokuSharp
@RubberDuck yup, that's the one
That's cool. I starred it.

« first day (482 days earlier)      last day (3466 days later) »