« first day (327 days earlier)      last day (3689 days later) » 

9:06 AM
Hmm, it would be nice if Netbeans could collapse all logging messages by default
 
@skiwi many languages incl. Ruby, Python, Scala, Golang terminate statements with newlines, but usually also offer the option to use semicolons.
 
And every guidline eventually states "don't use semicolons".
 
9:32 AM
@SimonAndréForsberg Do you know if it is possible to intercept log messages and provide own functionality? (Like writing to a XML file in a background thread on INFO messages)
I don't really know for which terminology I should search
 
@skiwi Yes, that's possible. Log4j uses the concept of "appenders" to provide a lot of customization.
 
Ok I'll look into that then
 
It even comes with a built-in FileAppender, but I'm not sure if there's any pre-configured XML ones available.
 
The basic one is just system out?
 
That's the ConsoleAppender I think
org.apache.log4j.ConsoleAppender logs to Syso
Here's an example log4j.properties file, which is used to configure Log4j:
log4j.rootLogger=debug, stdout, R, Zomis

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Pattern to output the caller's file name and line number.
# log4j.appender.stdout.layout.ConversionPattern=[%d{ISO8601}] %5p %10c{1} [%10t] (%22F:%3L) - %m%n
log4j.appender.stdout.layout.ConversionPattern=[%d{ISO8601}] %5p %10c{1} [%10t] %m%n

log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=mfeserver.log

log4j.appender.R.MaxFileSize=1GB
This is actually the real Log4j configuration for my Minesweeper Flags Server
Note that I've added a log4j.appender.Zomis=net.zomis.minesweeper.server.ZomisAppender, which is a custom appender I wrote.
 
9:43 AM
Ok, I am trying to find things for log4j 2.0 atm
Interesting
 
I've only used log4j 1.2.17
 
The thought behind it is similar i guess
 
@SimonAndréForsberg Do you know SLF4J and Logback?
 
@palacsint I know SLF4J yes, haven't used Logback though (I think)
 
I've used Log4j for a long time and I've always wondered why there isn't a newer version than 1.2.x... after that I found Logback which is developed by the same guy
 
9:51 AM
Beginner problems, I can't get the library to work
 
Log4j exists in 2.0
@skiwi Setting it up is always the hardest part :) What's the problem?
 
in Netbeans I added the folder with the jars as compile time library, as tons of times before
Yet org.a gives nothing
Much stupid.
Linking an individual file does work strangey enough
Guess I will add them jar by jar if this somehow doesn't work, and I'd like to progress today
 
for me when using Log4j 1.2.17, there's always only been one jar
 
I got like a list of 10 jars
 
what!?
what jars?
 
10:02 AM
I guess you need only the API and the core jars
 
@palacsint Might be yes, I'll just remove the other ones for now
 
yeah, apache-log4j-2.0-rc1-bin\log4j-core-2.0-rc1.jar and apache-log4j-2.0-rc1-bin\log4j-api-2.0-rc1.jar is probably the ones you need
 
hi all
 
Hi
 
10:16 AM
Hey @Nobody
 
0
Q: Simpler way of showing, hiding & disabling elements

NorrisI'm currently having this code & looking for a simpler and shorter way of showing, hiding & disabling my elements... $("#chReportData").click(function(){ if($(this)[0].checked){ $("#reportDataOptions").show(); } else { $("#ReportDataStatusO...

 
Everything is bugged today.
Even windows directory view was not refreshing when a file was moved...
What is the difference between fatal and error?
 
I'd say an error could be recoverable
and fatal never
 
Depends on the context.
 
for example if you clean your gun and look into it then this can be fatal or an error
 
10:25 AM
But the logging scheme implies that error is worse than fatal, as it does log error by default, but not fatal.
 
judge yourself what this means :)
 
It's always an error then @Nobody
 
INFO, WARN, ERR, FATAL
 
10
A: When logging when is an error fatal?

paxdiabloI consider fatal errors to be when your application can't do any more useful work. Non-fatal errors are when there's a problem but your application can still continue to function, even at a reduced level of functionality or performance. Examples of fatal errors include: Running out of disk spa...

 
--> noone needs that, might become a problem, is a problem, You're done for.
 
10:29 AM
I hate setting up Apache Logging...
Finally, the console logger works.
 
10:48 AM
-1
Q: Euclidean algorithm to find gcd of n numbers

NIharika Implement Euclidean algorithm to find gcd of any N numbers.[ gcd(a,b), gcd(a,b,c), gcd(a,b,c,d) etc.]

0
Q: Optimize a Makefile

makeMondaySince my project is getting bigger every day and I am just a starter in the wonderful world of makefiles, I need some help improving mine because, although it works (almost) as I wish, it really started looking like a mess. So it would be nice if someone could help me with it (and of course, advi...

0
Q: Connection to a database, do I need to create a new one and close it everytime?

l0r3nz4cc10I currenctly have a class which does several requests to a database with several methods (called from main method) sharing this pattern : public int getSomething(String id, File file) { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; int lines = 0; ...

 
Progress... yay
[INFO] [2014-53-27 11:53:48] [pool-2-thread-1] [RenameConsumer] Accepting the file "D:\OCR\input\Flynth01.pdf".
 
11:05 AM
Even better
[INFO] [2014-04-27 12:04:40] [pool-2-thread-1] [RenameConsumer] Accepting the file "D:\OCR\input\Flynth01.pdf".
[INFO] [2014-04-27 12:04:40] [pool-2-thread-1] [29] Creating directory "D:\OCR\renamed_input\29".
[INFO] [2014-04-27 12:04:40] [pool-2-thread-1] [FileUtils] Moving "D:\OCR\input\Flynth01.pdf" to "D:\OCR\renamed_input\29\29.pdf".
 
looks like at least your stuff is working...
2
 
Nice @skiwi. Good to see that someone here is getting progress
 
Now I think it is time to actually start working on next step of the project :P
I'm converting a prototype application to a live one
Does anyone have advice on how to build a layered application?
Currently the whole application is file/directory-based (moving files to other directories), and every stage is a standalone application taking file from input, processing, writing to output.
Let's say... the prototype version where all functionality was practically in one project... became a mess.
 
11:19 AM
Morning @Mat'sMug
 
Hello¡
 
#do-things-in-order: found an interesting job posting, ..but have yet to update my CV.
Gotta hit the road, back later!
 
Much surprise, I post the .pdf here in chat and on skype, and 10 minutes later I get an Adobe email about PDF processing.
@Vogel612 That comment is implying that your stuff is... not working.
 
well...
 
YES! It's working
 
11:30 AM
I am currently trying to create useful unit-tests..
 
Time for lunch
 
but our layers are kinda intervowed on a level where I can't really do much
and I have no clue on how to use mockito
 
Lunch time here aswell
 
and in 30minutes I got a presentation in front of 10 11-14 yr. old girls about "What a programmer does"
well I had some already ;)
 
@Vogel612 I'd say to them: A programmer hangs around the internet all the time and if the boss is looking says: It takes time to compile :)
 
11:34 AM
@Nobody my "boss" is watching...
better not tell the truth then
also
 
is your boss a 11-14 yr. old girl?
 
i am to "program" a calculator with them
in EXCEL
naaah, she's just also watching (AFAIK that is.)
 
what is the occasion for the girls to visit? anything like girls day or the like?
 
exactly
 
you're in germany, right?
I thought it was already this year but it seems I remembered wrongly
 
11:38 AM
0
Q: Is indentation of #if & #endif directives an important readability convention?

dumbledadI'm sharing C# code with a fellow programmer who is more use to writing C++. He uses #if and #endif directives (which I do not tend to use) and when they occur they have no indentation, for example private void dumpToDisplay() { #if false ushort[] ScanStatus = new us...

0
Q: JavaScript Good Patterns - Is this a good example?

Ivo PereiraI have been trying various formats of namespaces and modules patterns, however I have not came across a solution that I would use for all my projects. I've been developing the following, that would allow me to separate my application through applications, modules, functions and global variables....

0
Q: Processing C++ comments

AngewHere's the first functional version of my Python 2 script for processing comments in C++ source files. It's a personal project, I expect to expand it later with more advanced options (mainly about replacing comments with whitespace or marking their original positions in the comment-only output). ...

 
@Nobody y I am...
 
did you already do something like this?
I am keen to know how the girls pick it up
in my university there are some "courses" for girls day
where they can play around with some robots or computer programs
(at least this is what I can see at the CS department)
 
nope...
last year in our company was a huge failure...
not a single girl showed up
 
how do you know there will be some today? did they have to enroll in a list?
 
yea.
g2go, it's just 15 mins left, and I should move my laptop
BBL
 
11:44 AM
good luck :)
 
12:11 PM
And back form lunch
 
12:21 PM
0
Q: Evaluating a polynomial

user3426320You are given a polynomial of degree n. The polynomial is of the form P(x) = an x n + a n-1 x n-1 + … + a0, where the ai‘s are the coefficients. Given an integer x, write a program that will evaluate P(x). You are provided with a function named power( ) that takes two positive integers x & y a...

 
btw @SimonAndréForsberg nothing against your review at codereview.stackexchange.com/questions/45015/…, but I haven't accepted it yet as I heard that @rolfl was also going to answer it, so I'l still wait.
Also, you suggested the use of Executors.cachedThreadPool() there, but I cannot seem to find the possibility to set the upper bound
 
Monking all!
 
Monking! :D
 
Morwenn ... did you pick up Lola from yesterday?
We were all thinking that you look like the kink on the left.... ;-)
 
Monking @rolfl!
 
12:28 PM
Hey @skiwi ;-)
 
Argh... Why did they name a Supplier a Supplier in Java 8 and not a Producer... I always keep typing it wrong!
 
@rolfl Yeah, I did listen to that song.
 
Because, like drugs, you get them from the supplier, not the producer ;-)
 
@skiwi There might not be an upper bound for that one, are you really sure that you need to set one? I'll take a look at the executor methods though to see what I can find
@rolfl Monking!
 
And well... my hair is generally more curly than in my profile picture :p
 
12:30 PM
@SimonAndréForsberg Well for the code you commented on, I don't know, but I do need it for the code I'm working on now.
@rolfl That's actually a good combination.
Explanation, not combination.
 
So, it is March27, and it is still winter here.... I try to be up-beat about these things, but, -12 for crying out loud!
 
@skiwi One can always use a constructor
 
I chose to live here (bloody immigrants) and promised myself I was not allowed to complain ;-)
 
@rolfl: Is there a time when there is no winter in Canada?
 
But, they close the ski-slopes in the first week of march, so, it's still winter, but there's no skiing!
@Nobody - yeah, in the Summer in toronto it gets hot.... like +40C hot.
 
12:34 PM
@rolfl We've had Spring for almost a month in Sweden now! I thought Sweden was supposed to be cold? :)
 
Snow in the forecast for later today.... they are suggesting this will be the last time.
 
SQL Injection review and a bunch of other stuff:
0
A: Connection to a database, do I need to create a new one and close it everytime?

Simon André ForsbergI have to agree with Praveen's comment that you should open a connection when you need it and close it when your are done with the Database operations. But first I have to make a serious objection to this statement: ps = conn.prepareStatement(SQL_QUERY.replace("?", id)); That is not the way y...

 
Yesterday it dumped 50cm of snow on eastern Canada.
 
@SimonAndréForsberg: We had near 20C the last week and this Tuesday we had snow
 
@SimonAndréForsberg Cool, I didn't know it was a pubic constructor, as it has great focus on the factory pattern in Executors.
 
12:35 PM
   Heh, you may want to correct that          ^^^^^^^
4
 
@skiwi I forgot about it. I've used it before but totally forgot about it :)
 
@rolfl It's too late, it will always stay pubic for now...
 
hm sounds wrong: always ... for now
 
Yeah, and @SimonAndréForsberg may have a serious objection to some things!
 
When code gets nasty...
    @FunctionalInterface
    public interface SupplierWithIO<T> extends Supplier<T> {
        @Override
        @Deprecated
        default public T get() {
            throw new UnsupportedOperationException();
        }

        public T getWithIO() throws IOException;
    }
 
12:41 PM
@skiwi Why....?
 
Ouch....
 
0
Q: Is it possible to declare that a Supplier<T> needs to throw an Exception?

skiwiSo I am trying to refactor the following code: /** * Returns the duration from the config file. * * @return The duration. */ private Duration durationFromConfig() { try { return durationFromConfigInner(); } catch (IOException ex) { throw new IllegalStateException("T...

That's why.
Overriding, Deprecating and defaulting a method at the same time hurts though.
Hmm actually... I wonder if I should declare a new interface here, as I just looked into the Supplier interface and it does not have any other methods as get().
 
That sounds reasonable...
 
0
Q: Remove nodejs/browser specific code in library

edi9999I'm the maintainer of the following library on github: https://github.com/edi9999/docxtemplater/blob/master/coffee/docxgen.coffee I want to maintain a library that works on node and in the browser, however I don't want to have to update two separate repositories. The ugliest code looks like thi...

 
I think I'll really love default methods...
 
12:49 PM
morning
 
Morning @BenVlodgi
 
@skiwi - I think they will be a problem too.
It is a new vector of invisible functionality
A place where things can go wrong, and you can't see it, so it is the last thing you think about.
 
Hmm... in what way?
 
Ummm.... why is this link "not found"?
 
I'd say all proper projects have proper documentation about all their methods, so also the default ones.
 
And if you are implementing an interface yourself, and calling default methods then, you ought to know what they do in my opinion.
It does not take away that lots of people might have problems with it.
 
Thanks Monkey.
 
@SimonAndréForsberg - I think after the release of JDK8 they moved the documentation from downloads.* to docs.*
 
Might explain as 2 days ago half of the documentation (searched via google), was down.
 
@SimonAndréForsberg my guess is because The requested object does not exist on the server. The link you followed is either outdated, inaccurate, or the server has been instructed not to let you have it.
;)
 
12:56 PM
I think the official response to that is: "No shit, sherlock!" .... ;-)
 
@BenVlodgi Smart thinking! Why didn't I think of that?
 
I almost didn't myself
 
2
Q: Refactoring Methods With Conditionals

Md.lbrahimI have always suffered with too many conditionals in some of my methods. The following is a pseudocode/skeleton of one of my method like that: private List<ReturnType> DoSth(string name = null) { List<ReturnType> names = new List<ReturnType>(); for (int i = 0; i < somearray.Length; i++)...

 
Thanks @ChrisW @Jamal for taking care of codereview.stackexchange.com/questions/45335/…
 
1:00 PM
.... uhm .... sure! (It was ChrisW and Jamal .... mostly).
See how much fun you have been missing ? ;-)
 
Yeah
I still need my ZZZzzz... regardless
Also, @Malachi cool beans, have you decided to become super generous with bounties?
 
This is an interesting challenge... The config of the program needs to be able to be modified realtime, and I'm using an ExecutorService with a fixed amount of threads :)
And the amount of threads is in the config file.
 
@konijn - this new question needs better tags, and you are the expert there (I was not sure what to do)..... codereview.stackexchange.com/questions/45491/…
 
Does using Class and Class.getConstructors() fall under reflection, or is it somewhere in between norma usage and reflection? As you ought to be wary of using reflection.
 
Looking at it
I am wondering, I would like to add the tag cross-host
any objections?
perhaps cross-js-host ?
 
1:06 PM
Using Class is fine, using class.getConstructors returns java.lang.reflect.Constructor and is thus reflection
@konijn - see if SO has something similar.
If it does, borrow the SO tag.
 
Maybe I can work around it with a Function
 
@konijn - there is a difference between and .
 
I knew that ;)
 
I didn't :o
 
Did I already tell I love Java 8?
public static <R> R readFileEntry(final Path path, final String entryKey, final Function<String, R> converter) throws IOException {
    Objects.requireNonNull(converter);
    return converter.apply(readFileEntry(path, entryKey));
}
private Duration durationFromConfigInner() throws IOException {
    String entryKey = subClass.getSimpleName();
    configLastModified = Files.getLastModifiedTime(configFile);
    return ConfigFileUtils.readFileEntry(configFile, entryKey, Duration::of);
}
 
1:12 PM
Noops, nothing like that on SO
 
@skiwi I've never seen you mention Java 8 before.
 
That sarcasm...
 
That's fine. At least, you seem to be enjoying yourself, that's cute^^
 
Ohhh .... 'that's cute' .... dem is fightin words!
 
@konijn I don't know that it's fixed yet: it's locked, but the version which you reviewed hasn't been restored yet. In summary, I suggested that Jamal could do this but he has delayed doing that until he gets your agreement.
 
1:17 PM
@rolfl I don't quite understand the end of your sentence.
 
"fighting words" = "words which incite a fight". en.wikipedia.org/wiki/Fighting_words
 
Wow. I learnt something new.
 
@Jamal On the 27th March, I decideth that ye should roll back to version 11
@Jamal please ;)
 
Much interesting...
private Duration durationFromConfig() {
    return handleIOException(() -> {
        String entryKey = subClass.getSimpleName();
        configLastModified = Files.getLastModifiedTime(configFile);
        return ConfigFileUtils.readFileEntry(configFile, entryKey, Duration::of);
    });
}
 
@konijn Why not let the OP keep their latest/greatest edit, and add the version 11 original code to the top?
 
1:22 PM
@ChrisW Thanks for that .... I knew the expression, but did not know it was 'official'. I learned something too ;-)
 
Refactoring is the art of rewriting one single huge file, into a codebase of double the size spread over tons of files.
3
 
@skiwi But it's also doubly "idiomatic", "generic" and "clean".
 
@skiwi - the benefit of refactoring like that is you can then refactor it again as job-security.
and there is more to refactor the second time around.
 
@skiwi That's the first part of refactoring. The second part is subsequently being able to 'maintain' those small files instead of the one huge file.
 
@rolfl Exactly, every time you refactor, the codebase grows, so there's more to refactor.
I think I can live with this calling code now:
private Duration durationFromConfig() {
    return handleIOException(() -> getFromConfig(subClass.getSimpleName(), Duration::of));
}
 
1:27 PM
Ahhhh crap .....
I am going to have to relearn how to read Java ....
 
@Jamal, or, what @ChrisW said :Why not let the OP keep their latest/greatest edit, and add the version 11 original code to the top?
 
Infected Mushroom - Converting Vegetarians
 
Though really, it is so rambling, I think version 11 is more readable
 
@rolfl You will need to relearn all with Java 8.
 
@Morwenn - is any of your music up on youtube ... ?
 
1:28 PM
Once you get the hang of it is pretty simple
 
@rolfl You mean the music from my band?
 
Also I figured something interesting:
@FunctionalInterface
public interface CheckedSupplier<T, E extends Exception> {
    public T get() throws E;
}
I wonder if there is any reasoning behind as to why Java does not have default values for methods instead of the current method overloading... (Though method overloading should surely stay!)
 
"There's an idiomatic workaround for a know problem, no need for an idiomatic clean solution."
Here's is a song from my band (the only recorded one where I'm actually playing):
 
@Morwenn You know the value of that song now skyrockets as you just said it is the only one where you are actually playing?
 
Haha :D
But I also did some music on my own that you can find on YouTube too. It's... pretty different.
 
1:37 PM
Still tripping on converting vegetarians......
 
Converting Vegetarians is awesome! It's like a once-in-a-lifetime track!
But I have another argument to sell that folk metal music I just shared: there's a banjo solo.
 
@Morwenn Cool mix of folk and metal.
 
@ChrisW Thanks :)
 
The recorder makes a nice addition.... and it stands well for its solo.
Just at the banjo part now.
 
The best one - at least production-wise.
 
1:43 PM
0
Q: Pythonic way to dynamically generate Strings (or other variables)?

Jeff GohlkeI've got a Python script which is meant to launch several other shell scripts with the appropriate setup and parameters. I construct the file paths from other variables so that it's easier to change one setting and have it apply everywhere, rather than hardcoding everything. So, for example: H...

 
If anybody's interested, I also do some ESM (Electronic Shit Music):
 
Are people notified of updates on answers to their questions?
 
I don't think so.
 
No.
 
Nope
 
1:45 PM
@Morwenn - this was my introduction to classic-cross-somewhat-heavy music:
This is from the 80's..... so, at the time was 'modern'.
 
@BenVlodgi Therefore I sometimes post a comment so say I updated my question.
 
I went to many of their gigs, but didn't like the scene that much.
 
@rolfl I like that :)
 
Anyway, I can honestly say "I know the cellist from The Outsiders". ... ;-)
 
... e.g. if I edit after the question is accepted, or if I edit because they asked a question which I replied to by editing the answer.
 
1:48 PM
@rolfl And I can honestly say "I have never heard of The Outsiders".
 
@SimonAndréForsberg You won't be able to say that anymore.
 
@ChrisW indeed, good idea, tnx
 
@SimonAndréForsberg - really..... there is a much more famous "the Outsiders".....
 
@konijn on the unanswered ones where the user is still active in the system
 
1:50 PM
@konijn I also dropped the HTML tag in Favor of the Javascript tag which should help you find it in your searches. it had two JavaScript Libraries in it, should have had that tag to begin with
 
Ah, that might explain it :D
 
there are a bunch of C# questions, in the last 3 months with no answers. I should jump on that.
Later
 
I just put the 3rd answer on a 2011 zombie!
2
0
A: Detailed logs and keeping code clean (not AOP)

Mat's MugAn alternative to resorting to AOP, could be to extract a IFileReader interface, and to decorate the FileReader with some LoggingEnabledFileReader - note that sealed explicitly prevents your code from being extensible, I'd drop it (un-sealing a class shouldn't be a breaking change). This solution...

 
TTWN -> Time To Work Now
@Mat'sMug what about this one?▼▼▼▼
6
Q: C# SocketAsyncEventArgs send and receive

Matty SouthallI been working on getting the SocketAsyncEventArgs to work the way I want it to work. Now I was wondering is this going to work how it should work? /// <summary> /// The settings to use with this ServerSocket. /// </summary> ServerSocketSettings Settings; /// <summary> /// The buffer manager fo...

AFK
 
Now I was wondering is this going to work how it should work?
Honestly? No clue!
 
1:59 PM
@Mat'sMug I didn't want to answer it. I'm inexperienced with the API and thought the best answers would come from testing/load testing.
 
0
Q: array whose values are the product of every other integer

footyI was asked the following interview question over the phone: Given an array of integers, produce an array whose values are the product of every other integer excluding the current index. Example: [4, 3, 2, 8] -> [3*2*8, 4*2*8, 4*3*8, 4*3*2] -> [48, 64, 96, 24] and I gave the following an...

 
Interesting... Java 9 possibly will try to solve Java on the GPU, Erasure vs Reification, Primitive vs Reference types (without performance cost), new JNI, and of course the delayed custom profiles.
 
@skiwi - where did you find that? (and yes, IBM is working on this too: enterprisetech.com/2013/09/22/ibm-pushing-java-accelerated-gpus )
 
Pretty old actually
Yet recent enough.
Same conference as the article I linked.
 
C++14 finally standardizes variable templates instead of stating that a member static variable of a class template is an idiomatic workaround.
 
2:10 PM
@skiwi - here is a more recent release: nvidianews.nvidia.com/Releases/…
 
Looks nice
 
2:25 PM
@rolfl You know a lot about ExecutorService... I should've asked you before, but already have the SO question up...
1
Q: Middle ground between ExecutorService.shutDown() and ExecutorService.shutDownNow()

skiwiI currently have an ExecutorService where I want the following: No new tasks should be accepted. Current tasks should still keep on executing. All currently queued up tasks should be returned. The issue I am facing is that the shutdown() will not return any non-executing submitted tasks (in f...

 
@skiwi I have an idea for that one, will write an answer
 
Cool, looking forward to it
 
@skiwi First answer written, will edit a bit
 
@ChrisW all I'd have to say would relate to the tight coupling going on in the constructor, the multiple responsibilities of the Init method, and the off-putting naming UserToken being of type Connection... I guess I could make an answer out of that...
 
@SimonAndréForsberg Perhaps you should remove the Skiwi() in a public answer ;)
I'm trying to make a resizable ExecutorService, but I think the current approach will not be stable :(
 
2:33 PM
@Mat'sMug You could. Again, IMO those aren't the topics that the OP wanted answered; but yes I know that reviewers are free to answer/comment on any aspect of the code.
 
@SimonAndréForsberg - you have to clear the queue as well, the ExecutorService completes all tasks in the queue before it terminates.
 
@rolfl Like that?
 
I would do: ArrayList<Runnable> queued = new ArrayList<>(); queue.drainTo(queued);
 
@ChrisW kinda sucks that I can't seem to address the OP's concerns whenever it gets specific. starts to question own skills...
 
@SimonAndréForsberg No, drainTo is the right thread-safe solution.
 
2:35 PM
@rolfl There is something called a comment in the SE world you know :) (will fix)
 
O wow... ThreadPoolExecutor provides the option to change the amount of threads, I have been silly trying to implement it myself.
 
Yeah, I don't want to pollute your answer ;-)
 
@skiwi Replaced Skiwi with Special :)
@rolfl That better?
 
@SimonAndréForsberg Yay, I'm more special now!
hmm, is this even safe?
ThreadPoolExecutor executor = (ThreadPoolExecutor)Executors.newFixedThreadPool(threadCount);
 
2:38 PM
@skiwi Sometimes yes, and sometimes no. Depends on the implementation. Personally, I had problems with it when running on a Linux computer.
 
@SimonAndréForsberg prepare for a comment ... ;-)
 
I told you so! :)
 
Sometimes does not really quality as safe...
 
@skiwi Indeed it doesn't, which is why I would recommend using the explicit constructor.
 
@Mat'sMug Mostly the OP's fault / a hard question. Knowing what APIs result in best performance and predicting whether / how well they scale is difficult e.g. requires specific previous experience. And attacking the Zombie list implies you're trying to answer questions other people found unanswerable.
 
2:40 PM
@SimonAndréForsberg - nevermind, I am wrong, can't do that.
Think I will write a competing answer ;-)
 
I still find it unanswerable (as far as OP is concerned), it's just that I do see some things that could be worth mentioning, from a code review perspective. Writing a short answer right now.
 
I think it's a question best answered by performance/load testing, and/or by researching the literature. The best a code review can do is verify style (maintainability), testability, and inspect for edge-condition (e.g. race condition) bugs.
 
@SimonAndréForsberg what is your comment addressing? talking to yourself?
 
@rolfl How did you plan on overriding that considering the difference in returns? :) Unless you mean to override the shutdownNow() method?
My comment addressed your removed comment :)
 
That comment existed for about 4 seconds.... I am amazed you saw it ;P
 
2:43 PM
Now I don't know if I should accept @rolfl or @SimonAndréForsberg's answer :(
Meanwhile...
        Files.list(directory)
                .forEach(path -> executor.execute(() -> fileConsumer.accept(path)));
 
@skiwi So far the decision seems to be easy, as @rolfl doesn't seem to have written one.
 
@skiwi - accept Simons, there is not going to be one from me ;-)
 
But yeah I see what you are doing in the answer there
 
My reputation on SO so far today has been the biggest since one day in December when I posted this, slightly controversial, answer:
7
A: Does the <li> tag in HTML have an ending tag?

Simon André ForsbergThere is a difference here between HTML and XHTML. XHTML are more strict. While old regular HTML does not enforce it for all tags, all tags in XHTML must have an ending tag** to validate. Even <br> and <img> is often written as <br /> or <img ... /> to specifically give them ending tags. XHTML ...

 
2:47 PM
@SimonAndréForsberg .... @skiwi wrecked my low-rep-record on SO.
 
low-rep-record?
 
^^^ look at my rep-graph... I was so happy doing nothing until you wrecked it with one question.
 
Aaah... I know which question
From 4 march are also from that answer? :>
 
Compare that graph with:
Mostly, I have some JDOM answers in there too.
 
What, 290 rep?!
@rolfl Note the Java 8 release date:
 
2:52 PM
hey, I have 305 in there somewhere ;-)
@skiwi - you are on the front page: stackoverflow.com/tags/java-8/info
 
wow :o
cool
Finally, I outclass @JonSkeet somewhere.
2
 
@skiwi is #4 on SO ... ;p
4
 
Why did I have 277 on 7 december...
Ah... I decided that day that I wanted to get a bronze badge for capping out
 
Does anyone know how it would be possible to (easily) install Java 8 on a Linux machine without touching those dirty Oracle binaries?
 
Time to debug a strange NPE...
 
2:59 PM
@amon there should be an unzippable version somewhere....
 

« first day (327 days earlier)      last day (3689 days later) »