.net

.NET Remoting: monitoring events on server

Hi. First of all, sorry for my english. It's not my native language. Here is the problem: I'm writing client-server application based on .net remoting. The application is some kind of calculator. Client application has some field(number A and number B, and label for result) and some possible actions, represented by the buttons: Add, Su...

Wrapping up a C++ API in Java or .NET

Has anyone successfully "wrapped up" a C++ API in Java or .NET? I have an application that provides a C++ API for writing plug-ins. What I'd like to do is access that API from .NET or Java. Would I need to use COM, or are there simpler/better alternatives? ...

WMI Win32_Process.Create fails with Insufficient Privs

I'm trying to run a simple cmd utility on a remote Windows server from within a vbscript by invoking the Win32_Process class, like so: serverIP = "10.0.0.3" Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & serverIP & "\root\cimv2:Win32_Process") RunCommand = "cmd.exe /c echo hello >c:\hello.txt" wscript.echo RunComm...

POST request message to a URL takes abnormal time

Hello, I am trying to POST to a URL on the click of a button (to enable trigger pulse of the camera). I have a similar code to disable trigger pulse on the click of a button. The problem i face is that there is an abnormally high delay for the action to get completed. I could not figure out why it completes early sometimes and takes ...

How to do a UDP multicast across the local network in c#?

I am trying to get some simple UDP communication working on my local network. All i want to do is do a multicast to all machines on the network Here is my sending code public void SendMessage(string message) { var data = Encoding.Default.GetBytes(message); using (var udpClient = new UdpClient(AddressFamily.Inte...

Reading custom HttpWebResponse StatusDescription?

I'm setting a custom StatusDescription in a RESTful WCF service when an exception is thrown. It's meant to provide the caller with a friendly description of why they got the failure status code. The following is the response I see in Fiddler. So I know that my custom message is getting pushed back through to the caller. What I can't ...

Using BitmapFrame for metadata without locking the file

I've found the common way to get image metadata in WPF is to create a BitmapFrame object and inspect the Metadata property on it. However I can't seem to create a BitmapFrame object that fulfills these two requirements: Does not lock the file Does not throw weird, undocumented exceptions when given certain files Using these lines see...

AutoSize for Label / TextBox in .NET Compact Framework

Hi! I'm quite simply going totally bonkers with the omission of the AutoSize-property for the Label and TextBox controls in .NET Compact Framework. I have a simple app, that's supposed to list a bunch of text data (generally between one-liners to a few paragraphs of text) in a TabControl. Everything else works smoothly, but my attempts ...

Attributes vs comments

What advantages do attributes have over the use of comments (or xml comments at the signature level)? I do remember seeing a thread in the C# section of this site somewhere, but I can't find it now. Also, is it possible to apply an attribute to a specific parameter in a method (this was an interview question I read somewhere)? ...

FitNesse RowFixture: contains, startsWith, endsWith...

Is it possible to express this in a RowFixture in FitNesse for .net: contains(data) startswith(data) endswith(data) ...

Encrypted data size while using Triple DES

I intend to use TripleDES in one of my project. I was doing some experiments to be comfortable with it. I understand block size of triple DES is 8 bytes so I assume that if give 8 byte of data, I should get 8 bytes of encrypted data. But what I get is: Input Size | Encrypted Size . | . . | . 6 bytes | 8 byt...

Better way to make this case REST

Imagine this case: A color has an id. Easy enough. The same color can, depending on the user's language pref, search query and personal preference have a different display name. This display name is not defining, but it needs to be passed on to each page so the user is confronted with the same label every time the color is mentioned. Fu...

Dynamically editing a node label in treeview

Hi I have a treeview control. I just want the user to edit the text of a node for the some specified nodes alone. In treeview control i have labeledit property which makes the text editable for all nodes in the tree but i want only the corresponding node text to be editable.. Some thing like treeview1.nodes[1].edit=true........ Any...

how i can list out all the namespace in XML?

hi My basic requirement is to get element value from the XML file, i have used XMLDoxument.SelectSingleNode. My XML file contains some Namespace in header, so i have used NameSpaceManager to add namespace-prefix and i have used prefix to get that particular element. Now in my XML files that namespaces are getting vary, i don’t want to...

How do I implement intellisense-like suggestion boxes for a winforms textbox?

We have a textbox that the user enters sets of terms into, delimited by commas and separated by newlines. There may be thousands of valid terms, so we'd like to offer the user intellisense-style suggestions as they type. The default autocomplete isn't adequate because it will only do prefix-matching on the entire textbox, and won't sup...

converting a .net Func<T> to a .net Expression<Func<T>>

Going from a lambda to an Expression is easy using a method call... public void GimmeExpression(Expression<Func<T>> expression) { ((MemberExpression)expression.Body).Member.Name; // "DoStuff" } public void SomewhereElse() { GimmeExpression(() => thing.DoStuff()); } But I would like to turn the Func in to an expression, only i...

Finding multiple indexes from source string

Hello, Basically I need to do String.IndexOf() and I need to get array of indexes from the source string. Is there easy way to get array of indexes? Before asking this question I have Googled a lot, but have not found easy solution to solve this simple problem. ...

Cleaning up your source tree

Hi, What are the common things you remove when clearing up your source tree? For instance: Deleting bin/obj/debug/release directories Removing temporary/cache files, such as ReSharper cache files Removing source control files/directories, such as _svn and .svn Also, what are the things you commonly do with your source tree? For in...

Strip out all whitespace?

Hi, What's the best way to strip out all whitespace from a .Net website? I found this site Whitespace removal - 4Wall Art Site If you look at the source it's clearly a .net site but all unwanted tabs and spaces are removed. Now I've searched around it seems a regular expression on the page render is the best method but does anyone have...

ASP.Net URL rewriting and authentication

I have a web application using the .Net 2.0 framework. The whole website is restricted to authenticated users using Windows authentication. These rules are set in the web.config file the following way : <location path="/"> <system.web> <authorization> <allow roles="CustomerAdministrator, Manager"/> <d...