« first day (1501 days earlier)      last day (3453 days later) » 

4:01 PM
Hey guys
Can someone fill me in quickly on something?
     AC.AcApuHourRatio = item.APUHoursDif / Math.Max(1,item.ACHoursDif);
AC.AcApuHourRatio is a double
item.AouHoursDif = 7
item.ACHoursDif = 13
result = 0;
 
What type are they?
 
while i want a ratio as accurate as possible
double = int / int
 
integer division truncates
cast them to double before dividing
 
Hey guys I have a question about dynamic types and reflection. I seem to have a problem where I have a dynamic type when I call a property on it manually it works however when I use reflection to get properties I get propertyInfo[0] returned.
var propertyInfo = yahooApiResult.GetType().GetProperty(nameOfProperty); returns null
but yahooApiResult.nameOfProperty returns a value
 
is the property public?
 
4:05 PM
the problem is that I am trying to loop through the properties to populate another model
it may not be... but I can access it when using the yahooApiResult.nameOfProperty notation
so I assume it should be public right?
 
I don't care about whether it may be
 
I'm using a 3rd party library
so I can't see the code
 
If it's not public, you won't find it unless you use BindingFlags.NonPublic
 
Thanks you saved me
Owe you one Kendall
 
@Ninja_Noob You shouldn't need to see the code
 
4:07 PM
but then wouldn't yahooApiResult.nameOfProperty not work?
if it wasn't public
 
But try Go To Definition
 
I can't....
it's a dynamic object
 
instead I have another doubt :P
it would be nice to have a test for understanding the level of a developer
 
@Ninja_Noob Maybe that's why. What does GetType() return?
 
but usually tests are like tricky
 
4:08 PM
I'll check
 
it would be nice a test like: "do you know reflection? yes? +1 point"
not like if I use reflection to multiply 113235434534*213214534543 what's the result?
 
{YSQ.core.Quotes.YahooQuote}
base {System.Reflection.TypeInfo}: {Name = "YahooQuote" FullName = "YSQ.core.Quotes.YahooQuote"}
Assembly: {YSQ.core, Version=1.0.4.0, Culture=neutral, PublicKeyToken=null}
AssemblyQualifiedName: "YSQ.core.Quotes.YahooQuote, YSQ.core, Version=1.0.4.0, Culture=neutral, PublicKeyToken=null"
BaseType: {Name = "DynamicObject" FullName = "System.Dynamic.DynamicObject"}
ContainsGenericParameters: false
DeclaringMethod: 'yahooApiResult.GetType().DeclaringMethod' threw an exception of type 'System.InvalidOperationException'
 
Try BindingFlags.FlattenHierarchy
 
@KendallFrey that's what's returned from the intermediate window
 
Could it be in a base class?
 
4:10 PM
I did try .BaseType.GetProperties
and I tried BaseType.BaseType.GetProperties
 
Maybe it's in a baser type?
 
etc..
I went right down
until I got a null reference
 
this is an example of the kind of tests which I don't like
 
There is also the possibility that the property isn't even defined in code
 
in which case how would I be able to access it
at runtime?
:/
 
4:11 PM
dynamic magic :)
 
user862319
@Revious I prefer test questions that are more conceptual...
 
ugh
 
Is there documentation on this class online?
 
user862319
those smarterer.com questions are shit
 
... ah wait a minute
it's open source!
 
4:12 PM
brilliant
where's the code?
 
ooooooo .... Skip to content
Sign up Sign in This repository
Explore
Features
Enterprise
Blog
Star 6 Fork 1 jchristian/yahoo_stock_quotes
branch: master yahoo_stock_quotes / src / core / Quotes / YahooQuote.cs
Jonathan Christianjchristian on 9 Sep Added the ability for the return dynamic quotes to be accessed by theā€¦
1 contributor
49 lines (42 sloc) 1.644 kb RawBlameHistory
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;

namespace YSQ.core.Quotes
{
internal class YahooQuote : DynamicObject
oops I should have sent you the url
 
Yup, looks a lot like it's a 'magic' dynamic property
Why are you trying to get the property with reflection?
 
well... I have a model... that model has properties which are the properties I want to extract from the dynamic object so...
 
You won't be able to access the property, because it doesn't exist
 
I have this list of properties that I am iterating through... I want to be able to get the values of those properties from the dynamic object and use them to populate the model's mirroring property
 
4:16 PM
You would be able to use TryGetMember
 
yea I spotted that also.. I just need to figure out how to use it...
 
@Bob yes, where can I find a nice test?
 
thank you for your help... I might be able to figure this out
 
Smarterer is not bad.. but the question are ultradumb
 
user862319
@Revious What are you trying to accomplish with this test?
 
4:17 PM
@Bob mmm.. they could be useful for a company which hires developers
for me it's just a curiosity..
 
user862319
@Revious You are a hiring manager at a company looking to see what we think would be a good test?
 
Well shit, someone checked in code that causes a stack overflow
 
no, no, for me it's just curiosity. In my previous company I didn't grow because most of people were not very good developers... so I was really demotivated..
 
@KendallFrey Sounds like it's time to break out The Stick(tm)
 
user862319
@Revious If you are looking to grow your skill set and experience, I recommend finding some project to work on that interests you. In my experience it is rare to work for a company that will push you to learn as much as you can on your own.
 
4:21 PM
@Bob yes, also in mine..
now I'm using Pluralsight courses
and of course experience..
do you know other stuff which can help?
 
@MrDoom To be precise, the Scrum Stickā„¢
 
user862319
@Revious Courses and books and colleges can only take you so far. You really need practical experience implementing an actual project that people in the real world can use.
 
That's what we call it
 
user862319
@Revious All of the formal knowledge is useful during the development process, but it isn't going to get you far in the realm of experience.
 
Previous company had a sombrero that came out if you managed to sneak something broken past a code review and the gated checkin. It was hot pink and massive.
I only wore it once :D
 
4:24 PM
Yeah, we have a gated checkin too
No idea how this shit got in
There is even a compiler error
 
what is it?
Gated Checkin I mean
 
something XAML
oh, gated checkin is when you run a build before checking in
 
@Revious When you check stuff in the TFS server will fire off a build to make sure it's kosher
 
if the build fails, so does the checkin
 
If it fails the checkin is rejected.
 
4:26 PM
is it nice or not?
 
@Revious kinda slow, but really nice for preventing headaches
 
Extremely useful, I'm trying to get it implemented at my company.
 
we are not using TFS since it's expensive :(
 
It prevents "Oh, I forgot a semicolon and it broke THE EVERYTHING when it was pushed to production"
Are you using Git?
 
no, SVN
 
4:27 PM
gag
 
Ok, well, stop that
Switch to Git
 
git requires an external website to know our sourcecode?
 
You can set up your own personal git server.
 
not at all
 
nice!
SVN is a mess!!!
 
4:28 PM
GitHub is a fancypants interface on top of Git, that's all.
 
We used Hg for years, it's pretty much like git
 
Hg?
 
mercurial
 
Mercurial. It was a fork of Git before Git for Windows existed.
Nowadays they're almost at feature parity.
 
So we can swithch to Mercurial or Git and install them on our servers?
 
4:29 PM
I don't know why not
 
So if you want the easy route do some research here: enterprise.github.com
 
You'll have to port over the repository and maybe copy history, but in the end the workflow will be smoother
And if you really want, you can implement gated builds in git
 
There are ways to port SVN history into Git, so you don't lose anything.
 
lovely!
 
git works decently well with SVN repos, so you might be able to get away with just a clone
 
4:34 PM
and comparing git and svn what do you think?
which is more stable / better and so on?
 
git is obviously better
there are obviously things svn does better than git, but they are few and far between
I don't know about stability, I've never heard that as a concern for source control
They're all pretty stable
 
but also git is free?
 
5:00 PM
@Revious the git software is free, but you'll probably need a server to store a main central repo, and servers aren't free.
 
@KendallFrey ok, that's not a problem.. it's for my company
i guess tfs is very expensive..
 
user862319
5:24 PM
@Revious I'd check out gitlab
 
user862319
 
5:53 PM
@scheien I draw CAD for a living, at least on paper.
 
@JohanLarsson wut lol
 
you knew that already.
 
CAD on paper isn't CAD anymore
 
No pun intended on second reading.
 
5:57 PM
sry about the punny nature of that one
 
user1630889
I see ICollection in my Entity Framework T4 template. I'm going to be honest - I haven't really been keeping track. But between the previous version and the current version of our web application, this has broken unit tests.
 
user1630889
Is it safe to modify the template to use "List" instead of "ICollection", or is that just dumb and not considering the various effects that could have on my system?
 
List is mutable
 
Anyone ever get question marks in the debugger variable inspection hover window thing?
All of a sudden I'll have random properties of objects show up as "?" without the name or anything else
Can't tell if it's something I did.
 
6:13 PM
I got that this weekend, after that everything crached
 
Hunh, just happens with the mouse scroll wheel.
 
was debugging wpf
 
If you use arrow keys it doesn't happen. Weird.
Yeah, my stuff crashed as well soon after.
 
I don't remember if it was before or after I installed update 4
 
I've started seeing this very recently. VS2012
 
6:19 PM
@KendallFrey there is actually Rastercad, for legacy stuff. nasty stuff.
ok I'm on vs2013
 
Neat, not limited to my version.
 
what were you debugging?
I think it was dependency properties that erred for me
 
I was in a VB project and today I'm in a C# projet
 
user1630889
@JohanLarsson
 
user1630889
oops.
 
user1630889
6:25 PM
@JohanLarsson List is mutable... So are collections from EF, right? I mean, List implements ICollection.
 
I don't think ICollection is mutable but to lazy to look it up
 
ICollection is mutable
IEnumerable is not
 
user1630889
Ah.
 
@KendallFrey where?
 
I'm starting to realize what my job is. I write shit software to talk to other people's shit software because their shit designs require our design to be shit so we have to polish their shit and hope it doesn't smell too bad
 
@Pheonixblade9 Welcome to glue.
 
Note that the difference is the generic form versus the "regular" form
 
6 mins ago, by Kendall Frey
ICollection is mutable
 
@JohanLarsson I assumed it was the generic one. Nobody uses the other one
 
ok, you know what assumption is right?
 
6:34 PM
@Pheonixblade9 My job is a lot like KSP. Find places to put struts to stop stuff from breaking, and occasionally add boosters to speed it up.
@JohanLarsson :(
 
@MrDoom I'm just sick of being almost done with something and then some random bullshit fact about their shit API is figured out and I have to redesign the damn thing for the 10th time
 
@KendallFrey yes @Pheonix mom.
 
> Assumption is the mother of all failures.
 
@JohanLarsson eh wot?
 
6:38 PM
@JohanLarsson wow, burn
 
@Pheonixblade9 you started :)
 
sorry, it's too early for me to understand subtlety
 
Yeah, it did not come out right.
sry
 
Well neither did he
 
So I know a few of you guys are into functional programming.
Thoughts on adding ForEach to IEnumerable<>?
 
6:42 PM
Reed is one of them
 
Wherein it does not return the resulting list for further chaining?
 
@MrDoom Kind of against functional programming concepts
 
Indeed, but F# has Seq.iter.
 
Functional languages are always kind of hypocritical
They're all about pure functions, but they have to have side effects or they're useless
 
Now, this ForEach extension method is nothing more than condensing a single foreach(){} block into a single line.
 
6:45 PM
Eric Lippert has already discussed this: blogs.msdn.com/b/ericlippert/archive/2009/05/18/…
"It doesn't work" statements are very annoying
I had to resort to this comment: "You still haven't said what isn't working. What about that line is broken? It looks like valid C#. Do you get a compile error, runtime exception, velociraptors attack when you run it, what?"
I'm tempted to add that to an auto-template... :(
 
I thought list.ForEach iterated backwards
 
Struggling with some simple LINQ. Is there a way to say "return true if any customers.Where(w => w.favoriteColor == green) and some of them are right handed, and others are left handed."
So basically it will return false if all customers with the favorite color green are right handed
but if there is a mix of left handed and right handed it will come back with true
 
Johan, there are collections that do FIFO and LIFO depending on your needs
 
6:54 PM
customers.Any(w => w.favoriteColor == green || w.IsLeftHanded)
 
^ What he said
Not sure thats the correct condition
but Any is the way to go
 
Hm okay that will work but I thinkI worded my example wrong for my situation. I wanted to make it simple to avoid typing out my problem which is a bit more complex
Im using Any() so im on the right start
 
So you're saying all left handed people have green as their favourite colour? Bigocoloriacist!
 
Yes
If you want to know if any elements in the collection satisfy a condition, use Any.
 
Basically I do a select distinct for account codes, then I loop through each account code and I want to know for all the records that share that account code, which have a accountCode type NULL and accountCodeType NOT NULL
bool OACHasMismatched = Tbl_wwl_addresses.Where(w => w.AccountCode.Equals(address.AccountCode)).Any(a => a.OH_Code != null && a.OH_Code == null);
Basically I dont think that will work because its not possible for the record to have both NULL and NOT NULL OH_Code right?
 
user1630889
6:59 PM
That any definitely doesn't make any sense.
 
user1630889
Why can't you just do:
 
Okay so to clarify, I need to know for each GROUP of AccountCodes, which have a mix of NULL and NOT NULL OH_Codes?
Because then I need to apply that OH_Code to the whole group.
 
user1630889
bool OACHasMismatched = Tbl_wwl_addresses.Where(w => w.AccountCode.Equals(address.AccountCode) && w.accountCode == null && w.accountCodeType != null)?
 
user1630889
Oh.
 
there is also list.All(), use the one that reads best
 
user1630889
7:04 PM
Victorio: I think it's going to be difficult getting help for your question based on the information provided.
 
Be careful with All unless you need All
All will not short circuit
 
are you sure?
 
@VictorioBerra simplify your question
yes, he's correct
 
@BradleyDotNET I think you're wrong
 
7:10 PM
> The enumeration of source is stopped as soon as the result can be determined.
 
Sorry, I meant it won't short circuit in the "True" case
My bad for not stating that
 
of course not
 
Any won't do so in the "false" case
 
7:13 PM
@TomW o/
 
So you pick depending on what you expect to happen
 
use Any | All depending on which reads best
 
@JohanLarsson or what is correct :P you have to invert them, remember
 
Any and All are the exact same operation, just inverted
 
7:14 PM
what reads best is probably correct most of the time even if it has worse purrformance
 
Im not sure how to further simplyfy it without showing data..... so
Lets see
How do I do multiple lines in one comment here?
so I can build a table?
 
Shift+Enter
 
@Pheonixblade9 word
 
@TomW excel
Visual Studio is a piece of crap
 
I disagree.
 
7:24 PM
Visual Studio is quite nice IMO
 
they introduce new bugs as fast as they fix them
 
Certainly better than every other IDE I have attempted to use
 
it doesn't block for no reason for minutes at a time anymore
 
VS + R# + C# is nice
 
Intellisense and code completion just stops working until you restart it sometimes though
again for no reason
 
7:25 PM
Well, that bug has been around forever
Although it doesn't seem to happen as much in recent versons
 
I've never noticed it until 2013
 
Oh, it was there earlier
At least 2010
I'm pretty sure I saw it in 2008
 
When you think about it, the Immediate Window is utterly stupid
 
My 2012 hasn't done it in a long time though
 
ID - FullName - OtherAccountCode - OH_Code
1 - hats llc - A1022 - NULL
2 - hatz llc - A1022 - NULL
3 - hatzes llc - A1022 - B1022

Given a set of data, I need to see if a GROUP of records with matching OtherAccountCodes have a mix of NULL and NOT NULL OH_Codes. In this case the three records have the same OAC, but there may be thousands of records and hundreds of groups. The problem with the data is that the FullName is spelled wrong, so the timed job that runs to populate the OH_Code is missing them because its fetching the OH_Code from another database using the FullName to match on. Well
The problem here is we need to no mess with OACs that have all NULL OH_Codes, or all their OH_Codes already populated.
If anyone has a better idea then how im doing it, id like to be edumacated
 
7:27 PM
You know, I'm not even sure what it does.
 
ANyone know if there's a plugin to VS 2013/2015 that links to referencesource.micorosft.com when inspecting a .NET object?
 
No, but that would be awesome.
What does the Immediate window do?
 
@BradleyDotNET Its stupid internal crap, we have to import this data to another third party app. basically the DB is an intermediate between an XML from another company with their own code system, and a system that has its own code system which expects the import XML to have the OH_Code not the OAC.
 
Sorry, I was referencing the immediate window
Not your problem
I'm sure your problem is perfectly reasonable
 
How hard is it to say "does this group of records with matching OACs have a mixture of NULL and NOT NULL OH_Codes'?
 
7:30 PM
@VictorioBerra are the messages XML at both ends?
sounds like a straightforward XSLT to me
 
Company 1 sends us XML, we import to DB, then we fill in missing info from our softwares DB, then we export to an XML that can be imported into another system.
@TomW ^
 
@BradleyDotNET It evaluates expressions and statements at runtime, using the current debugger context, minus important stuff like using directives and lambda expressions
 
Ah
I'll have to keep that in mind in case I ever need to do that
normally I just create a watch variable for the expression
 
@VictorioBerra oh my SQL is rusty, but yes that should be simple
 
but the immediate window sounds like it could be nicer for some situations
 
7:33 PM
I have to say... referencesource.microsoft.com looks to be written by a C programmer who treats white space as gold. Comments? Those are for idiots.
Love the comments on this one though:
http://referencesource.microsoft.com/#PresentationFramework/Framework/MS/Internal/Data/RBFinger.cs,ea6f3e53789ebf77
Description: Finger into a red-black tree.
 
@BradleyDotNET Watch Window is subject to the same idiotic restrictions
 
Yes, I have noticed that
 
@VictorioBerra I guess you could use a WHERE COUNT(SELECT THING FROM THINGS WHERE OH_Code NOT NULL)>0 AND COUNT(SELECT THING FROM THINGS WHERE OH_Code = NULL)>0
or something along those lines
however it works
 
Remind me to incrementally test changes before doing other X large change and thinking that X broke something that was already broken
derperperp
 
We have a guy at work who either:
a) Knows what a style is and how it is used but does the opposite as pranks.
b) Don't know how a style is supposed to be used at all.
 
7:44 PM
@TomW yeah I basically did two any statements, and if both == true...
 
@JohanLarsson Assume incompetence, not malice.
 
assume++
 
8:00 PM
the most underrated feature of Outlook... the ability to recall an email... especially one sent early in the week before coffee has had a chance to improve your cognitive abilities.
 
only if they are using outlook
 
8:25 PM
@ton.yeung up?
 
Anybody here ever deal with the VS 2012 native coded ui test framework?
 
@Nathvi Yes, but in the realm of Web and then we dropped it and moved to Selenium.
 
@MrDoom, did you ever deal with an error like:
Cannot preform "WaitForControlReady" on Control
?
 
Nope, you're probably using Coded UI against a proper application and not web. Sorry.
 
yes, it isn't web
Curious, what made you guys switch to Selenium?
 
8:34 PM
So Coded UI does this element mapping thing
They'll look at your web page or WPF window or whatever you have and generate an object map off of that
then you go and write tests against that object.
In their web version of the stuff, it is "highly discouraged" to create your own mappings.
Well, that doesn't work very well when you have javascript bringing bits in and out on the fly.
So I was hired right after we had one coworker start looking into using the fully automated 'record' feature
where it does all of the code for you, and you just click on things to test them.
It's all visual, all clicky, and you're not supposed to touch the resulting code
 
@ton.yeung do you use &' for linking in diretcives much?>
ugh, sp
 
So when you go and change something, the MS engineer we were talking to suggested we just re-record every single test affected
Now, how often do buttons shuffle about in web pages? Decently often yeah?
So if you have 200 tests going through one button, you get to redo all of them manually
That wasn't going to fly, and I walked in the door with a fair amount of Selenium experience already under my belt.
We built up a case and went with Selenium
 
the js room is busy arguing about some meta junk, so no answers there
come to think about it... when are they not arguing about stuff?
 
@CharlieBrown They do have a problem with that
 
@ton.yeung is anyone actually on it, or is it filled with bots?
 
8:48 PM
ohey, gold badge
 
@MrDoom, the MS engineer was fucking dumb. You can make your code more modular so you don't have to re record huge sections of your code.
In fact, you can right click and "Split into new method". Also, the UI map is a partial class, so you can write custom functionality in the non generated code.
 
So that's entirely possible, it sounded like we weren't talking to a regular engineer.
One of the other big things was interacting with our custom elements. The engineer made it seem like the shared steps system was going to be unpleasant to make work with it all.
I left the meeting more confused about Coded UI and less confused about what system we wanted to go with, shrug
 

« first day (1501 days earlier)      last day (3453 days later) »