« first day (700 days earlier)      last day (3317 days later) » 

8:14 PM
1
Q: Code Inspection: Procedure not used

Mat's MugHere is yet another piece of Rubberduck code, this time the nasty ProcedureNotUsedInspection class, whose role is to identify all procedures that are never called anywhere, and to issue a ProcedureNotUsedInspectionResult for each one. Here's the code: using System.Collections.Generic; using Sys...

 
@Mat'sMug You around?
 
Hi
 
@sᴉɔuɐɹɥԀ ıɥ
 
How's it going?
 
8:18 PM
@Hosch250 Some people star strange things.
 
Did I miss the star-fest?
 
whistles
There, no more star
 
@sᴉɔuɐɹɥԀ whistles
 
Really... miniAudicle is asking me to force-quit... bleh
 
@sᴉɔuɐɹɥԀ Is it a feasible option to perma-quit?
 
8:22 PM
I accidentally left the VM running for over 1114 minutes
 
@Hosch250 I didn't know you could reply to yourself.
 
@SirPython You sure can.
 
Probably longer but it has stopped there
 
Didn't I just prove it?
 
Yes, you did.
 
8:24 PM
Just entered my TODO list from Trello into YouTRACK
Now I'm too tired to do any actual developing
 
@JeroenVannevel Since @Mat'sMug isn't replying, could I ask you a question?
 
I will happily be your second choice
 
What is the benefit, if any, of doing this:
 
The neat thing about developing ERP software is that your ERP software has a "Project Planning" module, and you just use that to track programmer tasks...
 
        private bool IsIgnoredProcedure(Declarations declarations, Declaration declaration, IEnumerable<Declaration> handlers)
        {
            var result =
                declaration.DeclarationType != DeclarationType.Procedure
                || handlers.Contains(declaration)
                || declaration.References.Any()
                || IsPublicModuleMember(declarations, declaration)
                || IsClassLifeCycleHandler(declarations, declaration)
                || IsInterfaceMember(declarations, declaration);
 
8:25 PM
Doing what?
 
Instead of just returning the boolean condition like this:
 
        private bool IsIgnoredProcedure(Declarations declarations, Declaration declaration, IEnumerable<Declaration> handlers)
        {
            return declaration.DeclarationType != DeclarationType.Procedure
                || handlers.Contains(declaration)
                || declaration.References.Any()
                || IsPublicModuleMember(declarations, declaration)
                || IsClassLifeCycleHandler(declarations, declaration)
                || IsInterfaceMember(declarations, declaration);
 
Ugh. It's just hanging in what appears to perhaps be an infinite loop
 
@Hosch250 maybe readability?
 
8:26 PM
No difference. 99% sure it'll be compiled to the same code
But obviously there's no point in the intermediate value
 
Assuming that's actually what the code is.
 
@nhgrif Maybe, but it seems equally readable and more obvious what is happening my way.
Yes, this is taken from a real question.
 
If you're really worried about the difference, you need to look at the assembly and see if it compiles the same.
 
Posted an answer here, but not sure if this is a good point:
0
A: Code Inspection: Procedure not used

Hosch250I'm not sure why you first store the variable, then return it without doing anything: public IEnumerable<CodeInspectionResultBase> GetInspectionResults(VBProjectParseResult parseResult) { var handlers = parseResult.Declarations.Items.Where(item => item.DeclarationType == DeclarationType.Cont...

 
Otherwise, it's such a minor style issue I wouldn't bother.
 
8:28 PM
@Hosch250 The only thing I can think of is that it can be easier to debug the return value when using a debugger.
 
If it isn't just DV, and I'll remove it.
@SimonAndréForsberg Ah, that is a valid point.
 
The compiled code will be the same I believe. I also wouldn't bother about it.
@Hosch250 Did that myself not so long ago :)
 
Bother about changing it?
I've done it too.
Just didn't think of it.
 
The only reason I say it might compile differently depends on if .NET has certain conditions that do/don't short-circuit.
 
It's really a minor thing.
 
8:29 PM
It's so minor, I wouldn't give it a standalone answer
 
OK.
OK, I'll delete and see if I can add something better too.
 
0
Q: Find non duplicateTriangle Triplets from a list of given numbers

SteephenI implemented an O(N^2) algorithmic solution but not sure it is better than my previous implementation Find Triangle Triplets from a list of given numbers in case of performance. I adapted almost all suggestions from answer except a structure to keep the triangle triplets. And @nhgrif pointed o...

 
JS1
@Hosch250 Not only can you see the result in a debugger that way, you can also change the result in the debugger if you want to test what happens if the result is the opposite.
 
^^ that is also a valid point
 
Hey @nhgrif I am back with a better solution
 
8:32 PM
Would you mind offering an explanation for why you opted not to use the struct? Preferrably in the question, but in chat would suffice.
 
@JS1 Change a value in the debugger? How does that happen?
 
Also, I didn't mention this in my answer, but if you notice in the code in my answer, we're passing the input vector by value (your code in both questions passes this by reference for no reason).
 
JS1
You can change the values of variables in a debugger. At least you can in the debuggers I've used.
 
Also, @Steephen one last point... you should probably mark my answer as accepted on the previous question since people should now be reviewing this newer iteration of the code.
 
8:34 PM
@nhgrif I will
 
Huh, I never tried that. Interesting to know
 
wait some more time, I will accept
Usually if I accept no one will review it again
 
Yes, but that's the point.
Now that you've opened a new question with the same code, no one should be reviewing the old one.
 
Okei
 
If you still want reviews on the old one, then perhaps you've posted the new one prematurely.
 
8:36 PM
Your argument on passing the vector as value
 
2
Q: Find non duplicateTriangle Triplets from a list of given numbers

SteephenI implemented an O(N^2) algorithmic solution but not sure it is better than my previous implementation Find Triangle Triplets from a list of given numbers in case of performance. I adapted almost all suggestions from answer except a structure to keep the triangle triplets. And @nhgrif pointed o...

 
Is it on function findTriangleTriplets()?
 
Yes.
Just get rid of the &
 
No
 
Why not...?
 
8:37 PM
This is better in that case
 
You're not modifying the vector.
You don't need a reference to the vector...
 
Then I should change it to const
 
Why are you passing it by reference?
 
But if in case t is a huge vector, this is the better choice
 
Okay, then make it const, I guess. I don't know, I guess. I'm not C++ expert.
 
8:38 PM
Yea, there is more changes needed in direction of const correctness
You are right
 
But if I pass in something by ref, I should expect it to be modified.
 
It is better to make it const
 
And therefore, if a function is expecting me to pass by ref, then it should be modifying.
But I'm more interested in your decision regarding not using the struct.
 
Not always
for example here it is not
Yea that I will explain
If you check SeiveDuplicate function
I am sorting the vector before inserting to std:;set
If I keep it in vector it is more easy
 
This is starting to sound like your previous argument...
You're using a vector because that makes one bit of code easier... and doing that at the expense of every other section of code being more complicated than if you used a struct...
 
8:42 PM
If I write a sort function for a structure, worse case is O(N2)
if I use std:;sort it will be O(nLogn)
And it is other way a way of reinventing the wheel
 
If you want to get a more detailed review of your code codereview.stackexchange.com might be more what you want. — Others 1 min ago
Before this gets posted to Code Review, the asker should figure out first what programming language this is (no language tag) and second whether or not they're sure it's producing the correct results and working as intended. — nhgrif 46 secs ago
 
Wow, that's an interesting false positive @Duga.
 
@nhgrif Sorry! They happen every now and then.
 
@JS1 so if a vector has size 3, will you say iterating over vector is O(N3)
 
That's not what he's saying.
Iterating over a vector is O(N1)
 
8:53 PM
Okei
 
But building the vector that you're iterating over is O(N2)
So your solution is O(N3)
 
Can you please elaborate @nhgrif
I am missing something
 
It's O(N2) to build the vector you're going to iterate over.
 
Okei
 
You're already at O(N2) before you iterate over the vector.
Then you iterate over that vector, which is O(N1)
O(N2) + O(N1) = O(N3)
 
8:56 PM
yet to see a question in this question, should be under code review site? — Jaak Kütt 28 secs ago
 
O(n^2) * O(n^1) = O(n^3)
 
Is it * or + needed
 
If the O(n^1) comes after the O(n^2) iteration, it is still O(n^2).
 
Or sure, that. I'm not great with O notation, but what JS1 is saying makes sense, and I think he's right.
@SimonAndréForsberg I think it's O(N1) as the inner loop of an O(N2) loop.
 
I don't know what code we're talking about :)
Where's the code?
 
8:57 PM
What @SimonAndréForsberg is saying right
 
1
A: Find non duplicateTriangle Triplets from a list of given numbers

JS1Not an O(N^2) algorithm You create a vector that contains every (i,j) pair. This vector contains O(N^2) elements. For each pair, you loop across the original vector of N elements. Outer loop = O(N^2) Inner loop = O(N) Total = O(N^3) By the way, unless you allow printing ranges of answers, ...

 
@nhgrif there is no inner loop inside O(n^2)
So it should be O(n^2)
 
that's O(n^3)
 
@SimonAndréForsberg You looked at the code?
 
8:59 PM
@SimonAndréForsberg can you please explain
 
you find pairs, that's O(n^2)
 
Yes
 
for each pair you found you loop over the original array, which is O(n)
so it is O(n^2) * O(n) = O(n^3)
 
See the pair is a vector
It is again a O(N) right
 
Two different N's.
 
9:00 PM
Not that timing is a good measure of the O notation, but have you timed this version versus the different version to see if this version even runs faster?
 
Looping over an ordinary array is O(n), yes. But in this case, the number of elements in the array is N^2.
 
I believe this is Q can be reopened: codereview.stackexchange.com/questions/85878/…
 
Looping over an array of N elements is O(N). This is not N elements. This is N^2 elements.
You could translate the code to Java and run it through a tool @rolfl and I have worked on. That will tell you how well it scales.
 
See in second loop not looping over pair
This is the operation over pair in second loop
std::count( std::begin( pair ), std::end( pair ), num ) < 2
just taking a count
 
@Steephen there are two N's.
 
9:04 PM
I am talking about this:
for(auto &pair : triplets)
{
    std::vector<int> pers_vec( pair );
    bool flag = false;
    for( auto &num : vec_input )
 
You're doing an O(N1) loop over O(N2) elements.
 
yes I got
See in that loop no were lopping over first O(N^2 ) elements
just taking std::count on pairs
not looping over that vector
adding one more element
into same vector
 
for(auto &pair : triplets) is itself looping over O(n^2) elements.
The number of elements in triplets is of the order N^2.
 
This will be triplets.size() iteration
not triplets.size()* 2 operation
 
triplets.size is approximately the same as vec_input.size * vec_input.size
 
9:10 PM
okei
while doing second iteration
 
So you understand now why your code is O(n^3) ?
 
kinda
That make sense somewhat
Thank you @SimonAndréForsberg
 
You're welcome.
 
I just run a test, N=6, size of triplets after first iteration is 15
 
and after the rest of the iterations?
 
9:15 PM
before seiving riplets.size() 42
after seiving 28
 
I just realized something... Swift's playground will help me calculate O notation...
I think.
 
@nhgrif haha
 
@nhgrif How?
 
Swift playground is magic.
Do you have an example of something very simple that should product O(N^3) ?
 
@nhgrif A triple for-loop? :)
for (int a : array) for (int b : array) for (int c : array) sum += a + b + c;
very simple ^^
and totally useless, but that's another thing ;)
 
9:25 PM
n = 2
See that (8 times)
n^3 = 8 when n is 2
(if I do just one element, it spits out the sum instead of how many times its called, because no matter when big O notation, it's only looped once if n = 1`
 
ah, okay.
so you can use Swift playground as a help for it. It won't tell you the complexity/scalability directly. but it is indeed useful.
 
Right.
 
Seriously, why can't companies actually say what they do as a business
 
So you still have to know what you're doing. For example:
 
> Pivotal offers a modern approach to technology that organizations need to thrive in a new era of business innovation. Our solutions intersect cloud, big data and agile development, creating a framework that increases data leverage, accelerates application delivery, and decreases costs, while providing enterprises the speed and scale they need to compete.
What on earth is their product?!
 
9:31 PM
(8 times) and (2 times), but it's still just O(N^3)
 
@JeroenVannevel No idea but it surely sounds good!
 
And if you do something like this:
Well, obviously it's still O(N^3), because that last part is constant
@JeroenVannevel This sounds like every company ever.
 
@nhgrif Exactly. How am I supposed to write I'm all enthusiastic about their product in my cover letter if they all say the same standard crap on their website
 
Link to their website?
 
And no email address for spontaneous applications :/
That's pretty annoying
 
9:39 PM
hmm, I'm not sure how to sum it up, but I think I get the gist of what they do
Which is basically... help software companies deploy their products sort of
 
It's probably not a good sign if people have such trouble figuring out what you do exactly
 
Well... it sounds a bit like Parse
You go to Parse, they help you get your backend set up and help you develop some APIs for talking to your backend (this is pretty much all automated)
And then you write an app that talks to these APIs you created.
Pivotal sounds like the same thing, except perhaps less automated and more tailored. More like, it's for bigger companies, whereas Parse is more for like individual developers.
 
I see
Still a little vague but I'm not an insider either of course
I'll just email their info address
 
I mean, there's a decently large demand, and Parse of course is extremely popular.
But that's because without Parse, as an individual developer, you have to be extremely flexible and have a big toolbox... or limit your app to not needing a backend.
And apps that don't require backends have limited utility.
 
I've never used Parse so not too sure how their process goes exactly
Question
Applied Computer Science sounds better than Applied Informatics, right?
 
9:49 PM
I don't know. I'm not HR, and technical people like me probably won't care what fany words you use.
 
Sadly, HR is an obstacle for me to go through
 
0
Q: Allowing googlebot to crawl a password protected page

JeffThe below I have put together as an experiment, I have profiles on my site that are password protected. I would still like them to be crawled by google. The script is taken from here and basically does a reverse dns lookup to verify if a googlebot is real or fake. I am then using this logic to ...

 
@Hosch250 it's for easier debugging. I can set a breakpoint and inspect the result before returning it ;)
 
For 1.5 years, the degree on my SO Careers profile was entered as "Bachelor's Degree". Nothing more.
FML.
 
10:10 PM
@Mat'sMug OK.
I just spent at least an hour creating a 6-7 second segment of animated video in Premiere Elements.
It locked up, it crashed every open application on my computer...
Probably just ate the memory up so the system had to take it from open applications, or something.
I think the main problem was there was no way for it to short-circuit the animated preview, so it would animate the preview in spurts for minutes after I was done.
And the best part was saving the project was extremely unresponsive...
 
10:24 PM
"I'm always mildly disappointed with my choices" #WifeWithoutContext
 
10:37 PM
How do I log out of this site?
 
@JeroenVannevel For 1.5 years, the degree on my SO Careers profile was entered as absolutely nothing!
Feb 3 '14 at 18:07, by Simon André Forsberg
Once you're in The 2nd Monitor, there's no way out.
2
 
Nevermind, I found it
 
0
Q: Multiple Choice Questions using OWL

Ravi ShankarI am working on a project on automated multiple choice question generation using Ontology Web language(OWL). I need python or Java tools to link the OWL and generate questions.

 
After having read several comments that @Duga catches that mentions this Programmers meta question, I have now read it.
36
Q: What goes on Programmers.SE? A guide for Stack Overflow

MichaelTYou're on Stack Overflow and you've found a question that isn't about coding. It's about design or something squishy like that. You are trying to be helpful, and you put a comment in the question: You should try asking on Programmers.SE instead. --YourName 2 minutes ago ... and suddenly, ou...

I can highly recommend others to read it as well.
And I wonder: Perhaps we should also create a question like that? "What goes on CodeReview.SE? A guide for Stack Overflow"
I know we have Be careful when recommending CR to askers on SO Meta already, I refer to that one quite often. But perhaps we should have another one simply for the purpose of referring to in comments?
^^ @rolfl @200_success @nhgrif @sᴉɔuɐɹɥԀ and others that are interested and/or often reply to misguided SO-users
The Programmers folks have referred to that question 50 times in one and a half month.
We have referred to "Be careful when recommending..." 24 times since @Duga started (about two months ago)
 
11:01 PM
@SimonAndréForsberg If we had a reference link on meta/help center I think it would be beneficial
One specifically for SO users, that we can reference in comments
 
-2
Q: C# Signed Byte is being written as Unsigned Byte

TGEI'm experiencing a weird issue where an sbyte is being written to the file as a normal byte. The data has to be in the -127 to 127 range so this is a major issue. Any help?

off topic
 
@nhgrif Closed
 
-3
Q: C# Signed Byte is being written as Unsigned Byte

TGEI'm experiencing a weird issue where an sbyte is being written to the file as a normal byte. The data has to be in the -127 to 127 range so this is a major issue. Any help?

 
@SimonAndréForsberg You could write one, but it would be very similar to our migration guide.
 
Where is our migration guide?
This:
16
Q: What questions are suitable for migration to Code Review, and how does the process work?

rolflConsider this situation: There is this question on another site which I think would be a good candidate for migration to Code Review. What should I consider before flagging the question, or actually migrating it?

??
@200_success Is that the meta you are referring to?
 
11:13 PM
-1
Q: Angular, paginate through restful api or save all in object?

JakeThe max size of the object would be no more than ~300 with 5 properties each around ~10 chars in length. At first I was doing a query with pagination ex. &?keyword=blach&page=1 then I saw something and was wondering if instead it would be better to get all results and save them into an object t...

 
If I am creating a chat room robot, am I allowed to give an up vote to one of the robot's posts to help get it to the minimum required reputation for chat room posting?
 
You really shouldn't.
I think the mods can give it access.
 
@SirPython Don't give the upvote yourself. Have another one do it. Write an answer with the robot account and ask others to check it. That's what I did with @Duga.
 
Thank you.
 
By the way, where would I get started in writing a chatbot?
What's involved in doing this?
 
11:23 PM
I just wrote a quick JavaScript bot. Nothing nearly as complicated as @Duga's source code
 
Or wait... is @Duga open source?
 
@200_success I think there are some points that are not covered by the migration guide (yes @nhgrif, that is the one). The size of the Code Review community and the size of Stack Overflow community is massively different. We get 32 questions per day, that's what SO gets in an hour.
 
And @SimonAndréForsberg how would you feel about @Duga posting messages when some of us have new blog posts?
@SimonAndréForsberg The answers are both community wiki. You could add any missing points. But perhaps it might be suitable to have a question specifically gear toward people trying to migrate from SO. Although...where else do questions get migrated from?
 
@nhgrif Should be possible to detect with RSS, which chat already have built-in support for: chat.stackexchange.com/rooms/info/8595/… (you can view that page, right?)
 
Oh wait, so the room could just be set up to listen to RSS feeds for our blogs potentially?
 
11:28 PM
@nhgrif I think there's a difference between "trying to migrate" and "recommending as another possible site". The meta I have in mind would be specifically aimed towards the endless stream of SO-comments suggesting CR. Not all of them are trying to migrate the question here.
 
Ah, okay.
 
@nhgrif Should be possible, yes. But I would like to make sure that at least a few others agree with the idea before I make any changes to the feeds.
 
feed://importblogkit.com/feed/
;)
Maybe I should open a meta about adding some of our users blogs to the feed?
 
@nhgrif We could try to get a somewhat chat consensus first.
 
I hesitate to promote blog posts automatically. That would start turning the site into a bit of a social network.
 
11:31 PM
I don't like it @SirPython
Especially given the chance at false positives.
I think that'd get shut down really quickly.
@200_success Is there a non-automatic way to do it?
Obviously, we'd really only want good Code Review relevant blog posts in the main chat.
 
:20919232 I don't entrust a bot with that. I prefer if all SO comments/questions are handled by humans. It's the same reason that I don't want to automatically vote or comment with @Duga.
 
I would like it if a star on a Duga post meant Duga automatically tried to upvote the comment.
I look at everything @Duga mentions in chat.
 
Post a link if you have a particularly good post. It wouldn't be oneboxed, though.
 
Well obviously all of my posts are particularly good...
...
</sarcasm?>
 
@nhgrif @Duga currently does not automatically-read chat, or detect starred messages.
^^ question would have belonged on CR, but was deleted before I could say something.
 
11:39 PM
heh
 
@SirPython Overall I like the idea of @Duga being able to classify things and inform about the classification in chat. But if there's one thing the past two months have taught me, it is that classifying something out of pure text is really difficult. I've adjusted the filter for comments mentioning Programmers several times. Making good filters is hard.
 
Oh by the way... you guys want to hear something ridiculous?
At my day job, I write ERP software.
 
@SimonAndréForsberg Yes, I can agree with that; there are so many things that someone could say and it's hard to be able to handle them all.
 
@nhgrif I gotta admit, I still have no idea what ERP is.
 
Part of the task of the software is to calculate the book value of your various inventory items, so that at the end of the month, you can compare your book values to your sell prices and see what sort of profit margins you're making and make adjustments to what you buy and sell at
So, if you buy a bucket of bolts and some sheet metal, the bolts have a book value price, and the sheet metal price. Then with the software, you create a job to assemble these materials into a product you're going to sell.
 
11:47 PM
@SirPython Just take a look at the starred messages in @Duga's Playground. Each star is on a message that was either posted to The Whiteboard but shouldn't be, or wasn't posted there but should have been.
 
Everything you put into that job effects the cost of the job. The materials you use on the job affect the material cost, and employees working on the job affect the labor cost. There are some other things that go into it, but those are the basics.
 
So, ERP = Enterprise resource planning.
 
@nhgrif / @SirPython - about chat bots.
 
So, let's say you put $40 worth of sheet metal, and $10 worth of bolts, and $50 worth of labor into your job. That job has a cost of $100, right? Makes sense.
Yes @SimonAndréForsberg
 
chatbots shoudl be created in their own room and tested there before being linked in to this room.
 
11:49 PM
Then if from that job, you get 4 final assembled products, it takes that $100 splits it among the products that came out of that job, so these 4 assembled products are worth $25 each
 
Even useful bots are subject to eviction, and are a 'privilege'
 
@rolfl Sure thing.
 
On the other hand, I encourage you all to play with them ;-)
There have been failed bots, @Duga is the only one which has been successful so far.
(on code review)
 
But if you then go back and receive a 5th assembled product from that job, the software goes to the original four and adjust their book value down to $20 and gives the 5th one a book value of $20 also (so we're still splitting the job's $100 cost evenly among everything we received from that job).
 
@rolfl What if the bot is not a feed? As in, what if the bot just responds to things that you tell it to do?
 
11:52 PM
Then, if I add another $50 labor cost to the job, so it has a total cost of $150, the software goes and adjusts the bookvalue up on all of those products, so now they're worth $30/ea
The software is really good at this. At any point in time, you can know exactly where all of your costs are at. And there's all sorts of reports to then see if you're overspending on materials or on labor, or if you're undercharging on your products.
(This is just one small aspect of the whole product)
But anyway... you can also manually set your book values. This is usually reserved for end of the year for inventory that has been sitting in stock and you're saying it has depreciated in value from sitting on your shelves basically...
 
@rolfl I am honored!
 
Last week, I found out... one of our clients is manually setting the book value of 100% of their inventory immediately after they receive it into stock.
And once the book value is manually set, it's not touched again. But the software instead accounts for the difference between the set book value and what it should be in adjustment account.
It's just baffling to me though that someone would pay the kind of money for software like this and then just use it like a fancy Excel spreadsheet.
 
@SirPython Such bots are at risk of being more 'play toys' than useful.
 
I am having some troubles... I created a new testing room for my bot, but when I try to add them to write access, it says that they must have at least 20 reputation. This confuses me because, under the "Explicit write access" section, it says that, even if the user's reputation is too low, they will still be able to chat.
 
@SirPython See this now frozen chat room for a previous bot idea that never made it to The 2nd Monitor.
@SirPython I think a moderator is needed to grant that additional access. What's the bot account btw?
 
11:59 PM
@SimonAndréForsberg Moderator of CR, or of the chat room?
 
@SirPython probably a chat moderator is enough. So any moderator on the chat.stackexchange.com domain.
Although I can recommend the approach of posting a CR answer with the bot
 
RELOAD!
 

« first day (700 days earlier)      last day (3317 days later) »