« first day (511 days earlier)      last day (3638 days later) » 

2:57 AM
Q: Why does this code doesn't change the value of
<TextBlock x:Name="In_Time" Foreground="#FF55534F" FontSize="71.312" FontFamily="HelveticaNeueCyr" Height="79.45" LineStackingStrategy="BlockLineHeight" Canvas.Left="2.724" LineHeight="71.312" TextAlignment="Center" TextWrapping="Wrap" Canvas.Top="69.985" Width="231.581" Text="09:00">

Here is a code:
objAfterLogin.In_Time.Text = DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString();
 
 
4 hours later…
7:27 AM
Hello Guys
I have a hard time getting how Drag and Drop should work in MVVM...
 
 
2 hours later…
9:38 AM
Nope I gave up, solving it in codebehind instead
 
 
2 hours later…
11:31 AM
0
Q: Scrolling X axis Plot area - Silverlight Column Series

GoofyI have a Column series chart which is working fine. I have a feature that i need to add to that, i want the horizontall scroll to be enabled to the plot area that is x-axis. Here is the screen shot: If you see the screen shot i have six items, and the bar are very thin because of more number...

 
12:14 PM
@Markus i would have done the same thing! DnD is a view thing - i don't see how you'd do in other places
(or why you should do it!)
 
I have found a lot of examples, not the least with Behaviors, but it got to complicated
 
Mornin
 
mornin'
 
1:04 PM
Hi
 
elo all
 
1:36 PM
btw gregory.bmclub did you know that you can get the name of the calling method or property by adding [CallerMember] to the methods signature like this void MyMethod([CallerMember] string propertyName = "") ?
then you can just call OnPropertyChanged();
 
That sounds interesting...
 
my mistake [CallerMemberName]
it is
 
Have you got a tutorial or something about that? So I can take a look at it?
 
just google the attribute
and you find all you need
 
2:12 PM
and its .NET 4.5 and higher
 
wow - i never knew sheridan can be a dick like that!
people like him turn away perfectly polite people
@gregory.bmclub was your problem sorted? or you need something specific still?
 
haha i always had that impression of him
 
i've seen his answers, but never his comments
 
No wasn't sorted; did you read through the question and see the image? I don't understand that one minute (before I add the filter) it works, but when I add it all the items in the list vanish.
 
"I'm too busy to be polite with you today" ... like boggled my mind right there
if you're too busy, don't reply!
 
2:20 PM
Thats what I thought.
 
nah i started reading and noticed it had a reply
so i jumped to that - then noticed it has comments.. so i jumped again to them and then my comment here
 
Dont get me wrong; I appreciated his question and all the effort and time he put into it; just didn't find it appropiate by his comments.
 
is the code in question exactly what you have now?
 
I know Im not a very strong programmer; I just find tutorials and implement them but still, not very nice thing to read. Im still only a beginner when it comes to programming; so Im a bit slow picking things up and some times need a bit more explanation.
Yeah, if you look at the solution you looked over the other day; its the same apart from the ContactNameSearch property.
I tried implementing the code in the answer, but it throws a null exception.
 
2:39 PM
umm
i can't run that thing so I can't actually see whats wrong.. when it throws the exception in debugger.. just hover over parts of the chain to see what is null
null exception is always to the left of . operator
nullObject.ToString() will throw that.. but nullObject itself will never throw that
if you don't get anything.. keep going left one part at a time until you do see debugger show you its intellisense data
where you get the first response.. the bit to the right of that is the culprit (and obviously shouldn't be null)
i did tell you you'll run into null exceptions because you're doing FirstOrDefault() instead of Single()
 
Should I change all the FirstOrDefault() to Single then?
 
0_o never knew the difference between First and Single
 
Nor me, lol.
 
68
Q: LINQ Single vs First

BahaiResearch.comLINQ: Is it more efficient to use the Single() operator over First() when ever I know for certain that the query will return a single record? Is there a difference?

 
you guys got it now then?
 
2:53 PM
Sorta.
 
whenever you're dealing with PKs, you should always be using Single or SingleOrDefault
anything that should always return 1 result.. Single is your man
 
but if there is no record it with throw an exception?
 
Default version if for times when you expect the result to not be there
yes.. the question is: are you expecting the result to be amiss?
if you're expecting it to not be there (user giving you a stupid PK) -- then SingleOrDefault() and always check for null before you use the result
if you're not expecting missing results (your list was populated from Db and user is just using combobox to pick a choice) Single() is your choice
 
Go ballsy, use Single.
 
First() is meant for times when you're expecting multiple results
and only care about the first / last / or any other one element at an index
First() is just a shortcut for .ElementAt(0)
 
2:56 PM
Single... better get a damn result basically. First, well you better have many things. SingleOrDefault... only if you ever expect it to possibly be null.
 
Single will throw if there are multiple matches or if there's none at all -- this is generally the desired behaviour
SingleOrDefault will still throw on multiple matches but won't moan about missing matches
 
Just changing all mine to singles now :)...
 
Single will... ensure you catch errors that you may not have seen :)
 
So in most cases, Single() is always best to use?
 
var employeeInDB = db.Employees.SingleOrDefault(x => x.FName = "Bob");
if (employeeInDB == null) // Bob not found in DB
unless you expect nulls ^^
Or multiple results from your criteria
 
3:08 PM
Makes sense. :)
 
var employees = db.Employees.Single(x => x.IsActive) // ERROR if more than 1 active employee
var Iknowthisexists = db.Receipts.Single(r => r.ID == TheIDIKnowExists)
^^ what if that receipt ID you know exists suddenly doesn't exist any more? It would cause an exception
 
Brock
SingleOrDefault
check for null
 
important thing about using Single() is ... you can safely chain things on top of this
but you can't do that OrDefault variation
by safely i mean - if there's an error, you'll know fairly clearly that you've messed up
 
"safely"
 
Yar you'd have to check for null when chaining singleordefault
So I'm using #if DEBUG mystring = x but mystring isn't being set to x
I feel like sometimes that doesnt work?
I can't get [Conditional("DEBUG")] to work either
 
3:23 PM
sorry i dont use pre-processing
 
going to try this instead: if (System.Diagnostics.Debugger.IsAttached)
 
that won't tell you if you're in debug build though
 
3:38 PM
@BrockHensley is mystring greyed out when you use preproc?
 
It works now
Its like, randomly it doesnt -- though VS shows the grayed out section correclty, when ran - the non-debug variable values are being used
I've ran into it a few times, it goes away, I move on. I've seen others say the same on the interwebs.
I blame the pathological liar that is known as VS.
 
never seen that happen before
just make sure your debug constant is defined, you're in debug build, and you're actually using the variable.
 
May not have sorted my filter out, but found a nice and pretty report application. Yippee :)
 
@BrockHensley so how would you write something like this for error handling: gist.github.com/kevlut/445645a7ec9b5d5acfa8
i could change it to return a bool, but how would i say it failed trying to open a key, or it failed trying to create a key
or do I not use try/catch and go about it your way to determine the exact like thats throwing exceptions
 
3:56 PM
uhm
Is LoadMRU in your Model or ViewModel?
Basically you want it to return one of 3 things, success / no permissions / other error ?
i.e. what calls LoadMRU?
 
4:11 PM
@BrockHensley try using explicit defined variable
 
is there any ways to customize XML tags for function headers? i want to add a <author> tag
 
@BrockHensley initializing an instance of the class. updating the list... its acting as a VM i'd say
 
/// <summary>Describe the method here.</summary>
///
/// <author email="alan.dean@thoughtpad.net">Alan Dean</author>
public void MyMethod() { … }
Checking for pass/fail when calling: if (!LoadMRU()) { // display error message and / or try again via loop }
while (true)
{
    if (LoadMRU()) break;
}
Unless you want to know which of the 3 possibilities it returned?
 
okay, simple enough for XML stuff.
 
4:22 PM
maybe create a quick enum of return status
 
well its possible there is a failure when opening/creating the key
 
if (LoadMRU() == MyReturnType.SecurityError) { // You dont have permissions
 
don't want to put that in while(true) because its something the user might not be able to control
ahh
 
if (LoadMRU() == MyReturnType.SomethingElse) { // Try again?
 
gotcha now
 
4:23 PM
If you know theres only 3 outcomes you could use a nullable boolean instead of a custom Enum
false = fail, null = retry, true = success
 
meh this class should probably be static. it's making registry changes.
 
4:39 PM
jk, will be leaving that broken for now
 
 
1 hour later…
5:46 PM
@BrockHensley Why is that preferential to a enum with { Fail, Success, Retry }? Seems much more clear
 
6:12 PM
@ReedCopsey not much, why?
 
you replying to my question yesterday?
 
yeah :)
in the mountains, extremely poor internet here
did you check the undo thing?
 
@ReedCopsey Only for simplicity sake, quicker to use bool? than create your own Enum etc. I usually use enum.
 
@JohanLarsson I didn't look at that
I'm trying to fix a bug in the XAML type provider
 
what is the bug?
 
6:29 PM
right now, I'm getting: "JIT Compiler encountered an internal limitation."
:p
that's a fun exception
 
Reboot!
 
6:44 PM
@ReedCopsey I've been getting that for days - i just turned the CTP off!
(not on your project, on different projects I've been compiling)
(I'm also assuming you're test driving RyuJIT CTP 2)
 
7:34 PM
I have it off on this machine
;)
Have you reported that? It shouldn't happen with normal code
I'm getting it because I'm workign on generative type providers, and that happens if you do something wrong
since you create invalid IL
 

« first day (511 days earlier)      last day (3638 days later) »