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

12:40 AM
posted on July 08, 2015 by Scott Hanselman

There are some amazing free and open source C# and VB.NET analyzers and refactorings that you can download and use now in Visual Studio 2015. Formerly called "NR6Pack" they have now be renamed VS Refactoring Essentials, a nice nod to VSWebEssentials I must say. The best part, of course, is that since the Visual Studio Community Edition is not only FREE but also now supports extensions, that an

 
 
1 hour later…
2:09 AM
What is the use of a Common Language Runtime?
(C# Jr here)
 
@Royalgambino The CLR is basically the engine that runs compiled .NET code
 
So Visual Studio is powered by the Common Language Runtime? @KendallFrey
 
Visual Studio is a .NET application, so yes
but Visual Studio isn't part of .NET
.NET consists of the CLR, which is kind of like the JVM, and runs compiled .NET assemblies, and the Base Class Library, which is a whole bunch of types you can use in your projects, like DateTime and Regex, and the compilers for languages such as C#, VB, and F#.
 
Thankyou for that informative answer @KendallFrey I have one more question, in terms of being a developer or software engineer. I have two interviews friday for Jr. Dev roles that focus on c#. I'm fairly skilled in understanding it, but actually implementing design patterns has me confused.
I don't know which design patterns or where to start in higher level architecture.
I want to be prepared for a white board interview.
 
Did you study design patterns in school?
 
2:18 AM
Not yet, I just got out of an internship from Microsoft. I got into their program in a business role then switched to a Jr. Dev role about 1 month in.
Now that I'm out I got a few offers.
I understand like Web API's, Controllers, Services, Workers. Etc
But I want to learn more about design patterns.
Certain! design patterns.
If you can point me in the right way in your opinion.
 
Design Patterns: Elements of Reusable Object-Oriented Software is a software engineering book describing recurring solutions to common problems in software design. The book's authors are Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides with a foreword by Grady Booch. The book is divided into two parts, with the first two chapters exploring the capabilities and pitfalls of object-oriented programming, and the remaining chapters describing 23 classic software design patterns. The book includes examples in C++ and Smalltalk. It has been highly influential to the field of software engineering...
That's apparently a very good book
 
Awh yes, Thank you so much!
 
IMO, the most effective way to learn design patterns is by simply writing code.
After a while, you start to see patterns emerge, simply because they're easier
The most valuable thing to know about a design pattern is why it exists, what problem it solves.
 
Thankyou for the informative responses @KendallFrey , Do you have any favorite design patterns (If that makes sense) or ones that you use the most?
 
Well, as a WPF developer, MVVM is probably the most pervasive.
As a programmer in general, I'd say my favourite "pattern" is functional programming.
As a C# programmer, particularly the thing of functions having no side effects.
 
2:32 AM
Thanks for the valuable information. Do you have any advice for me going into my first dev role outside of my internship @KendallFrey
 
Don't let being wrong and making mistakes get you down. Be happy. The more mistakes you make, the faster you're learning.
The best place you can be is the worst developer on the team. That way, you never have to deal with someone else's bad code, and you can learn from all your peers' good code.
 
 
1 hour later…
3:59 AM
hi all
 
 
2 hours later…
6:04 AM
good morning
 
Morning
 
hullo
 
6:57 AM
In user interface how do I select default value of combo box
grrrrr why is it so difficult
 
@Learner ?
 
You know combo box right ?
you add items to it in forms
not in code behind
 
Yes? WPF?
 
oh man
Win Forms..
 
Bleh
 
7:02 AM
6
Q: VS2010/C#: How do you set the default value of a ComboBox in the IDE?

paulsm4I'm writing a Windows Forms app in C#, using Visual Studio 2010. It has a combo box. I've set the DropDownStyle to "DropDownList", and added a few lines to "Items". Q: Is there any way for me to set SelectedItemIndex in the "Properties" editor, so that line in the "Items" collection will appea...

I want this but not in code
 
Can't help you with that, never used WinForms
 
you have to add something like - select
or - default next to it
 
Isn't the first item auto selected?
 
nope, i just had to add Text to it
win forms are so out dated
 
7:17 AM
Good morning!
Can somebody help me with the following? I'm trying to use 2 ViewModels on 1 View and bind commands from ViewModel1 to a button but it's not working...
 
7:30 AM
Hi guys, I have written an encrypt / decrypt function with Aes class, however I'd like the code reviewed by security folks to point me if this little piece of code is secure or not
It's not a serious production project so no worries :)
 
@Koliat You might want to try posting it to codereview or a security related stackexchange site. I reckon those guys know a bit more about security :)
 
yeah that's what I look for - I've not heard about codereview
I just don't want to spoil the site by posting rather general question
not a specific problem as the enc / dec works fine
@Benj
@BenjaminDiele will do, thanks :)
 
7:47 AM
Does anyone here have any experience with ASP.NET Identity 2.0 ?
I'm very confused by this, I've made my own implementation of IUserPasswordStore<TUser,TKey> and using UserManager.Create(TUser) works just fine, but when I use UserManager.Create(TUser, Password) it will create a user but without setting the password.
 
8:25 AM
@OverlyExcessive I've only used it with the built-in EntityFramework password store.
 
@OverlyExcessive what examples/tutorials/documentation are you following?
 
Does somebody have experience with C# WPF MvvM - CommandBinding?
Im trying to bind a command from childviewmodel to MainWindow button but cant get it to work unless I set the DataContext to the childviewmodel... But I have more than 1 ChildViewModels
Anybody?
 
@FadeD Not sure I understood.
You have a MainWindow with a button in it. You're trying to bind it to a COmmand in a ViewModel that's the child of the main ViewModel?
 
I'm trying to bind a command from 1 of my childviewmodels to that button
 
Something like `<Button Command="{Binding SubViewModel.MyCommand}"/>, assuming the button's default datacontext is the MainViewModel, and it has a property called SubViewModel that's the child?
 
8:40 AM
doesn't work Avner
I have multiple different childviewmodels
which all have commands that I have to use on buttons which are on the MainWindow
I have a Fluent Ribbon on the MainWindow
 
@FadeD Are the childVMs properties in your main vm?
 
@Loetn yes
private TicketsViewModel Tickets { get; set; }
private KlantenViewModel Klanten { get; set; }

I set them in de OnLoaded event of the MainWindow
 
So why can't you bind to Tickets.SomeTicketCommand?
Ahh, they're private.
They should be public.
Can't bind to them if they're private.
 
You should be using the public properties
 
EDIT: Not working...
the button: <fluent:Button x:Name="btnEditEntry" Header="Bewerken" LargeIcon="../Resources/TicketEdit.png" Command="{Binding TicketVM.EditCommand}"/>
the constructor and loaded event:
public TicketsViewModel TicketVM { get; set; }
public KlantenViewModel KlantenVM { get; set; }


private ObservableCollection<Object> ViewModels;
public TicketView()
{
InitializeComponent();

Instance = this;


}

private void TicketView_OnLoaded(object sender, RoutedEventArgs e)
{
TicketVM = new TicketsViewModel();
KlantenVM = new KlantenViewModel();

tvKlanten.ItemsSource = KlantenVM.ListKlanten;
lvTickets.ItemsSource = TicketVM.Tickets;
}
 
8:47 AM
Use Snoop and see what Binding Errors occur.
Rather than guessing blindly.
 
Snoop? <-- Meant: What is Snoop?
 
lets see
 
Wait, your VMs are in the Window's code behind?
They're not part of the ViewModel?
That's not a good way to go. A View should only have one ViewModel - one DataContext.
 
I haven't really created a MainViewModel
 
8:50 AM
Call it MainViewModel.
 
it's just the MainWindow :p
 
Right now, you're instantiating them OnLoad, which might be too late, because the bindings have already been resolved against null.
You should have a MainViewModel, instantiated in the constructor (not OnLoad), which exposes the relevant properties - either directly, or as child VMs.
 
so I should make a MainViewModel which will be the DataContext of the MainWindow.

Then I should instantiate the childviewmodels in the constructor of the MainViewModel?
(Still a f***ing noob when it comes to WPF MvvM ) :P
 
Thanks will try it straight away!
 
8:54 AM
MVVM works best and simplest when you can visualize a clear View<->ViewModel relationship. Naturally, they're all complex objects - a view has controls, user controls and so forth, while a ViewModel has properties and child VMs, but at the top level, a View has a ViewModel.
 
Awesome! Thanks for your explanations :) Much much much appreciated!
 
No problem.
 
9:08 AM
@FadeD MVVM is pretty much the same everywhere.
 
@Sippy I know, still learning ;) I'm coming from the good old WinForms
 
@FadeD :P
 
and trying to learn everything myself instead of courses :p
 
Lol
glhf
Shouldn't be overly difficult, you have Google.
 
@FadeD and you have the WPF chatroom too
 
9:14 AM
@Sippy thanks :) @franssu I know but this chatroom is more active :) (thanks for the invite :))
 
There are WPF dudes in here anyway.
 
@Squiggle I'm following this blog series odetocode.com/blogs/scott/archive/2014/01/20/…
 
it's more a matter of signal / noise ratio than activity
 
@OverlyExcessive looks fairly comprehensive. How come you're rolling your own?
at least if you roll your own you can debug it easily, right?
 
9:30 AM
@AvnerShahar-Kashtan next question: if I want to bind the ViewModel which I have instantiated in the MainViewModel to the corresponding UserControl(View) do I have to use var userControl = new UserView(UsersVM)? when I am opening the View
 
<ns:YourUserControl DataContext="{Binding TheViewModelProperty}" />
 
9:45 AM
thanks @franssu
 
you can also define a DataTemplate as a resource with its DataType set to the type of TheViewModel, so that whenever you're displaying data of TheViewModel type, the view is implicitly set to whatever your DataTemplate defined (in your case YourUserControl)
 
i'm using a frame control for navigation
so what I have done is the following:

when I open the childview I do this: var cv = new ChildView(MainVM.TicketVM);
that works :)
 
a lot of things do work in WPF, unfortunately
(that's not the right way of doing it)
 
hmm.. thats an old habit from WinForms
I'll change my code @franssu
@franssu should I create 1 command to open views or should I make a command for every view in my MainViewModel?
 
What could be the reason of sudden problems with local SQL connection? Havent changed anything. Rebuild does not help.
 
9:56 AM
Both are fine maybe ?
1 command using command parameter may be better, idk
 
Documentation completed.
 
lol
 
25 pages, mostly screenshots, which nobody will ever look at.
 
gg
 
nice :p
 
9:59 AM
!!gg
 
@Sippy That didn't make much sense. Use the !!/help command to learn more.
 
;o
 
srsly that's, like, my favorite gif of all time.
 
@Squiggle So days became day. Nice :)
 
10:01 AM
I googled good game gifs
nothing to report.
 
Why does release version connects to local SQL db but Debug cannot?
da fuq
 
cus u fuked up.
 
no i pro
WTF release version does not work anymore
 
^You fucked up big time
Delete and start over
 
Format hdd
go again
 
10:04 AM
I would just buy a new computer
 
WTF is Mixed platforms deploy and why does it selects by default :o Any CPU works well on Release but not for Debug, any suggestions?
What is wrong with this day?
 
@Loetn Oh no, I've still got to document the other 4 processes. This is just the first.
 
@Squiggle Ooh.. Gl :)
 
@Squiggle rip
 
@Marek sounds like a confusing error. Is it a library incompatibility? Build issues? Broken config? Account permissions? Caching?
Protip: If your code starts behaving in weird and unpredictable ways, 9 times out of 10 it's a caching issue.
@Sippy totally ripping right now
 
10:08 AM
@Squiggle It was config file error, which did not get deleted on rebuild. Thx.
 
10:19 AM
Two infrastructure guys sitting on chairs in the middle of the gangway, one with a laptop patched into the floor. Wonder what's going on
 
@TomW skynet
 
Now one of them is under a desk
 
@TomW A few years ago I was working as a contractor at a top-secret government project. One day I came in and saw two guys with badges wandering around the parking lot with an open laptop held up in their hands.
That wasn't suspicious at all.
 
in HTML / CSS / WebDesign, 1 min ago, by Sippy
// somedev1 -  6/7/02 Adding temporary tracking of Login screen
// somedev2 -  5/22/07 Temporary my ass
 
@AvnerShahar-Kashtan if you see something, say something.
 
10:28 AM
@TomW I mentioned it to the security guard at the gate. He shrugged.
I was not reassured.
 
I had armed security around my office a month ago. They're gone now. I kinda miss them :(
made me feel more important than I am
 
SJD
Hello.
 
Hello!
 
SJD
Can I define in some way, in xaml, resources for a specific type of controls and automatically to bind to that type of controls without being forced to explicit bind Style={StaticResource.. etc"
?
 
10:43 AM
@Squiggle skynet O_.
 
SJD
So, if I define for instance a style for Buttons, where the text is yellow and background is black, I want to apply for all my buttons in my app, without explicit go through all my xaml files and set style to that specific resource? :D
 
@SJD Sure. Just define a Style with a TargetType attribute but no x:Key. It will set as the default style for that target type. ASsuming, of course, it's part of the main app's resource dictionary.
Check out this tutorial: wpf-tutorial.com/styles/using-styles, specifically the "application-wide styles" section.
It's important to understand WPF's scoping rules. When parsing an element, the parser will look for a Style defined on the element itself. If not found, it will go up the tree looking for matching styles defined in the containers - the immediate containers, their parents, etc, through the current window and then the global application, until it finds a match.
 
10:58 AM
Please help me !
I have table A Which have column A1(Primary key) second table B which have relation with table A. like B(Foreign key A1). now I am Getting list for table B and I am getting the object of table A nothing.

I have done the savechanges after that suddenly getting all object of table B but not getting object of table A. For getting records of object A could hit the query again
 
@vishuminhas This is Entity Framework?
 
Yeah @AvnerShahar-Kashtan anyone know Entity Framework here
?
 
Don't know EF. Is there a select command involved?
 
SJD
@AvnerShahar-Kashtan tx
 
yea I can EF
@vishuminhas have you disabled lazy loading?
 
11:25 AM
good morning
Happy Hump Day!
 
Again?
 
11:44 AM
For Steve, every day is hump day
 
awwwwwwwwwwyis
 
Is it can be pub time nao plees
 
plz.
 
no u
 
'k. Off to pub. bbl.
 
11:48 AM
@Squiggle I'm coming
 
It's about time I had a holiday. 19 days left to take and weekends feel like a blip
 
@TomW you're welcome to visit :)
 
I'm not sure I can afford it
Just doing some gardening and diy, that'd be nice
 
the best thing about skype is how it doesn't transmit smell
 
@KendallFrey odious colleague?
 
11:53 AM
90GBP return per person for a long weekend. I've got a spare room, a riverside balcony and a large fridge.
 
@TomW no, me
 
;)
@KendallFrey yeah, I hate that feature in Google Hangouts.
Smugly observing an email chain I'm cc'd in, where two other people are quietly panicking about missing a crucial feature 3 days before deployment.
 
@Squiggle ooooooooooo
 
This is why I dislike 'no blame culture'
No blame means nobody is told not to do that again
 
@Squiggle hahaha
haaahahaha
 
11:58 AM
Someone fucked up on requirements. It's that person's fault. They'll keep fucking them up until they're told
 
@TomW this is one of those 'low priority' projects that nobody has invested much thought or time on. It's been in development for about 18 months, which is impressive given that it took 2 weeks to implement.
feh.
 
Managers tend to be very into no-blame culture, presumably to avoid being held responsible. Blame still happens, and it lands on developers instead, which suits managers fine
 
@TomW this is why I retain email discussions.
 
@Squiggle yup
 
@Squiggle I do that too but I've never found it to be useful. Too much cognitive dissonance; you'll still be blamed even when there's proof it wasn't you
 
12:03 PM
I guess I'm just lucky to have decent managers.
I've been very careful to avoid making any business decisions for this project. The moment you start trying to take control and fix something, all the shit starts to fly your way.
 
Yep. Really pains me but I've had to start refusing to do things for that reason. I hate being a cog in a broken machine, would rather just write something that works
 
@TomW no blame culture <> don't blame me. it's more for the blaming side, not the side being blamed
and usually it's not about no blaming, but tends to fame in public, shame in private
 
that's not entirely correct. The no-blame culture involves no blame, with discussions like this:
A: This thing doesn't work.
B: You're right, it doesn't.
A: OK.
B: OK, then.
 
^ well, that's more like a ill-formed one imo
 
with nobody wanting to propose solutions because that would require actual effort
 
12:10 PM
in team meeting:
A: this doesn't work
B: ok, i will fix it.
A: cool, come to my office, let's discuss about this

in one to one:
A: dammit, why in a world this doesn't work?
B: well, you know, I just made a mistake.
A: dude, you'd better make sure this won't happen again.
B: yessir
that's my preferred strategy
 
Forgive me if this question is very silly. If I'm calling a function, can I pass reference of a private variable as a parameter to it?
 
@codeln Sure. If it's a reference type, you simply pass the reference in. If it's a value type, it's copied in.
Easy enough to check, too. :)
 
Cool, got a bit confused there. Thanks :)
 
@codeln Yes, just use ref
The fact that you got two completely different answers to the same question should indicate that you asked the wrong question.
2
 
well yeah, I was looking for what avner said.
 
12:25 PM
My understanding is that you asked whether the contents of a private variable are somehow "unauthorized" to access from outside the class. They aren't. The variable itself is only accessible in its scope, but the referenced object can be accessed by anyone with a reference.
 
exactly
 
How can I return a list of open views in a frame control C# WPF?
 
@AvnerShahar-Kashtan I would disagree with that
 
@FadeD Not sure what you mean by "open views". Or by "frame control".
@KendallFrey With the general concept or with something I misspoke in my comment? :)
 
You can't access a local variable from outside the method except for references, pointers, and closures.
 
12:27 PM
Well, If I navigate through views using a FrameControl you can go back and forward. But I just want to list those views so I can click and navigate to the clicked view
 
@FadeD Ah, I never actually used the various Frame navigation controls in WPF. Not sure how they maintain state.
 
I'm trying to figure out the best way to use naviation in WPF
can you advise something?
 
Although looking now, I see that a Frame has a BackStack property that remembers the navigation history.
No OneBoxing for MSDN? For shame, SO, for shame. :)
 
@AvnerShahar-Kashtan awesome, that BackStack might do the trick. Give me a sec to figure it out
 
@KendallFrey You can't access a variable, but if you have a local variable which is a reference type, you can pass it to a function, essentially creating a copy of the reference, and access that reference type instance elsewhere.
 
12:30 PM
Were were talking about variables, right? :P
 
Strictly speaking, you can't access a private variable but only copy values, but effectively, you're passing a privately held object to a different class, with C#'s reference semantics abstracting away the fact that it's copying a reference, not giving access to a private member.
 
> whether the contents of a private variable
Reference parameters and reference types are completely, wholly, and fundamentally different.
And everyone should understand this.
 
var priv = new MyObject();
externalClass.GiveObject(priv);

I'm (in abstract) passing a "private variable" to an external object.
 
you're merely passing an object
no you're not
(reverse the order of two messages gahh)
 
@KendallFrey I agree with you, I'm just saying there's a difference between "passing a private variable" in the strict technical sense (where your point holds), and in the vernacular, which is what I believe codeln asked), in which this term refers simply to passing an object which is (currently) held in a private variable.
I can certainly sympathize with insisting on the proper terminology, but I'd rather answer the question intended rather than the question (literally) asked.
 
12:35 PM
Programmers of all people should insist on proper terminology
 
It's the word "private" that should be removed, it implies something special about it
 
Forgive me for assuming that the OP meant what his question said
@CharlieBrown It should be "local" if we're talking about local variables, which I still haven't figured out yet
 
@KendallFrey Given the same set of words, we understood two different things, so "what the question said" apparently has more than one interpretation.
 
I fucking love semantics.
 
@Squiggle And pragmatics even more so.
 
12:38 PM
@Squiggle I, fucking, love semantics.
 
indubitably
Also, programming is no place for pragmatics.
 
Programming, no. Questions about programming? Sure. Humans communicating are humans communicating.
 
Tru, dat.
 
humans are terrible at communicating
 
tell that to my dog who wont get off the fucking couch
jk i dont have a dog
 
12:43 PM
@SteveG lol you don't even have a couch
 
i do, and its larger than yours
2
but that shouldn't be suprising
 
some mess I've caused huh! sorry for the poor wording. I didn't know about ref keyword and references in c#. Avner caught exactly what I meant and I still don't know what other meaning that sentence could have :(
 
(he needs a bigger couch cos he has a bigger ass)
(murica)
 
lmao wish i could deny that
 
@Sippy daaaaaaaaaaamn
 
12:44 PM
Hahaha
 
@codeln welcome to communicating on the Interwebs! :) don't worry about it.
 
@SteveG Just sing Black Eyed Peas - My Humps
It's all good.
 
my lovely lady lumps
hump, idc
 
she's got me spendin'
 
@RenieChuah hi
 
12:48 PM
Morning.
 
@FreeAsInBeer morning
 
@SteveG Surf, or turf?
 
both
 
Mmm... I love me some sushi + rare steak.
 
ohhh me too
damn i haven't had good sushi in a while, i think i'll go this weekend
 
12:55 PM
Me either. I really should get some. Maybe I'll go for lunch...
 
What is the best practice for localization of text strings in WPF? Via resources files.
 
 
I haven't had good steak in a while ..
 
@Marek with x:Static?
 

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