.net

Process.kill() denied in Windows 7 32bits even with Administrator privileges

Hello every one. I'm faced with a weird problem. My application has a simple method that in case IE enters a state were it gets unresponsive this method is fired closing all IE process's and then the application restarts its work with IE. Method code: foreach (System.Diagnostics.Process exe in System.Diagnostics.Process.GetProcesses()...

C++ to C# array declaration

I want to convert the below code to C#: struct Elf32_Ehdr { uint8 e_ident[16]; // Magic number and other info uint16 e_type; // Object file type uint16 e_machine; // Architecture uint32 e_version; // Object file version uint32 e_entry; // Entry point virtual address uint32 e_phoff; // Prog...

Powershell One-Liner to return version of .NET Framework on a machine?

My first guess is something involving WMI. Does anybody know better? Clarification: One-Liner to return only the latest version for each installation of .NET ...

Choosing the right exception type when custom attribute is missing

I have some trouble for choosing the right type of exception to throw when an expected custom attribute is not found (I would prefer one of the existing .NET exceptions). What do you recommend in this case? Thanks in advance. Edit: Here his the context: [<ExpectedAttribute()>] let foo args ... = ... The function foo (which is user-...

Get substring from string with a regex

How can I get my four numbers from strings with this format: Some text with 1 numbers (10/ 100) some other text... From -10°C to 50°C Some other text with 2 numbers (10/ 100) some other text... From -11°C to -2°C Some other text with -30 numbers(100/ 1001) some other text... From 2°C to 12°C First two numbers are in the brackets and ...

Using ASP.NET HttpCache to buffer data from a web service

What problems might I encounter by using the HttpCache to buffer data from a web service, as opposed to storing the same data in a database table? In a hypothetical situation whereby the service was temporarily unavailable, if the server needed to reboot during that time there would be no way to re-populate the cache. So for that reason,...

StackOverFlow on Application start point

I built a program, and i press a button, the program crashes. Here is the button's code: _alRecord.WriteXml(@".\alRecord.xml", XmlWriteMode.WriteSchema); Debuging returned StackoverFlow(location is marked in a comment), Here is the whole code: private string alFile = @".\alRecord.xml"; public DataTable alReco...

"Object reference not set" error

I have the error "Object reference not set to an instance of an object." on the next method: private void alSave_Click(object sender, EventArgs e) { _alRecord.WriteXml(@".\alRecord.xml", XmlWriteMode.WriteSchema); } and i don't know what can i do... here is the code: private string alFile = @".\alRecor...

Is Mono a subset of .NET?

I know the converse is not true, but if my application works using Mono is it guaranteed to work if I switch to the real deal? If not, where can I find a list of caveats? ...

What are the kind of variables that must be disposed? (.NET/Java)

Three questions: What kind of variables should be disposed manually in .NET/Java? I know that SqlConnection should always be either disposed manually or used in a using{} block. Is it right? What are the other kind of variables that should be disposed? I read somewhere that unmanaged code must be disposed manually. Is that right? What ...

Merge elements in IEnumarable according to a conditon

Hello Everyone, I was looking for some fast and efficient method do merge items in array. This is my scenario. The collection is sorted by From. Adjacent element not necessarily differ by 1, that is there can be gaps between the last To and the next From, but they never overlap. var list = new List<Range>(); list.Add(new Range() { Fro...

Parallel Extension & locking - C#

I am reading the excellent article on Parallel extensions by Joe Albahari. He says, Leveraging multiple cores is easy for most server applications, where each thread can independently handle a separate client request, but is harder on the desktop — because it typically requires that you take your computationally intensive...

GPS intermediate driver...

I am writing a program that should take several GPS coordinations and do some processing on them. I assume the server on which the app is going to be installed should be equipped with a gps receiver. I am quite new to GPS things. 1) One of my question is that does the GPS receiver store the gps coordinations temporarily to be used in a...

Formulating both general and specific stub-methods?

Hello, in order to test another class, I want to create a stub for an interface IFoo: public interface IFoo { int DoSomething(int value); } The stub is created in the SetUp (or TestInitialize)-method for the test fixture and stored in a property as almost all test methods need an IFoo: this.Foo = MockRepository.GenerateStub<IFoo...

Fluent NHibernate XML Field

Is there a way to map an XML field using Fluent Nhibernate. If you have an XML field in MSSQL database, how would you Map using Fluent NHibnernate? Example Table("Address"); LazyLoad(); Id(x => x.AddressId).GeneratedBy.HiLo("1000"); Map(x => x.AddressLine1).Length(100).Not.Nullable(); Map(x =>...

System.Tuple in two assemblies, what to do?

Error 1 The type 'System.Tuple' exists in both 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\mscorlib.dll' and 'c:\Program Files (x86)\FSharp-2.0.0.0\bin\FSharp.Core.dll' C:\Users\Bent\documents\visual studio 2010\Projects\FSharpExtensionsCSharp\FSharpExtensionsCSharp\FSharpListEx.cs 51 41 FSharpExten...

Sharing cache between apps (asp.net) on the same physical machine.

We have several virtual applications inside one main (root) application. How to share Cache between this virtual application and main application if they are located (and always will be) on the same physical machine? By Cache i assuming System.Runtime.Caching or System.Web.Caching. Hope that i do not need to setup AppFabric Caching for...

How can I use Func<Tkey,T> in linq?

How can i change below codes to second Type: i try to use flexable codes like first =>second usage... First Type private void Form1_Load(object sender, EventArgs e) { List<City> cities = new List<City> { new City{ Name = "Sydney", Country = "Australia" }, new City{...

Extended filed properties in a custom data provider with SSRS

Hello, I wrote a custom data provider for the SQL Server Reporting Services. I found many articles describing how to retrieve and use the extended properties, but nothing about how to set them in my custom data provider. So my question is, how can I define extended field properties, such as color and formatting, in my custom data pro...

Programmatically define layout for printing images in .NET

When you print images in Windows Photo Viewer, you can define various options: Number of copies of each picture Paper size (Letter, legal, tabloid...) Layout (full page photo, 5x6, 5x7, etc) Is it using WIA? If not, what technology should be used? Any code/ready component available to accomplish the task by accessing those printing p...