« first day (1417 days earlier)      last day (3525 days later) » 

12:26 AM
How to clear console programatically at VS ? To print I use System.Diagnostics.Debug.WriteLine();
 
@Yoda Can you elaborate on what you mean?
Need advice: Is it worth it to spin up a thread dedicated to actively preventing resizing of a window?
 
12:42 AM
@KendallFrey Can't you just block resizing?
And I think he means: clearing out the output window
 
@RodrigoSilva Nope, assume I can't
 
@KendallFrey Can you handle the SizeChanged event?
 
I can
I would then have to revert the change
 
So, prevent being the keyword?
 
well, actively prevent
 
12:56 AM
I can't see any other option, assuming setting the MinHeight/Width and Max are out of the question...
@KendallFrey Could you maybe filter out the messages and when SC_SIZE is received, do nothing?
 
that actually happens after the resize
this isn't actually a normal Windows window
 
What is it then?
Or is it classified? :P
 
It doesn't matter, but 256 fake internet points if you can figure it out.
 
What are exactly my restrictions, what can't I do?
 
1:06 AM
Well, for example: I can't just block resizing, as you said
 
right
 
Any other restrictions? Is this the correct word?
!!define restrictions
 
yeah
um
 
@RodrigoSilva [restrictions](http://en.wiktionary.org/wiki?curid=103222) plural form of restriction
Restrictions may apply.
 
the only indication that the window has been resized comes from a message loop
which now that I think of it, would cause problems with a second thread
 
1:08 AM
Hm...
 
1:40 AM
Holy crap I just tried to put all my vegetables/proteins in an interface and boy did I eff that up.
 
 
2 hours later…
3:16 AM
HI
I have a query on events in c# .net
posting the psedocode
*pseudocode
Class A
{

List<B> listofB = new List<B>;

public Method2()
{
B objB = new B();
objB.RaiseOnComplete += new ..(Method3)
listOfB.Add(objB);
}

}


Class B
{
public event RaiseOnComplete;

public void Method1()
{
RaiseOnComplete();
}
}



Class C
{

A objA;

public C()
{
objA = new A();
}


//on some condition i call this lets say
public method3()
{
objA = new A();
}

}
there is a memory leak here ... the event hooks of previous objects still exist
so whats the solution for these kind of requirement
is there any pattern ?
 
 
2 hours later…
5:37 AM
Hello!
I need to find all namespaces withing a given namespace.
I found a way to find all types within given namespace, but I need to find namespaces, not types.
I have a namespace N, where I have few classes and other namespaces A and B (which also have some classes, but it does not matter). So I need to do sort of N.GetNamespaces(); to get string[] with two elements A and B.
 
 
3 hours later…
8:22 AM
Bump. :o
 
8:33 AM
I'm not sure namespaces are first-class objects in .NET reflection.
 
@Denver Namespaces are not available through reflections, but types are (namespaces don't actually exist until there is a type in it). You can get all the types and the full associated namespace path. You can then parse that namespace path and thus build a namespace overview that way.
 
8:46 AM
guyz, I have some questions about what kinds of questions can be asked on this site (SO). I've read the thingy, but I still have some doubts
There is one problem that I have always had, and have never been able to fix. I just counted all of the code samples that (worked for others) I've downloaded over the years and not a single one of them has ever worked for me (remotely, between two remote PC's - locally always works). You could say that I'm just stupid and not doing it right, but I have ...
...raised a few questions on here years ago and everybody said my code is right and that there are other things wrong like for example I might be behind a NAT or router or whatever. But the problem has never been solved. The thing is, I want to write a simple app that I can give to a friend, get him to type in my IP address (when I give it to him) then I type his, then ...
...we "Connect". then we can send plain text messages. But the problem is, there is always errors like "Connection refused by remote host", etc. So, my experience with this tells me that networking is fucking hard. And there are many things that can get in the way of a successful remote connection. So I just had an idea. Would it be on topic if I asked a question along the lines of "How the * do we connect to a remote PC ...
...given an IP address and what are the things that can cause remote connections to fail when the code itself is not the issue?"
 
Routers generally allow outbound connections, but don't allow inbound connections without explicitly configuring your router to translate external connections to forward into the internal network. And literally everyone has a router. Besides that, you have software firewalls that can seriously mess inbound connections up. Usually they follow a similar rule of "Block everything until explicitly allowed".
 
maybe make it a community wiki post or something. i'm not looking for "a right answer per se", i'm looking to build a whole list of things that will get in my way while trying to connect remotely
@RoelvanUden I have disabled firewalls and antivirus on both my PC's and have set rules in my router config page to allow remote inbound connections in the past. I don't remember the exact error message unfortunately, since it was about 2 years ago, but I do remember thinking "*&^%$! What now?"
 
But if you want to hook up two PCs, one can use outbound connecting, while the other end is listening. Only one of the two ends needs to be configured appropriately. If you are the server, your friend doesn't need to configure his network at all. To sum it up; router, corporate firewall, computer firewall.
Corporate firewalls often have rules saying "You can connect outbound to port 80 or 443, but not any other port".
 
@RoelvanUden so if I setup inbound rules to allow, that means my friend doesn't need to? I don't understand that, because if my home router needs configuring to accept incoming stuff, wouldn't his, too? (this isn't corporate firewall it's just home pc's - unless you're referring to our ISP's?)
I understand that only 1 needs to be server, though.
 
@baeltazor If he connects to your PC, he's connecting outbound. Like asking for a web site, that's totally outbound. If you are just acting as the server, thus listening, you are acting like a web server -- waiting for someone to ask something and then start chattering about.
 
8:59 AM
@RoelvanUden ohhh I got it now
 
@RoelvanUden Well, I guessed that. Thanks for the answer.
 
A web site is also asking a server for a page, and getting a response. Hell, this chat room uses Web Sockets which is just a fancy way for bi-directional communication over the HTTP protocol. So once the connection is established, data can flow both ways without limitions.
 
that made a lot of sense. your last sentence made me think of a cord being plugged into a port and when it was plugged in stuff started moving both ways.
 
Exactly! Great example by the way, I'll remember that :)
 
thanks lol :) and thanks
 
9:04 AM
Mornin' all
Shouldn't you be in bed, bael?
 
you sound like my partner, @Sippy. I'll sleep when I want! lol
but no, it's only 7pm over here :)
 
Lol
If my girl said that I'd say 'Bitch shut yo'self'
Then prolly get slapped or something
 
LOL
I know right lol
i should sleep early though
i sleep too late
 
Meh, I was playing firefall till midnight last night lol
 
firefall?
omg ur like the first person ive ever spoken to who likes scifi games lol
 
9:11 AM
Uhhh.. Mass Effect was sci-fi too!
Who didn't like that?!
 
mass effect is cool
 
I like scifi.
 
@baeltazor See. Programmers are your kind of people. :P
 
You may talk to me, baeltazor, so I will be the second person.
 
You'll be the third.
 
9:14 AM
yay lol
 
Don't forget me :-(
 
proggies are the coolest peoples lol
 
Awww, only 3rd. :( Always too late.
 
lmao
aww :(
don't be sad mr
 
@Denver Still Bronze!
 
9:16 AM
Well, as for scifi, StarCraft2 is pretty popular and can be referred as a scifi strategy, can't it?
@RoelvanUden Platinum in League of Legends measures.
Well, I guess the latter was an odd comparison.
 
lol, the starred comments on the right of this page just reminded me of primary school where the teacher drew stars next to our names on the blackboard. i think it's kinda funny how we still get all warm and fuzzy inside when we see a star next to our name.. and we're like, in our 20's, 30's etc
 
@RoelvanUden I'm done with this nuget thing. I'm honestly surprised anyone uses it, given the amount of time one needs to invest in it
 
9:31 AM
@SteffenWinkler you need some help?
 
@SteffenWinkler It's really need so hard. What are you stuck on?
 
@baeltazor not anymore, no.
 
(Granted, npm is way, way easier to use)
 
@RoelvanUden Well, for one I don't get why nuget spec $assemblyname creates a completely useless .spec file
seriously, there is almost no difference to nuget spec
 
Uhh, does it matter?
 
9:33 AM
uh, I guess. Since there is no other way to get a versionnumber into a package
because it chooses to ignore the actual versionnumber of the assembly/csproj file
next up that it doesn't seem to find dependencies on a assembly level. Meaning that I need the csproj file. Wtf?
And inside a build process you don't get to see the csproj files that were used, since TFS just fires the entire .sln over to msbuild
meaning you've to create a file with all csproj files involved and you'd need to remember that file and add csproj files in the future
 
hi ..
 
in short: it's too much effort
just to be on the safe side: I do not want any help here. It was just merely a 'this tool is really not for me' post with a side-rant
 
9:53 AM
@baeltazor I like Scifi everything ..
Not a huge fan of Star Wars or Star Trek though.
Or Firefly for that matter
SciFi games tend to be the shit though
^ lol.
 
i hate it when msgs r deleted. i miss out on all the fun here lol
 
Guys : I am creating a desktop app , just wanted to know if asking for needing administrator rights is bad as an app ?
 
No.
It's not.
But you should just do it via UAC or not at all I think
Don't add dialogs to ask for admin rights.
 
In case of the user who use it into corporate environment, might see issues ahead ?
@RoelvanUden - Hi hows u doing ?
 
Does anyone know how to do the same thing as a SQL replace in an nhibernate query? Everything I've read so far is very vague
 
10:00 AM
If the user wants to be prompted to give admin access they will have UAC enabled, else if they don't want to be prompted then they won't.
@baeltazor He said something about Star Wars being a romantic sitcom, not a scifi. Dunno if it was sarcasm or not.
 
@bhuvin In general, yes, it's a bad idea because it complicates matters and opens potentials problems in deployment. That said, sometimes you just need to perform administrative tasks. Do you, in this case?
 
@bhuvin Don't ask for admin if you can avoid it.
 
@AvnerShahar-Kashtan - Its like I have a web server running and other network communication , file access etc ...
but like i "Guess" i can manage ..
but suppose in case i want ... then in that case will each user have to be added administrator rights .. ?
yes of course it will ... Bad question .. :P
 
10:25 AM
@bhuvin What files are you accessing? Are they your own files? If so, store them in user-accessible locations, such as Isolated Storage, the user profile folder and so on. Don't store them in %ProgramFiles%.
 
Ben
hey folks can anyone tell me if this is possible
if I have: string s1 = "AIB Pension";
string s2 = "AIB Executive Pension";
Console.WriteLine("String test: " + s2.Contains(s1));
this obviously returns false
is there another function that would account for individual words that would make this true?
 
@Sippy no idea to be honest, lol. i can't even remember what i was doing before i left the computer :/
 
@Ben Split S1 and S2 into arrays and use LINQ to check if s1Elements all exist in s2Elements?
 
@baeltazor No I meant I don't know if what he said was sarcasm or not lol
 
@Sippy ohhh
lol
kk
 
10:34 AM
:P
 
can somebody write a whole custom control for me? i has me a headache lol
 
Ben
@AvnerShahar-Kashtan I think that will work thanks!
 
string[] s1 = new[] {"1", "2"};
string[] s2 = new[] {"1", "3", "2"};
var isContained = s1.All(s2.Contains);
 
Ben
.All() genius. thanks
 
Or maybe !(s1.Except(s2).Any())
Though that's even less readable.
 
Ben
10:43 AM
well using .All() was perfect for my situation
 
If you use it a lot, it'd be a good candidate for an extension method with a more expressive name. Maybe "IsSubsetOf" or something.
 
@baeltazor Lol, that's what I'm doing atm Y_Y
 
@Sippy lol cool, what control you makin? I'm making a ConfirmationButton
Instead of clicking a button then showing a messagebox to confirm, you just click the checkbox inside this button, then u click the button itself
 
@baeltazor Making add/edit/delete controls for database
Cos some idiot thought it was a good idea in the first place to have plugins for that.
 
lmao
 
11:01 AM
Has anyone ever had an issue with intellisense in VS2012 where certain things supposedly don't exist in a context until you open the file they're defined in?
 
@Sippy In C#? No.
 
It keeps telling me that my objects don't exist, even though they're defined. Then I open the file in the IDE in which they're defined and voila, they're suddenly defined again.
Keeps happening and it's really annoying.
Building, cleaning etc have no effect on it.
 
@Sippy I have had that issue in VS 2012 preview. are you still using the preview version?
 
No.
 
ok
 
11:12 AM
Ah
As always restarting VS worked
 
i have no idea then, sorry.
 
Dunno why I didn't think to do that yesterday
 
@Sippy prob cause its the last thing u wanna do to fix a problem lol
 
true
It helps that .sln stores the open tabs these days
Or if not that, something does.
Never looked into it haha, just noticed the change.
 
yep it does
oh u know what gets on my nerves????? when ur using the designer view on a winforms app in VS and you close the designer view, then later on u come back to it and you see everything "refresh" inside the view and some of the controls have been placed in the slightly wrong location by VS automatically and the little asterisk appears in the tab title to indicate unsaved changes (but u didn't make any changes)
 
11:15 AM
Lol
Fuck win forms.
and web forms
All forms can go to hell.
 
@Sippy are you serial?
 
Yeah, use WPF and fuck forms.
 
I am an MVC developer
Lol
I associate with MVC because it's cosy
 
well yes web forms can eat my * but i love winforms lol
i feel like i have less control in WPF not sure if that's the case or not but it feels that way
 
I tried writing some WinForms code a while back, after several years in WPF. It was painful.
The lack of composable UI really hurt.
 
11:17 AM
Well yea, WPF just requires some time to get into.
 
@AvnerShahar-Kashtan Are you Irish? You're not supposed to go backwards!
 
But after you are in, you can't get back to WinForms.
 
@Denver can u use gdi+ the same way (basically) in wpf as you can in winforms?
 
@baeltazor Lol
 
like, can you say, "drawline here" and it will draw it (without having to write any weird xaml stuff first)?
@Sippy did i make a funny?
 
11:20 AM
Yes, but it uses own ways to draw stuff.
 
ah
 
Also you can avoid xaml if you don't like it.
 
why not use my way? my way is the way :P
 
@baeltazor Unlike WinForms, WPF isn't a managed wrapper around GDI, but an indepenent implementation of a graphics engine.
 
All xaml can be written in code behind.
 
11:21 AM
@AvnerShahar-Kashtan oh, that does sound really cool
 
You can always put a <Canvas> element, then simply write code that creates a Line and give it the right coordinates on hte Canvas.
@baeltazor It still uses underlying APIs, of course - DirectX/DirectShow, probably GDI as well - but it doesn't just expose their functionality, but has a whole layer of abstraction.
 
nice
 
As for "DrawLine" there are different ways. From high-level to low-level. High-level would be placing a line on your Window. Low-level would be calling a DrawingContext and using DrawingContext.DrawLine();
 
@baeltazor yus.
 
The best part of Drawing in WPF is that all drawn elements are objects. Not just static picture. Everything your draw can be moved, animated, changed, recolored etc.
 
11:28 AM
can you assign custom properties to them with some level of ease?
 
In example?
 
Peanut butter jelly time!
 
Backing to our DrawLine example, you can change its properties at any time with just assigning new values to Line properties. Thickness, color or whatever.
 
@Denver oh, hmm. you guys always make wpf sound so cool and easy lol.
 
line.Thickness = 10; and the line gets redrawn (tho most common way is to use bindings, so you do not change the property of a Line but you change a property, which is bound to your line).
But in simple way calling line.Thickness = x will redraw it. Without needing to call for Graphics or whatever.
 
11:35 AM
@baeltazor There's a learning curve. It's a bit steep, too. But once you're over it, it can do nice stuff.
 
Yeah, learning curve is huge.
 
I think there was a line going around, something like "WPF - Making the easy things hard, and the hard things possible".
 
WPF/MVVM will change the wiring in your brain to a much cooler state. I can't imagine going back to non-WPF UI coding
It would feel like I was being punished
 
Just the WPF Grid makes it vastly superior to WinForms.
 
now, it took me a year to get to this point, and there was much frustration along the way
 
11:41 AM
^ +1
I am being 4 months in WPF now. And I do not regret it, even tho I know that I still have much to learn. Advantages are too huge to avoid. And I hope MS does not stop supporting WPF.
 
lol
they will stop supporting it very shortly. for me, everytime i get to a point where I can confidently say "yeah, i can do this" i find out that Microsoft has deprecated it and there is either no replacement or there is something new to learn yet again
 
For some reason, it seems, that Microsoft bosses or whoever rules there do not understand how great WPF is and they do not pay as much attention to WPF as needed.
@baeltazor Yeah, they are odd. :(
 
I think WPF will be the standard for desktop for a long time.
Most of MS's effort is probably going into WinRT.
 
And XBox :)
 
hai durch
 
11:52 AM
Has anyone worked with Monogames? I haven't tried it, and I'd like to know how much of XNA is integrated
MonoGame*, sorry
 
12:05 PM
guys i'm having an issue here with graphics.MeasureString and TextRenderer.MeasureText. They're both innacurate. I need to get the width and height of a string of text before it's drawn anywhere, so i know where exactly i need to place it. but the results returned are always inaccurate. How can I make it more accurate?

		protected override void OnPaint(PaintEventArgs pe)
		{
			// Get the surface on which to draw.
			graphics = pe.Graphics;

			// Draw the button.

			#region DEBUG ONLY
			if (this.BorderColor.All.IsEmpty)
 
inaccurate in what way?
 
oh sorry, i forgot that part. allow me...
the code above should place it in the center of the button control. but it always places it towards the top left not in center/middle. and the more i resize the button the more inaccurate the measurement appears to be
 
guuuuuuuuuuuuuuuuuh I need 3 monitors
Working on 1 is so 1999
@rlemon I see a lemon
 
is it yellow?
 
Looks blue from here ..
 
12:09 PM
that's a waffle
 
Oh dear.
 
@baeltazor Have not worked in WinForm for a while... Am I right saying that Width and Height there are integers?
 
> For example, the default behavior of the TextRenderer is to add padding to the bounding rectangle of the drawn text to accommodate overhanging glyphs. If you need to draw a line of text without these extra spaces you should use the versions of DrawText and MeasureText that take a Size and TextFormatFlags parameter. For an example, see MeasureText(IDeviceContext, String, Font, Size, TextFormatFlags).
However, if the inaccuracy increases with the size of the control, it must be a problem with your math
 
If I am right with latter, then the problem is the rounding after dividing integers by two.
 
@KendallFrey yeah I suck at math but hmm, not sure about that still. cause if i use the same code to center a .NET button control it inside a container element it centers perfectly. i think it's the way i'm measuring it or something
@Denver ah, that could be it
 
12:11 PM
Try drawing a rectangle using what MeasureText returns
 
@KendallFrey kk, thanks am trying now
 
@Denver That doesn't explain the inaccuracy of more than half a pixel
 
Yeah, I just thought about that too.
Then use WPF. :D
 
@KendallFrey ok so i drew the rect "around" the string i drew. the RED rect is supposed to be the width + height of the drawn string....
 
wha
Are you sure you're using the size of the text as the size of the rectangle?
Also, where's this inaccuracy that you spoke of?
the text looks fine
 
12:18 PM
the width and height returned for the string is way off. i'm pretty sure, i will post my code though cause i am kinda confused atm and probably did screw it up
i will calculate and show you :)
 
Well, what does it return?
 
baeltazor, back to WPF discussion - Visual Studios 2010-2013 are written using the WPF.
 
@Denver yeah and that's around the time i was no longer able to middle click to scroll up and down large files! that pissed me off bit time lol
but the overall performance of VS has improved a lot
 
:D
 
It still crashes every day
 
12:24 PM
yeah lol
 
Well, it is not WPF's fault.
:)
 
And has some problems with web services
 
I've recently found that if I disable my network card (I use it for quick'n'dirty simulation of my app's behavior when losing connectivity), VS2013 tends to crash several seconds later.
Not always.
But usually.
 
@KendallFrey so, ok, this time for some reason the bigger the button the better the measurement. but small button still crappy. i just measured it. string is 59px from top and 60px from bottom. Andddd..... string is 100px from left and 106px from right, so there is a pretty good difference.
 
Never had problems with VS. Prolly I am just creating childish apps.
 
12:27 PM
@baeltazor well then the up/down isn't really a problem, but the extra 6px is funny
 
@Denver This is probably more to do with EF, but trying to use n architecture with EF isn't exactly straight forward.
VS still craps out trying to do scaffolding from a network drive as well.
 
@baeltazor I would make a bitmap of your button at runtime, calculate the amount of pixels from right and from left and adjust the text accordingly. <- Mark as best answer.
 
@Sippy Well, may be so.
 
@KendallFrey thanks, checking it out now
 
12:33 PM
This is the most extended discussion I've ever seen about centering text.
You have diagrams and everything :D
 
:D
 
What's the keyboard shortcut to collapse all in VS2012, anyone know?
 
Gotta write a dissertation about that text centering.
Ctrl M O
 
Star
 
And Ctrl M L to open.
 
12:37 PM
Thanks :D
 
Yeah, best shortcut ever.
 
Ctrl-M-M for a specific region/block your cursor is on.
 
Really
That seems a bit stupid
If you're right handed you kinda can't make good use of that shortcut
 
@KendallFrey thanks Kendell. I've got:

TextFormatFlags flags = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter;
TextRenderer.DrawText(graphics, this.Text, this.Font,
new Rectangle(0, 0, this.Width, this.Height), SystemColors.ControlText, flags);

which gets the vertical alignment right, but the horizontal is still off. Only by 2pixels though. Not sure if I've done it wrong or not
 
Unless you have ridiculously big hands.
 
12:41 PM
@Sippy use the ctrl key on the right?
 
@baeltazor With left hand?
 
yeah lol
 
Bad usability, I tell ya!
I won't be using that one much anyway haha
 
lol
 
Close all is v helpful though
 
12:43 PM
@Sippy I think it's Alt+F4...
 
COLLAPSE ALL
DAMN YOU
 
lolz :P
 
This web forms shit has me highly strung.
 
@baeltazor Try drawing the rectangle again, see if the size or the math is off
 
@KendallFrey i try now.
ah crud, i need to take the bins up. be back later guys. thanks for ur help :)
 
1:10 PM
@KendallFrey It's still off by 2px horizontally after drawing the rect again. Also, same code, but this time it's off by 1px vertically, too.
Not sure whats going on but I think I'm gonna get cancer from this lol
 
is the rectangle 2px off?
 
oh the rect is way massive vertically and way off horizontally:
 
@Sippy W..w..what?
 
1:15 PM
I know it's not right but I had to lol at that.
 
Reading... yes... it poses difficulty for some :/
 
The fact he asked for fluent api
 
@baeltazor looks ok to me
 
When you told him that there was a fluent solution
Much lol
 
@KendallFrey I guess I'll just have to live with it for now. 1-2 pixels is not gonna kill me. It's much better than it was before (~6px) so thanks for your help man :)
 
1:19 PM
@baeltazor Don't say that! Don't you know how many people die every year from Acute Pixel Displacement Syndrome?
 
lol
@AvnerShahar-Kashtan well atleast it'd stop me from obsessing over a 1pixel difference :P
 
@baeltazor I'm working on a small custom control in my app right now, a simple 3x2 grid with some of the controls in it being replaced dynamically. So that's about 8 different tiny controls written by various people on the team, each one alignining itself a bit differently, having a slightly different margin, and generally a pixel-twisting mess.
I'm slowly going over all 8 and removing all margins, alignments and assumptions of location, so that their container control can have, well, control over it.
 
@AvnerShahar-Kashtan Dude, that sounds like hell!
 
@baeltazor It's about 30 seconds work for each control, so it's not too bad.
But I hate fiddling with precise layouts.
Especially since I am occasionally surprised to discover a new control that can be dynamically loaded into the grid.
 
1:37 PM
Negative @juanvan
it turned out to be a bad trace info
the line number reported was one before the actual source of the error encountered
 
sorted then?
 
Dudes and dudettes, why running a console app in Windows 8.1 from a network share would results in:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: The parameter is incorrect. (Exception from HR
ESULT: 0x80070057 (E_INVALIDARG))
at System.Security.Policy.PEFileEvidenceFactory.GetLocationEvidence(SafePEFileHandle peFile, SecurityZone& zone, StringHandleOnStack retUrl)
 
looks like your parameter is incorrect.
 
@Nathvi lol.
 
obviously the problem
 
1:49 PM
Thank you Captain Obvious
It runs fine on a remote server
only if executed from a network share, it generates this error
 
Could be access rights or path issues?
 
I am an admin
 
We used to get quirky shit happen when running stuff off network drives
 
the UNC share is mapped using SUBST
but, the workstation is not part of the domain
the share is
 
1:59 PM
hi
 

« first day (1417 days earlier)      last day (3525 days later) »