« first day (1726 days earlier)      last day (3237 days later) » 

3:00 PM
this is too difficult
 
Leave it to the "architect" to design a circular reference into your assembly dependencies by using nuget
 
Meh, crap happens.
You going to fix it?
 
^ that's why dev environment and production/staging environment should be 100% separated
 
doesn't that make your workstation the server?
you know you can use UNC path \\server\c$\ ?
 
3:16 PM
im not a fan of the heavy use of annotations in ng2
 
@ton.yeung it might well have been one of those
 
i have an xml document, it has a structure similar to
<lineitem>
   <offers>
       <item> <offerName>banana bread</offerName><otherdataNeedsXformingtoo>blah</otherdataNeedsXformingtoo></item>
       <item> <offerName>apple pie</offerName></item>
   </offers>
</lineitem>
<lineitem>
   <offers>
       <item> <offerName>apple bread</offerName></item>
       <item> <offerName>banana pie</offerName></item>
   </offers>
</lineitem>
<lineitem>
   <offers>
       <item> <offerName>banana bread</offerName></item>
i need to transform all the unique offernames
<xsl:key name="offerName" match="//offers/item" use="offerName" />
<xsl:for-each select="//offers/item[generate-id() = generate-id(key('offerName', .)[1])]">
thats how i'm attempting to get unique offers
 
i have been reading the prelease stuff from ng-book 2
 
it skips ALL of the offers, what am i doing wrong
 
@SteveG not using linq2xml
 
3:25 PM
unfortunately not
 
@SteveG You forgot your sacrifice of atonement to Skeet
 
damn, i can't believe i forgot a sacrifice
 
does .Net still not support xpath 2.0?
@SteveG when you say 'get unique offers', given your snippet, what should it select?
 
it should select banana bread only once
 
so select distinct, rather than select unique?
 
3:30 PM
yes
well
is there a difference?
 
one has 8 letters, one has 6
 
out of a set [A, A, B, C, C]
distinct would be [A, B, C]
unique would be [B]
surely?
27
Q: distinct in Xpath?

AntoineI have this XML file, from which I'd like to count the number of users referenced in it. But they can appear in more than one category, and I'd like these duplicates not to be taken into account. In the example below, the query should return 3 and not 4. Is there a way in XPath to do so? Users ar...

it's piss-easy in XPath 2.0, which is why .Net XSLT is so frustrating.
 
yeah, so that answer is assuming the nodes are ordered
i think?
 
Bleh. XML.
 
fuck
lol
 
3:34 PM
hah
 
sorted, ordered, whatever
okay let me look at that
 
sorted != ordered :P
 
using generate-id to create keys, which is what you were doing. I just didn't understand it because it's difficult to read.
 
@KendallFrey lol yea thats why i corrected myself
 
sorted == wicked // innit bruv
 
3:36 PM
i have no idea
 
jeez I'm so out of practice with XPath, considering it was 50% of my job about 8 years ago.
 
the fuck did you do 8 years ago
 
this is what my stuff was based on:
30
A: How to use XSLT to create distinct values

Mads HansenAn XSLT 1.0 solution that uses key and the generate-id() function to get distinct values: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="UTF-8" indent="yes"/> <xsl:key name="prod...

i have looked into MUENCHIAN grouping yesterday
and landed on this
lol
 
speaking of munching, i want lunch
 
@SteveG Have you tried the second answer on that page?
 
3:41 PM
@FreeAsInBeer no, thats also under the assumption that they're sorted
i think
idk what this shit does
.=preceding::*
but i think it's trying to walk back up the tree
 
Yeah, probably.
 
> i think it's trying to walk back up the tree
who doesn't love drugs
 
okay?
 
Are you averse to doing this yourself via LINQ instead of XSLT?
 
this is part of an entire sales backend, it's complex so no, unfortunately, i can't switch it
 
3:45 PM
@SteveG I think you're going to have to select all nodes, then sort, then select distinct by key/index. It's gonna be ugly.
 
damn
 
@SteveG this stuff is always a bastard. Yours doesn't look obviously wrong
I'll try and have a look at it when I'm home
 
thanks man
 
This is why XQuery was invented, and then promptly never supported.
Encountered a problem yesterday whereby some SOAP integration wasn't working because "the namespace prefix was wrong".
 
@SteveG I think key() should take item, based on the linked example
it's the name of the node whose key is generated, not the name of the seed used to generate the key
if that makes sense
ohhh yeah, the other solution is simpler
not(.=preceding::*) << 'where my value is not the same as the preceding value'. That necessarily excludes duplicates - assuming the list you're selecting from is ordered
Or maybe it's 'not the same as any preceding value'
in which case it'd work either way
 
3:52 PM
but be terribly inefficient
 
Probably. The XSLT engine might have an efficient optimisation, but I doubt it
Also how fast does it need to be
 
Steve, what do you want to do with the xml?
 
@TomW okay that makes sense, because when i do
<xsl:key name="offerName" match="//offers/item" use="." />
that gets rid of 1 duplicate, but my sample xml doesn't precisely match the xml i'm working with
so theres still 1 dupe in there
@KalaJ just transforming it into an internal schema
ahh, it's because duplicate "item" elements, aren't exact matches
just the name is :/
anyway, thanks
 
@SteveG so that's right then?
Based on the strategy you devised, it's doing what it's supposed to?
You just have the wrong strategy :P
 
lol
basically, when an order comes in, we want to see what offers came in with that order, what promo code used
but the offers get attached to each line item, we don't care, we just want to see all the offers for the order
so i'm getting duplicates, which isn't a huge problem, but it's just junk data that'll fill up the db
and what i have now, seems to pull out duplicate offers, when ALL of the data in the nodes match
it's not dependent on the name or id of the offer, and i'd like it to be
ommmmmmmmmmmmg i might have done it
 
4:08 PM
tankionline.com
 
@SteveG Why don't you care what line item the offer is attached to?
 
it's not up to me, if it were, i'd keep track of which line item a promo code was used for
 
Yeah, that seems really weird.
 
posted on July 08, 2015 by Visual Studio Blog

The final release of Visual Studio 2015 is coming soon! Mark your calendars for the celebrations on July 20th 2015. This event featuring tools for any developer and any app will start with Soma’s keynote streamed live starting 8:30 am PDT. New this year, you will have the opportunity to see the Visual Studio team creating an end-to-end solution for an open-source project, leveraging t

 
@FreeAsInBeer glad i'm not the only one
 
4:12 PM
@SteveG You are the only one, anywhere, ever, and you can't disprove it
 
@SteveG surely there are promo codes that apply to orders, and promo codes that are per-item? "Get 10% off your order!" vs. "Get a free pen when you buy a battleship!"
 
lol yep, there are
 
@TomW Perhaps not the best example to illustrate your point.
 
im capturing both types and just treating them as per-order promo-codes
preaching to the choir ;)
 
4:18 PM
What are the scraped codes going to be used for?
 
@FreeAsInBeer i'm pretty sure they just want to do reporting on them to see, generally, how good a promotion went
 
Ah, well I guess that makes slightly more sense that they don't care about the codes application then. But only slightly.
 
i have a public class pretending its internal... driving me nuts
 
We have internal classes pretending they're half-public
 
We have private classes treated like public via reflection.
 
4:28 PM
looking at the dll in reflector, it shows like the class doesnt exist
 
@SteveG, ah okay. I havent' done that before but I know there are programs to do that
 
@IssaJaber suchen Sie Deutschspracher?
 
No, there are no German speakers.
 
Ich sprache nur ein bischen Deutsch
 
Yo no comprende Douche.
Deutsch*
 
4:33 PM
Does SQL have any encryption capabilities.
 
@Greg reducing the font size in SQL Server Management Studio can make it difficult to read. Does that help?
 
Well, not quite. I was hoping it had something above and beyond Hashing.
 
I believe it should
what's the use-case? I normally do all encryption in code.
want to be able to query against encrypted fields?
 
@Greg comparing encryption and hashing is like comparing a drill and a hammer.
a drill is "above and beyond" a hammer, but only if you intend to make a hole in something
 
At least a drill and a hammer are related. Encryption is a far cry from hashing.
It's like comparing a sedan to a kiddie pool.
 
4:38 PM
I wouldn't go quite that far
but the point is, they solve different problems
 
Absolutely.
 
Well, since the implementation is some what trivial but security required. I'll just have the DBA use a Guid.
 
I have no idea what you're talking about
GUIDs have absolutely nothing, zero, zip, not a single thing whatsoever to do with security.
 
Encryption is two way. Hashing is one way. TO encrypt something means you want to decrypt it, you never want to unhash something... and if you do - encrypt it instead
 
Hashing can also be used for more than obscuring information
 
4:45 PM
Umm... Yeah... WTF @Greg?
Not sure if trolling...
 
you can hash browns
 
Yeah I'm interested to see what comes of this
 
@NETscape And you can salt your hash.
 
and smoke
 
if something kinda green is greenish, what is something kinda hash?
 
4:48 PM
you mean, green is to greenish, hash is to _____
 
@KendallFrey A poor attempt at creating a breakfast side dish?
 
because hash isn't a color
 
@NETscape irrelevant
 
@KendallFrey Or, perhaps "octothorpish" is the word you're looking for?
 
I will hurt you and it will be spectacular
 
4:49 PM
Don't tase me bro.
 
saying a color has similar traits as a food/plant is kind of not right?
 
^ Where was that expressly stated?
 
@NETscape sure, but I never said that
 
ight
 
I still want to hear what guids have to do with security
 
4:59 PM
I'm equally curious.
 
this is crazy
class is included in dll when built with VS. class is missing when built into nuget package
 
hash all yer pw's with guids, all saltz shall be guids
 
@NETscape guids. It's got electrolytes
 
morning guys
 
@FreeAsInBeer Sadly, my office prefers int over Guid.
 
5:05 PM
@Greg Wat?
 
@Greg that doesn't even make sense
my office prefers paper over elevators
 
what do paper and elevators have in common?
you transport using both?
 
@NETscape read the conversation
 
an int and guid only differ in size of bytes, right?
 
5:10 PM
the way you use them might be different... but you can use a GUID as an ID or you could int as an ID, i thought.
 
If you stack 62747484927364101936 papers in the right arrangement you have a manual approximation to what an elevator allows you to do
 
just like you can write on an elevator
 
only if you want to hate your self later
 
I.e. go upstairs
So the analogy works
 
they share similar quantitative characteristics at least, you measure both in bytes
 
5:12 PM
you can measure paper and an elevator in grams
 
and qualitatively, they both can be used as an ID
 
so, I ran an ef migration in vs 2015 and it broke my project hardcore. I am getting stuff like "object does not contain a constructor that takes 0 arguments..."
it is like System no longer exists, wut happen?
 
i agree, it wasn't a very good comparison, but i think his intention can be implied
 
"The predefined type 'Task' is defined in multiple assemblies in the global alias; using definition from 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".... erm, wth did I do @.@
 
5:20 PM
omg i finally got it:
<xsl:key name="offerName" match="//offers/item" use="offerID/text()" />
<xsl:for-each select="//offers/item[generate-id() = generate-id(key('offerName', offerID)[1])]">
 
during migration did it name one of your entities/classes Task?
 
nope, I even tried deleting all my migrations just now
it doesn't know what System.<anything> is
conflicts with mscorlib and System.Runtime it seems but there are like 2,000 errors
 
@Greg int and Guid are both perfectly fine for IDs. int is better in cases where order matters, usually.
@CuddleBunny call technical support
@CuddleBunny git reset @head --hard --nosrsly --plzhelplinus
 
@Pheonixblade9 pretty much... lol
meh i think i broke dnx...
 
Anyone have a clever, generic way to test how "good" and "correct" a GetHashCode function is, in MSTest?
 
5:31 PM
@Jeremy i assume unless it throws exception it should be fine... i mean, it's really hard to write a no-good hash function
 
@Jeremy uhm... download resharper and have it do it for you instead?
meh. people are assholes, SO is stagnating. It sucks.
 
@tweray No, it's hard to write a good hash function
 
@KendallFrey in security perspective, maybe yes, but... i mean... i don't think he indicates "good" in that direction. i can be wrong though
 
security? I don't think GetHashCode has anything to do with security.
 
if you're using GetHashCode for security, please reeducate yourself :)
GetHashCode is all about determining if two objects are exactly equal... you need to know the difference between reference/value types, structs, etc... how to compare them
 
5:37 PM
@KendallFrey so don't I, then how can it be hard?
 
Because any trivial implementation will have a high likelihood of collisions
the easiest possible GetHashCode is to return 0
 
that's not "good" in any sense
 
hence why I use automatic GetHashCode generators
 
@ton.yeung Agreed, totally random downvote on an answer I posted a year ago
very weird
maybe somebody doesn't like the C# room
 
5:40 PM
What's wrong with random downvotes?
 
@BradleyDotNET maybe they just don't like SO, or maybe they just hate life
 
Perhaps
but if they feel that strongly about it, on a dead post, at least they could leave a comment
 
yeah, I don't mind downvotes if they give you a reason, but random downvotes with no explanation on an otherwise upvoted answer are annoying
 
@Pheonixblade9 oh... so... that generator is not built in to VS?
 
@tweray nah, which is kinda dumb, but it's not a "core" feature, so it makes sense
there's tons of addins that will do it for you though
R# is a popular one, though I don't care for how R# totally revamps my VS experience, so I don't use it
 
5:45 PM
GetHashCode should return the same value if and only if .Equals would return true
 
well, again, i feel should try some day delete resharper and see if i can still code
 
@BradleyDotNET not really
A correct implementation of GHC only requires that it returns the same value if Equals is true.
 
I feel like most of the things I want R# for, StyleCop does
 
If Equals is false, it should return different values as much as possible, but this isn't always possible.
 
Fair enough
 
5:47 PM
there are some really nice things it does, but it is a memory hog
 
@Pheonixblade9 wat
I have R# - where is this option
 
@Jeremy for GetHashCode? Idk, my old lead used to use it all the time
 
@Pheonixblade9 Oh. I see. This is what it generates:
/// <summary>
/// Serves as a hash function for a particular type.
/// </summary>
/// <returns>
/// A hash code for the current <see cref="T:System.Object"/>.
/// </returns>
public override int GetHashCode()
{
    unchecked
    {
        return (base.GetHashCode() * 397) ^ (_lockManager != null ? _lockManager.GetHashCode() : 0);
    }
}
 
yep, looks about right
 
...our equals function on this object is 70 lines long, and falls back to true.
So there will be at least some cases where objects are equal that don't have the same hashcode with this implementation.
Which basically breaks every common use of the GetHashCode method.
 
5:49 PM
lol
sounds like a personal problem
 
@Pheonixblade9 if i could slap the author I would, but he got canned.
 
^ find him on linkedin, and slap him with respect
 
@Jeremy obvi just change it to if(this = _lockManager) return true; return false;
(obviously I'm joking...)
 
lol
I was going for
/// <summary>
/// Serves as a hash function for a particular type.
/// </summary>
/// <returns>
/// A hash code for the current <see cref="T:System.Object"/>.
/// </returns>
public override int GetHashCode()
{
    return 42;
}
hash function is always correct; no longer breaks C# collections.
 
@Pheonixblade9 obviously, because you can't assign a value to this
 
5:52 PM
@KendallFrey yeah because it's static :P
 
uwotm8
 
@KendallFrey question is, for the generated code, if base.GetHashCode() == 0, what will happen?
 
@tweray uh, nothing special?
 
@Pheonixblade9 Also, why does R# offer that GetHashCode method?
 
@Jeremy because it's a PITA to implement and R# tries to make coding better
 
5:55 PM
Seems like you only want to override GetHashCode if you're overriding Equals, because you want any to equal things to have the same hash code.
 
@KendallFrey isn't going to return 0 as well?
 
So then, if you're overriding equals, there's finer grained logic in equals, right?
Like, maybe your equals method tests if two database rows have the same Id.
Then, if R# generates your GetHashCode, your C# hash collections are still broken.
@Pheonixblade9 And, you've swept the CS warning under the rug.
 
@tweray not if _lockManager.GetHashCode() doesn't
 
Or, am I missing something obvious...
 

« first day (1726 days earlier)      last day (3237 days later) »