.net

Why does DataContractSerializer not implement IFormatter?

I'm getting a bit frustrated by the lack of consistency within the different forms of serialization in .NET: DataContractSerializer - uses new attributes OR old [Serializable] attributes, but the serializer itself does not implement IFormatter where some of the other WCF serializers do. Opt IN. NetDataContractSerializer - uses new attr...

Understanding AppDomains in Windows

I am trying to better understand appDomains. From my understanding Windows runs all applications in a process. each application is encapsulated in it's own object that resides within this process. This object also holds some global varibles which can not be shared. All objects that are in the process can not share any data with one anoth...

System.TimeSpan creating debugging problems? (Cannot evaluate expression because a thread is stopped at a point...)

Using System.TimeSpan in a C# application, with WPF. TimeSpan is an argument in a method call. SixDOFPosition GetPositionForTimeCount(TimeSpan timeCount) Using VS 2009, this error is displayed in the debugger when trying to look at the value of timeCount: Cannot evaluate expression because a thread is stopped at a point where ...

What should be passed as the objectName when throwing an ObjectDisposedException?

When implementing IDisposable, I undertand that every method that shouldn't be called after the object's been disposed should throw the ObjectDisposedException. But what is the standard for the name object that should be passed to the exception's constructor? ...

how to stop an update panel from refreshing when the same updatepanel does the postback

I have an update panel with a linkbutton inside of it. The updatepanel has its updatemode set to conditional. From what I understand, regardless if the updatemode is set to conditional, it will refresh the panel, if something inside of it initiates the postback. Is there anyway around this? ...

Do some of Castle ActiveRecord's LINQ operators not work?

I'm working with an object model in Castle ActiveRecord that represents pregnant women. It's a simple tree structure: Patient Visit Delivery A Patient has 0 or more Visits and a Visit has 0 or more Deliveries. I've mapped everything to the database, and I can loop through the Patient>Visit>Delivery hierarchy and print out ever...

Redirect without changing urls?

Weird question but here goes... I have a webpage and i want to get images from another site. However i would like to prevent users to knowing which site. It doesnt need to be perfect just 'good enough'. Is there a way i can write and have the browser get the image from another domain? If the user right clicks and hits view image i woul...

How to extract a URL from a 200 character string of words in C#, preferably using RegExp

Hi, I'd like to implement a RegExp (regular expression) that can check a string to see if it contains "http://" (i.e. it contains a URL), and then take that whole URL into a new string variable. The string I am using is not HTML, it is simply text with any arrangement of words, characters, numbers and URLs. I'd imagine I'd look for a m...

Run Silverlight 3 standalone

So I have a small Silverlight application that plays a slideshow of pictures. What I want to do is burn the application to a cd and mail the cd to my mother so that she can run the silverlight application on her computer. I am using Silverlight 3. How do I create a standalone silverlight application/player? ...

Change sound output

Is there a way in windows by which I can toggle the audio output between a built-in speaker and the headphone jack using a python library. I am thinking someone with .NET experience would be able to give me some pointers (I could use IronPython if there is a .NET library to do that). I have no idea where to start. Any hints would help....

NetworkStream.Read delay .Net

I have a class that inherits from TcpClient. In that class I have a method to process responses. In that method I call I get the NetworkStream with MyBase.GetStream and call Read on it. This works fine, excpet the first call to read blocks too long. And by too long I mean that the socket has recieved plenty of data, but won't read it un...

how to trigger page refresh

Hello everyone, I am developing a webpart using VSTS 2008 + C# + .Net 3.5 + IIS 7.0 + ASP.Net. I want to refresh the whole page in my WebPart code, refresh I mean the same effect when user press F5 for browser. I did not find a solution yet, any ideas? thanks in advance, George ...

.NET Reverse Semaphore?

Perhaps it's too late at night, but I can't think of a nice way to do this. I've started a bunch of asynchronous downloads, and I want to wait until they all complete before the program terminates. This leads me to believe I should increment something when a download starts, at decrement it when it finishes. But then how do I wait until...

.NET, Java, AIR, Win32... What's the most compatible environment for running desktop apps?

I have an old Win32 application that I'm considering having someone port to an environment that's more flexible and easier to maintain. The foremost requirement is the new version, like the Win32 version, must install and run without major headaches on Windows machines. In other words, almost all WinXP or later machines should be abl...

Screen synchronization - Event Aggregator VS Caching ViewModel References...

Hi, i did some homework and couldn't find any article about best practices about when to use each method.. just for clarification: When using the event aggregator pattern : each screen has it's own reference of a viewmodel, the viewmodel publish changes using the eventaggregator, which later the observers use to synchronize their state....

How to move .NET libraries to a subdirectory?

I want to put all libraries (dll) used by my application to a subdirectory (let' say named "lib"). How to instruct assembly loader to look for referenced assemblies in that particular directory (which is a subdirectory of a directory, where main assembly exists)? I assume it should be done by some settings in app.config, right? ...

Text editing LinkedList vs List of lines.

I'm writing a text editor using C#, I know i'm just reinventing the wheel but it's a learning experience and something I want to do. Right now I have a basic Text Document using something that resembles a Gap Buffer however I have to update my line buffer to hold the start of each line each time an edit is made to the buffer. I am look...

How do I set up an ASP.NET build server?

I want to create an ASP.NET build server for the first time since I've never used it. Does anyone have a tutorial or resource on how to make an ASP.NET build server? Or can anyone tell me how it's done? ...

How would this snippet be rewritten using F#?

I'm learning F#, and I'd like to know how a snippet like this could be written using F# only: 2.times { puts "hello" } If you can explain how/if functions that take blocks are possible in F#, that would be great as well. ...

.NET SCTP implementation

Hello, I'm looking for a .NET implementation of the SCTP protocol. A component or a C#/F# source code would be preferred, however if no such thing is available a VB.NET source code could probably work too. The project I'm working on is targeting the .NET Framework v3.5 but anything that works with .NET v2 to v4 is welcome. ...