« first day (681 days earlier)      last day (3335 days later) » 

9:05 PM
I've been having a weird web browser issue lately... Whenever I'm on this PC (Windows 7, IE 11) whenever I open a CR page (any regular post page on CR) the PC display freezes completely for a solid 10-15 seconds
It works fine during the rest of the day. But each day it does that again. Not shutting down the PC or web browser overnight. Also does not apply to chat.
 
9:32 PM
0
Q: Less repetitive / more efficient way of extracting lines from a bytearray

zwolThis class is part of a utility that reads lines from a set of nonblocking file descriptors, blocking only when there are no complete lines to emit. class NonblockingLineBuffer: def __init__(self, fd, encoding): self.fd = fd self.enc = encoding self.buf = bytearray()...

 
I don't think this is too particularly odd necessarily. What I would do entirely depends on a lot more context. If you're really interested in figuring out the best way to do this, you can always post a question on Code Review with a working version of your code. — nhgrif 1 min ago
 
Feel free to go upvote the answer I posted that comment on. ;)
I'm gonna use @Duga to advertise my Stack Overflow answers for me, when I can. ;)
 
9:47 PM
0
Q: An array of dictionaries; comparing each {key, value} pair; and combining dictionaries

user1157751I'm trying to optimize a nested for loops that compares an element in the array with the rest of the element in the array. There's two part, the first part is for example, an Array has 3 elements, and each element is a dictionary: [{"someKey_1":"a"}, {"someKey_1":"b"}, {"somekey_1":"a"}] 1s...

 
10:10 PM
@nhgrif I'm learning more about ERP and CRM systems this week in class.
Unfortunately, the book is very poorly written, so I don't even know what they are getting at, other than that keeping inventory is more expensive than JIT systems (which I already knew).
 
Storage space costs money.
 
There is no lecture as I'm an online student - not sure whether I'm glad or sad about this one.
It sure does, whether it is physical space or digital space.
 
And doing the calculations to make sure you get your stuff at the exactly right time to minimize your required storage space and shelf-time is hard.
 
So, from what I've gathered from the book, an ERP system gathers and analyzes data from the entire company, and displays it so the company leaders can easily make the best decision (well, a perfect decision is like bug-free software), and helps them run their manufacturing process more efficiently?
Like, automatically placing orders from suppliers, and the like?
 
Sort of.
Generally, you'll have sales agents. Sales persons. They're finding people to buy your products and making sales orders.
Then you have your shop floor managers, factory managers. They look at the sales orders, and they'll schedule shop floor time to manufacture the necessary goods.
And then you'll have purchasing agents that look at what material is needed and when, and purchase stuff based on that.
 
10:17 PM
And the ERP lets them all see the same, up-to-date data?
 
Your purchasing agents know nothing about any of the scheduled work orders, nothing about the sales orders.
They just know what materials need to be purchased and when they're needed by.
 
Only, in different forms customized and adapted to each department?
 
What do you mean exactly by that?
 
So, one department might not see all the data shown to another department, but the ERP stores it all.
 
Yes. But generally, your "purchasing" is a department. They do all of the purchasing for every other department.
 
10:18 PM
Like, Purchasing doesn't need to track customer's orders, but they need to know input inventory.
 
They can see all of everything that needs to be bought.
All purchasing needs to know is what stuff we need to buy.
They don't need any other information.
They don't need to know what inventory is on-hand.
The ERP system has already looked at on-hand (and everything else) and calculated how much to order and by when.
 
Clever.
 
The purchasing agent's job is to find the best deal on the products.
 
That algorithm must be awful complex.
 
@Mat'sMug here's a question for you, what would you expect "abc;xyz".Split(new[] { ";" }, 1, StringSplitOptions.None) to return?
 
10:20 PM
@mjolka Two empty strings.
 
@nhgrif why is that?
 
@Hosch250 So the purchasing agent looks as see we need X sprockets. We can order them from Acme Co, but they have a 2 week lead time. Sprockets, Inc. can get them in 7 days, but they're 50% more expensive. And Sprockets-Are-Us have the same lead time as Acme Co, they're also cheaper, but they're late by an average of 2 days.
So the purchasing agent has to choose who best to order our sprockets from based on that information.
Taking price, lead time, likelihood of being late, etc. into consideration.
I don't know, nevermind @mjolka
 
@mjolka Just ran it.
It returns a string array, of course, with one element: "abc;xyz"
So, it returns [ "abc;xyz" ]
Or would it be { "abc;xyz" }?
 
@Hosch250 right. and if you change 1 to 2 you get { "abc", "xyz" }. so why doesn't a parameter of 1 give you { "abc" }?
i mean, it's documented to behave the way it does, i just think it's a really strange decision
"count The maximum number of substrings to return." ... "If this instance does not contain any of the strings in separator, or the count parameter is 1, the returned array consists of a single element that contains this instance."
 
I suppose it is so you don't lose any data.
Seriously, if you just want the first result, just do "abc;xyz".Split(new[] { ';' })[0];
@mjolka Is [0] or .ElementAt(0) better?
 
10:30 PM
@Hosch250 i'm not using this, i just came across what seems a really strange api design decision
 
OK, just curious myself now.
 
use [] if the collection has an indexer, otherwise use First/FirstOrDefault
 
What is an indexer?
 
I thought the [] worked on all collections and strings.
What about [i] or .ElementAt(i)?
 
10:32 PM
again, i'd use an indexer if the collection supports it
 
OK. Because sometimes I use .ElementAt and sometimes I use [].
 
IEnumerable<int> xs = new[] { 1, 2 }.AsEnumerable();
// Won't compile.
// int y = xs[1];
int y = xs.ElementAt(1);
 
Oh, IEnumerable, I don't use those very much.
I just use List<T>
Which is better? Should I be using IEnumerable more?
 
If you haven't come across an issue with it yet then you don't have to do a thing
 
10:36 PM
@JeroenVannevel Top notch
 
There are benefits to IEnumerable<T> and there are benefits to IList<T>
 
I've never used IList, is that the same thing?
 
It's the Interface for list
 
It's the interface of a list
 
Oh, OK.
 
10:37 PM
:D
 
I've never written an interface. That is on the top of my list of things to learn.
 
Learn to use them @Hosch250. In the right place they offer the right solution
another tool in your toolbox really :)
 
Sure do, I just realized how to make my code neater.
 
It's a basic feature of the language and OO-programming in general
 
10:39 PM
How is everybody btw. Morning morning :)
 
It is abstraction, isn't it?
 
yes, amongst other things
 
In C++, I was taught to create a class and abstract from that.
But, it was different.
If I didn't override the methods, they would just fall through to the next class until it reached the first one to override/implement it.
 
C# and Java have that too
that's simple method overriding
 
Yes, I just didn't know Interfaces were special.
 
10:52 PM
The come really handy when you want to use factory methods and all
 
C++ isn't the ideal environment for learning Interfaces.
2
 
get cracking... some good stuff to learn :)
 
C++ has Interfaces... but mostly, Interfaces solve a problem that doesn't quite exist in C++.
 
Welcome to Stack Overflow. Please take the time to familiarize yourself with the Stack Overflow help file, which will help you understand what kinds of questions are appropriate for this site. This site is intended to help you obtain answers to specific programming questions, as opposed to providing tutorial, design or code review assistance. — MarsAtomic 1 min ago
Edited. My last code review was "keep it to the point so people can read it." And, it's complicated because I need to know how the complicated stuff works. If I keep everything simple, I'll never find out how to keep the global scope clean, or how to format the structure so it can be properly documented and maintained. — Junior Dev just now
 
11:18 PM
I'm 5 upvotes away from "Good Question" (silver badge) on Stack Overflow.
15 upvotes away from "Guru" on Stack Overflow.
 
Why am I still out of stars? It's way past .... oh.
UTC doesn't have daylight savings time.
Anyway, pre-mature congratulations @nhgrif. =)
 
11:41 PM
The codereview.stackexchange.com site was created for questions like this. — Neil Lunn 34 secs ago
I'm voting to close this question as off-topic because it belongs on codereview.stackexchange.comNeil Lunn 1 min ago
 
11:54 PM
0
Q: Nesting models within models

ZacI am saving data into a MongoDB. The data will be saved into 3 Mongoose models that are hierarchical. A User model contains an Activity model array. An Activity model contains an array of Data models. Are the following model definitions correct (or does an explicit reference to the parent model n...

 
RELOAD!
There are 1185 unanswered questions
 

« first day (681 days earlier)      last day (3335 days later) »