« first day (265 days earlier)      last day (3745 days later) » 
00:00 - 19:0019:00 - 00:00

12:00 AM
@ChrisW - didn't I just say that ;-)
 
didn't you.
 
RELOAD !!!!!!!!!!!!!!!!!
 
12:22 AM
And... enough voting for tonight. I'll be more less useless tomorrow :)
 
12:53 AM
7 points, just sayin'
JM
 
What are you talking about, willis?
3
 
1:14 AM
0
Q: Entity Framework, code-first repository pattern review. Where to validate?

RyanI've been iterating on my repository pattern implementation over the course of the past 4-5 months. In my new projects I choose to use this pattern and I try to improve upon what I learned in previous projects. I'm pretty pleased with the state of my current implementation. I feel like I could im...

 
1:25 AM
@Malachi Why did you edit the tags on this one; and/or why does this site have 5 different asp.net tags?
 
because there are different tools and things for each version of ASP.NET framework and then there is a different set for MVC as well.
that person couldn't decide between MVC 3 or 4 so I put the generic MVC on there. and added ASP.NET because ASP.NET is the main framework
and it needs a couple more questions to reach 200 for that tag
 
Yes. An advantage of fewer tags would be that they reach 200 more quickly.
 
 
1 hour later…
2:51 AM
0
A: Entity Framework, code-first repository pattern review. Where to validate?

lol.upvote The only thing that I think if slightly leaky is updating an existing entity. It isn't the only leak you have: public interface ISession : IDisposable This is a leaky abstraction. You have a specific implementation in mind - one that implements IDisposable, and you're leaking this specifi...

 
Sorry, got no votes.....
... for you....
...only got votes for questions .... @lol.upvote (Ding!)
 
tsss
 
Syborg has been so quiet on chat because he's embarassed about his lack of answer voting.
3
 
Should I pin this? :)
ugh. I "accidentally" spent another 12 votes...
only 13 left for tomorrow.
 
2:57 AM
the up/down ratio is rather unbalanced. you know that downvotes also count as question votes right?
 
He's now only 30 behind me.... and we started at:
Jan 17 at 4:08, by rolfl
@syb0rg - you are short 372 question votes from electorate, I am short 276 ...
 
that's 96
 
So, Jan 17 to today, that's 6 full voting days.
6*40 is 240 .....
he started 372 short of 600, or 228.
And he's now at 427
 
impressive
 
In that same time I have gone from 324 to 457 ..... 133 question upvotes.... compared to his 200.... so I have voted on a bunch more than him.... (answers, that is ).
(though I have only used 3 of today's votes) ... he's used them all already.
 
3:01 AM
it'll be interesting to see the cumulated January voting figures on your chart, especially vs previous years :)
 
Yeah.... between the two of us we will be individually adding 560 votes per week... which is about half of the 1100 votes that is 'normal'.
(last weeks total).
With your daily max as well, that's 3/4 of the whole of last week's voting.
But, that is normal for answer voting... not question voting... I guess the three of us contribute only 3.4 of half of the voting.
 
That's why I said the voting figures will be interesting. I expect a "slight" bump in the Q votes.
 
1850 votes the previous week, total Q&A
 
did you just upvote my answer or that +1 was from someone else?
 
Part of that was already us.... and we were heavy already... so we may not make much difference now
yeah, I had upvoted that answer.... looks good.
'leaky mug'.
 
3:08 AM
haha
 
Seen this getting-old-nearly-ready-for-retirement zombie?
0
A: How to hide implementation of JDBC while processing large query in client's code?

rolflYour assumption that the entire dataset is read in to memory is not necessarily accurate. The JDBC clients I have worked with (DB2, MS-SQLServer, Sybase, Oracle, etc.) each default to, or have an option to limit the size of the client-side buffer. You only have a small amount of data on the actua...

 
Thanks! ..but now you're lagging behind the robot!
What are you talking about? That answer has an upvote!
 
hehehe ;-)
 
Hmm. I really like the sound of your answer. I'm currently trying to absorb what you said and think about how it'd look. So, if I scrap the generic repository class, which is indeed pointless as far as I'm concerned, and make my services translate between ViewModel and Entity ... I'm just trying to picture what these ViewModel classes would look like. It sounds like I would need a lot of them, one for every possible View. Also, my service methods would need to be very specific as well, one for each View also, basically. — Ryan 8 mins ago
I hope an actual ASP.NET/MVC programmer reviews that code. I get a feeling that my WPF/Windows background is steering him in a direction that I can't be sure makes sense with MVC.
 
You sound like I sound like when I review C# code... that's not a good thing, is it?
 
3:21 AM
yeah... dunno.
 
You know you've done a lot of C++ programming when the semicolon key finally stops working. Or perhaps my (external) keyboard really does suck.
2
 
Ooohhh... I got a steelworks keyboard... amazing.
 
wow
 
Also, FWIW, I run out of Ctrl key before the ; goes....
Between the two good keyboards I have had (IBM clackety, and the steelworks), I tended to replace them every 18 months.
 
It's also the quotation mark key, and the period key is kinda slow. Now I'm back to my laptop keyboard, which is an inconvenience when I'm using my external monitor. Time to browse Amazon...
 
3:24 AM
Jeff Atwood wrote a Coding Horror blog a few months ago (last fall I think) about a programmer's perfect keyboard that he developed with some friends. I need to find the link...
 
@Jamal - consider the best mechanism for a not completely outrageous price
 
@rolfl: I'll see if Amazon has that. I'd prefer to shop from there since I have gift card money.
...and now the price has loaded on the screen. gulps
 
Be warned that a solid-click keyboard is different to modern things (since you were born).
 
If anything, I can really benefit from a keyboard that can defend from even the worst eat-right-next-to-the-keyboard user. But I don't think there's such a keyboard like that.
 
3:31 AM
Be warned also that as you get happy with your keyboard, you won't happy with other ones when you need them.
 
^^ last mechanical keyboard I used
 
 
I wouldn't be surprised if it were a higher quality than my Microsoft one.
 
The Model M is the trend-setter... everything else is trying to imitate it.... including steelseries and coder....
 
@rolfl I've seen keyboards like this, but they were more in shades of... yellow.
 
3:34 AM
They did not age well, especially since people back then were mostly smokers....
and had dirty hands, etc.
When you used to get grease on your hands from changing disks in the mini,
 
^^ well-earned "lol"
 
Mix that with the ash from your spilled cigarette, as well as the heavy coffee atmosphere...
Those are the keyboards that people used to 'throw'.... and the wall would break.
2
 
0
Q: Refactoring Java class with lots of constants

airbearclass MyObject { public static enum Type {A, B, C, D;} public static final int ID_MAIN = 1; public static final int ID_MAIN_UK = 2; public static final int ID_MAIN_US = 3; public static final int ID_SUB = 4; // lots more constants here public static final String DESC...

 
I still have mine, but I actually like the windows and fn keys.
 
I may just go back to Logitech this time.
Or fork over the dough for a gaming keyboard.
 
3:47 AM
I have a MS "Natural Keyboard" at work, I like it very much and miss it a lot when I get home. But it takes some getting used to.
 
I have a dvorak keyboard using EBCIC ... kidding.....
 
But it is easier with my opposing toes.
 
 
4:07 AM
all right, it's getting late, I have some sleep to catch up. see you tomorrow!
 
Night!
 
tatata
 
 
1 hour later…
5:27 AM
0
Q: Using Callback in Codenameone native code using Java

kpanI would like to use Callbacks in my StateMachine to fetch values from Callback class, that is set in the native android code. Is this a right approach to create one. Do you see any issues with the code. public class PrintCallBack { private static String bluetoothDevices = ""; private static St...

 
5:52 AM
0
Q: Find the longest unique string in the input list

JavaDeveloperGiven a list, find the longest non-repeating (in other words I mean unique) string in the input list. Looking for code review, pointers on best practices, optimizations etc. public final class LongestUniqueWord { /* * do not initialize this class */ private LongestUniqueWord( ...

 
 
1 hour later…
7:00 AM
0
Q: delete duplicates in a linked List

LiondancerI am reading cracking the code interview and I am getting a bit confused at the bit using 'previous'. In this problem, the method deletes duplicate nodes in a Linked List. My assumption is that head is used to scan through the linked list while previous is used to update the linked list head be...

0
Q: Guessing a unique 4 random digits number

Rafa ElI've created a simple game, in which user needs to guess 4 digits number between 0-9, generated randomly using Random() (The 4 digits is unique). User has 5 attempt to guess, and each failed(almost correct) guess will tell the user in which part they got it correct. Do you think this is too hard...

 
7:58 AM
0
Q: Resize iframe & textarea in reverse directions

Rain LoverI have a textarea and iframe whose sizes should change dynamically and in reverse directions. I'd like to achive this effect without using a frameset or jQuery plugin. Here's the result of my attempt: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> ...

 
 
2 hours later…
9:55 AM
0
Q: Optimizing my Project Euler Problem #23 code

Mohammad Areeb SiddiquiSo I am trying to optimize my Project Euler problem 23rd code for almost a day now but my program is not ready to get small and optimized. Can anyone please tell me how can I do that? Here's my code(Python): def isabundant(n): return sum(list(x for x in range(1, int(n/2)+1) if n % x == 0)) > ...

 
10:26 AM
0
Q: How to write an template class or gem to apply on semiliar functions

pocI have many similar tasks, The common flow of tasks is run_automation in controller, then launch a series of tasks one after another. setup do something teardown Now I just did the copy and past from an older script to a new one. Then modify something in the new script. I think there must...

 
10:38 AM
0
Q: Checking if a string matches an array of valid characters

rmcmkI am wondering what a better solution would be for this bit of code: public static void main( String[] args ) { String name = "hello, ddd"; boolean[] success = new boolean[ name.length() ]; for( char character: VALID_CHARS ) { for( int index = 0; index < name.length(); index...

 
11:15 AM
0
Q: Boolean expression complexity and bitwise operators

janosGiven this kind of code: public static final int DEFAULT_MASK = Mask.BASE | Mask.SECTOR | Mask.GROUP | Mask.INDUSTRY | Mask.NAME | Mask.COUNTRY Sonar raises a warning: Boolean expression complexity is 5 (max allowed is 3). What would be a good way to deal with this? ...

 
11:40 AM
0
Q: Interop Function to export to excel from C#

user35501Please Help me to export Values which is there in Data grid to Excel using the introp function.. I have 3 tabs having 3 different grids i have to get all three grid in a single worksheet or atleast in a single work book

 
12:11 PM
1
Q: Python Creating objects to be added to a list

andy bootWhen creating objects to be added to a list in python we can avoid the 'if' statement by changing our create_object function to return a list. Is this a good idea or not? Why? (assume create_object is called in multiple places and is always added to a list). def _create_object(self, data): if...

0
Q: Operations on files and their locks - code too bulky?

avalanchaA couple of hours ago I asked a question on Stackoverflow to find out if there is a good way to delete files in a folder only if all files are indeed deletable and I got some good answers that led me (I think) in the right direction Based on the two currently most upvoted answers I scrambled tog...

 
12:48 PM
It's always exciting to run a process that can will probably take around five minutes, without having a clue about whether it will work or not.
If it doesn't work, then try to fix the error and run the process again for five minutes.
 
 
1 hour later…
2:08 PM
@rolfl Are you good in Hibernate? I'm having a problem at work with this.
I want to persist an entity in the database, but there's a big bad CascadeType.ALL on a @OneToMany relationship, and when persisting/commiting transaction I get an OutOfMemoryError: java heap space :/
 
@SimonAndréForsberg - sorry, never used it.
 
@rolfl You should :)
 
> Are you good in Hibernate? I'm having a problem at work with this.
really ^^^^ ???
 
oldest computer I have ever used
 
@rolfl OK, perhaps you shouldn't :) You have a point there :)
 
2:12 PM
Q.E.D. ;-)
 
Should we have a multiton pattern?
In software engineering, the multiton pattern is a design pattern similar to the singleton, which allows only one instance of a class to be created. The multiton pattern expands on the singleton concept to manage a map of named instances as key-value pairs. Rather than having a single instance per application (e.g. the object in the Java programming language) the multiton pattern instead ensures a single instance per key. Most people and textbooks consider this a singleton pattern. For example, multiton does not explicitly appear in the highly regarded object-oriented programming text ...
It seems that we should create it as a synonym for the singleton pattern?
 
@konijn How could it be a synonym when it's not the same thing?
 
0
Q: Is this a true Multiton and is it thread safe

OldCurmudgeonSee WikiPedia - Multiton Pattern for details on the intent. Here's the class: /** * Holds a thread-safe map of unique create-once items. * * Contract: * * Only one object will be made for each key presented. * * Thread safe. * * @author Paul Caswell * @param <K> * @param <V> */ p...

 
"Most people and textbooks consider this a singleton pattern. "
from the article
it is a singleton with added feature
 
Like C++ is C with some added features ... ;-)
 
2:24 PM
to me it singleton is a swallow, multiton is an African swallow
 
I think we should give new tags a chance before removing them.
2
 
^^^ ditto ^^^
So, I think we should close it as not being the OP's code ..... !
 
@rolfl Why?
 
@SimonAndréForsberg:
    * @author Paul Caswell
    * @param <K>
    * @param <V>
 
@rolfl Should we ask the OP who Paul Caswell is and why the OP is posting Paul's code? :)
 
2:36 PM
Well, I considered it.... but then I thought ... "Damn, I'm late for a meeting".
3
 
I might have solved my problem now...
Will know when the queries has finished executing :)
 
@rolfl I just looked at the query again. and I am joining Tables that I don't need to, I moved some of those tables to the function, so I should take them out of the query and let the function do what it does
 
@SimonAndréForsberg I think the OP is Paul Caswell.
 
@ChrisW Tell that to the monkey
 
@rolfl A Java-related post by Paul Caswell: rootschat.com/forum/…
 
2:46 PM
@ChrisW Btw, are you and ChrisWue the same user or do you just have horribly similar usernames?
3
 
Different users.
 
OK
Couldn't one of you be lol.chris instead? :)
 
EXCEPTION: java.lang.OutOfMemoryError: Java heap space <--- oh crap!
 
... matches the age and country (though not the photo) of the OP of the Multiton question.
 
2:48 PM
huh.... the SE Photo looks feminine....
Maybe it is just my old eyes ..... and monkey brain.
 
@rolfl it's a picture of a kid
 
leaving job for today this week in 10 minutes, catch you later
 
@rolfl And yours looks like a monkey, but who am I to judge?
3
 
I've seen lots of people that use pictures of their children in their profile.
 
true ....
like me.
 
2:50 PM
0
Q: Generator expression in combination with StopIteration: kind of a hack?

LarsVegasThe first piece of code should cover the standard expected data. But as you can easily see, the data not always conveys to this standard. The code works great but I wonder if this is thought be a miss-use of the try/except clause. Better to go with if/else? try: short_name = short_name.upp...

 
That awkward moment when one realizes that you and @ChrisWue are two different persons (conspiracy theories aside) :) — Nikita Brizhak Jan 16 at 10:34
2
 
1
A: Finding an element in a list

ScüterIn your first piece of code... count = count + 1 can be rewritten as: count += 1 Secondly, putting count = count + 1 under a return statement is silly. The return statements boots you out of the function meaning that code will never be run. Finally, adding continue at the end of a l...

1
A: Operations on files and their locks - code too bulky?

HeslacherWhy not use a class to hold both the file and the lock, so you don`t need to manage two Lists like: public class SafeDirectory { private File directory = null; private FileLock lock = null; private List<SafeFile> deleteableSafeFiles = new ArrayList<>(); public SafeDirectory(Str...

1
A: jQuery Fallback Support for the CSS Property "background-attachment: local"

konijnThis code annoyed me for a while, the part outside of the initialization does not belong and it seemed silly to add it to the listener. Plus, the code outside of the listener will mess up when you have multiple data-holder elements. Then I realized that I could take a different approach, do this...

1
A: Boolean expression complexity and bitwise operators

ChrisWThe first expression in the OP is better than its alternative; and as amon said in a comment this warning is IMO a mistake by Sonar. Therefore, I suggest, see Turning Sonar off for certain code on StackOverflow.

0
A: Python Creating objects to be added to a list

Michael UrmanAvoiding an if statement is not a useful goal. Occasionally it is the correct means towards a goal, such as making code easier to write or to understand. Thus I think your question is too narrowly focused, or oversimplified. The problem here is that the wrapper function _create_object is too simp...

0
A: Boolean expression complexity and bitwise operators

Simon André ForsbergWithout any more information than in your question, this is just a thought. I have no idea what Sonar would say about this approach: private static final int part1 = Mask.BASE | Mask.SECTOR | Mask.GROUP; public static final int DEFAULT_MASK = part1 | Mask.INDUSTRY | Mask.NAME | Mask.COUNTRY; W...

2
A: Checking if a string matches an array of valid characters

rolflmemory is surprisingly fast and efficient. If your string-to-test is even modestly large (like 1K), then you may find the following algorithm is efficient. This is especially efficient when the valid-character set is reusable.... boolean[] isvalid = new boolean[Character.MAX_VALUE + 1]; for (cha...

2
A: Optimizing my code for Project Euler Problem #23 (Non-abundant sums)

amonYour first problem is that you're trying to cram too much information onto one line. As a result, you loose the overview. Here is a simple refactoring: def is_abundant(n): max_divisor = int(n / 2) + 1 sum = 0 for x in range(1, max_divisor): if n % x == 0: sum += x...

1
A: Checking if a string matches an array of valid characters

HeslacherInstead of two for loops and checking the names chars with each char of VALID_CHARS i used one for..loop and check validness by checking, if the name contains the char by using the String.indexOf() method. public static void main(String[] args) { String name = "hello, ddd"; boolean fail...

0
A: Resize iframe & textarea in reverse directions

ChrisWPerhaps add overflow:hidden; to the CSS of the textarea and iframe, and add scrolling="no" as an attribute of the HTML iframe element: because otherwise, a scrollbar will appear when the slider is very big or very small. Maybe a scrollbar is what you want (for usability); but a scrollbar makes a...

is multiton a multi-anti-pattern?
2
 
@lol.upvote lol
 
Hmm I thought "multiton" was something that weighted several tons. lol.upvoted. — lol.upvote 3 mins ago
 
Had I known school would be closed today due to the weather, I would've slept longer. T_T
2
 
3:10 PM
0
Q: Could random unique selection using while cause an infinite loop?

EsaevianI recently came across code that looked something like this (generates 4 random numbers in an array, this is not the actual code, I just wrote this up now, so it's untested): var uniqueNumbers = new Array(); var count = 4; var max = 10; function main() { for (var i = 0; i < count; i++) { ...

 
"This question is off-topic because it contains code lifted from a book rather than code you wrote yourself." -> lifted from sounds a bit harsh here..
 
@konijn sounds like he is a thief
I need more Rep in SO......LOL
 
0
Q: Implementing MVVM in PHP

Oleg TikhonovI have made this small project to try an implement an MVVM design pattern with php. Any insights or tips for improvement are warmly welcome!. Also, the population script doesn't seem to be able to create the second table which has a foreign key constraint with a reference to the users table, is...

 
3:27 PM
Huh, never guessed how meaningless this query would be actually : data.stackexchange.com/codereview/revision/162696/207409/…
 
@konijn what does that mean?
 
Well, most everybody in that list does not need a little push to get over 4000
rep goes so fast that data.stackexchange cant keep up
 
big answer provided....
0
A: Is this a true Multiton and is it thread safe

rolflI think your use-case and the Wiki description are different. Technically, the Multiton should return the exact same intance for the exact same key, always, but, because your multitons Map is not a static instance, you can simply create multiple instances of the Multiton and each one will generat...

 
@konijn it's Friday, SEDE is missing the entire week.
And I do need a little push to get over 4K :) ~hint~
@rolfl 5 votes left for today.
 
hint acknowledged....
 
3:36 PM
sam here
same is also here
 
same here / Sam is also here?
 
suffice to say that I have an odd sense of humour and that you got some extra rep ;)
 
lol.starred :)
 
@lol.upvote - can't double-up-vote, sorry, gave up looking for your answer candidates.
 
no worries, I gave up on yours too (plus there's way too many to browse now)!
1
A: Boolean expression complexity and bitwise operators

rabaYou could do something like the following. It may be better or worse depending on what you want to do: enum Mask { BASE(true), SECTOR(true), GROUP(true), ... OTHER(false) ; private final isDefault; private Mask(boolean isDefault) { this.isDefault = isDef...

2
A: Is this a true Multiton and is it thread safe

rolflI think your use-case and the Wiki description are different. Technically, the Multiton should return the exact same intance for the exact same key, always, but, because your multitons Map is not a static instance, you can simply create multiple instances of the Multiton and each one will generat...

CR has 20 trusted users!
 
4:11 PM
0
A: Could random unique selection using while cause an infinite loop?

ratchet freakyour first attempt is indeed in danger of getting into an infinite loop if a certain value never gets returned from rand, (but any half decent PRNG will return all of them eventually) your second attempt is very close to the (most efficient) fisher-yates shuffle, with the difference that you use...

 
4:24 PM
@lol.upvote At this rate, I probably won't make it before we graduate.
 
@konijn @rolfl woah I got a whole bunch of badges! [badge:nice-answer] [badge:necromancer] [badge:enlightened]
 
yeah
I gunned for questions where you had 9 votes
 
Awesome!
@Donald.McLean you'll be at least 3K which makes you able to close questions on a graduated CR, still good :) ...and does that mean you expect graduation to happen like very soon?
 
@lol.upvote I sort of have a vague understanding that the site is mature enough to graduate, but we're short on 20k users - people who will STILL be trusted after graduation. Since we have some users who are nearing 20k, I'm guessing that perhaps sometime this year?
 
Yeah I think 2014 is CR's year :)
We just need to keep voting!
 
4:33 PM
@OldCurmudgeon - hate to labour it... sure, in my version, Prayer is a Callable, in yours, it generates a callable. We both create a new Callable at the exact same point. In your case, new FutureTask<V>(prayer.pray(key)). here prayer.pray(key) creates an anonymous Callable instance. In my case, I do new FutureTask<V>(new Prayer(key)), which is a Callable. It is important you understand your own logic (not because I'm bashing you on this 'just because')... Perhaps join us in the 2nd monitor? — rolfl 42 secs ago
 
@rolfl seriously, how do you even manage to get any work-work done?
 
@lol.upvote - while people like @SimonAndréForsberg take 5 minutes to test things, it takes me 10 minutes to start my system, then another 30 minutes to get results.
4
 
they actually made a t-shirt with that!?
 
I know where to get them ... ;-)
 
@lol.upvote: He probably answers questions with his hands and work-works with his tail.
 
4:46 PM
WHOO HOO!!!!
JDOM is now being shipped in the native debian repository
 
@rolfl So that's how you gain so much rep! I gotta start writing slower methods.
 
Yeah ... it sure helps when you work on 'big' data... but, the down-side is I work crazy hours too.... like the job will finish in 2 hours... OK, I'll go home 'early', and finish it up when i get there....
@OldCurmudgeon and welcome to the 2nd monitor ;-)
(ding).
 
It seems I am being discussed ... <Grin>
 
So, since I am shameless, (and on the far side of the world, I hope), are you really Paul, or Pauline ;-) ?
 
That RC profile IS me. :) The photo is one of me as a child. ... but thanks for the creepy reminder that everything I do on the net is interconnected.
2
 
4:56 PM
@OldCurmudgeon Welcome. Being discussed here is really something positive. It makes people aware of your existence which provides opportunity for up-votes. Now, anyone want to discuss me?
 
@rofl - Shameless or not - I am Paul - a He. <Grin>
 
@SimonAndréForsberg: Who are you again?
2
 
@OldCurmudgeon you can do scary things with photos on google-images.
Drag your picture to images.google.com
 
Oh, and welcome, @OldCurmudgeon!
 
@Jamal Just a nobody without a diamond next to my name :) I am a trusted user nowadays though, so you'd better start trust me ;)
 
4:58 PM
@OldCurmudgeon does what I say about your Prayers make sense ?
 
@rofl - Anyway - on the Multiton comments - my tiny point was that if you let the Prayer object create the Callable it will only be created if the FutureTask is placed in the Map, i.e. it is the ONLY one. Under a highly multithreaded situation there may be several FutureTasks created but only one will get into the Map and therefore be run - thus only one Prayer object.
 
That's the place where the difference is.... you say: it will only be created if the FutureTask is placed in the Map ... and I say pray() will be called in order to construct the FutureTask that you may, or may not put in the Map
 
@rofl - In your (much simpler and therefore in my opinion better) code, every thread will create both a FutureTask and a Prayer.
 
Only if the concurrentMap comes up empty.... for both of us.
(I didn't mess that up, did I? let me check....
 
@rofl - But my Callable is only created when the pray method is invoked. Yours is created when the FutureTask is built - or am I misunderstanding.
 
5:03 PM
Is that when you pray it works? :p
2
 
You are misunderstanding....
The pray is called in order to create a callable, that is used as the constructor argument for the FutureTask.
(You create the Callable using prayer.pray()), and I create it using new Prayer() (which is a calalble).
For both of us, the actual call() method on the callable is only invoked when the FutureTask is run().
 
The pray is called in order to create a callable, that is used as the constructor argument for the FutureTask - no for the V. The FutureTask is always built for both of us.
 
The FutureTask constructor we both use.
It throws NUllPointerException if the calalble is null.
 
In my scenario there could be 1000 threads that create 1000 FutureTasks but only one will get to create a Prayer object.
Creates a FutureTask that will,upon running, execute the given Callable.
 
technically, none of your threads create a Prayer object. For you, Prayer is a generator instance that is final.
Your final instance prayer creates a Callable when you call prayer.pray(). That callable will create a V when you run the Callable.call().
 
5:09 PM
Yes! For me there is also only one Prayer. <Grin> For you there is a Prayer for every FutureTask.
 
OK, so, If I was to call my PrayerClass PCallable instead.... would that help?
Your code essentially does:
Callable<V> c = prayer.pray();
FutureTask ft = new FutureTask<V>(c);
Mine does:
Callable<V> c = new PCallable(key);
FutureTask ft = new FutureTask<V>(c);
We both create a new Callable instance.... and use it to construct a FutureTask.
 
Dammit!! You are right - sorry for the code blindness!!!
 
;-)
Technically, all things considered, I create one less instance than you .... a Prayer abstraction....
 
That was fun - thank you for not giving up.
 
You're welcome... and feel free to come haunt this place .... it's mostly friendly, except for @lol.upvote who's a mug.
2
 
5:15 PM
I'm saying nothing derogatory about lol.upvote - he upvoted my question! <Grin>
 
(he also 'owns' this room 2nd monitor .... shhh).
8990 and at repmax .... :( probably not 9K today....
 
I like the back of that shirt. I need to order one!!!
 
Now perhaps I'm not so "trusted" anymore:
0
A: Posting CodeReview on code shaming sites

Simon André ForsbergMea Culpa (For those of you who don't know Latin, that means "I'm guilty" / "My fault") I have to admit that I was the one who posted at least one question on codecrap. I might have posted a second one, but I can't remember which one. If there are more than that though, there's been someone els...

@rolfl Unless our new friend @OldCurmudgeon accepts your answer.
 
(... hear no evil ... ) mode .....
 
@SimonAndréForsberg, please turn around and put your hands behind your back. grabs handcuffs
;-)
 
5:29 PM
CodeMonkeys hard at work: ;-)
 
@Jamal Everything I say can and will be used against me, I suppose.
 
Of course ;-) But, what was that? Bananas?
 
@rolfl Not just any bananas!
 
I ate a banana this morning! Perhaps it'll allow me to answer questions today.
 
I gotta go to the kitchen and grab me a banana-nana-nana-na...
 
5:34 PM
ditto
 
Speaking of codecrap, this is really the code I deal with at work in a nutshell: codecrap.com/content/23
 
5:51 PM
I eat a banana and cinamon on cereal most weekdays.
 
every time someone says banana I think of Despicable me and that song they sing, or the banana skit on the extras
 
6:07 PM
Next weekend challenge, anyone? wimp.com/problemtimezones
 
what is the maximum size for a file that you want to open with Notepad....?
what is the limit?
 
0
Q: Problem with number to words C++

thenfluxSo yeah, I got this little problem our professor gave us. I got the concept, but my only problem is when I get a number that ends with the numbers 11-19. Instead of "one hundred eleven" I get "one hundred ten one". I know I didn't put the switch cases, but I already tried them and results are not...

 
45-54k I guess
this is much bigger than that......ugh
 
JEdit to the rescue ;)
wimp.com is having trouble
 
@Malachi - Use NotePad++ - I have opened >> 4GB files.
 
6:12 PM
Really, notepad craps out that quickly? Damn. Would've expected at least 50MB or so.
Yeah, Notepad++ can handle anything fine as long as it fits in memory. The second it starts swapping though, it gets very, very unpleasant.
 
I tried it in Notepad++ first
 
I have a laptop with 16GB mem .... ;) Helps
 
and it's not even a GB yet.. I think it's because the application creating the file crashed.
 
Jealous :(. Just got 8GB
 
I might have to rewrite someone else's code....
 
6:14 PM
which i thought was plently, but Chrome + netflix + virtualbox + thunderbird + ... = 1239819024GB
 
I bet I know what they did too....
I need to wait for the application to finish. I thought it crashed, becuase first it gave me an out of memory exception and then let me pick a place to save and then it wouldn't respond
so I killed it of course
 
Speaking of Chrome... Any of you guys use Chrome for SE chat? I have the CR in a fake application Window thing, and it pops up the "Blah blah blah has stopped responded" crap all the time. The window is actually fine. No freeze, no high CPU, no high memory nothing... Am just wondering if it's a problem on my end, or if it's a chrome + SE chat thing. googling doesn't bring up much.
 
that is why it wouldn't open in Notepad++ becuase it didn't finish writing the file so it thought it was a huge file
 
@Malachi I opened a 28 MB file not so long ago, using good(?) old Notepad.
 
@Corbin I sometimes have issues with memory eaten up on my machine I never thought it had somethign to do with Chat though....that is something to think about
 
6:19 PM
It's not a memory thing. It's just a bug as far as I can tell. I've just yet to be able to figure out if it's Chrome or Chrome + SE triggering it. It's just a false warning as far as I can tell.
 
@Corbin Windows keeps changing my theme settings and stuff.
I thought it might be linked....
alright it finished
 
@Malachi It worked fine with the 28 MB file I used.
 
Hrmmm, yeah that definitely seems like memory issues >.< lol
although Windows pops up a rather intrusive little "OMG YOU'RE RUNNING OUT OF MEMORY!!!! OMFG FLIP SHIT!!!!" when you hit 85% memory
3
 
0
Q: What is the best to select a javascript object property at any depth?

chafnanI'm looking for suggestions on how to select properties on the child level or deeper dynamically. For example, here is the method that I am currently using. The method parameters is the object and either a string or array for the property name. If a string is passed used, it will just will get...

 
Weekend challenge : curl this page : archive.org/details/stackexchange, parse the table with the site related 7 zips, output the list sorted by size of the 7zipfile.
waddayathink?
 
6:24 PM
@konijn Eh, I bet I can do that in 20 lines of Perl ;-)
 
are you saying you want to write more than 20 lines for a weekend challenge ? ;)
 
@SimonAndréForsberg
 
@SimonAndréForsberg I cannot get this file to open and it's only 1.19GB
@konijn smells like Code Golf
 
@Malachi There's nothing "only" about 1.19 GB.
 
0
Q: Is there a faster way to compare if 2 images are the same?

puretppcBitmap image1 = null; Bitmap image2 = null; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) //first image open { OpenFileDialog openDialog = new OpenFileDialog(); if (openDialog.ShowDialog() == DialogResult.OK) { image1 = ...

0
Q: Java API without exposing implementation details

cldfznI am creating an API for consumption by other developers to interface with an internal framework. My goal is to be able to have the developers type something like: profile.setPreference(new GroupPreference(id)); or UserPreference preference = new UserPreference(); preference.setDefaultInbox(...

 
6:27 PM
What type of format is it? Notepad++ gets pissy if a file has very long lines.
 
@SimonAndréForsberg I disagree: when a hard drive gets to "only" 1.19 GB free, "only" is warranted for.
 
@SimonAndréForsberg back when a hard drive was massive when it only held 250 MB I would agree with you....lol JK
 
@lol.upvote 1.19 GB is still plenty of space, come back when you have 115 MB free space! (Happened to me not so long ago on one of my drives)
 
@Corbin it's supposed to be an XML file, i was trying to check and see if the program created the file correctly, but apparently it didn't and I will have to rewrite an application.
 
Ah :).
 
6:32 PM
@Malachi Yeah, I remember a drive I had once, 425 MB, that used to be plenty of space. Back in the days when you transferred files on floppy disks.
 
Yeah, 1.44MB used to be so much space!
 
when you had Windows 3.1
 
@Malachi Or MSDOS.
 
"Who's ever going to need more than 640K of memory?"
 
@SimonAndréForsberg you had to have MSDOS
windows 3.1 booted off of DOS
 
6:34 PM
@Malachi Lol, yeah... I mean: Or you just had MSDOS, without Windows.
 
if you hit the right button on startup you could stay in DOS with out booting to windows and look around
I am sure that is how people retrieved files they weren't supposed to have access too....
 
When autoexec.bat and config.sys ruled the world... dinosaurs walked the Earth...
 
x.x
 
@Malachi I believe the button was F8 :) And then you chose option 5.
 
6:37 PM
@SimonAndréForsberg I like the "I see little commercial potential for the internet for the next 10 years." quote.
 
@SimonAndréForsberg I don't remember having to press F8. I think you are thinking of the CMOS table
 
No, it was F8.
 
option 5?
 
Still worked in Win98
 
@Malachi Not entirely sure of option 5, but I'm sure it was F8.
 
6:38 PM
@SimonAndréForsberg I don't remember I was like 10
 
0
Q: DRY multiple if statements used to show/hide elements based on slider value

apaul34208I'm showing and hiding 4 svg paths based on the value of a slider, all is working as expected, but it still feels a little cumbersome. Does anyone know a way to "DRY" it out a little more? jsFiddle $('.volumeSlider').slider({ value: 1, orientation: "vertical", range: "min", max:...

 
it was option 5 :)
 
I probably hit SHIFT + F5
and bypassed the screen
 
@lol.upvote for some stupid reason I feel a bit proud that I remembered that!
 
@SimonAndréForsberg I'd be proud, too, probably for the same stupid reason!
0
A: Is there a faster way to compare if 2 images are the same?

GuffaYou can use the LockBits method and pointers to access the image data directly. Example for 24 bpp images: bool equals = true; Rectangle rect = new Rectangle(0, 0, bmp1.Width, bmp1.Height); BitmapData bmpData1 = bmp1.LockBits(rect, ImageLockMode.Read, bmp1.PixelFormat); BitmapData bmpData2 = bm...

5
A: Scrabble algorithm review and performance suggestions

ChrisWue@Teresa has already provided some good hints on how to improve the performance by using a better data structure so I'll concentrate on general things: Your code has a bug such as that it will crash with a NullPointerException if the file cannot be found. You initialize dict to null You catch ...

13
A: Temperature conversion in C

Jamal You don't need invalidchoice() as it just prints a statement and nothing else. Just put the printf() under default. Consider receiving all user input in main() and having the functions only do the calculations. It's best to have a function do one (useful) thing. In this form, the functions co...

2
A: Are my forms a danger towards code injection?

miniBillIt's not a security risk for your server, but it may be for your users. Beside the fact that if the input contains < the output might not be what you expected, the real dangers you face are XSS and CSRF. For example, a malicious attacker could make the user click on a link which opens your ex...

0
A: Could random unique selection using while cause an infinite loop?

GuffaThe first method can definitely go into a very long loop, but that is very unlikely to happen. Unless the numbers to pick is not very close to the available numbers, the probability that the loop would be so long that it would be noticable is very small. If you for example pick 5 numbers out of ...

1
A: Guessing a unique 4 random digits number

AJMansfieldFirst off: public class Game { Really? What game is this? Is this like, tetris or something? Make it something like CodeGuessGame, and add a javadoc comment to the class explaining exactly what it is, and what it does. System.out.println("The computer has generate a unique 4 digit number.\n" ...

0
A: Could random unique selection using while cause an infinite loop?

Yann VernierIt depends on the proportions of count and max, obviously, but most importantly on the behaviour of the random number generator. ECMAScript leaves the behaviour of random() to the implementation, so there's no immediate answer; it would be platform dependent. Expressed in Python, because it let...

 
6:50 PM
@lol.upvote Do you remember when you started to be our personal @StackExchange bot for answers?
I'd really like to see a database query for the number of votes per day pre-answer-feed and post-answer-feed. (once the data explorer has the latest data available of course)
 
@Malachi: The suggested edit already had the grammar correct for that comment.
 
Good evening.
 
Hello!
 
@Jamal but it changed stuff in the code...
 
Everything alright=
 
6:56 PM
it was a review. I am not used to doing those yet @Jamal
I haven't done many of them.
Hey @kleinfreund
 
Bah, the data explorer only updates once a week
 
@Malachi: Okay. Not a big deal; I just wanted to point it out.
 
@kleinfreund Hello and Welcome! Your username sound German.
 
Exactly, it is.
 
"small friend"
 
6:57 PM
Yours is pretty neutral, tho. :p
 
@kleinfreund Yeah, I guess it is. I am Swedish though :) Got plenty of German friends.
 
@Malachi Kinda have to agree to cimmanons answer on meta. What do you think?
Name's Philipp. Could be from anywhere, I guess. They told me it's Greek.
 
00:00 - 19:0019:00 - 00:00

« first day (265 days earlier)      last day (3745 days later) »