« first day (1570 days earlier)      last day (3603 days later) » 

20:00
I was going to ask how you submit code that doesn't compile. Then I remembered we use TFS.
2. != false
3. prop named MyBool
@NETscape #3 isn't actually true
What's wrong with this null check? pastebin.com/FFeQH9gF
yeah i figured haha
@KalaJ Model can be null?
20:02
@KalaJ well, it's not strictly a null check
it's also redundant
what am I doing wrong?
Ram
Ram
did you check if Model != null ?
@KalaJ How are we supposed to know, if you don't tell us your problem?
well I am getting null exception :S
then model == null
20:04
hmm the model should not be null
Is it null?
Can you use a debugger?
the "should" should never be used in software design
ok I will try one sec
IF you rely on should's, then you're just shoulding all over yourself and others
true... I wonder why it would be null though strange? It's not null when I arrive at the page but if toggle to another part on the page and back, it turns null?
20:08
is something like this legal in C#: int x = 1; delegate = () => { x++; }?
but why
int x = 0;
Func<int> inc = () => x++;
inc();
Console.WriteLine(x);//1
@SpencerRuport jsfiddle.net/pj3ermx9
this question is about if C# lambdas can be closures
what are you closing over
You can use a lambda to close over a value though
int x = 0;
Func<int,int> inc = i => i++;
inc(x);
Console.WriteLine(x);//0
20:27
@mrpyo Yes, lambda functions and anonymous delegates are closures
@Pheonixblade9 - How do you feel about ribbon bar interfaces?
@TravisJ I think they're good for basic users and frustrating for advanced users
@Pheonixblade9 - What frustrates you about them?
the keyboard shortcuts often do not work and it's designed for clicking only
@Pheonixblade9 - what are some of your favorite keyboard shortcuts?
(I am working on UI design today :P)
20:33
depends on the app
for Chrome, the tab manipulation stuff
ctrl+pageup/down, ctrl+shift+T, ctrl+w
I use the winkey shortcuts a lot. win+arrow is very useful for moving windows around
oh god not this again
(thing.MyBool==false? "false":"true")
@KendallFrey stringly typed code!
ugh
I hate those movies
20:40
hello
I have a problem with changing a private double field to a public property, it is causing the application to freeze. Not sure why though, can someone assist?
Starting freezing as a result of changing a double field, I was using to output sensor readings to a public property.
@KendallFrey - I do it the other way around. In a js script that is included in my bundle,
var True = true, False = false;
clever, but gut-wrenching
20:55
When razor renders bools it does it as True or False. In the cshtml file it looks perfectly normal, the only place it looks odd is in the rendered html which you only see on client side debugging anyway
Anyone watch/care about the superbowl?
@TravisJ - This doesn't seem like a very View Model-ish approach. Why am I messing with the element rather than the list it's looking at? Shouldn't angular push the change to the view automatically?
@SpencerRuport - Yes. It was a workaround because there is some internal fail about watching the state of the people array.
On my part or kendo?
That solution though, came from the KendoUI / Angular tutorial
Hard to tell, I couldn't narrow down where the fail was and since you were afk I kind of went off to do other things :P
AH for sure.
Angular is hard :(
21:00
It is obfuscated :)
Knockout was way easier to see and understand.
I don't have any idea how to fix this observable array issue.
anyone here well versed in obj c?
I absolutely cannot stand obj c
@DiplomaticMedic - I think there's an objective c room
21:03
Anyone Know why changing a private field to a public property would cause a program to freeze? I know its a very vague question but the application doesn't crash so its hard to debug it just freezes and the output readings don't update. This is the class before I changed to a public property:
http://pastebin.com/JPhuphHe
And this is the class after I changed the `degreeOutput` to a property which caused the freeze:
http://pastebin.com/0E5mbeRw
@BrianJ - Because of reflection being used to access it with a private flag?
@TravisJ in this example they use a private flag:
https://msdn.microsoft.com/en-us/library/aa288470%28v=vs.71%29.aspx
So I just need to change degreeOutput to type `public`? Is this not a bad practice making a field public?
you can't bind to a field
For a readonly field I think public is fine
mutable is perhaps better as an (auto) property. (Auto unless you need change notification)
@JohanLarsson this is me, still me trying to bind the degreeOutput to the gauge control, please say I'm on the right track at least?
It sounds right
Check out the ViewModel class in the binding sample
21:12
Just testing now anyways so will see, I've changed the field to public to satisfy the above requirement.
public double DegreeOutput { get; private set; } // Auto property
private double degreeOutput;
public double DegreeOutput // Property with backing field
{
    get
    {
        return this.degreeOutput;
    }
    private set
    {
        this.degreeOutput = value;
    }
}
Property with change notification for binding in WPF (check history)
@JohanLarsson so in the `Myo_OrientationDataAcquired` method how do I set degreeOutput to `= ((e.Pitch + PITCH_MIN) * CALLIBRATION_FACTOR);` ?
I tried setting it like this `DegreeOutput = ((e.Pitch + PITCH_MIN) * CALLIBRATION_FACTOR);` but I get the error: "this member is defined more than once"
> this member is defined more than once
Is probably a decent hint
Do you use Visual Studio?
so I think I need to create an instance of the class and access DegreeOutput , this is what I tried but I get the same error as above..
AdductionAbductionFlexionView abducObj = new AdductionAbductionFlexionView;

//myo indicator must be facing down or degrees will be inverted.
abducObj.DegreeOutput = ((e.Pitch + PITCH_MIN) * CALLIBRATION_FACTOR);
F4z
F4z
21:31
i created a basic text editor. I'm messing around with opening text file different ways to open it. So far dragging the file into the application successfully works however when i open a text file with "Open with..." I can't seem to get it to work properly. Is there a way to detect whether the textfile opened in the program was using "Open with..."?
@F4z It should be the same. What difference are you seeing?
F4z
F4z
@KendallFrey I wanted to test it by adding messageboxes to see whether they get activated and dragging and dropping does not when I open with so clearly something sin't right when I open with
@JohanLarsson so I've updated my code again but the gauge still isn't updating, I've set `Value="{Binding DegreeOutput}"` and this is my code behind: http://hastebin.com/qifefaboki.xml

Any idea where I could be going wrong with this?
@F4z Would it kill you to ask a coherent question?
21:37
What is Interaction?
F4z
F4z
i converted vb.net code to c# its meant to be Messagebox
and for the one on the top
just command()
Use normal code, not whatever this Interaction comes from
F4z
F4z
like i said, i converted it from vb
i kn i'm correcting the code
I am using a bootstrap modal to display a reset password window for users. i need to catch the validation in the same modal. how to do that?
What am I supposed to do?
21:39
right now the return view() opens a new view
F4z
F4z
@KendallFrey you can wait if youre not busy and see what i did wrong? or I can wait for someone else to help :)
meh, editbox does not fit my screen & scrolling broken
@F4z I can wait
@BrianJ you are probably binidng more stuff than you have in your viewmodel. Try hardcoding values for max min etc. Also that margin looks nasty
@JohanLarsson I don't have any of these bindings in my view model, do you have any samples of setting up this gauge to be bound to a double variable? I'm seriously lost when it comes to getting this set up. The Telerik examples were much more straight forward in terms of set up.
21:49
I really really hate VS right now
@KendallFrey - What made you convert from really hate to really really hate?
F4z
F4z
@KendallFrey taking too long, I think it'll be easier to just ask the WPF section because i'm using vb.
Thanks tho1
@BrianJ I'm a bit busy with a thing here.
@JohanLarsson no problem, I'll have another look at the gauge demo and see if I can get it wired up.
did you clone it?
If so you can just wreck it and revert back
Pretty good way to learn to use git and play with a sample.
21:56
@BrianJ whats your vm look like?
@BrianJ Alomst all properties of the control are bound in the sample. You probably want to hardcode many of them in xaml.
@CharlieBrown this is the VM for that model: http://hastebin.com/rorehiwute.vala
and this is the VM of the application: http://hastebin.com/izobulofop.cs @JohanLarsson yeah I need to go back and look at the demo some more.
don't use regions imo.
I see no DegreeOutput property
Also have you wired up your datacontext?
@JohanLarsson I set the DegreeOutput property in the code behind of AbductionView.
I don't really know what it means but it does not sound right.
22:03
@BrianJ the value you bind in the view must exist in your viewmodel, not the code behind
@CharlieBrown I'm back
guess i should leave then
@CharlieBrown good eye, I'm refactoring now
I was chatting to you about my project. I have a Winform app, with WebAPI and EF6. You recommended having a class library for domain model, data model and view model
So the json coming back from the WebAPI, what class objects would that be ? ViewModel ?
22:07
lol, so it gets more complicated
to make your life easier, start with just sending domain models
@JohanLarsson need to go back to the drawing board, I'll keep you posted.
Best coding advice I can give: 1. Write it once. 2. Make it correct. 3. Make it better
2
your not gonna get it perfect the first time, so start with that and have at it. Perfect is the enemy of done.
@CharlieBrown Cool. I will have 1 class library which will have all my classes ?
should be ish
So for EF, this would be in separate class library ?
are there any decent sample projects ?
22:10
i have one for you
I used this for a class on enterprise EF patterns
Nice, thanks will have a look
The longer i do this, the more i think that college degrees should require a year of pair programming.
With the WebAPI, I would need to authenticate every request ? Or can you use some sort of sticky session or similar - not sure just asking
forms auth, cookies will create a sticky session
Even using Winform
22:12
hrm, thats right
Cool, thanks much appreciated. Will leave you alone now
;)
best using a secret key and auth with that
@CharlieBrown I think that would be a great idea, I've got into a lot of bad habits from being told to just go out and do the project and come back when its finished..would have been great if someone was there to review the code at certain stages
@BrianJ I just want to start on the right route, I know everyone does things differently and they all work. But I like to follow the best practices where possible
62
Q: Stack Overflow Annual Survey 2015

samthebrandThis year's survey is officially open. To participate, click here. Windows vs. Mac. Vim vs. Emacs. Tabs vs. Spaces. Lots of questions about who you are, how you work, and how you use Stack Overflow. It's all in there. Joel wanted to include a dozen "Would you rather fight..." questions involvin...

22:17
@CharlieBrown should the value bound in the view, exist in the VM for that view or the application VM?
Perhaps there should be a supplemental survey with Joel's questions
vm for that view
OK @JohanLarsson I see from your GaugeBox solution that there are classes "CodeGenerator", "CodeVM" and "ItemsControl" can I implement the gauge without using these classes? I'm thinking all I need to do is set the data context to AdductionAbductionFlexionViewModel and then set the DegreeOutput property in that VM.
@TravisJ No Visual Studio on the text editor list
those are in the sample/test project
You only need the Gauges.dll it should be reasonably clean.
22:27
This is my progress so far in adding the property to the VM instead: hastebin.com/ijoyayisib.vala and in the code behind set data context: hastebin.com/exodesakev.cs but since I moved degreeOutptut to the VM, its throwing errors in the view's code behind as "The name degreeOutptut" does not exist in the current context. @JohanLarsson
@BrianJ that looks perfect as long as the value will never change
if it changes you need changenotification for the binidng to update
You probably want to bind stuff like:
degreeOfAbductionTbx.Text = "Degree: " + degreeOutput;
Also keep on struggling. It will get easier.
@JohanLarsson I'm still getting errors though as "The name "degreeOutptut" does not exist in the current context in the view's code behind. I'm setting degreeOutptut to a calculation here but now it can't be accessed as it was moved to the VM..
It is really hard in the beginning when everything is new
Is you code on github?
I should sleep now though
daily wtf candidate:
0
Q: Can someone please explain to me why this is an infinite loop?

kencan someone please explain to me why this is an infinite loop? unity just hangs when i try this. im trying to build a deck of 52 cards public class Deck { private List<Card> deckList = new List<Card>(); public Deck() { for (int i = 0; i<52; i++) { ...

else { i--; } ouch
22:35
I got 20 rep today!
wutwut! :)
If all days were like this I would see flags before the end of the year.
Can I get some help.
@BradleyDotNET - I think there was serious fail in the decision process there. Instead of creating 52 unique cards and shuffling, they attempted to randomly create a card that was not in the deck in order for it to be shuffled once all 52 cards were produced.
That depends on the help you need :)
@TravisJ Unquestionably, about the worst way I can think of to shuffle a deck
22:38
@BradleyDotNET not really, we are full stack now :)
@Greg ask?
Also interesting that the {i--} was such a huge red herring that its not so obvious he is instantiating Random in the loop
Hi @Mehrad
@JohanLarsson thats not binding
> Call my bluff: One player is given a single-line project goal, and then several sets of requirements purporting to support that goal. The player has to guess which set of requirements is the real one for the project. The twist is that none of the sets of requirements is even slightly realistic. Again, this game is in widespread use, played by Business Analysts on unsuspecting developers.
Skeet you so funny.
@CharlieBrown what where?
:21310938
JK.
JK.
22:43
Can we get some close votes on this one please: stackoverflow.com/q/28041882/325727 thanks :)
@BrianJ you got lots a craziness going on, you might need to take a step back and start with basics
@JohanLarsson just wondering how degreeOutput can be accessed in the View's code behind if it has been moved to the VM.
@JK. - What was wrong with that question?
@BrianJ Typically you want very little in the code behind in wpf. Ideally nothing.
@TravisJ I'm really hoping that was sarcastic...
@BrianJ Johan is right, something should be bound to degreeOutput, you shouldn't be accessing it from the code-behind at all.
22:47
@BradleyDotNET - Random link dump, I want to hear reasons :D
@JohanLarsson @BradleyDotNET Okay I think I need to rethink how I've coded for this view. Ideally should I move all my events and initialization code to the VM instead? This is the code behind at present: hastebin.com/mamebikoci.cs
Most of that belongs in the Model
I don't have a model class for this model, what exactly should be moved to the model?
All the networking stuff
not model
22:53
View = UI,
View Model = Data for the UI
Model = Thing that generates, handles, and persists that data
your going to have some problems moving the dispacther code
events dont go in models
@BradleyDotNET Okay that clarifies things a bit.
@CharlieBrown Models can have events
Certainly not UI events
but its perfectly reasonable for it to raise a "DataRecieved" event that the VM listens to
Which would then modify some property, for the UI to pick up via INPC
INPC does not need UI-thread
INCC needs it if bound to a control which is gross imo. The control should handle that like with INPC.
@BradleyDotNET you wont have access to the Dispatcher (or, you shouldnt) in models
@CharlieBrown Absolutely. Obviously that code will need some refactoring
I never hesitate to have INPC anywhere though
My intention was not "drop it in the Model". It was "take all that functionality and write it into the Model".
@JohanLarsson Hopefully its just on your VM's and DTO/POCOs
Could someone breakdown what parts of the code in that code behind should be placed where, for example the events?
For starters, anything dealing with networking should go in the model. You'll have to refactor the pieces that modify the UI to raise events for the VM to pick up
23:02
Hello !
Any UI events have to stay in the view of course
Hi @Marc-AntoineJacob
Did you ever make a game with XNA in 2D
?
I really don't know where to start here..might have to look up some MVVM samples first
@Marc-AntoineJacob yup
23:03
because I'm coding a new game with XNA and I have some problem for the choice of the collision detection, it's a platformer
with tilemap
and that problem is....
strange question but how come in my kendo grid, the text that I have that is a single long word is ellipsed but if I have multiple words separate by spaces, the text is not ellipsed? What could that mean?
@BrianJ Perhaps you could ask a more specific question? Just moving the networking will get you a lot closer.
@BradleyDotNET Okay I'll start there, How/Where do I move the networking code? By networking code you mean what exactly? the hub code that checks if the device is connected?
This doesn't submit to Google, it always fails:
                Console.WriteLine("Submitting Sitemap to Google...");
                var certificate = new X509Certificate2(key, password, X509KeyStorageFlags.Exportable);
                var credential = new ServiceAccountCredential(new ServiceAccountCredential.Initializer(account)
                {
                    Scopes = new [] { Google.Apis.Webmasters.v3.WebmastersService.Scope.Webmasters },
                }.FromCertificate(certificate));

                var cancel = new CancellationToken();
23:07
@BrianJ Yes, and anything related to that device
Sorry, it just looked like WCF/SignalR type names
All that code should go in its own class that deals with talking to your device
its a Thalmic Lab's Myo arm band btw
okay and that class would be called the model,yes?
@BradleyDotNET It is, I just didn't want to give you all the try catch stuff to.
Its part of the model
@Greg ??
@BradleyDotNET Oh, you weren't talking to me.
but generally it would be called ***Model?
23:09
@BrianJ no offense given, but your lacking big gaps in your knowledge. this will be difficult
@BrianJ I would give it a descriptive name. I've seen code that always appends Model to those classes, and sometimes it works, sometimes it doesn't
"MyoDevice" would be sufficient for me.
@CharlieBrown no doubt about that, but I'm sure it won't bee too big of a task to port a code base this small to this pattern? (famous last words) :P
I have until Friday..
famous last words indeed
23:13
but in all seriousness, there isn't a lot of code there to refactor
shouldn't be a massive task
I hope
..
If thats all the code, you should be ok
I'm going to break the problem up, starting by moving the networking code to it's own class and getting that talking to the code behind, then porting whats left. Thats my poa anyways
t - 4 days remaining :)
Not talking to the code-behind
Talking to the view model, preferably via events
okay I better get started anyways and I'll keep you updated.
so step one, move hub code to own class, ie MyoDevice
ok I'm back with my problem of 2D collision with my XNA home-made platformer.
23:24
ok
@BradleyDotNET those are the most common places of course but I never hesitate to implement INPC wherever I find a need. INPC is not in an ui namespace
The problem is that I have a character in my game and I want to get him collide with the blocks on my tilemap
So in each Block derived class I check those collisions by the Update() method
@JohanLarsson No question. Its just a pain to manually listen to :(
i will give you what I coded
public void DetectCollisions()
{
//New way to detect collisions
if (Craby.RightSide.Intersects(this.Bounds))
{
if (Craby.Velocity.X > 0)
{
Craby.Velocity.X = 0;
Craby.Position.X = this.Bounds.X - Craby.Width;
this.Entity.Color = Color.Blue;
}
}
else if (Craby.LeftSide.Intersects(this.Bounds))
{
if (Craby.Velocity.X < 0)
{
Craby.Velocity.X = 0;
Craby.Position.X = this.Bounds.X + Block.Size;
this.Entity.Color = Color.Yellow;
}
}
if (Craby.DownSide.Intersects(this.Bounds))
{
if (Craby.Velocity.Y > 0)
Craby is static class that represent my character
I think you will understand because my code is pretty clear
@BradleyDotNET what do you mean by manually listen to?
23:27
if you want clarifications ask them
@JohanLarsson I mean actually use it, instead of the framework using it
I've had to do it once, and that wasn't the cleanest code I've ever written, suffice it to say
@Marc-AntoineJacob not your code
I see your code
So what's wrong with it?
23:29
ok all work except one thing
when I'm jumping and running at the same time to reach up another block, my character jump in arc just near the top of this Platform but it falls because it intersects to the right of this block at the same it intersects to the top
so I move left because of that, so I fall because my position isn't on the block
hi @ all
@BradleyDotNET I wrote a lib for using it.
Hi @Proton
I want that my character standing up on that block
Hi!
@Marc-AntoineJacob If its just a priority issue, make the down check happen before the "left" check
23:32
@BradleyDotNET Do you also know something about connections to databases?
yes I've done this before but I changed to this code because another probelm occurs
I've connected to lots of databases :)
just a question. ;)
It was a pretty easy one... ;) Or did you have a question about databases?
23:34
if the downside is checked before, whenever we jump into a wall, my character is teleported to the top of this wall because we check the bottom first
to be honest it's not just database related, at least i guess that.
so I get a little confused
@Marc-AntoineJacob You could give each block an "important side" variable
that is the side that gets priority when checking
That might help
So this is my attempt at moving the network code to it's own class:
http://hastebin.com/koraqupoqa.cs
But I'm getting a raft of errors as a result:
http://hastebin.com/nuveweqoca.tex
@BradleyDotNET
yes it's interesting
so when a block is Under another the priority is sides left-right and when it's not the priority is up down
23:41
@BrianJ Thats pretty normal for refactoring :)
@Marc-AntoineJacob Sure, that could work
When should i use
try
{
SqlConnection connection = new SqlConnection(connectionString);
command.Connection.Open();
command.ExecuteNonQuery();
}
catch (SqlException ex)
{
// Do Something
}
finally
{
coneection.Close();
}

using (SqlConnection connection = new SqlConnection(connectionString))
{
SqlCommand command = new SqlCommand(queryString, connection);
command.Connection.Open();
command.ExecuteNonQuery();
}

But how can i catch errors then? Is it like this then?

using (SqlConnection connection = new SqlConnection(connectionString))
When should i use using and why? How do i catch an error then?
Is it like this then?

using (SqlConnection connection = new SqlConnection(connectionString))
{
    SqlCommand command = new SqlCommand(queryString, connection);
    command.Connection.Open();
    command.ExecuteNonQuery();
}
    catch (SqlException ex)
{
    // Do Something
}
Well, you should always use using so it gets disposed properly (for SqlConnection)
Then inside that, put your try/catch
Isn't it the same then, like i would use finally?
Sure, the using is more to make sure you don't mess up
and you already did (you didn't call Dispose)
@BradleyDotNET so the first errors I'm getting after refactor are, "hub" "channel" "create" is a field/method but is used like a type.
how can this be corrected and refactored?
23:47
put it in a method
you've got code in a class declaration
If i would use using instead of finally, close is no longer necessary, even if a Exception occurs?
@Proton I think the using will still exit scope correctly, but I'm not sure. You should try/catch the code inside anyways
@BradleyDotNET so refactor the connect and disconnect code to a method?
@BrianJ Yes. Two methods probably. And remember that C# never allows for statements in a class declaration.
@BradleyDotNET so like this? using (SqlConnection connection = new SqlConnection(connectionString))
{
try
{
SqlCommand command = new SqlCommand(queryString, connection);
command.Connection.Open();
command.ExecuteNonQuery();
}
catch (SqlException ex)
{
// Do Something
}
}
using (SqlConnection connection = new SqlConnection(connectionString))
{
    try
    {
        SqlCommand command = new SqlCommand(queryString, connection);
        command.Connection.Open();
        command.ExecuteNonQuery();
    }
    catch (SqlException ex)
    {
        // Do Something
    }
}
this, sorry. ;)
23:51
thanks for the tip, I tried straight off the bat, to highlight the connect code from channel= until the closing bracket for the connect code, then right click "extract to method" but I get a message box error "the selected text is not inside a method"
@Proton Yes, that should be safe
What did you mean, as you said (you didn't call Dispose). Where should i do that? To be honest i still don't see the advantages of using instead of try-catch-finally? I read that i or everyone should use it, if the class implements IDisposable
using using* ;)
Thats right
because using disposes the object after the scope is exited
so calling Dispose yourself in the finally block does the same thing
but easier to forget :)
@Proton using is just shorthand for a try..finally..Dispose
Also, by putting it in a using you've scoped the variable to that block
so you don't accidentally access a disposed object
Just be careful with returning an IEnumerable in a using
Thats just asking for an object disposed exception
23:56
@BradleyDotNET You mean enumerator methods?
you mean disposing as closing the connection?
@KendallFrey I mean anything returning an IEnumerable, for example, returning a collection off of a LINQ To SQL object
Since its lazy enumerated, by the time the enumeration happens the object has been disposed
Why would IEnumerable have anything to do with IDisposable?
@Proton No, calling Dispose and calling Close are different
@BradleyDotNET trying to extract the connect code to a method but get the error: "the selected text is not inside a method"
23:59
@KendallFrey It doesn't, other than there is a gotcha there
What gotcha?
@Proton In this case, Dispose calls Close IIRC
Are you referring to closures in LINQ queries?
How would i dispose the connection? then, i mean without using using
@KendallFrey See a problem here? (code coming)

« first day (1570 days earlier)      last day (3603 days later) »