« first day (1337 days earlier)      last day (2663 days later) » 

12:00 AM
RELOAD! There are 3242 unanswered questions (91.9974% answered)
 
12:10 AM
@denis Not sure.
Actually, yes.
If he has a custom cast operator on Types.
He could have a custom cast operator on Types that takes an object, casts it to a string, and does custom parsing on it.
I wouldn't recommend doing that, but it would work ;)
 
I don't think this is possible
 
It is.
You can create both explicit and implicit cast operators in C#.
 
The problem is that the parameter is object
 
47
Q: How do I provide custom cast support for my class?

esacHow do I provide support for casting my class to other types? For example, if I have my own implementation of managing a byte[], and I want to let people cast my class to a byte[], which will just return the private member, how would I do this? Is it common practice to let them also cast this to...

Doesn't matter.
He would be stupid to do that, but it would work.
He could define a cast from object that takes the object and expects a string.
 
The signature should be something similar
public static explicit operator Types(object target)
 
12:17 AM
Yup.
Then he would cast target to a string, which would succeed in that instance.
 
But we cant do that
object is base class
 
Ah, right.
Well, let's see.
I don't see any way that would work.
 
Yep, does that makes the code broken :?
 
Well, I already VTC'ed as unclear, so...
Wait, what if Types derives from string?
 
You cant
 
12:21 AM
String is sealed?
 
Yep
 
I see.
@denis:
var foo = (object)this;
Checkers.GameController.GameController bar = (GameController)foo;
That works.
 
Well everything derives from object doesn't it ..
 
I defined a cast operator from GameController to Checkers.GameController.GameController.
It doesn't complain, so it could work if he had a cast operator from string to Types.
@denis Yeah, I basically forced it to be type object.
It might blow up with a failed cast at runtime, but for a specific subset of usages, it would work. He might just be using within those usages.
So, I would say that code is stupid, but it isn't necessarily broken.
 
Those 2 cases are different
 
12:25 AM
How?
I'm casting from one type to another type through a variable that only knows it is an object.
That's what he's doing too, and he apparently knows the type is string already if his string casts work without blowing up.
 
Can you post a link to your question where this is happening ?
 
So, if he had an object that was really a string, and he cast the object to Types, and he had a custom operator from string to Types, it would work.
I don't have it in a question--I just did it in my IDE.
Although, most of the underlying code (except that cast above) is here: codereview.stackexchange.com/q/150982/34073
 
the only safe part of OP's code is this
Client.Name == (string)valueToSearch || Client.Phone == (string)valueToSearch
If none of those if's evaluate to true the program will crash
if it hasn't already
Where your code kinda needs more context to verify that it will/wont work
 
That's not true.
We know that valueToSearch is a string, if the first one doesn't blow up.
If he has a cast operator from string to Types, this will succeed:
Client.Type == (Types) valueToSearch
 
Hmm
 
12:34 AM
It will implicitly cast it to string for the cast operator.
It doesn't know that it isn't a string, and it won't be a compile error, as I showed above.
I don't like it, but there is a chance that it will work.
Anyway, I have to go eat dinner. Just VTC as unclear, if you want to CV it.
 
Alright I test that out too, will let you know the results, tho it seems like it will work.
@Hosch250 It doesn't work it wont do the cast for you.
 
0
Q: A simple improvement of Log2 method

Tiger HwangI saw a simple method to calculate Log2(N), where N is the power of 2: unsigned int Log2(unsigned int N) { unsigned int n = 0; while (N >>= 1) { ++n; } return n; } It would be not likely very necessary, but I try to improve it in a simple way, the idea comes from bi...

0
Q: Identifying changes between two data frames

Lee MtotiPlease see this link to see original question and code: I tested that code to see if I could implement something similar I was working. Manually went through code. Saved M so I can read it again and continue. M <- read.csv("test-2016-12-30.csv") KEYS = c("ShortFileName") VAL = c("scanDate","Co...

 
1:05 AM
possible answer invalidation by InBetween on question by InBetween: codereview.stackexchange.com/posts/151233/revisions
 
0
Q: PHP does escapeshellarg have any vulnerabilities?

Sanchke DellowarI know an answer could be as simple a "no" but I need clarification. Because if someone were to bypass this logic then the attacker pretty much have full control of the website: $condomFile = escapeshellarg($file); $res = `ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of ...

 
1:38 AM
WEEKEND :D
 
2:12 AM
I think it will be much better in codereview.stackexchange.comDekel 29 secs ago
 
Today at work I was subjected to a Q&A quiz game that some poor soul made with PowerPoint. I don't think I've ever seen such a buggy thing.
I'm tempted to rewrite it for browser-based version with JavaScript
Deliver it to them next week, "Here I fixed your game, just copy your questions in this file and open up the page"
 
@Mat'sMug Everyone wins. :)
 
0
Q: How to handle multiple dimensions of arrays with speed

Jonathan PortorrealI'm looking to learn how to write efficient Haskell code. This snippet works, but the run time is slow. How can I write faster Haskell code? input: maxPrice = 7 input: vendorsDelivery = [5, 4, 2, 3] input: vendorsProducts = [[1, 1, 1],[3, -1, 3],[-1, 2, 2],[5, -1, -1]] output: [1,2] (fastest...

 
2:28 AM
yesterday, by Phrancis
What kind of behavior would one expect from push() ing a node to the front of an empty linked list? By that I mean it is only the head pointer
I gave that some thought, and would it make sense that pushing to an empty list just populates the list with its first element?
(and subsequent pushes then work as you'd expect)
 
2:49 AM
This is maybe a better fit for the code review SE site — David Rawson 6 secs ago
@Pyol7 I will suggest to use codereview.stackexchange.com for this purpose, post a link here, after asking there. — saurabh 39 secs ago
 
0
Q: 3x3 matrix with static corner elements

AndreasI revised the code in here because I wanted to get an square magic 3x3. It works, but it's slow. Any suggestions on speeding up the code? import itertools def eligCheck(m): flag=0 if (len(m)==3 and len(m[0])==3 and len(m[1])==3 and len(m[2])==3): flag=flag+1 #Check 2 if ...

 
3:21 AM
I got the accept from that zombie I killed today :)
 
Nice!
 
1
Q: Slack bot for miming similar messages

MarcI have a Slack bot that takes a stream of messages and the idea is that if 3 different users repeat the same message, the bot will also mime that message. I am just beginning with RXJS and I am trying to figure out the correct, most idiomatic way to refactor the following code. Is it even possi...

 
I know one post I'll nominate for best title, if it gets there :)
 
Hey @Hosch250 see just above, I saw you responded to it yesterday, do you think that approach would make sense? Since there is nothing to push towards the back of the empty list
 
3:38 AM
@CaptainObvious Looks like someone else's code.
 
@Peilonrayz Good catch, I agree
 
4:01 AM
@Hosch250 Very likely. ;)
 
Blast from the past (an upvote brought me back here)! I rolled back the last revision (sorry for not noticing like, uh, a wee bit earlier), since it basically removed the question from the post; future viewers may be looking for a question with a specific problem similar to their own, to seek answers - and for that the site needs to retain its Q&A nature and not become some discussion forum. If you would like some constructive feedback on this code (or anything that works as intended, really), you can get exactly that and much more on SO's Code Review sister site. Happy new year! — Mat's Mug 8 secs ago
 
From 3 years ago ^^
 
@DanPantry What are you referring to?
My aggregator has run for the last time that it ever will in 2016...:'(
 
11 of us just earned an tag badge. @EBrown did we have 11 tag badges by any chance? (I hear you collect badge info?)
 
@Mat'sMug Unfortunately it adds far too many API requests for me to collect tag badges. :(
 
4:09 AM
@EBrown Huh why?
 
@Mat'sMug Because it doesn't run again until midnight UTC, the next UTC midnight will be 2017-01-01 00:00:00.0000000.
 
makes sense. hadn't realized the date lol
 
Yeah man the year is almost over.
 
about time we leave that one behind
 
No kidding.
I need a Windows C compiler.
Or do I?
Maybe one for my Mac.
Someone passed 1k rep today. :)
6
 
4:16 AM
@EBrown You already have one silly
 
@Phrancis A bad one.
 
Meh, seems to do the job, for Windows
It is, after all, made by Microsoft.
 
I have cast exactly 800 votes as of this moment.
 
4:40 AM
@EBrown beautiful!
 
I'm going to be brutally honest: I'm part of that problem.
 
@EBrown and of the solution
 
@Mat'sMug How so?
 
Solution is to vote... and you can do that ;-)
 
I edited it again.
See bottom ('How bad is this?')
 
4:43 AM
Eh, don't be so hard on yourself.
 
I don't vote enough, or participate enough for that matter.
 
@Phrancis See what?
 
I mean, you're not alone... I don't even the last time I hit the vote-cap. I should vote more as well. Everybody should.
 
> Total : 5,059,999
 
@EBrown I have 711 votes on cr meta alone.
 
4:45 AM
That's a funny number of rows to me.
@Mat'sMug We all should.
 
8309 on cr main.
@Mat'sMug I hit it just two days ago.
Unless it was three days ago.
Still, not very long ago.
 
If we took the ~10-12 regulars (hell, even the 6-8 users talking in chat every day) and used all 40 votes in a day, that's 240-320 on the low side, and 400-480 on the high side just from the regulars.
That's a lot of votes.
If we used those on the 64 posts coming in daily...
That would be 3.75 to 7.1875 votes on every post hitting the site daily just from the regulars.
 
Only 64 Q+A's coming in each day?
 
@Hosch250 Yeah, that's been the average for the last 30 days.
 
Well, why did I get +11 on my latest question in less than 24 hours?
 
4:48 AM
I'm only talking regulars.
Just people in this room on a daily basis.
 
@Hosch250 went HNQ?
 
2 hours ago, by Phrancis
I gave that some thought, and would it make sense that pushing to an empty list just populates the list with its first element?
 
That's Me, @Mat'sMug, @200_success, @Jamal, @Hosch250, @Phrancis, @Mast, @denis, @Kaz, @Dex'ter, @Peilonrayz, @DanPantry, @DanLyons, @JeroenVannevel, @Donald.McLean, @Gemtastic, @janos, @SimonForsberg, @Malachi, @N3buchadnezzar, @skiwi, @SirPython, @t3chb0t, @ThomasWard, @Tushar, @Vogel612. That's 26 people...that's 1040 votes...16.25 per post just from regulars.
Also, lots of pings. ;)
4
Just the regular users in this room that were on the ping list could vote every new post up (or down) to at least 10 at the moment.
That's not even passers-by. Or @Marc-Andre or the other people in the Cardshifter room frequently that still creep around here. :)
That's just people that chat here daily.
We can make a difference.
8
 
@Pyol7 this seems good, I will suggest to use codereview.stackexchange.com for this purpose, post a link here, after asking there. — saurabh 15 secs ago
 
@Mat'sMug Not as far as I know.
Just got a 12'th on it.
@EBrown Wait, are you counting off topic posts?
It will be fun to see -16 on some posts.
And if they are deleted, we get our votes back.
 
4:56 AM
@Hosch250 Yes, but usually when those are from -3 to -5 people stop down voting them mostly. So we could probably increase that number much more for on-topic posts.
 
Even though I am one of the top voters, I have almost never used my daily allotment.
 
I personally think that getting more new regulars in here would make a big difference in the long term. I thought that congratulating rep milestones of non-chat-regulars in here (my a mod of course, since only theiy can super-ping) would make a big difference
 
For one, I don't have the time to read that many posts.
6
 
@200_success That's the problem I have. I don't have time to read enough around here to keep up with voting.
 
Ditto
 
4:57 AM
For another, I feel that my votes are more meaningful if I discriminate rather than upvote everything that I come across.
And I'm quite picky when voting. If anything in an answer rubs me the wrong way, I end up commenting instead.
 
Yeah, not everything should be +16.
 
@Hosch250 It doesn't have to be. We can use them on existing questions/answers.
I guarantee that there are no people who have voted enough to be able to have voted on even half of the questions + answers on this site. The highest voter is @Jamal at 22k, that's just over half our questions if he only voted on questions, not to mention all the answers as well (66k).
Total vote counts for the top 36 voters (one page) start at 22k, and then go down to 1800.
 
It says that a -4 post is one away from Reversal.
 
5:21 AM
@EBrown Since I was pung, IMO those users are already making a difference, without them we wouldn't have a community.
 
Yeah, I hit the one-vote-short queue and DVLR'ed already.
I've clinched a spot as the number 9 voter for the year, and I didn't vote at all probably half the days.
I have exactly 4 votes per day in the year on average.
I couldn't have planned that better.
 
You might want to check out the Code Review stack exchange. Stackoverflow is more for specific questions about problems you're having. — dustmouse 48 secs ago
 
5:35 AM
Morning
 
Morning? I was about to say Good Night!
 
It's morning here. Last day of 16.
 
It'll be the last day of '16 here in about 20 minutes.
 
0
Q: Rest API NodeJS, ExpressJS and MySQL

user1270510 down vote favorite In the last month I've been studying Javascript for the first time and I jumped right into ES6. I have a JavaSE background but nothing related to REST or JavaEE. I'm trying to create a Rest API for a project of mine and was wondering if the flow that I'm using to create the r...

 
5:52 AM
@Tushar Which part of morning?
 
Late. 11:20 here
 
@EBrown The part before noon, obviously.
 
Nifty, 00:53 here.
 
It's tomorrow!
Oh wait, it's only today.
Today isn't a good functional variable--it is mutable.
 
@EBrown One more thing is, users who are coming from main SO site(like me) tend to vote less on normal answers as they've seen a lot of such answers. I only vote on answers when I see exceptionally well-written answers.
If you check my stats, I've more helpful flags than votes.
We need to advertise CR on Main Meta, take help from mods/users on Main site to encourage users to join CR.
As we see many questions are migrated from Main to CR, it clearly states that people don't know about CR. Even after migration, the users who posted on these questions don't join CR. These migration should be ideally zero.
 
6:15 AM
@Tushar I'm all for more SO users participating on CR, we need to primarily attract answerers which I feel sure some of the tag regulars there would enjoy if they tried it
 
I'll try to vote more from now.
 
If you see some really good answers on SO (that are recent/active users) feel welcome to comment linking them to appropriate tag searches on CR
 
Sure, I'll.
 
Sorry for interfering with site business.
 
No worries
 
6:20 AM
Gotta go now. CYA.
 
I can finally go to bed.
See ya.
 
Night!
 
Hi, @BrunoBorges.
You'll need +15 on an SE site to talk here.
 
@Mat'sMug @200_success @SimonForsberg @Jamal @janos what do you think about this?... :
2 hours ago, by Phrancis
I personally think that getting more new regulars in here would make a big difference in the long term. I thought that congratulating rep milestones of non-chat-regulars in here (my a mod of course, since only theiy can super-ping) would make a big difference
Typos notwithstanding :)
BTW.Mobile
 
6:45 AM
@Phrancis nice idea!
I'll look into adding a new feed in RoboSanta for milestoners, to remind us
btw any user can comment on a post to invite the user here, like Syb0rg did to me
 
Ok. We could also find relatively recent ones with SEDE
 
7:01 AM
SEDE is remarkably difficult to use on mobile
 
you're brave to even try!
anyway, I gotta go now
 
7:18 AM
SE should totally make SEDE app
UX is horrible
Even with a coding keyboard it's barely usable
 
0
Q: Discord music bot

CoreyI have code for a discord music bot, but I don't understand why when I try to addstaff. I get **LOG [01:04:21] Command !addstaff invoked by Spectre C:\Users\Kerolous Hanalla\Documents\Discordbot\bot.js:103 var roles = server.rolesOf(message.author); ^ TypeError: Canno...

 
7:35 AM
0
Q: More pythonic, simple try-except-return statement

TechMedicNYCWhat is a more pythonic way to write a try/except clause with a return value? Example A, is shorter, but I don't like the fact that the method seems to have a "dangling" return statement (visually the method just drops off the end). Example B, is longer, but seems to be more clear that the meth...

 
 
1 hour later…
8:40 AM
0
Q: Intersperse :: a -> [[a]] -> [a]

BlueJ774This code is my answer to question 7 of Real World Haskell, chapter 3's review section at the end. intersperse :: a -> [[a]] -> [a] intersperse _ [x] = x intersperse sep (x:xs) = x ++ sep : (intersperse sep xs) intersperse _ [] = [] The code satisfies all of the conditions of the question, but...

 
possible answer invalidation by Sela12 on question by Sela12: codereview.stackexchange.com/posts/151072/revisions
 
9:05 AM
possible answer invalidation by Sela12 on question by Sela12: codereview.stackexchange.com/posts/151072/revisions
 
@Duga rolledback
 
9:41 AM
@Phrancis Masochist.
@EBrown Mine has gcc built in. But you're a VS fan, right? That can do C.
Come to think of it, might be an artefact of running Cygwin, guess it somehow ended up in the Microsoft PATH as well...
@EBrown So, we should vote more often? I think I've said something along those lines a couple of times.
@CaptainObvious One more VTC.
 
9:56 AM
That's not an awful lot of votes.
The last user on that first page has 42 votes this month. We can do better than that.
That's barely more than a vote a day.
 
if there only were a next question button so that you don't have to navigate back and forth or open new tabs for each, it would go much easier and faster
 
@t3chb0t Right-mouse click + open in new tab.
Close tab when you're done.
Problem solved.
Besides, you're still required to properly read the question/answers before voting.
Don't autovote.
That would kill the system.
 
problem solved, no?
 
@t3chb0t If that isn't good enough, you're trying to shave off seconds where you only got 40 votes a day.
Besides, you're ranked 2nd in the weekly top voters, so you're already doing fairly well.
If you're looking to improve anything, you could throw more flags.
 
I usualy don't flag, I VTC
 
10:05 AM
That's good. Some comments or answers deserve flags though.
You can't VTC an answer :-)
 
that's right, but I rarely find an answer that needs to be flagged, most of the time they are in review queues as low quality already
 
@Hosch250 Found an F# zombie from March '14, interested?
+5/-0
 
the quesiton quality is really poor, every second or third question on the main page is on hold
 
It happens. Sometimes we close 5 questions in a row.
 
I'm just look at a haskell question and ask myself why do people invent languages with such funny/weird syntax
 
10:19 AM
@t3chb0t That's nothing. Try .
 
lol this is something
 
0
Q: Can this be written more pythonic? (changing characters in a string, string.replace() method?)

RoellandI have a function in python where I want the reverse complement of a DNA string. This is what I have now: def inversComplement(input): output = '' for letter in input: letter = letter.upper() if letter == 'A': output += 'T' elif letter == 'T': ...

 
Maybe a dictionary would be a little bit cleaner?
something like `output = (dictionary[c] or c for c in input_str)` (I'm not a master in python)
The chat doesn't support markdown?
 
10:35 AM
It does.
output = (dictionary[c] or c for c in input_str)
But it breaks pretty much all markdown in multi-line messages.
So
markdown
will
fail
 
Oh, OK. thanks!
 
10:49 AM
0
Q: Parsing the first two command-line arguments and extracting the remainder

HeinziMy program can be called like this: FakeDpi someInteger someExecutable [parametersForSomeExecutable] For example: FakeDpi 120 "C:\Program Files (x86)\...\excel.exe" /X "C:\Users\...\myFile.xlsx" should result in dpi = 120 exe = C:\Program Files (x86)\...\excel.exe args = /X "C:\Users\...\m...

 
possible answer invalidation by Sela12 on question by Sela12: codereview.stackexchange.com/posts/151072/revisions
 
@Duga Rolled back, that's the 2nd time.
 
even the 3rd time although he knew not to do it again, nice
 
11:05 AM
@EBrown Just questions, right? I can work at glancing over questions in little time, but for answers I really need to sit down
Also that mass-ping didn't actually work and you may be autoflagged by the system now ;-)
 
Once you're done with your assignment, I suggest you post it over at Code Review and we'll tell you how you can improve it. — simbabque 28 secs ago
 
@skiwi Is there such a thing as getting autoflagged in chat?
 
11:35 AM
0
Q: Shorter VBA Code for tabbing through multiple comboboxes

ThatsEarElephantI need to TAB through a combination of ComboBox(es) and cells in my worksheet. I have written the following code to jump from a ComboBox to a ComboBox: Private Sub ComboBox1_KeyDown (ByValKeyCode As MSForms.ReturnInteger, ByVal Shift as Integer) If KeyCode = 9 Then ComboBox2.Activate End Sub I...

 
@Mast There's no way to know, but I know SE isn't happy with mass-pings in general
Not that I'd have an issue with it if it would've worked
 
possible answer invalidation by Roovy on question by Roovy: codereview.stackexchange.com/posts/151186/revisions
 
@Duga rolledback
 
When reaching the last combobox, it won't matter (the way the user utilizes the database). I'm going to reach out to Code Review and see if anybody knows a generic script...I don't know vba code syntax — ThatsEarElephant 43 secs ago
 
11:56 AM
-2
Q: JavaScript text Adventure - how should I handle input strings?

CuckooI'm a noob coder, learning Javascript. I'm trying to make a text adventure game, which is starting to take shape. But I've hit a brick wall when it comes to making the text commands interactive. For instance, I'm working on 'get'/'take' items. Obviously the command would followed by the item (for...

 
12:16 PM
-1
Q: Revealing module pattern proper naming for event handlers

Hamid MosallaI use revealing module pattern to give my JavaScript code a little structure, my question is about proper naming, I have something like this: var pathFinderEditModule = (function () { function editPathButtonClickEventHandler() { $("body").on("click", "#submit-edit-path", e => { e.pre...

 
12:49 PM
As I said above, post the working code on Code Review and we will show you how to do it in a better way. You can turn off the warnings if you want, but it would be better to chose a different approach. — simbabque 34 secs ago
 
Heello
 
1:07 PM
0
Q: warnings to be removed in perl

user127069i have here a full working but when i run it, it shows below warnings: given is experimental at grocery.pl line 38. when is experimental at grocery.pl line 40. when is experimental at grocery.pl line 62. when is experimental at grocery.pl line 89. when is experimental at grocery.pl line 100. k...

 
You have working code you wish to improve; that's what Code Review is for. — Scott Hunter 29 secs ago
 
1:29 PM
Monking
 
Hello skiwi
 
0
Q: Inheritance in JavaScript

TobiGiven animal is a 'class', is this a good / the way to inherit, like in other languages? function trexdogrhino(...){ this = new animal; ... } // es[5-] ECMAScript 6 has brought a ton of changes; is there a new / better way to do this in ES6?

0
Q: Thread worker simulator

EdwardBecause I have writing more multithreaded C++14 code lately, I've developed some tools that help me make sure that my threads are all working as intended. In the real code, it's often difficult to detect race conditions or unintended sequence dependencies among threads, so I have found that temp...

 
@EBrown Vogel posted an image of the meta being down for maintenance
 
That should be posted to codereview.stackexchange.com — JB Nizet 30 secs ago
@ayav I see. You can also link your accounts, you don't need to make a new one. The Stack Exchange network is one big thing. Stack Overflow and Code Review are just two of the sites there are. Include some more information over there and maybe also link back to this question. — simbabque 18 secs ago
 
1:53 PM
Guys I feel like @t3chb0t deserves some more upvotes on his 2 answer on my question
 
done :)
 
Thank you @Dex'ter ! :)
 
no problem, bruh ^^
 
this question is probaby more fit to be posted under Code Review or Webmasters — Fred -ii- 16 secs ago
 
2:13 PM
@denis this was a great question, first I was a little bit scared of the expressions but now I feel much more confident ;-]
 
@t3chb0t in what way funny/weird?
Monking btw
 
Heya
Great thing @t3chb0t same here I also learned a lot from the original question
 
@Vogel612 sorry, I don't follow you
oh, I got it
I've just noticed the tiny arrow link next to the message, I didn't know it
 
I wonder who has the most hats on CR at this moment ^^
 
check the leaderboard
 
2:20 PM
it's @janos
 
with 7 hats ahead of edward
 
yes that's quite a huge margin
 
@Vogel612 its syntax is so unlike any other (non-brainfuck, non-lol etc.) language and seeing this . filter ((<= mP) . sum . map itemPrice) I guess you need to be extremely careful where and how many spaces you use
 
The only thing that annoys me about Haskell is it's IDE, I cannot be friends with it
 
@t3chb0t this method is bad private static string GetMemberName(Expression expression) In many cases if it's not possible to specify 2 generic parameters and instead you pass an object boxing will happen which will result in a UnaryExpression not a MemberExpression which will crash the program even if the expression looks fine p => p.X
It should be combined with the GetMemberInfo method I had in the TypeAcessor class (I have it moved to a separate file now)
 
2:29 PM
@t3chb0t oh ... um. you should be aware that . does something completely different from what you expect
 
And in fact I made it as a extension method for Expression, so you can turn your GetMemberName function into a single line =>expression.GetMemberInfo().Member.Name;
 
2:43 PM
@t3chb0t Those methods are really inefficient `PropertyInfo FindProperty<T, TIndex1>`
`SequenceEqual` is a really slow method just by itself.
 
@denis you mean where you can specify several expressions for multiple properties and they are all of type object? now when you say that it makes sense, I remember I once had this problem, I need to bring it back, ideed
 
Yep exactly
The expression will be boxed to an UnaryExpression in that case
 
this doesn't matter, it's going to be executed only once for property access, the expressions and reflection produce much more overhead
 
Are you talking about the FindProperty method ?
 
yes
 
2:45 PM
Oh sorry nvm that I didn't notice it's a private static I thought that it's something that the user can call
 
I guess it would be of no use for him :-] in non-critical parts convenience first
 
Yes I agree
 
0
Q: (Java) Consumer/Producer (Concurrency) - Exception Handling

racc44I have a circular buffer (array/first in first out), a consumer and a producer. A producer puts random numbers into the array, and a consumer takes the first number and checks if it is relative prime. My code works, and I think it works correct, but I want to improve it. I am not really shure ab...

 
@denis how about a small combo?
	var memberExpression =
		expression.Body as MemberExpression ??
		(expression.Body as UnaryExpression).Operand as MemberExpression;
	var memberExpression =
		expression.Body as MemberExpression ??
		(expression.Body as UnaryExpression)?.Operand as MemberExpression;
 
This should work too
 
3:05 PM
I'm voting to close this question as off-topic because it contains no specific problem. Questions about reviewing the code may be asked on codereview.stackexchange.com. — Tsyvarev 34 secs ago
 
@denis oh, I just see I have them twice :-] not so pretty
 
3:23 PM
@denis for multiple properties
public class ExpressionList<T> : List<Expression<Func<T, object>>> { }
reader.GetValues(foo, new ExpressionList<Foo>
{
    x => x.Bar
});
 
3:55 PM
possible answer invalidation by sDima on question by sDima: codereview.stackexchange.com/posts/151088/revisions
 
4:38 PM
@Duga @t3chb0t In the future, please roll back instead of reviewing newly added code.
 
0
Q: entab program which replaces 4 spaces with a tab

SiliproksiI wrote an entab program which needs to replace every \$n\$ spaces with 1 tab. I picked \$n\$ to be 4, so every 4 spaces should be 1 tab. I have a feeling that my code is far too complicated than it should be, and the logic I made it with could be much simpler. The logic of the code: Note: \$n\...

 
@200_success ok, I wasn't sure if this qualifies for a rollback
 
Remember: There's only a few hours left to code, otherwise you'll have to wait until next year
Oh wow I just realized that VS gives the option to add new item from template to add a class (in C# as example), I was using that big interface the whole time and was already thinking there has to be an easier way
 
you're learning c#
 
0
Q: Generating a sequence number based on last item of a list

Sirwan AfifiI wrote this method in order to generate a sequence number based on a specific pattern: public string LatestNumber(Guid id = default(Guid)) { var number = ""; if (id == Guid.Empty) { var items = myList.ToList(); var lastNumber = items.Any() ? items[items.Count - 1].Nu...

0
Q: RGB LED color control on arduino with a python program

ddmdavidSome I am trying to develop a program in python with tkinter and pyserial with the objective to control the color of a RGB LED connected to the arduino. The code is functional, but with a few problems. Here is the code: Arduino. //pin layout int red = 12; int green = 11; int blue = 10; //st...

 
4:51 PM
Yeah, trying to find out where exactly I need to add a JSON file to my WPF application if I want to use it inside
 
@skiwi That's R#.
 
derps around near the Python tag for no reason
 
@Hosch250 Oh, cool
 
@Mast Challenge Accepted.
 
Now what will I do once my free R# subscription ends? :(
 
4:58 PM
Use VSD.
It doesn't replace that nice interface, but it is sure working on replacing the code hints.
And talk to the VS team about making that a little nicer.
 
Wow, Newtonsoft.Json has a few downloads
 

« first day (1337 days earlier)      last day (2663 days later) »