« first day (1795 days earlier)      last day (3194 days later) » 
00:00 - 23:0023:00 - 00:00

12:16 AM
It's not enough to be on topic for SO. There might be a way to rework the question, but it needs a lot of work. If you want to ask a broader question, you'll need to clean this up a lot by going through the research and organizing your thoughts, confusion, and concerns. (You might end up with multiple questions, and it might end up being a better fit for Programmers.) If you just want your existing approach critiqued for bugs or things you might have missed, Code Review would be appropriate. (They have very strict guidelines. Read through the Help if you even consider going there.) — jpmc26 1 min ago
 
 
1 hour later…
1:38 AM
There wouldn't happen to be a good way to iterate over an empty ArrayList to fill it with empty objects would there?
 
user55340
@MetaFight The code around it...
 
user55340
public class Main {
    public static void main(String[] args) {
        int hands[] = new int[6];   // 5 + blind
        LinkedList<Integer> deck = new LinkedList<>();

        int shenagigins = 0;

iter:   for (int i = 0; i < 100_000; i++) {
            deck.clear();;
            for(int c = 0; c < 32; c++) {
                deck.add(c);
            }

            Collections.shuffle(deck);
            //System.out.println(deck.toString());

            // five hands
            for(int p = 0; p < 5; p++) {
 
user55340
That's the v 0.1 type - just to make sure I've got it.
 
user55340
Note the quick test of if((hands[p] & (Cards.ACE | Cards.FACE | Cards.TRUMP)) == 0) {
 
1:59 AM
+1 shenagigins
 
user55340
2:56 AM
0.5% shenanigans chance with 5 player. 2% shenanigans chance with 6 player.
 
8:46 AM
hi
i want make app for a website witch is better for make this app for android & IOS

use Eclipse for Android app & xCode for IOS app

use AngularJS,IONIC,Cordova for Both app

which is best?if i use Cordova to make app do I have problems?
 
9:21 AM
lots of free spam flags at Workplace today...
...two more are right there now. Those interested in flag badges, can keep an eye on it
 
@gnat continuing wave of spam
 
hands[5] |= (1 << deck.pollFirst()); <-- is that combining two cards? What does that represent in the game?
 
9:40 AM
@MetaFight Each card is represented by a bit in a 32 bit word so ORing them together combines them into a single hand
(2-9 don't have individual bits though)
 
ah yes. sorry. I misread what hands was.
I assumed it was an array of individual cards. it's actually an array of hands, each of which is an ORing of cards.
 
 
1 hour later…
10:45 AM
Hello!
 
11:04 AM
I just wanna confirm if this is the place/site to go to when you want to get some feedback on best practice on a design pattern?
 
11:17 AM
100
A: Why is asking a question on "best practice" a bad thing?

RosinanteWhile you may be an exemplary, clear-thinking, individual, who uses the term best practice in a constructive manner, you have been preceded by a giant procession of zombies who use it as the antithesis of thought. Instead of understanding the important specifics of their situation and looking for...

9
Q: Making "best practices" questions more palatable: how to ask a "best practice" question that is acceptable to the community?

Robert HarveyWe all know what the problems with most "best practices" questions is. Quite Often, it is spotting a herd in the distance and going trotting off after it. The other problem is that they can often be too broad. But what, after all, is a site like Programmers all about, if it's not about best pr...

 
Well, it's hard to reinvent the pattern wheels when you're new to things ^^;
 
11:44 AM
Let's hope I did ok
 
12:06 PM
Hello!! Is someone of you familiar with hard disk sentinel?
 
12:38 PM
I heard about sentinel in a linked list
I have a DListNode constructor:
 DListNode(Object i, DListNode p, DListNode n) {
    item = i;
    prev = p;
    next = n;
  }
The `DList` class includes a `newNode()` method whose sole purpose is to call the
`DListNode` constructor.
protected DListNode newNode(Object item, DListNode prev, DListNode next) {
    return new DListNode(item, prev, next);
  }
how would the constructor look like? If the, DList should be circularly-linked, and its head should be a sentinel node (which holds no item)
  /**
   *  DList() constructor for an empty DList.
   */
  public DList() {

  }
 
head = new newNode(null,null,null);
head.next=head.prev=head;
 
head.next? head.prev? are we breaking encapsulation?
this.newNode
 
user55340
12:59 PM
That is inside the class itself. It is supposed to be able to access it's innards.
 
Ideally DListNode is inner class to DList?
 
user55340
It could be.
 
1:23 PM
It should be. It's a (private) implementation detail of DList that's small enough.
 
user55340
Examples: map.entry and linkedlist.entry
 
user55340
Note that the map version is public while the list one is private.
 
and the only reason the map version is public is because it's handy for entrySet to contain
 
user55340
Yep. Getting entrySet() to iterate over all keys and values is much more performant than keySet() and get(key)
 
2:13 PM
@golem - You're responding to a nearly 2 year old comment that was left prior to the post being edited and migrated. If you check the original revision history, you'll see that the first version of this question left a lot to the reader's imagination and was a very poor fit for Programmers.SE where it was initially posted. — GlenH7 11 secs ago
 
Happy Coffee Day progs!
 
user114359
3:06 PM
@durron597 I only drink caffeine on days that end in Y.
 
@Snowman I thought only on days that have a third to last letter equal to D
 
3:21 PM
How should i go about filling an empty ArrayList?
 
addAll
 
in a loop
 
user55340
Happy preferred caffeine delivery mechanism day.
 
in a loop you can just use add
 
Happy iced double shot latte day.
 
user55340
3:22 PM
Happy preferred ethanol delivery mechanism evening.
 
Happy caffeinated beverage (aka Programmer's) day
 
Happy ground bean tea day
 
user114359
@LinkTheProgrammer Unclear what you are asking. What are you trying to put in it? How is the data generated?
 
anyways, what I mean is I get the annoying IndexOutOfBoundsException after I fill the ArrayList so apparently it is not filling correctly because the size() is still 0...
The data is generated like so:
 
@LinkTheProgrammer list.drink(coffee);
 
3:24 PM
lol @durron597
`private ArrayList<PixelPartition> fill(ArrayList<PixelPartition> list) {
for (int i = 0; i < width * height; i++) {
list.add(new StaticPixelPartition("empty@" + i, i, i, 0, 0, false, () -> {
// nop
}));
Realtime.log("Added Partition; ArrayList size: " + list.size());
}

return list;
}
`
 
@LinkTheProgrammer If that doesn't work and throws IOOBE then either width or height are 0. Or both.
 
user55340
Have you set a breakpoint and used a debugger?
 
Is that method getting called before the frame is visible?
 
i haven't fully explained the situation yet :(
 
@LinkTheProgrammer Remove the backticks and click the fixed font button next to upload...
 
3:25 PM
fill() does not throw the IOOBE
 
@LinkTheProgrammer I know it doesn't.
fill() doesn't add anything to your list because width or height are zero (or both)
 
user114359
I would also use and return List, not ArrayList.
 
for(int w = 0; w < width; w++)
    for(int h = 0;h < height;h++)
        list.add(new StaticPixelPartition("empty@" + w+", "+h, w, h, 0, 0,//...
 
oi, the width and height are not zero
I promise
 
user114359
3:27 PM
Also, it is rare that you should be directly accessing list elements by index. Either use an iterator, or if necessary, a for loop bounded by its size.
 
@LinkTheProgrammer Can you check?
 
and also I need to return arraylist for the functionality
yes I can check
 
user114359
So an IOOBE should not occur
 
@LinkTheProgrammer which functionality is that?
 
[10:12:13][ERROR] Failed to assign Partition:[name:"Brick[111]", width: 50.0, height: 20.0, index: 10077, size: 0]
It's a PixelPartition @durron597
 
3:28 PM
find where that log is emitted from and work backwards
 
The log is called in BrickLayout#createBricks()
 
@LinkTheProgrammer This is going to get too complicated for this room with pastebins and stuff. Can you just ask on Stack Overflow? I promise I'll look at it.
 
I would love to! But I can't because a few years ago I asked a bad question and can no longer ask!
 
user55340
Can you put print statements before and inside the block?
 
user55340
3:30 PM
The for loops.
 
@LinkTheProgrammer You're still q-banned on SO from a few years ago?
What does it say?
 
the usual message you see when you are q-banned and try to make a new question
 
user55340
Use "contact us" to ask for the old post that is triggering the ban to be dissociated.
 
You have reached your question limit
 
@LinkTheProgrammer Which is what?
It still says that?
 
3:32 PM
ya
 
user55340
Note that the questions you are asking here would likely be closed too.
 
user114359
Newest question from you is a year old, nothing rated below zero. Any deleted questions?
 
ya because It's quite complex and it isn't easy to put all of it on a chat hehe
 
user114359
Unfortunately none of us can see anything not on your user page
 
user55340
3:32 PM
You need to try debugging the code either with prints or a debugger.
 
user114359
@ratchetfreak Yes, I am looking at his SO user page
 
I'm debugging with prints, but I could try a debugger I guess...
 
user114359
Debugger > printf
 
@Snowman and I see 2 negatively rated questions
 
@LinkTheProgrammer Do you have any deleted questions?
 
3:33 PM
I have a few I believe
 
Can you undelete them please
 
one actually now that I think of it
 
Undelete it and then link it here
(self deletions, not community deletions)
 
user55340
You don't have prints in the for loop you pasted above verifying the values of height, width and that you actually entered the inner loop at least once
 
I pass the shown width and height in through the pixelpartition
I can show you the method
well, a portion of it
 
3:35 PM
@LinkTheProgrammer Stop. It's too hard to debug this in this chatroom
I'm going to help you get un-qbanned at SO
focus on that first.
 
Can you undelete all your self deletions at SO and link them to me
 
user114359
@ratchetfreak Ah, I see those now, at the end of the question list. -1 and -2, from a long time ago. Those alone shouldn't cause a question ban.
 
yes I'm doing that right now
hmm I'm having a hard time finding ones that I've deleted...
 
there should be a checkbox att he bottom of stackoverflow.com/users/2950711/… to show deleted questions
 
3:40 PM
@LinkTheProgrammer How many questions does it say you have?
 
after clicking the checkbox that @ratchetfreak mentioned
 
at the bottom it says "deleted recent questions" which shows no results
 
Hm. Well I upvoted a few things you've done that look good to me. Are you still q-banned?
 
3:42 PM
@LinkTheProgrammer Okay. Ask it there, make sure to follow the good question guidelines
Read both of those.
 
the complexity of the situation may take a while before the question is complete
 
@LinkTheProgrammer That's fine, the point is that it's too complicated for this chatroom
You may be able to find the problem just by trying to simplify it enough to put on Stack Overflow
This happens often and is intended
 
Hello guys. I'm being pinballed around chats in hope to find the right place for a question. I need a way to identify where, in a webpage's source, a certain element is changed (it is a "you have mail" icon that lights up - I just want to create a userscript when that happens.
 
@Zachiel This may not be the best room for that. Try this one instead:

 JavaScript

Topic: Anything JavaScript, ECMAScript including Node, React, ...
 
3:46 PM
@Zachiel right click and choose "inspect element". On chrome, an element that changes will be highighted purple for a moment
may help in creation of what you are trying to make ;)
 
@LinkTheProgrammer thank you.
 
no problem
 
They often search for the element by ID you can search the JS for that ID and then follow the element that will get passed around
 
@durron597 I'm altready asking on the php chat there and they sent me here, but I'll try JavaScript too.
 
I would think there is a listener for the document, but I'm not sure since I hate javascript and python with my guts for the lack of strong typing
 
3:48 PM
@Zachiel PHP is wrong too, if you're trying to write a userscript.
 
@LinkTheProgrammer that element has its own right click menu so I can't select it. :(
 
As said, the question is too broad and not specific enough. If you narrow down to real code snippets, you can get them reviewed there. Right now you have only posted non-working code. This is indeed not acceptable over there. For discussions on design and architectural approach, there's the programmers.se, but also there you still have to be more specific. — BalusC 30 secs ago
 
@durron597 Well, I'm not writing the script yet. I'm just trying to understand what the script should change, first.
 
then right click somewhere else near the element you want to watch. hovering the mouse over an element highlights the element on the actual page and in source
 
@Zachiel it's still going to be a Javascript problem.
 
3:49 PM
it might be inside a div or something, so if you inspect element on the container it is in, it should narrow it down for you
this is just to know when an element changes
 
@LinkTheProgrammer ah yes I found where the element is, I think, but I don't get the exact place where the image is changed (I don't even see the image link)
 
@Zachiel The image is changed... within the page's javascript code.
Probably using Ajax.
 
there is a resources tab in the form that has the source code
 
find where they manipulate the element
 
I'll inspect the 12 or so scripts then
 
3:51 PM
xD
 
Hoping they're commented.
 
thing is, if you don't see a link... then that's just weird
 
Probably not, most of the time they are minified
 
meh, are you telling me you don't need to provide an href to an image to show it in a webpage?
 
@LinkTheProgrammer well it's <img src= not href
 
3:53 PM
that's what I meant
 
or it's a canvas and they are using webgl
 
I have no experience with webgl
anyways, I'm going to make that question now
you know what I just thought of for what I'm doing?
 
@LinkTheProgrammer the rubber duck has spoken! lets hear it.
 
@Snowman Grats on passing Martijn in CV reviews!
 
I'm trying to implement a PixelPartition, and I'm not sure if I'm taking the best approach, but I'm using an ArrayList for expansion in case you want to resize the Partition (PixelPartition is abstract, and I wanted to make a StaticPixelPartition and DynamicPixelPartition). Now that I think about it, it would be better to just initialize a fixed size array and make PixelPartitions immutable like Strings.
if I want to resize a Partition, I create a new object with the data of the previous Partition
I'll see if it works...
 
3:59 PM
http://pastebin.com/gp3T1izH
this is the part I think the image should be in. Do you see any images save for the loading one?
 
search in the scripts for a place they look for a element with ID "mail" and where they adjust the src attribute
 
one slight problem, the z-index
I want to have multiple layers for my PixelPartition, and I can't be sure of the number of layers at initialization... I need an ArrayList for an expandable list of indexes, so is there a way I can put my array in there?
 
make a PixelLayer class?
 
that seems kind of unnecessary...
PixelPartitions can contain another PixelPartition, as well as it's own runnable to be executed. The idea is for a more efficient implementation of collision detection where you can call PixelPartition#run(int x, int y, int zindex); a certain group of pixels would hold a reference to one PixelPartition that holds the Runnable to be executed
 
@ratchetfreak Ok, will do. Thank you!
 
4:08 PM
I would love to create an immutable 2D array for the z-index as partitions[zindex][x + width*y], but I would have to recreate the entire array and put it in a new PixelPartition every time I make a new layer (which is the zindex)
also 2D arrays are slightly slow depending on how you access them; I don't feel like implementing a biased PixelPartition system that calls run for the current zindex first before the rest
 
not the entire array just newPartitions = Arrays.copyof(partitions); newPartitions [z] = newlayer;
 
how exactly would that work?
if I have newPartitions[2][4], and I want to add a layer, newPartitions has to be [3][4]
 
user114359
@durron597 ZOMG I'm a reviewing machine. Next up: gnat.
 
newPartitions = Arrays.copyof(partitions,partitions.length+1);
newPartitions [partitions.length] = newlayer;
 
partitions.length -1 *
 
4:14 PM
no +1 because that parameter is the length of the new newPartitions array
the last value will be null so the next line is setting the new layer
 
I mean newPartitions [partitions.length - 1] = newlayer;
 
and I used the old array's length just to confuse you ;)
it should probably be newPartitions [newPartitions .length - 1] = newlayer;
 
oh right
well if it was color coded I would see it easily :P but that's a poor excuse for not noticing right away
also the fact that there was a space inbetween "s" and "["
 
I'm typing too quickly
 
hehe
if I had a faster keyboard layout I would type far faster with fewer mistakes... if only I had that faster keyboard layout :(
 
4:19 PM
dvorack(sp?)?
 
Damn you creator of QWERTY!
yes
 
I'm on azerty
 
Apparently QWERTY was literally made to slow you down, and yet I try to type fast and I fumble; my fingers get tied up in a knot just trying to speed up my typing speed.
 
no it was made so common digraphs are far apart
which is a good thing for fast typing
 
4:22 PM
because old typewriters jammed if you typed adjacent letters to quickly
and for fast typing it's because then you can alternate fingers
 
would be easier life if I didn't have to lift my fingers so often
 
The DataHand keyboard was introduced in 1995 by DataHand Systems, Inc. It was invented by Dale J. Retter and was produced by Industrial Innovations as early as 1992. The keyboard consists of two completely separate "keyboards", one for the left hand and one for the right, that are molded to rest the user's hands on. This allows the user to place each hand wherever it is most comfortable to them. Each finger activates five buttons, the four compass directions as well as down. The thumbs also have five buttons as well, one inside and two outside as well as up and down. The button modules in which...
 
wow, that sounds excellent
Ima get one
that explains why it's so easy to wreck the buttons on a game controller
hey, @ratchetfreak, would you be willing to help me with the next project I'm going to work on? It's a Friend App that I'm making for my friends and I would like to test the Internet part(s) of it at some point.
 
I don't think I'll have the time
 
I never have the time to do anything lol
I plan to make a very simple version of it by the next Sunday, so I'm trying to finish this PixelPartition thing and then I'm going to immediately start work on the Friend App.
Are there any programming patterns similar to a PixelPartition, or is there a similar idea for collision detection similar to mine?
 
4:46 PM
@Snowman I'm a week away from top 5
Unfortunately the top four are all actively reviewing. I think I'm much more consistent than Dan but it will still take a long time to catch him.
 
Can Git and TFS be used in Visual Studio simultaneously?
(each in different solutions)
 
user55340
@durron597 for fun, calculate how long it will take to catch Glen if he stopped reviewing.
 
user114359
@RobertHarvey I don't see why not, although I have never tried it.
 
@MichaelT a year and a half of daily
@MichaelT You're more consistent than him, you will catch him eventually at this rate.
 
user114359
 
user55340
4:55 PM
My consistently of reviews is if I'm the first vote, or fifth.
 
user114359
Eventually we will run out of old crap to close. Whoever reviews the most in a day will be a matter of timing.
 
@Snowman I found a gold mine in of POB questions
I've been throwing my spares on it every day
for like a week
 
user114359
Maybe I should edit its tag wiki excerpt to say "USE THIS TAG. Questions on naming are high quality and guaranteed to receive upvotes." Then camp out on that tag and throw CVs at all the new questions.
 
@ratchetfreak is down to 37 questions from it's height of close to 1600. (on stack overflow) These 18 questions could really use some delete votes
 
5:30 PM
@ratchetfreak I actually heard sometime back that this was an utter myth
I don't recall the backing evidence and argument claiming it was a myth
how is that keyboard not a known and common thing... that must be a significantly better way to type, I can't imagine it not being...
 
hah
115
Q: Is uninitialized local variable the fastest random number generator?

amuseI know the uninitialized local variable is undefined behaviour(UB), and also the value may have trap representations which may affect further operation, but sometimes I want to use the random number only for visual representation and will not further use them in other part of program, for example...

 
@JimmyHoffa my parents once had an old typewriter (newer than the model that qwerty was designed for) that I could jam when mashing the keyboard it was always adjacent arms that jammed
 
user114359
@Telastyn I saw that too and cringed. One of the answers further down gives a very good writeup of why that is a terribad idea, with links to articles that explain what modern compilers do when optimizing UB.
 
user114359
63
A: Is uninitialized local variable the fastest random number generator?

Shafik YaghmourLet me say this clearly: we do not invoke undefined behavior in our programs. It is never ever a good idea, period. There are rare exceptions to this rule; for example, if you are a library implementer implementing offsetof. If your case falls under such an exception you likely know this already....

 
@ratchetfreak I had one of these as well; it was QWERTY
>
> They conclude that the mechanics of the typewriter did not influence the keyboard design. Rather, the QWERTY system emerged as a result of how the first typewriters were being used. Early adopters and beta-testers included telegraph operators who needed to quickly transcribe messages. However, the operators found the alphabetical arrangement to be confusing and inefficient for translating morse code. The Kyoto paper suggests that the typewriter keyboard evolved over several years as a direct result of input provided by these telegraph operators.
@Snowman haha of course C++ folks are using undefined behaviour more and more, it's inherent in their whole culture and sold strongly by your language that it's totally ok to have absolutely no clue what is occurring whatsoever because the most seasoned veterans of C++ still release their software with endless reams of problems that they can't pin down or identify causality for
Not being able to parse what the code will actually do is part and parcel of C++
 
user114359
6:08 PM
@JimmyHoffa Only for people that choose to write bad code.
 
@Snowman no true scotsman eh.. pfleh
No true Scotsman is an informal fallacy, an ad hoc attempt to retain an unreasoned assertion. When faced with a counterexample to a universal claim ("no Scotsman would do such a thing"), rather than denying the counterexample or rejecting the original universal claim, this fallacy modifies the subject of the assertion to exclude the specific case or others like it by rhetoric, without reference to any specific objective rule ("no true Scotsman would do such a thing"). == Examples == Bradley Dowden explains the fallacy as an “ad hoc rescue” of a refuted generalization attempt. The following is an...
 
user55340
@Snowman some memory isn't random.
 
user55340
Aix (ow was it Intel?) initialized memory or 0xDEADBEEF. Always.
 
the problem with C++ and claims of "just write good code" is you're saddled with way more code you didn't write than you did - and the way you have to integrate wit that code forces your code to be a mish mash of problems because you can do nothing with C++ itself, it lacks underlying libraries to provide anything at all. So you integrate with shitty libraries that make your code shitty, no matter how you slice it, C++ code ends up bad; good coder or not.
 
user114359
@JimmyHoffa I don't see how that is a logical fallacy. The standard is well-defined. UB is well-documented. It is not difficult to steer clear of it.
 
user55340
6:11 PM
It was AIX that did it.
 
user114359
I am writing a program right now in C++ and it steers very clear of UB.
 
user114359
It is not difficult to do.
 
I would agree that the quality of your C++ is at least partially dictated by the quality of the libraries you choose to/have to integrate with, but there are plenty of C and C++ libraries that do not suck
 
@Snowman does all of it's libraries and integrated pieces of code do the same?
@Ixrec but not a comprehensive set - if you want to do most things you'll end up tied to at least one or two which are crappo.
 
user114359
@JimmyHoffa It is built on wxWidgets which does a good job avoiding UB and other problems. It is well-tested on multiple platforms.
 
plus the post above was detailing the fact that the C++ compilers themselves take advantage of undefined behaviour without coders even needing to do it on purpose
 
user55340
> When running the debugger (dbx), you may have wondered what the
'deadbeef' is you occasionally see in registers. Do note, that
0xdeadbeef is a hexadecimal number that also happens to be some kind
of word (the RS/6000 was built in Texas!), and this hexadecimal number
is simply put into unused registers at some time, probably during
program startup.
 
user114359
That answer was talking about optimizations, where the compiler can basically say "one branch uses UB, so both branches do" and combined with more advanced optimizations involving multiple functions, can actually result in time warps where side effects occur before the events that trigger them. All because of using UB.
 
user114359
@MichaelT That is a good reason never to rely on default values unless they are guaranteed to be a specific value (e.g. defaulted to 0 or false).
 
was this the question about the compiler assuming the argument must be within a certain range because otherwise UB happens?
 
user114359
6:15 PM
Even then I am in the habit of always initializing just in case, regardless of language.
 
user55340
@Snowman yep.
 
my understanding was that the optimization would work if the code always passed arguments yielding defined behavior
 
@MichaelT heh previous job I was at, we had a service that ran on port 57007, found out after a couple years from one of the architects he explicitly chose that port as a dumb joke of what port our service listened on in hex
 
user114359
@Ixrec I think this was the SO question about using random crap on the stack frame as a RNG
 
weird, that one seemed much less controversial
 
user55340
6:18 PM
0xCAFEBABE
 
user55340
(The magic number for a Java class file)
 
@MichaelT The official cheerleader for Coffee Day
 
user55340
/erc/magic is an interesting file and format.
 
user114359
@Ixrec The only controversy is Jimmy Hoffa talking smack about anything that is not functional programming.
 
@Snowman That would explain it.
I should go check what functional features haven't been added to C++ yet
 
user114359
6:28 PM
@Ixrec Nah, go check how much memory FP takes and why it takes 12 GB to do basic math.
 
About being off-topic - I agree, this is a question for programmers.stackexchange.com And about question itself: what are those other classes? I can imagine both a shopping cart that has to be connected to the client as well as "paying client" which has more functionalities available, but besides them he needs user credentials. In both those situation API would look totally different. Anyway, (2) doesn't seem nice to me - explicit is better than implicit and you would create a Client instance implicitly. — FilipMalczak 43 secs ago
 
7:13 PM
grumble mumble bumble urghly blah. Why can't I make the .NET ThreadPool perform for a good goddamn? I try to queue 100 stupid simple things - record the threads they run on, and I see the same 2-4 threads being reused over and over and over... why doesn't it parallelize the 100 things I have queued across a bunch more damn threads? I manually create 40 threads, signal them all to start executing those 100 things and they gladly do the work and I see all 40 thread id's being printed.
I can get 100 things done in a stupidly simple manually written ThreadPool in bloody seconds, but for years I've never been able to make .NET's built in thread pool use more than a few threads at a time - it's like it's ultra conservative about scheduling things in case it needs all it's other threads, so it does as much serially as it can
The dumb thing doesn't have like lots of methods, it shouldn't be a difficult thing; queue work, and expect available threads to pick it up instead of sitting idle thinking "Ahh some other thread will get to it" meanwhile thread 18 ends up doing half the work and thread 22 the other half
I rarely need it to do a bunch in parallel because I can usually optimize in other ways, but for this task I kind of want as much of it to be parallel as possible...
 
How many threads does the pool have?
Does it actually have more than 2 threads?
 
@ThomasOwens all indicators are that it does, I was pondering that - GetAvailableThreads tells me 1000 which I find highly unlikely
GetMaxThreads says the same, I figure it means "I will spin this many up if I get the work to do" but instead it doesn't actually spin them up
 
Odd.
 
And of course there's barely any literature on the damn thing so this is something I've seen for years and always slightly recognized but never needed to dig into until now, and I always kind of figured I would see the literature in my perusing before it becomes an issue
 
Is there an SO question with a Jon Skeet or Eric Lippert answer?
If it's .NET, chances are yes, if it's a well-written question.
 
7:20 PM
I'm quite good at threading, writing my own thread pool is really no trouble, it's fun and easy and gives me very predictable results which I like - so I'm inclined to just do that and not give it any other thought, but damnit I should be able to just use the built in thread pool...
@ThomasOwens You think many .NET folks really inspect this shit closely enough to notice? I'm trying to find questions about it and coming up blank
 
If you tag it and have a code example, someone will come along and answer it.
The amount of inner-workings-of-.NET knowledge on SO is insane.
 
the built in thread pool would of course be far more trust worthy than the one I would write, but for the life of me I can't identify why it's not behaving as you would expect it to. All the literature indicates it should behave as you'd expect... and the details of how it schedules are basically nowhere
@ThomasOwens yes, but those people don't ask questions, and it takes one of those people to actually find this to begin with
These are the questions about threadpool on SO:
107
Q: When to use thread pool in C#?

creedence.myopenid.comI have been trying to learn multi-threaded programming in C# and I am confused about when it is best to use a thread pool vs. create my own threads. One book recommends using a thread pool for small tasks only (whatever that means), but I can't seem to find any real guidelines. What are some con...

I guess I'll post my question
 
7:35 PM
oh...the thread pool only uses coreNumber of threads... in an ideal world that makes sense, in all examples of reality I've experienced, that is a woefully throttled approach because the amount of thread switching going on is only going to starve your tasks unless you create more threads to make the switching favor your work over underlying system shit
 
Aren't some tasks actually more performant if you have more threads than cores? Like reading over a network.
 
@ThomasOwens exactly.
I don't have 20 cores in this box, but when I ran my stupid task on 20 threads in my manual thread pool it took 6 seconds, I doubled the size to 40 threads and it was a perfectly linear 3 seconds, meanwhile when I just queued the same number of tasks to the thread pool it takes 28 seconds...
(and the console printing I'm doing shows all the work being done on only a few threads)
 
I thought that the on-paper best was threads == cores in the instance where everything was in memory and you were only computing over it. As soon as your have disk or network access, I've read that you should start with 1.5x - 4x the number of cores as the number of threads (and benchmark from there).
 
maybe if I run it through an exercise to warm up the thread pool; then it'll have and use the number of threads I want? Will have to try that now... but that's stupid, I don't want a thread pool that acts with intents I don't get to choose...
 
I don't know if warming it up will do anything.
If you're reading from disk or network, my default is to set the number of threads to 2*numberOfCores right off the bat.
 
7:39 PM
it may, but I would never rely on such an algorithm. It's just a test case to get a better understanding for the thread pool's behaviour
 
I'll profile if and when users complain.
 
I'm pretty much sold at this point on the fact that I'm going to have to write my own thread pool.
 
Why? Can't you adjust the settings on the .NET threadpool?
 
@ThomasOwens no
that's the problem, it picks and chooses it's behaviour in your best interest
 
That's disappointing.
 
7:40 PM
and demands that you not use it for things like network or disk reading...
 
Is this one instance of Java actually being better than {your favorite .NET language}?
 
yes, very. I've always been underwhelmed with it, and now more so. It's only redeeming quality is that it's unbelievably easy to use safely for the people who need the simplest amount of background work and have no idea how to do any multithreading, plus it's quite robust in some ways (under the covers it can and will do some interesting stack-swapping things that are kinda crazy, but unnecessary if you know how to strategize your concurrency to begin with..)
 
I'm kind of glad I prefer sticking to the JVM. I do wish I could buckle down and work more in {not Java JVM language}.
 
@ThomasOwens F#?
 
Abby T. Miller on August 3, 2015
Welcome to Stack Exchange podcast episode #66, recorded live at Stack Exchange HQ in New York, NY on July 7, 2015. Today's podcast is brought to you by The Association of Ex-Fog Creek Summer Interns (AEFCSI). Today's show is hosted by the usual suspects Jay Hanlon, David Fullerton, and Joel Spolsky, plus ex post facto Producer Alex.
 
7:44 PM
I'll never sell myself as a Java developer or a Scala developer or a Clojure developer or even a JVM developer. But I really prefer the tooling there.
@JimmyHoffa I assumed your favorite would be F#, followed by the newer versions of C# with functional features.
 
I would never call Java better than C# or F# in any way shape or form - but the JVM vs .NET as frameworks go? They're both extremely solid and definitely have pros to both sides. Talking languages though, Java only has I think two features that I would like to have in C#; the variance in their generics is a little more comprehensive using the ? in certain places, and anonymous interface implementations is pretty cool
 
I hate Java generics.
 
I don't know anything about the JVM ThreadPool, very well may be better, but the .NET one I can definitely say is more than a bit lacking for advanced use cases..
 
the bitch of it is IIS runs ASP.NET on the default .NET thread pool - and the transactions per second throughput it gets is absolutely phenomenal, so it makes me feel like an idiot for having no idea how the feck they have done it. Reality though is IIS does some insane shit with the .NET AppDomain to begin with which may be where the magic is
Pondering doing some analysis of this custom thread pool for .NET, vs writing my own
3 years old? Pah I should just write a quick modern one
 
7:50 PM
I'd check GitHub first.
Even though it's easy, I'd prefer one that's been used and tested to avoid a stupid mistake.
Because I'd end up making a really terrible, but very easy mistake that didn't get caught in testing.
 
@JimmyHoffa They've had what... 15 years to get it right?
 
@ThomasOwens I don't know... I've had very good luck writing my own multi-threaded code, and very bad luck using other peoples... Looking at it actually, TaskScheduler is the piece you implement for the TPL to do your own scheduling, and it's an extremely simple interface.. 3 methods. I'll implement those and see if I can get the performance exactly like a List<Thread> I was using
 
This "Entity classes that speak" question. Would one have the EF classes inherit from an ISay interface?
public interface ISay
{
    public void Say(string name);
}
And then provide a constructor in the EF class that takes an ISay as a parameter?
And then have an IoC container that injects the dependency?
 
8:16 PM
...this kind of sucks. I run my work through the thread pool just to test - 20 seconds, but towards the end I start seeing a greater variance of thread ids doing the work... So I run it a second time, 7 seconds - way more thread ids. So the thread pool not only needs to warm up, but it takes a good long time to do so...bla.
 
8:33 PM
It's been a while since I've looked at the JVM language landscape. Java, Scala, Clojure still the big players?
Groovy is floating around, but is it for more than scripting?
 
user55340
Depends on what you call scripting. Grails for web. Gradle for build.
 
user55340
Though if given the choice, even the author of groovy would have gone to scala... If aware of it at the time.
 
So Groovy isn't really a thing anymore?
 
It's a thing, but apparently it's author is demented because he's decided Java++ is worth while...
Scala is to Java, like C++ is to C. I can do analogies! :D
 
From what I've read (and working through like 4 tutorials), I kind of like Scala.
F* (pronounced as F star) is a dependently typed programming language developed at Microsoft Research based on F#. It can be compiled to either .NET CIL or JavaScript. The type system of F* is much richer than that of F#. It allows for functional correctness specifications that can be checked semi-automatically. == References == == External links == F* Homepage Microsoft Research Project Page F* tutorial A fully abstract compiler from F* to JavaScript...
Uh...o_o
OK. Good night, all.
 
8:51 PM
You should probably ask this at programmers.stackexchange.com because your question is entirely subjective. Besides that it's not really that wonderfully worded, why not just modify randString? — evanmcdonnal 59 secs ago
 
So I went through my first deploy of a new assembly here. It involves versioning the modified assemblies, figuring out what all of the dependencies are between a dozen or so projects, creating new Nuget packages for the dependent modules, reinstalling the nugets into the depending projects, recompiling everything, switching to remote desktop, downing the services, making a backup of the original assemblies, copying the new assemblies and restarting the services.
Can some or all of this be automated using build scripts? Can it be automated? Would Continuous Integration help in some way?
 
9:17 PM
In general, anything can be build scripted, it's just a matter of effort. Here, we only have that last step automated (deploy to environment)
The first (auto versioning) is in progress.
 
9:36 PM
Your question is off-topic on StackOverFlow. You should ask this kind of question on "Programmers" (programmers.stackexchange.com) maybe "Ask Different" (apple.stackexchange.com) that are part of Stack Exchange Q&A Platform Network. — Rémi Becheras 23 secs ago
@RémiBecheras: This question doesn't seem suitable for Programmers. Read the Help Center, in particular the part that says "What Language Should I Learn Next," under "And it is not about...". — Robert Harvey ♦ 38 secs ago
 
@RobertHarvey Are you using a shared file for your assembly versions as described here codeproject.com/Articles/328977/… ?
combine that with [assembly: AssemblyVersion("1.0.*")] and versioning your assemblies becomes automatic.
 
user55340
10:07 PM
@ThomasOwens I'm teaching myself groovy now because it's a scripting language I can get access to. Scala is more disciplined, but sometimes I wish to have code I can write fast and loose. Perlish in the jvm
 
10:20 PM
@MichaelT Here's a stat for ya. Stack Overflow is 26 million undeleted, 5 million deleted. Programmers is 160,000 undeleted, 130,000 deleted
(that's questions + answers)
 
user55340
10:32 PM
We are more active on moderation of the site. We are less hesitant to delete questions with 10 answers. We close faster and down vote so the roomba deletes more.
 
user114359
@MichaelT We also had an almost complete change of what is on-topic which invalidated most of the questions after the site's most active time period.
 
10:45 PM
This probably belongs somewhere else, maybe to programmers. It is opinion based. You can use whatever you want, .nml, .conf., .cfg, .ini... — Vladimir F 27 secs ago
 
00:00 - 23:0023:00 - 00:00

« first day (1795 days earlier)      last day (3194 days later) »