« first day (1566 days earlier)      last day (3367 days later) » 

12:00 AM
Here's one of my actual functions for reference:
 public IEnumerable<User> GetAllUsers()
        {
            try
            {
                using (var connection = new SqlConnection(_connectionString))
                {
                    connection.Open();

                    StringBuilder sql = new StringBuilder();
                    sql.AppendFormat("select {0}, {1} ", UserColumns, UserLevelColumns);
                    sql.Append("from Users u ");
                    sql.Append("left join UserLevels ul on u.UserLevelId = ul.Id ");
 
@BradleyDotNET That makes sense, but I have to specify what it is returning in the Interface though-
 
Sure:
interface IContext<T>
{
    IEnumerable<T> Read();
}
That would seem to specify it :)
 
@BradleyDotNET So almost every time that is how Dapper returns?
 
With that Query call you mean?
 
Yeah, that is what I'm trying to gauge.
 
12:03 AM
All Query calls look like that, yes
IIRC there are some libraries like Dapper.Rainbow that make it less ugly
Our schema at the time didn't support those libraries, and now that they do, there hasn't been much motivation to re-write the working code
 
That makes it incredibly simple to generalize while still being somewhat expressive across the application.
 
I would agree :)
 
So, if you intend to return an object for insert inside that interface. You just implement T and bam Dapper is cool with that.
 
Thats not really a dapper thing at all
You slam a User in there and the implementation has to return a User, period
Dapper doesn't really care, so if you tell it to return a User, then it does it.
 
@BradleyDotNET You said tat i could Ping you, if i have further questions? So here are two: 1. So is it also valid to have more then one design pattern in a project? Is that normal? 2. Do you also have a recommendation for an ebook or an online source?
 
12:05 AM
@Proton 1. Yes, all the time.
Remember, a design pattern solves a particular problem
Software projects usually involve solving lots of problems
2. None that I could reccommend from experience, sorry
The gang of four book comes with a CD though
@Greg Remember, dapper is just doing an object mapping with the columns it has. You have to give it the type to map to.
 
@BradleyDotNET So I'll need reflection then, otherwise injecting the IContext through the constructor of Context won't know the type.
 
That really depends on what Context is doing
I wasn't sure what the purpose of that class was, to be honest
 
Well, I wanted it to be the universal call. Example:
 
As I'm sure you know, needing reflection (especially so early) is a quick "backtrack" flag
 
IContext dbContext = new Customer();
Context context = new Context(dbContext);
Or am I thinking about this wrong?
 
12:14 AM
@BradleyDotNET One of my biggest problems is that i have no clue, how to get a good architectural structure or how to build up a good one in the projects i'm doing for myself. Also some basic stuff, but i'm on it.
 
@Greg I think you have it wrong :)
It seems it should be:
IContext<Customer> dbContext = new CustomerContext();
var customers = dbContext.Read();
or something like that
And anything that cares about customers as a paramater would take an IContext<Customer> so you could do DI
 
@BradleyDotNET True, but that context class would be useless?
 
@Greg Mine or yours?
Like I said, I don't understand what your Context class even does/is for
@Proton Like I said before, there no real "getting" a good architectural structure.
From a system architecture point of view, you can certainly pick a overarching strategy
But I would start smaller
Just design a single project, solving one problem at a time, applying the correct pattern where needed.
 
Well, it's supposed to be for DI but what would your customers var represent?
 
Oh, just a sample call into the context to get the data
A "sample usage" if you will
@Proton Did that make sense?
 
12:20 AM
Your answer? Yes.
 
@Greg The idea being once you have an IContext<T> you have what you need to get your data.
 
@BradleyDotNET So basically, just inherit the interface then do your implementation.
 
@Proton As you get better and more experienced, you'll start seeing applicable patterns before you even start, or potential interaction conflicts. And with enough experience, you can do whole project design from the start. That takes a lot of practice though.
@Greg Thats what I would do, yes.
 
@BradleyDotNET Hm, that makes sense. So if you don't have an Id present will dapper still map correctly?
 
My actual approach was to collate all of my direct DB calls into one class, then all my specific class called into that (nothing generic). Your way is likely better though :)
It can map correctly without an Id, but you have to set it up different.
 
12:23 AM
...?
 
Of course we changed ours, so I don't remember what the setting is...
 
@BradleyDotNET But how do i know, if i've finished a project, that my solution is a good one?
 
@Proton You don't :) Not until a few months later anyways
A good design will be flexible when the inevitable changes come
A bad one will break all over the place
Good designers can anticipate these flaws ahead of time, so you can conduct a design review if thats an option
but really, the proof is in the pudding when it comes to design
@Greg I'm looking for it and failing miserably. But if you don't have an Id column, it will throw an exception
Googling that exception gets you the answer pretty quickly
Could someone translate this: "OG Loc"?
 
Saw that answer coming. I wish i would have someone who would check my stuff. ;)
 
Blasted TxtSpk
@Proton I don't know if CodeReview.SE does design reviews
but you could check
 
12:28 AM
Thanks for your help.
 
Not a problem. If you have any specific questions, like if (or what) pattern is appropriate to a specific problem, feel free to swing by
 
@BradleyDotNET I see, can you add some MVC Validation to the POCO that Dapper uses or will it freak out?
 
I will go of now. Bb.
 
@Greg I have absolutely no idea. The only thing it tends to freak about in my experience is private properties
 
@BradleyDotNET Hm, okay.
I usually don't use an ORM.
 
12:30 AM
Haven't tried any MVC (obviously ;) )
Okay, I just googled that phrase and it really doesn't make any sense
I think he called me a gangster. Or something
 
?
 
From earlier: "
Could someone translate this: "OG Loc"?"
2
A: How can I have an access to a TextBox in a UiElementCollection?

BradleyDotNETYou have to cast it first, there is no implicit conversion: myTextBox = (TextBox)myCollection[8]; Of course, it is likely a good idea to check if that was a TextBox first using is, or do a null check and as. Also, the standard note for WPF applies here, in general you should be accessing suc...

Ok, thats funny. I try to paste a question in, and I always get the blasted comment. Now I want the comment, and get the question
grrr....
 
I'm assuming you have to match column names to your POCO.
@BradleyDotNET The reverse I mean.
 
For any auto-mapping, yes.
But in my example above, you can do some custom mapping (like for your FKs/Nav properties)
 
You can manually map though?
 
12:42 AM
haha, original gangster @BradleyDotNET!
 
@NETscape Thats what the internet said
And I totally don't get it
 
but s/he is from france
 
I assume its some sort of compliment.
Does that change anything?
 
might be slang for something else
@franssu what is OG Loc. ?
 
Well, that makes it even more confusing. Though the only thing that came up for "Loc" was something about the Crips. Which makes sense with the gangster thing, but is still very confusing overall.
 
12:45 AM
haha i never heard of the Loc before--maybe Loco? but i guess, maybe the since frenchman is misusing it... or maybe s/he knows something we don't! :p
 
 
2 hours later…
2:27 AM
// NOTE:  The field _isNotDistinguishedIdentity is a work-around to the
//        problem that we can't define a default constructor that sets
//        _w to 1.  So the default constructor sets all fields to 0 or
//        false, and we interpret _isNotDistinguishedIdentity as follows
//
//        If false, the quaternion is the identity 0,0,0,1 even though
//        the member fields are 0,0,0,0.
//
//        If true, the quaternion has the value given by its member fields.
//
//        Don't mess it up!
Other people's source code is fun to read
 
 
2 hours later…
F4z
4:24 AM
is it possible to focus on textbox without loosing focus on form? for exmaple like the Notepad's search form. You can hit "enter" and keep the focus on the form and go through each result but at the same time the focus is on the textbox which enables it to select text.
 
 
3 hours later…
7:03 AM
@BenjaminDiele: I'm on now. Whats up?
 
7:15 AM
@scheien Ah, it was some more frustration with EF :D
morning btw!
 
You still going code first?
or is it problems with the model?
 
I went back to code first, and just replaced my funky 1 - 0..1 to 1 - *
Now I'll have to do some more checks that the db would've done for me, but eh. I lost enough time as it is
 
Check whether or not the gasmeter exists?
Something like that?
 
That, and allow only 1 of each type per premise.
 
Can't you create a primary key that consists of both PremiseId and MeterType?
That does not allow multiple records with same type and premiseid.
 
7:21 AM
Perhaps. But I've lost almost a week to this shit now. I don't want to spend much longer on it for almost no benefit to the end user
 
Is this work related or some personal project?
 
second job, getting paid by the hour
 
ah
 
and I don't think my client will want to pay that much for something that won't make a difference to him
I want to do it the right way, but I need to stay pragmatic
 
They usually don't care "as long as it works".
 
7:24 AM
Yeah, and I've given it a week of my personal time. I've got more stuff to do than that :D
 
You can do a check before trying to add a new meter, to see if a meter of the same type already exists on the given premise.
If it exists you serve the user a "meter already exists", or something like that.
 
Yeah, but then I'd have to make a new ICollection<> class, right?
Because I can't make my virtual ICollection<Meter> protected or private
 
I'm not that into code first, but I would guess that Premise would have a collection of Meters yes.
 
The problem that I'm seeing is that anyone (it's only me, but still) can do a myPremise.Meters.Add(new Meter()) for as many times as they like
 
Yep
 
7:30 AM
that's what's bothering me :D
 
That is why you should constrain it in the database
With a PK that consists of premiseid and metertype
That would throw an ValidationException
I think it is, atleast an exception stating the error (which you would know how to handle)
Or you do a myPremise.Meters.Any(x=>x.MeterType==MeterType.GasMeter)
That would return true if a GasMeter is in the Meters collection
thus being able to state to the user that "hey this meter already exists. try edit instead" etc
 
That's what I do now, I have a [NotMapped] property on my Premise which returns the GasMeter, WaterMeter, ..
 
 
2 hours later…
Ram
9:09 AM
0
Q: Not updating the Read only textbox's Value using Jquery

RamI have three textboxes, two of them are readonly. when i update first then i am updating text-value of other two textboxes. i am using the following code to do this, $('[id$=txtQty]').change(function (e) { var pre_Id = this.id.substr(0, this.id.lastIndexOf('_')); var exactIdlblInvoice...

please help me
 
9:33 AM
Welcome C# chat!
 
@Squiggle hai
 
@Ram Have you tried Javascript or jQuery chat?
'lo @BenjaminDiele
 
I just say ClientIdMode => Static!
What's up @Squiggle?
 
10:11 AM
So that's an hour's worth of merging code conflicts, half an hour spent filling in timesheets, and an hour fielding support queries.
Might actually get some real work done today, too.
 
10:32 AM
Mornen
 
'lo.
 
11:15 AM
aye, another surveillance system leaked by Snowden.
 
@scheien ?
 
Ah, who cares.
 
I care. I like having privacy.
 
You really download that much dodgy stuff?
 
11:20 AM
Governments shouldn't have these tools.
Plain and simple.
 
If it stops people dying what's the issue?
 
It's not the download part, it's more the tracking of cellphones, deploying malware/spyware
 
Meh
 
Would you trust these tools in the hands of the Russian or Iranian government?
 
If you're not a dodgy individual they don't even flag you anyway.
That's different isn't it
 
11:21 AM
@Sippy: That's not the point
 
I don't think the Canadians have the same plans lol
@scheien It's entirely the point
 
nah
 
Without terrorism the surveillance software used by governments is barely justifiable.
 
I shouldn't be afraid that I might get tagged
 
Then don't be a terrorist?
It's quite easy ...
 
11:23 AM
I should be able to write what the fuck I want, and be anoymous
 
@Sippy OK... define "terrorist"
 
That's now how the internet works lol
 
It's not necessarily being a terrorist
 
Tor works like that though
Play there :D
 
They flag you for a lot less than that.
 
11:24 AM
!!tell Squiggle wiki terrorist
 
@Sippy but what defines a dodgy individual? Who labels people a terrorist?
 
@Sippy even with "terrorism" it' not justifiable.
e.g. the US can't even quantify how many "plots" were stopped thanks to surveillance.
 
NSA have been eavesdropping on other goverment officials, e.g. Germany, which is considered an allied.
That's trust for you
 
It's the same with saying, "yeah, torture is ok when we need info"
it's never ok
 
11:25 AM
Waterboarding ftw
 
Lol
You guys take shit so far out of context
 
Not gonna bother
Personally I agree with surveillance cos I have nothing to hide
I don't give a shit if someone watches me fuck my girlfriend or reads my texts to my mom
I don't give a single fuck.
 
and what for people who want their privacy?
 
What you got to hide?
Why does it matter?
 
11:27 AM
I haven't got anything to hide, but I don't walk around naked all the time either
 
You could if you wanted to
Prolly get arrested though
@Squiggle Lol
 
FWIW, Greenpeace has been labelled as a terrorist organisation in some places.
 
Even if you got nothing to hide, who says they don't change the rules and from now on everybody who runs linux is a suspect and isn't allowed out of the country?
 
Why would they only check names
How dumb is that
 
Political opposition groups have been labelled as terrorists in some places.
 
11:28 AM
@BenjaminDiele Sucks for linux users
 
@Sippy it's about as dumb as a computer.
 
Again, taking shit so far out of context
@Squiggle Yeah
I don't see how they thought that was a logical way to check identities
 
How is giving concrete examples taking things out of context?
 
@Sippy I'd expect more sense from a programmer.
Privacy is not something you should give up lightly.
 
@Sippy Are you american or british by any chance?
 
11:30 AM
Why is it that having a different opinion means I don't have sense?
That's not really fair.
 
I'm saying this stuff is actually used and doesn't work. It hurts people and it can be used maliciously.
 
I am not saying surveillance is perfect
 
it is used maliciously. No "can" about it, they're doing that right now
 
Or that it works properly.
 
true, that
 
11:30 AM
I'm saying it exists for a reason and I agree with the reason
 
It doesn't even work a little bit!
 
If they know everything of everyone, and a new power comes into town and decides "Everyone who's ever eaten a burrito is going to jail for 10 years!" it's awfully easy to find those people. What seems like not a problem NOW, may become one SOON.
Knowledge is power.
 
@RoelvanUden indeed
knowledge is control
 
Yeah cos that won't cause civil unrest.
And is also extremely likely in western countries ..
 
The UK government is trawling journalists emails. The same journalists who are questioning the legitimacy of said government.
it's.. just not right
 
11:33 AM
and the prime minister would make end-to-end encryptiuon that GCHQ can't decrypt illegal
after the Paris attack
 
Not to call in Godwin's Law, but that's what the germans did back then
and we all know how that went down
 
Well, since you mentioned it. Stasi were really good on surveillance
:)
 
I think they could learn a thing or two from the americans and brits though
 
11:49 AM
It's so fun when someone just pulls latest from repo, does some updates, and just deploy what they've done.
So that it's missing loads and loads of files
 
Lol
 
And everything crash and burn like a baws
 
You need a paddle
So you can slap them when they do it until they stop doing it.
 
I guess they would not have done it a second time :p
 
@scheien no CI or so that tells when the build is ready for deployment?
 
11:51 AM
nah
It's usually not a problem. This time is was just a minor bug fix, but nonetheless they should checked if there was other updates, rather than just deploying a single assembly.
 
@Sippy It doesn't have to be so extreme. But it is possible, and especially consider things that are considered extremist (e.g. let's round up all active religion participating moslims for "safety"). A more realistic example is manipulation of thoughts; media is already pretty good at this, but if you can decide what the common factor is for most people you can manipulate everything; spendings (economy), votes (politics), outrage (e.g. on news), etc.
If it's as simple as, "I have to say X to get most votes", entire countries can be derailed by the personal agendas of people that have that access. THIS ALREADY HAPPENS BUT NOT IN SUCH EXTREME FORMS (YET)
"I have nothing to hide anyway" is a shitty piss-poor excuse for people whom are completely ignorant of the concequences both personal and countrywide.
 
@RoelvanUden A good response to "i have nothing to hide" is: "give me your facebook login & pass, email login & pass, etc etc"
 
You want to abolish surveillance?
Go ahead
But when my brother is the soldier being beheaded in London by a mad man with a machete
I'll be coming to find the people who abolished it.
Like I said
It's not perfect
but you can't just say "it's all bullshit and no one should be doing it"
 
It worked before; investigate high risk; not everyone!
That's all I'm saying. There is no reason to spy on everyone.
 
How are they to know who is high risk without the algorithms that decide that factor?
 
12:04 PM
Investigate PEOPLE. Y'know, like the f'ing police.
 
uhh ..
What you want them to do, house calls?
 
NSA couldn't prevent the London incident, and neither the Paris attack
 
Knowing everything of everyone is just extremely dangerous. You're a fool if you don't see that, seriously.
 
I do see that.
 
@RoelvanUden I don't agree with Sippy's opinion, but it's not a good way to discuss by calling people names :D
 
12:05 PM
It's not name calling. It's telling someone he's considered stupid. Anyway, pointless debate, back to code.
 
So... isn't programming in C# brilliant, eh?
 
:P
 
Let's discuss the new VAT legislation then :D
 
the EU VAT changes? Urgh.
I know loads of people who have been stung by that
 
@Squiggle Charge: Uttering a Canadianism outside the borders of Canada. Fine: 2 Poutine
 
12:08 PM
Also - want to pay less for digital goods? Just pretend you live in Luxembourg.
 
@Squiggle I think you need a VPN and your CC based in LU for that to work
 
@KendallFrey what? "eh"? I was being a Liverpudlian...
 
@Squiggle Which changes? :-o
 
@RoelvanUden Now you have to pay VAT according to the country you're selling to, instead of the country you're selling out of
 
@RoelvanUden the one that forces all companies that sell in the EU to collect VAT in the country of the buyer, not the seller.
 
12:09 PM
e.g. I, a proud Belgian, sell to a customer in the UK. I need to charge UK VAT.
 
Ah. That makes sense.
 
It makes sense, but it was announced and enacted in a very short timescale with no consideration for small businesses.
The UK used to have a rule that you didn't need to register for VAT unless your turnover was above 60,000 GBP or something.
 
@Squiggle Go conservatives!
 
Now this rule applies to all businesses, even little Etsy shops.
 
I'm going to Madagascar.
 
12:12 PM
@Sippy how does one "Madagascar"?
 
@Sippy SHUT. DOWN. EVERYTHING.
@Squiggle How does one English?
 
@KendallFrey with tea and scones.
 
oh yeah
 
And surveillance apparently.
@Squiggle first .. get in a box on a ship
then become a zoo animal.
Or a lemur.
 
hehehe
 
12:13 PM
you're a crab
 
@Sippy and then boogie all night long
 
Yes but I can adapt.
they have beaches in madagascar!
 
12:29 PM
@Sippy and no diseases
 
I have a problem halfway in between Javascript and C# (the project I'm on is using both). This is in relation to my code at stackoverflow.com/questions/28180525/….
I changed the name of something in the database on the request of the guy who's managing me (namely changing DateTime to EffectiveDateTime to avoid ambiguity) and now, when I try to pull the value of the DateTimePicker, I'm just getting a null value instead of the contents of the bound control.
My suspicion is that this is due to a name mismatch, but I think I've changed everything over that needs to be. At that, the name change shouldn't affect the control's variable, only the variable that I'm pulling it into. I'm new at DB programming, new at web programming, and thoroughly confused.
I would swear that this worked yesterday... I tried reverting those SQL changes this morning and then modifying the C# and js code to match again, but I'm still getting that null.
 
How good are you at debugging?
null in C#? or null in javascript?
 
I'm decent at debugging C# code. Still finding my feet on the javascript side of things. I know enough to walk through things in the console.
And the null is in the C# code, specifically when I try to assign the contents of my DateTimePicker object to the EffectiveDateTime field in `ResourcePowerStatusGridUpdate`
I'm mainly hitting a wall here because I really have no idea how it populates the web control such that it gets modified when the value in the bound column does. I get how to specify it, I think, but the internals are hidden to me.
 
12:46 PM
@SeanDuggan not enough information. How are you mapping database rows to objects? What web framework are you using?
 
I am using a Telerik MVC grid. I bind the column to the Telerik DateTimePicker object by setting columns.Bound(o => o.DateTimePicker) and the DateTimePicker variable is tied to the HTML definition of the control via a UIHint. The objects are fetched from the database via the update command set for the grid.
I can verify that I am getting the value from the DB. I can verify that the DateTimePicker control has the correct date in it at the time of editing and at the time that I try to save the edit. But when I hit the C# code where I try to pull the value out of the DateTimePicker variable, that DateTimePicker variable is NULL.
 
urgh. Telerik :P
 
I have the code (written when it was just DateTime) at stackoverflow.com/questions/28180525/… if that helps.
 
checking it now. One sec.
 
@Squiggle: Yeah, but it's what my company uses. Worse, we're behind a version, so Telerik answers any questions with "You should buy our Kendo UI so we can support you".
 
12:53 PM
hah dang.
So this issue is when the form data is posted back from the page, the EffectiveDateTime is null?
 
Telerik can get bent then, not ever giving them money
 
do you know how to use Developer Tools to track the data sent/received by the browser? Perhaps that might provide some clues?
 
That's starting to get over my head.
And it's the DateTimePicker that's inconveniently NULL in ResourcePowerStatusGridUpdate when I try to assign its value to the EffectiveDateTime.
 
@SeanDuggan communication between MVC back-end and the web browser is done over HTTP.
By looking at the content of those HTTP messages, you can better figure out if it's a front-end or back-end issue?
I'm still not entirely sure where in the lifecycle you mean, TBH
My open question to anyone here - ever used Microsoft Fakes? I can't get my build passing on TFS because of a "missing System.Fakes" assembly :(
 
@Squiggle once briefly
 
1:00 PM
When I click on the Telerik control to save, it first calls its OnSave event (which I can intercept in a Javascript function). There, I can see that DateTimePicker is correctly filled with its value. Then, the ResourcePowerStatusGridUpdate function in C# gets called. Previously, the DateTimePicker variable in the bound was getting populated with the value of the control. Now, I'm just getting NULL.
 
I'm not familiar with Telerik controls, so I can't really suggest a fix. It sounds like an issue on the UI - the HTML markup. I'm not sure what control you have over that...
 
Very little. I was lucky to get working what I did in the linked question, getting the text box of the DateTimePicker filled with the extant value.
I'm going to check to see if my more expert co-worker is in yet. BRB
 
best of luck!
@TomW not a fan of Fakes?
 
No dice. sigh
 
@SeanDuggan any chance you could share any of the markup?
 
1:08 PM
Sure. I don't think there's anything sensitive. What's the best way to post a chunk of HTML?
 
@Squiggle no seemed fine, a bit mysterious at first
 
Perhaps via jsfiddle.net or gist?
 
was distracted with something else before i got very far
 
@TomW did you have tests with fakes passing on a central build server?
 
hell no
:)
 
1:14 PM
phfff
 
BRB Coworked showed up
 
just had british gas on the phone, scottish lady on the other end. Very hard to understand. A few times I was like "Yeah sure" having no idea what she said
@Squiggle I got as far as this question - solved it but didn't really progress. Didn't use the fake very much
 
I love the Scottish accent
Southern Irish is the one I find most difficult
 
jsfiddle.net/9r9251j1 should be the code. The first is before Edit. The second is during edit. It's ugly, though.
 
Hmm. The <col> tags aren't closed properly - doesn't format very nicely :-/
So...
` <input class="t-input valid" id="DateTime" name="DateTime"`
shouldn't you update the ID and name there to reflect the new field name?
also I think your formatting is a bit broken. Could cause issues.
 
1:27 PM
I tried that. That's actually tied into the DateTimePicker control, not the EffectiveDateTime variable.
 
ah
 
And yeah... unfortunately, that's all automatically generated by Telerik,
 
you sure?
ah
Well, then.
Telerik
 
Hmm... I may have something odd going on in the Javascript. BRB
Ah. I had some debug code that was causing some odd visual artifacts, but nothing that would actually shed light on the issue.
 
1:51 PM
Wish for WCF: An attribute for contract types that injects <xs:annotation> into the WSDL
there are third-party solutions, but nothing built-in
 

« first day (1566 days earlier)      last day (3367 days later) »