.net

Is there a Visual Studio Build Profiler?

My VS.NET 2008 solution is taking longer and longer to compile (ASP.NET 3.5 + ASP.NET MVC 2 + C#) and I am wondering if there is a way to know what project takes the longer to compile and why? I disabled the compilation of a few projects and it helped reduce the build time but I want it faster. ...

How to achieve a captionless bordered Aero window?

I know how I can remove the border of my form, but I simply want to remove the caption. Googling for P/Invokes didn't give me much results, so I'm wondering, how can I achieve such a result? Exampel: http://localhostr.com/files/d2e951/Captionless.jpg ...

What is problem on this lock ?

Hello Highly there is a problem in this lock but i couldn't understand what is that. I have strong suspicious that below example doesn't lock enough well. So what can be problem ? class example { object locker = new object(); void start() { for (int i = 0; i < 1000; i++) { (new Thread(dostuff)).S...

Lazy<T> implementation and .NET generics

I was looking for ways to do lazy initialization and found Lazy<T> which is included in .NET 4. I was thinking of rolling my own implementation of Lazy<T> for .NET 3.5 (with a simpler multi-thread policy), and I bumped into the following problem: Lazy has basically two types of constructors: class Lazy<T> { public Lazy(){...} // ...

Updating a Detached Entity Instance with Navigation Properties using Lazy Loading with Entity Framework 4.0

I have a detached entity that has a navigation property as such: public class ClassA { public int Id { get; set; } public string Name { get; set; } public virtual ICollection<ClassB> ClassB { get { if (_classB == null) { var newCollection = new FixupCollection<ClassB>(); ...

How to reselect date from calendar control after validation failed?

I have a textbox, a imagebutton and a calendar control inside a user control to pick the date from calendar and set the selected date inside textbox. All work well except the validation. I tried to validate the textbox's value to be a valid date. If it is not valid date, I want to reselect date from calendar. but looks like if valication...

How can I get the position of a key on a keyboard

I am writing my own on screen keyboard. The only piece missing is the position of each key on the keyboard. Windows allows you to get the keyboard layout: http://msdn.microsoft.com/en-us/library/ms929433.aspx But how does one get the position of a key for a given layout? ...

Trouble launching program with System.Diagnostics.Process.Start()

What should be a trival matter has now gobbled up an hour of my time! >__< I want to start an executable with a xml path as an argument. (I've added the directory in which this program resides to my system path.) Seems simple enough. My first approach was using the static Process.Start() method as such: Process.Start(@"MyExecutable...

Screen capture window .NET control/library

I'm looking for a control or library to capture what an application is showing on screen in particular IE/Firefox. My app will open an instance of IE to a web page. User does what she needs to do on page then when he clicks button in my app to capture screen of IE/Firefox. My app saves image to db. I started to write it myself but wi...

LogRecordSequence archiving problem

I'm using System.IO.Log.LogRecordSequence for logging and I'm running in to a problem when I'm archiving the log. The log is created as such: m_oSequence = new LogRecordSequence("log dir path\alex.log"),FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite); if (0 == m_oSequence.LogStore.Extents.Count) { fnAddExtent(); fn...

validation error message inside user control disappears after clicked outside

Why my valication error message disappear after click the submit button outside? Is there any way to keep it after clicked the submit button? ...

Visual Studio 2010 debugging ASP .NET MVC 2 app is slow

Hey folks, Asp .NET MVC 2 apps started from Visual Studio 2010 are damn in my opinion. It takes 2-5 seconds to refresh or open a new page. Do you have the same problem? Do you know if this ASP .NET MVC 2 debug mode can be somehow sped up? I work at 64 bit computer, Windows 7 and Visual Studio 2010. ...

jQuery Ajax call not working

Hi i am just trying to make a simple Ajax call using jQuery this is my JavaScript: //Starts the game function startGame() { $.ajax({ type: "POST", url: "Default.aspx/StartGame" }); } my button: <input type="image" value="twist..." src="images/play.png" class="playButto...

Does not exist in current context build question?

The problem is that I have to hit build on my website application multiple times to get all the errors to go away, eventually it will build successfully. But, i get several messages "label, button, etc does not exist in context". If I click on the file, it corrects itself and disappears. If I click build again it corrects. I am looking...

Can't get Left JOIN linq query to work!

I've been looking at the following post and trying to apply it to mine but with no luck: http://stackoverflow.com/questions/525194/linq-inner-join-vs-left-join I have the query below that returns 0 records everytime I run it: var tasks = from tt in d.luProjectTaskTypes join cbt in d.CostByTasks ...

Manually setting the Value of Lazy<T>

I have an object which I create from the response from a webservice. If I get a list of these objects, they have a minimal amount of information (in the example below, ID, Prop1 and Prop2 are returned in the list response). If I get the object by ID, the full set of information is returned, including the child objects in Prop3 and Prop4....

ASP.NET Profiles versioning?

How does ASP.NET profiles handle versioning? I know because the data is serialized this could be a problem where with tables it is not. Will it throw some sort of serialization error? Example: I store a v1 object to the profiles. I update my web application with a new v2 version but the database still contains v1 objects. What will ha...

"You must add a reference to assembly 'System.Data.Services.Client, Version=3.5.0.0'"

I'm building an app using Windows Azure Table. I've encapsulated all my calls to the Table Service into its own assembly. This assembly uses the .NET 4.0 Framework and includes a reference to System.Data.Service.Client (4.0). I'm able to use this assembly from a test project with no issue. When I add this project as a reference to an M...

Is it safe to check an object for null and in the same if-statement compare the object's property value?

See thread title. Can I safely do something like that without worrying about a NullReferenceException, or is not guaranteed that those boolean expressions will be evaluated left to right? // can this throw an NRE? if (obj == null || obj.property == value) { // do something } ...

VSTO: Get Text Cursor position (X/Y)

Is it possible to get the text cursor's position (the X and Y coordinates) within a Word Document (not the mouse cursor)? Basically I need to know where the text cursor is currently located on the screen. Is that even possible? ...