.net

Simple Regex help for C#

I have an unfinished binary file that has some info that I can recover using regex. The contents are: G $12.Angry.Men.1957.720p.HDTV.x264-HDLH Lhttp://site.com/forum/f89/12-angry-men-1957-720p-hdtv-x264-hdl-538403/ L I Š M ,ABBA.The.Movie.1977.720p.BluRay.DTS.x264-iONN Phttp://site.com/forum/f89/abba-movie-1977-...

How can I use a ssl wildcard certificate to mutually authenticate several WCF servers via X509?

I've got two WCF servers, both on the domain mydomain.com (fictional example, as are IP below !), respectively named server1 and server2. They are both accessible through their public IP addresses (foo.1 and 2), but also from the private LAN they are on (ie 192.168.0.1 and 192.168.0.2) I own a wildcard ssl certificate for *.mydomain.co...

Activator.GetObject - Using the state parameter.

In .NET Remoting, Activator.GetObject method has a state parameter. What is the purpose of this state param? Can I retrieve its value from server side? mdsn didn't help much. What I'd like to do: Client side: ChannelServices.RegisterChannel(new TcpChannel(0)); object obj = Activator.GetObject(typeof(MyObj), "tcp://serverName:1234/Remot...

Accessing private member of a parameter within a Static method?

How can this code compile? The code below in the operator int CAN access a private variable of the class MyValue? Why? class Program { static void Main(string[] args) { Myvalue my = new Myvalue(100); Console.WriteLine(my + 100); Console.Read(); } } public class Myvalue { private int _myvalue; ...

How do I find which control is focused?

I have a .net MDI application written in vb.net. I'm trying to program a form that will allow the user to select a special character such as °, µ, ², ³, ɑ and so on and have that character inserted into whatever control was focused prior to their launching the form via a hot-key or the main menu in the MDI parent. The easy way to do th...

How to get the Form.DesktopBounds from before the window was minimized or maximized

I would like to save and restore the state of a WinForms Form, more specifically the DesktopBounds and the WindowState. However, when the WindowState is not normal (i.e. minimized or maximized) then I would like to save the previous value of DesktopBounds, when the Form was still in a normal state. Obviously, windows remembers this pr...

How to integrate a blog engine into an asp.net mvc site?

My current site (VisualHint) uses ExpressionEngine and allows me to have the basic ecommerce I need inside a templated web site containing several blogs (one is the main blog, the others are testimonials, announcements). But I need more to handle licenses and subscriptions, so I decided to port the site to asp.net mvc. My only concern r...

.NET Workflow Engine Suggestions ( currently considering stateless )

I came across stateless, a hierarchical state machine framework based on Simple State Machine for Boo, but configured using C# 3.0 It is easy to configure and use, I will probably use it soon. But I was just wondering if Anyone used stateless for real projects (If so what is your opinion?) Are there any other good workflow engines fo...

What is the best Battleship AI?

Battleship! Back in 2003, (when I was 17,) I competed in a Battleship AI coding competition. Even though I lost that tournament, I had a lot of fun and learned a lot from it. Now, I would like to resurrect this competition, in the search of the best battleship AI. Here is the framework: Battleship.zip The winner will be awarded +45...

Pimp my UAC and a few questions about it

Hi, I have this application that need to do some things in protected paths (like %PROGRAMFILES%), I know that I should be using %APPDATA%, but I can't change that for now. I have isolated all the things that could require UAC to show up on another project, here's a sample code: using System; using System.Diagnostics; using System.IO; u...

What License should I use for a new OSS project in .NET

Greetings, Anyone who is big into TDD and who uses .NET seems to eventually run into the sealed classes problem. Some classes in the .NET library are sealed which prevents you from extending them (and thus mocking them). To add insult to injury Microsoft does not provide interfaces for these classes. Work of all the classes have a t...

ClickOnce: BadImageFormatException when running x86 package on 64 bit windows

My .NET 2.0 application imports unmanaged 32 bit dll. The dll is loaded (first interop call happens) when user opens a file via a dialog within the application. When I deploy the application via clickonce with target platform "Any", users on 64 bit windows get BadImageFormatException when trying to open files from the application (at th...

Need microsecond delay in .NET app for throttling UDP multicast transmission rate

I'm writing a UDP multicast client/server pair in C# and I need a delay on the order of 50-100 µsec (microseconds) to throttle the server transmission rate. This helps to avoid significant packet loss and also helps to keep from overloading the clients that are disk I/O bound. Please do not suggest Thread.Sleep or Thread.SpinWait. I woul...

Linq To Sql Associations

So I've created a dbml in my project, which has three tables: Elements, ElementImages and Images. Every Element record could have multiple ElementImage records and each of those ElementImage records should have one Image record. The primary and foreign keys are all set up correctly and the associations are defined correctly as well. ...

.NET WCF calling .asmx with WS-Security

Can a .NET WCF Client program call an existing (vendor supplied) .asmx web service that uses WS-Security for logon? In our case, the vendor has provided an .asmx web service with WS-Security. We are going to try to use SOAPUI and WCFTestHarness or WCFTestClient to access it first. Would rather use WCF if possible. Thanks, Neal Wal...

hosting a WCF + ASP.NET website

I'm working on a website written in ASP.NET that will access a WCF app. and possibly, some parts will be developped using Flex. So, I'm already looking for hosting for my app. I want to know : -what good providers are there out there that can provide me hosting for all the parts of my app ? (WCF, ASP.NET, and Flex(?,don't know flex yet...

Find which account a service is set to "Log On As"

How to find out the user account (Local System/User etc) a service is set to run under ("Log On As")? Unlike this similar question this code can't run from within the service itself and the service may not be running. The System.ServiceProcess.ServiceController class has useful methods for getting the status but not the "Log On As" use...

Get the date-time of last windows shutdown event using .NET

Is there a way to find out when the system was last shutdown? I know there's a way to find out last boot up time using the LastBootUpTime property in Win32_OperatingSystem namespace using WMI. Is there anything similar to find out last shutdown time? Thanks. ...

Debugging RESTful WCF Service

I am attempting to debug a RESTful WCF service I've created using a web browser as my client. Initially things go well however after stopping the debug session and making some changes to my code when I restart it's as if the old code is still being run. My breakpoints are ignored and it's as if a process is not being stopped. I am runni...

Extension 'Class': Good use of extension methods and increase code readability... or bad smell?

So I've been dealing with several APIs recently provided by different software vendors for their products. Sometimes things are lacking, sometimes I just want to make the code more readable, and I'm trying to avoid a ton of static methods where they don't belong to "get what I need" from the APIs. Thus, I've found myself writing quite a ...