.net

Using Aforge.Net library in .Net CF application?

Can a desktop .net library [Aforge.net] be used in a .Net CF 3.5 application? I agree that the CF is a subset and all... that certain functions etc will not work... but the error i am getting is baffling... AForge.Imaging.Filters.ResizeBilinear resizeBilinear = new ResizeBilinear(240, 320); Bitmap new1 = resizeBilinear.Apply(new System....

Ensure ascii values

I want to ensure certain input into my webapp contains only characters that can represented as ascii (it's for tagging and I'm trying to save space in the database column by using varchar instead of nvarchar) Is there a framework feature to do this in .net or should I check the character codes one by one to ensure they're in the correct...

How can an object not be compared to null?

I have an 'optional' parameter on a method that is a KeyValuePair. I wanted an overload that passes null to the core method for this parameter, but in the core method, when I want to check if the KeyValuePair is null, I get the following error: Operator '!=' cannot be applied to operands of type System.Collections.Generic.KeyValuePair<...

Access violation when accessing a COM object from .Net

...

Random row from Linq to Sql

What is the best (and fastest) way to retreive a random row using Linq to SQL when I have a condition, e.g. some field must be true ? ...

How to: Back button support "Ajax"

I have an asp.net ajax website, it full of things happen on the same page without page reload, such as sorting records, paging,... When the user go to another page in the same site and press the browser back button, how can i make the browser save the page state to return to it with the preselected options such as sorting option, page nu...

How to block Winforms UI while background thread is running

I've inherited a Winforms application that does a lot of long running calls into the application server from the UI thread, so the UI stays unresponsive, unusable, unclosable for quite some time. (Which makes me really go AAAAAAAAARGH!) I plan to move the server calls to a background thread and have the UI disabled - but movable & closa...

Any NIO frameworks for .NET?

Are there any non-blocking IO frameworks for .NET? I am looking for something similar to what Apache Mina and JBoss Netty provides for Java: a framework for implementing highly scalable servers - not just the low-level support that the .NET framework provides. EDIT: To better explain what I would like to see, here is a basic example o...

Find Packet Loss and Trace Route in .NET

Hello All: I am trying to code to capture the packet loss on computers, but the only way I've been able to do so was to run the NetStat.exe and the TraceRt.exe processes and capture them to a listbox (using the code below): Private Sub myProcess() Dim p As System.Diagnostics.Process Dim theFile, sTemp, sLineOut, mySent, myRetr...

How can I list all processes running in Windows?

Hello world. I would like to find a way to loop through all the active processes and do diagnostics checks on them (mem usage, cpu time etc) kinda similar to the task manager. The problem is broken down into two parts: Finding all the processes Finding diagnostics attributes about them I am not sure even in what namespace to go lo...

WPF internal : Why UserControl is overriding AdjustBranchSource ?

By Using reflector you can see that WPF UserControl is overriding AdjustBranchSource. internal override void AdjustBranchSource(RoutedEventArgs e) { e.Source = this; } My very own problem regards inconsistency caused by that issue. When an element is based inside a user control or outside. The Source parameter behaves differ...

Interpreting JavaScript outside of the browser?

This is more out of curiosity that a real requirement, but I'm wondering if it's possible to treat JavaScript as (ideally) a first-class .NET citizen, or (secondarily) have some way of invoking/interpreting pure JavaScript functions (that don't require the DOM) in a desktop setting? Has anyone ever attempted implementing a CLR version o...

Linked List Thread safe?

Well i writing in .net and i have a list to witch i will only add item never remove and its a linked list i can change that if its not the best pick but any way to the point would it be safe to not use any locking in this case when i know that this list will never be changed in any other manner but that its added to? (a lock will be used...

How to write bits to a file?

How to write bits (not bytes) to a file with c#, .net? I'm preety stuck with it. Edit: i'm looking for a different way that just writing every 8 bits as a byte ...

Is there a way to delay an event handler (say for 1 sec) in Windows Forms

I need to be able to delay the event handlers for some controls (like a button) to be fired for example after 1 sec of the actual event (click event for example) .. is this possible by the .net framework ? I use a timer and call my code from the timer's tick event as below but I am not sure if this is the best approach ! void onButtonC...

Looking For A .Net Table Component

I'm looking for a table control (aka ListView or DataGridView) that: Can display a series of rows as a "child" of a row - if anyone's spent any time with Access, it does this when it works out associations between rows will let me insert headers into the middle of the table, so I can e.g. group by a particular row and have a header abo...

How do I create a where condition on a sub table in LINQ

This is in response to this question in the answers section of another question. I have a collection of Orders, each Order a collection of OrderItems, and each OrderItem has a PartId. Using LINQ how do I implement the following SQL statements: 1) Select all the orders that have a specific part ID SELECT * FROM Order WHERE Id in (SELEC...

Standard Output from MSTest, NUnit, MbUnit, xUnit.NET test runners

How do you in any of the common .NET testing frameworks MSTest, NUnit, MbUnit, or xUnit.NET get the command line test runner to output a simple yes/no or true/false or 1/0 on whether all the tests passed or failed? I'm open to workarounds like: 1) no output if all the tests passed, output if anything fails. 2) count of tests that fail...

How to write Code Analysis (FxCop) rule to prevent a method call

How do I write a code analysis tool for vs2008 to prevent a specific framework call, such as GC.WaitForFullGCComplete() or Application.DoEvents() I tried overriding the VisitMethodCall in my custom rule, but I cannot figure out what the Microsoft.FxCop.Sdk.MethodCall parameter really has in it. Could not find example on the web. Can so...

Open file without (really) locking it?

Is it possible to open a file in a way that allows subsequent deletion/renaming of its parent folder? I know you can do this: File.Open("foo.bar", FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete) Which will allow for the file to be deleted when the file handle is closed. However, if it does not allow the parent fol...