« first day (893 days earlier)      last day (4056 days later) » 

1:04 PM
hey
has anyone worked with a custom userControl?
 
Yes.
 
ok, well, i am having an issue
how can i use the regular textbox
but have more controls
well, like have cs code for it
i want it to act like a textbox, but i just want it to do something special
 
Have you tried a RichTextBox ?
 
You can either use a UserControl, or inherit from TextBox directly.
 
well, i want to make a dll for future use
 
1:07 PM
I recommend a UserControl if you're adding anything to the TextBox UI (e.g. spinner buttons)
 
that is what i want to do, but
 
If there is just a behaviour change, inherit from TextBox.
 
i want some code in there also
well
i can not do this
 
UserControls have a codebehind. What's wrong with it?
 
<local:HotKey_TextBox text="textbox" Margin="0,172,507,165" />
 
1:08 PM
EEEEWWWWWWWWWWW
 
That Margin screams of horrible UI design.
 
1:09 PM
You probably aren't using Panels properly.
 
thats just a random placement
that is not actually in my program
 
@KendallFrey Do you have some "real world" experience with Serializers?
 
Yes.
 
@KendallFrey but i can not do what i can do in a textbox
like make the text directly from my control
 
What are you trying to do?
 
1:13 PM
<local:Hotkey_TextBox text="text here"/>
and i want to be able to customize it like a regular textbox
 
Oh, but as a UserControl?
 
yes
 
You need to implement a Text property that sets the textbox's Text.
 
how would i do that?
 
If you expect it to act like a TextBox, you should be doing the inherit approach, not the usercontrol.
 
1:15 PM
We are currently using serializers save config for our application ... As it grows I was asking myself if we could fall into problems when a newer version does not include a property (for example: server typer) because we do not need it anymore and to upgrade to a newer version one can't access the property because ... well ... the class does not have to property anymore.
 
well, i am currently changing the UI
 
@GameScripting I'm very familiar with that problem.
 
@KendallFrey how do you pass on the properties
from the textbox
 
@EliteGamer You could use templates instead of usercontrols.
 
@KendallFrey How did you handle it?
 
1:16 PM
to the usercontrol
 
I didn't XD.
 
i would like to use a userControl
 
Are you actually using serializers or do you do the "serialization" youself (using linq to xml for example)?
 
because i want to add it to my toolbox later on
 
So create a Text property that gets/sets the text of the textbox.
 
1:17 PM
how?
wait
let me look it up
 
Why can't you add a normal control to the toolbar?
 
i need to
what do you mean
i am making a textbox, but with more features
 
@GameScripting I use XmlSerializer for a fairly large project right now. (Bad decision...)
 
1:19 PM
What would you use, if you could start from scratch?
 
@KendallFrey could you give me an example of how to do this?
or some documentation
 
Do what?
@GameScripting You got me.
 
i need a property on my usercontrol called text
so i can pass the text to the textbox in the usercontrol
 
Probably either manual, or a db.
@EliteGamer So when the user sets UserControl.Text, add code to set TextBox.Text.
 
well, yes, i want to do this for my control, and it effect the textbox
 
1:21 PM
@KendallFrey There must a solution for this problem, everybody has to store data in any way ... Let me think about it ... Does the same problem come in, when using a database ...
 
<local:Usercontrol text=""/>
 
@KendallFrey I would guess yes, because one would have to restructure the db too ...
 
Yeah.
 
so, i want to have a text="" property
on my usercontrol, that will effect the textbox inside
 
@KendallFrey Do you use structures live MyObjectV1, MyObjectV2, MyObjectV3 etc too handle different versions of files?
 
1:23 PM
The best way is to use a system that is resilient enough to skip missing properties, but to upgrade data.
 
@KendallFrey
thanks for not telling me
 
Even if you say it has been a bad decision to use the XmlSerializer, would you go with it a second time?
 
i found the solution here
11
Q: User Control - Custom Properties

baeltazorI have developed a User Control in Visual Studio (WinForms C#) and have a question. I need the user of my User Control to be able to change certain string values and I would like them to be able to add the user control to their Form and click on it to bring up the Properties Pane where my User C...

thanks
ha ha
 
I'm not a code vending machine, remember?
If I can get someone to think through it and answer it themselves, we all win.
 
ha
ok
hey @KendallFrey i was returning a string
but how do i do colors
 
1:32 PM
Replace string with Color, maybe.
 
oh, ha ha, i though it was like brush or something
 
Java question (Oh god!); what is the easiest way to serialize an array with items and store locally?
 
Well, keep in mind that Color != Brush.
 
i know
 
If you're actually doing Brushes, you should be doing Brushes.
 
1:33 PM
but how would i do a brush?
brush
 
Is it possible in Git to push a commit abcd from RepositoryA into a branch called TestBranch of RepositoryB? So the current commit in TestBranch of RepositoryB will be entirely overwritten by commit abcd. Possible?
 
ha ha
 
@RoelvanUden Bazooka.
 
@Carven 'current commit'?
 
1:34 PM
As in the latest commit of the branch TestBranch
 
Why would you overwrite it?
 
Some time ago, I cloned my main repository out into another repository, started playing around and testing with some things. Then I went on to develop more stuff in the other repository.
Now I think I'm getting too far off in this repository, and I should get everything back to the main repo
The things on the main repo are too outdated. So I thought I might as well overwrite them with the files in the other repo.
 
That's not how source control works.
You can either copy the changes you made since the main one, or just make a new repo.
 
So I can't just push a commit from one repo to another repo?
 
@KendallFrey
iunstead of passing one property at a time
can i just send all the properties at once?
 
1:40 PM
@Carven Yeah, you can.
 
and for some reason....this will not work
public Brush Background
{
    get { return txtBox.Background; }
    set { txtBox.Background = value; }
}
 
But not in the way you described.
 
what do you mean?
 
@EliteGamer What reason?
 
what do you mean
i want to pass all the textbox properties to the usercontrol properties
 
1:41 PM
If you want to send all properties at once, inherit from TextBox directly.
 
how do i do that?
 
@EliteGamer I mean, what error message?
 
@KendallFrey Ahh...I see. Thanks!
 
class MyTextBox : TextBox
 
well, that code will not work
it says the Background property is hidden
it hides inherited members
 
1:43 PM
So rename it.
 
thats what it says
rename it...why,
why does it not overide it
like the text does?
 
Or inherit from TextBox directly.
 
@EliteGamer There is already a property named Background.
 
i know
 
user142019
1:48 PM
I should alter my monadic parser combinators to work with bytes so I can use it with binary formats.
 
Yes you should.
I manually parse binary files.
 
user142019
Why would you do anything manually?
 
user142019
There are computers for a reason.
 
Speaking of which, is a small complex file format better than a large simple one?
 
user142019
No.
 
user142019
1:49 PM
Simple = good.
 
Small = good too.
I don't expect anybody but me to parse it anyway.
 
user142019
Simple = gooder. :v
 
Why?
 
user142019
Less time wasted.
 
user142019
More maintainable.
 
user142019
1:50 PM
Easier to understand.
 
It's not going to be easy to understand either way.
 
user142019
Then you're pretty screwed anyway.
 
Why?
As long as I understand it, all's well.
 
user142019
Because nobody else will ever have to deal with your code.
 
No, they won't.
 
user142019
1:52 PM
Is there a better way to do something like new[] { x }.Concat(xs)? I find this ugly.
 
This is for a personal project.
@Zoidberg What does that do?
 
user142019
It prepends x to xs, returning a new IEnumerable.
 
user142019
Like unshift in Perl. :v
 
Well, there is Enumerable.Single.
 
user142019
Doesn't that return the first element?
 
1:54 PM
No, that would be First.
 
user142019
Oh right.
 
Wait, that doesn't create an IEnumerable. Idiots.
 
user142019
No of course not. :P
 
user142019
Something like xs.Prepend(x) would be nice.
 
user142019
7
Q: Is there a statement to prepend an element T to a IEnumerable<T>

jyoungFor example: string element = 'a'; IEnumerable<string> list = new List<string>{ 'b', 'c', 'd' }; IEnumerable<string> singleList = ???; //singleList yields 'a', 'b', 'c', 'd'

 
user142019
1:56 PM
Mark's yield return solution looks nice.
 
Enumerable.Repeat, if you pass 1 for count
 
Is there a tutorial on how to use blackbox testing?
 
Yes.
 
Link?
 
I don't have one.
I just answered your question :P
 
1:58 PM
:)
I did find tutorials, yeah.. but no practical aspect
 
A practical aspect ratio is 16:9
 
Give me pi to 100 decimal digits
 
I only know about 20 from memory.
 
Fail
 
user142019
3.141592653589793238462643383279502884197169399375105820974944592307816406286208‌​9986280348253421170679
 
user142019
2:00 PM
I only know 3.1415 and that's more than enough.
 
Bob
I shamefully just trust that Math.PI knows what it is doing... >.>
 
If errors is a string, would you prefer if (errors) or if (errors != "")?
 
user142019
The latter, obviously.
 
Yeah
 
user142019
2:10 PM
Implicitly casting strings to Booleans is braindamaged.
 
But I prefer if(!string.IsNullOrEmpty(errors))
 
@LewsTherin Gross.
 
Readable
 
user142019
You know what I prefer?
 
It will not be null anyway.
 
user142019
2:11 PM
Having errors not be a string.
 
And I think my way is more readable.
 
user142019
But an IEnumerable<Error>.
 
And then concat them?
 
@Zoidberg That's even worse
 
user142019
Stringly typed is just as braindamaged as implicit conversion of strings to Booleans.
 
2:12 PM
Someone teach me black box testing
 
All these are for is to display a message. Get over it.
 
user142019
@LewsTherin you write a test for a black box.
 
user142019
I hope you have its interface.
 
I thought we don't care about code for a blackbox?
 
We don't.
 
2:15 PM
Ok I think I get why I need the interface.. know the methods to call and its arguments.
Fair enough.
 
user142019
Of course.
 
user142019
If you don't have the interface, you're pretty much screwed.
 
What do you mean write a test?
How does one write a test in BB testing?
 
@Zoidberg It then becomes "no box testing".
 
user142019
@LewsTherin You write tests according to the interface of the entity you want to test.
 
2:17 PM
Doesn't that involve code?
Which defeats the point of a non programmer knowing how to use BB testing
 
You mean UI testing?
 
user142019
> Black-box testing is a method of software testing that examines the functionality of an application (e.g. what the software does) without peering into its internal structures or workings (see white-box testing).
 
user142019
It kind of depends what kind of black-box testing you want to do.
 
user142019
Do you want to test a complete existing program?
 
user142019
Or just a single function or a single class?
 
2:19 PM
I was incrementally testing the whole system UI + database, that is pass in invalid query parameters to see if a query will break the app
 
user142019
You need the interface of the tested entity anyway, whether it's the interface of a class, the signature of a function or the user interface of a program. It's the only thing you can use to do the tests. You need to interface with the entity in some way.
 
But I'm not sure what type of testing that's called
 
Service cannot be started. System.TypeInitializationException: The type initializer for 'System.ServiceModel.Diagnostics.TraceUtility' threw an exception. ---> System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.Configuration.ConfigurationErrorsException: Unrecognized configuration section userSettings.
Say... what?
I hate deployment issues, they are the worst kind of issues
 
I guess it's complaining that the configuration section in app.config/web.config was unexpected.
You probably need to specify a handler in the <configSections> section.
 
@MikeF well that's the issue: there is no such configuration section!
 
2:33 PM
e.g. <section name = "userSettings" type="my.special.parsing.Thing" />
Oh, so it's seemingly complaining about nothing?
 
well, yeah
 
Are you referencing a separate config file via a "configSource"?
 
no I'm not
 
How are you deploying it?
IIS?
 
Oh wait
 
2:37 PM
Well I'm stumped. good luck. My next step would be to try to scan all files in the solution for that string.
 
No it's a plain windows service
 
Then I'd search the entire hard drive.
 
@MikeF Can you solve that 5x5x5 cube?
 
@KendallFrey I might need to research hints. But yeah I have one and have solved it plenty of times long ago.
 
This section 'userSettings' was originally part of the .settings file (in the Properties folder of my project)
 
2:39 PM
I actually did one a few days ago.
 
But if I now go into the properties of this project, it says under 'Settings' "The project does not contain a default settings file. Click here to create one'
Seems like my .settings file is out of touch with the rest of the project
 
I don't think I've ever dealt with a settings file. I just always used app.config and the like.
 
Guess I should do this from now on too!
 
Seems like settings are more for per-user storage on desktop apps?
 
yeah, if you use 'user settings'
 
2:45 PM
ah, here's some archives of wisdom stackoverflow.com/questions/13100498/…
 
thanks @Mike!
 
any idea if Eric Lippert commented on this msmvps.com/blogs/jon_skeet/archive/2009/09/10/… ?
 
Rob
Does anyone have an idea why Community randomly rejects suggestion edits?
 
I doubt it's random.
 
Rob
After making like 5 suggest i'm once again blocked from editing a whole week because Community rejects them
Well they're perfectly clean code tag fixes, approved by 2 or 3 other real users..
That's new..
 
2:54 PM
StackExchange offline? NOOOOOOOOOOO
 
Rob
'Stack Exchange is currently offline. We'll be back shortly..
It's alive,... MUAHAHAH
 
hey guise
 
wat
 
Bob
So, I'm learning about .NET and C# and I'm confused about something. I was under the impression type safety verification is provided to prevent access to native code and to ensure objects aren't accessing memory outside of their bounds.
So then... I stumbled across this: pastebin.com/z5bcBKba
Now I'm confused. I didn't think code being "type safe" also means it's secure and non-malicious
 
3:09 PM
y u dead link me
 
He took it down.
@Bob That is complete and utter bullshit.
It's related to the Halting problem. If you can't prove whether or not a program will end, you can't prove that it won't do anything malicious.
 
why would he do a thing like that
 
BTW, type-safety doesn't have anything to do with accessing native code.
@rlemon Because he was jealous, probably.
The code is open-source, so start your own.
 
Hi kendell
Hello to all the legends of SO
:)
 
do they form a league?
of legends
 
3:24 PM
Yeah, SO Hall of fame
 
Good luck finding any legends here. We're all just goofs and screw-ups.
Especially that @KendallFrey fellow.
 
Hey, speak for yourself. @DamienJoe, I'll be signing autographs all week.
 
I have a wcf service and I'm planning to load data to memory periodically and return on some function calls to the service. Do I have to add any extra operationcontracts of datamember tags here and there?
 
Bob
@KendallFrey So security and type safety are not related? Is it mainly just keeping Foo's from becoming Bar's and accessing memory they shouldn't?
 
hi does anybody has experience with retrieving data from Dynamics CRM?
 
3:39 PM
@Bob That can normally be prevented by other means.
 
type safety is unrelated to memory access safety
 
Bob
:|
 
Javascript has memory safety and hardly any type safety
 
Type safety is more about guaranteeing your code does what it says it does.
And what he said.
 
@MikeF just found the answer to my issue!
 
3:40 PM
the phantom config section?
 
I just kept scanning the hard drive for a user.config file, ended up in a place called 'SysWOW64'
yes
 
I thought type safety is using an ergonomic keyboard to not get carpel tunnel
 
Bob
Can someone clarify this statement? "When code is type-safe, the runtime’s security enforcement mechanism ensures that it does not access native code unless it has permission to do so." from ashishkhandelwal.arkutil.com/csharp/type-safety-in-net-security
Sorry, I'm working on a class assignment in a group and I'm fairly certain none of us has a clear vision of what type-safety is, but we're supposed to write about it.
 
Type safety is being sure a string is a string, and not an int.
 
Essentially, in order to get around proper type enforcement at runtime, you have to use unsafe.
 
3:43 PM
> In a .NET security context, type safe means preventing programs from accessing memory outside the bounds of an object’s public properties.
 
Bob
@ShotgunNinja When would it be appropriate to do that?
 
I question the authority of that article.
 
here's type safety:

var myString = "hello";
mystring = 1; //blows up the compiler
 
Bob
Well I'm with you, but I also have never used .NET before.
 
@Bob Usually when dealing with a C++ library or some other non-.NET stuff.
 
Bob
3:44 PM
Beyond about thre weeks ago
 
@PhillipSchmidt Actually, that's not really type safety, but a different flavor of weak type enforcement.
 
Bob
I see, that does make more sense
For some reason a lot of MSDN literature likes to juxtapose security and type-safety
 
@ShotgunNinja wouldn't it still fall into the type safety category?
 
Bob
and I think that's confusing to newcomers
 
The term "type-safe" is a poorly-defined term, and can mean two or three different combinations of two properties of programming languages.
 
3:45 PM
@Bob What MSDN literature?
 
Bob
In reference to C# in this instance
 
^ Read that, after "Strong vs. Weak Typing"
 
The article you linked talks about not accessing private members. I can access private members in C#, it's just more complicated.
> (For this discussion, type safety specifically refers to memory type safety and should not be confused with type safety in a broader respect.)
It is being "confused with type safety in a broader respect."
 
Bob
Okay I think that kind of clears it up for me; to verify this, type safety you're saying has basically nothing to do with security, except in the context of X object cant' access Y object's private data?
 
3:50 PM
Pull the other one.
 
Type safety is not what it's talking about at all.
 
Bob
Hrmp.
 
It's talking about what it calls "memory type safety", meaning that it actively prevents malicious code from accessing objects in a way that it would not normally be allowed to.
 
Bob
So it's only protecting objects from being typed to something they aren't extending/etc?
 
No, that's normal type safety.
 
edc
3:52 PM
then there's generics, a different type of type safety
 
Type safety essentially says that if you ask for a dog, you won't get a cat.
 
Whoo, type safety and strictness and polymorphism, oh my!
 
edc
oh myyyyy
 
Bob
Well I'm back to being confused.
 
Next, we'll be learning about Liskov and her substitution principle.
 
edc
3:54 PM
maybe we can just compare javascript and C#?
to keep things simple for Bob
 
Naaaaaah
That'd be too easy.
 
But what he's reading is a completely different meaning of type safety.
 
If we don't give him all this stuff now, he'll never know it for the test, when it becomes important!
 
edc
Oh I scanned through it just now... how come the title is type safety but it talks about memory safety.
 
Because this is the Internet, and you can't believe everything you read.
Actually, regardless of where you read something, you should always be wary of where it is coming from, and how much effort went into ensuring that it is correct and up-to-date.
 

« first day (893 days earlier)      last day (4056 days later) »