.net

BinarySearch not having expected results

I have populated a sorted list of dates(stored as strings in the format dd/mm/yyyy) from an xml file using xpath. However when querying the list to see if a date exists within the list I always get negative result(i.e. doesnt exist) even though i have hardcode the query string to match a date within the list. However, when doing a stri...

How can I get Excel-like formulas in .Net?

Should I use a commercial component? Should I roll my own expression evaluator? Should I roll my own dynamic language? I know programmers are notorious for wanting to write their own language, but this is not the case here. The less work, the better. Lets assume that compatibility with Excel formulas is not a strict requirement; if t...

How do I stop a windows service application from a thread?

I have a windows service that starts a thread in the OnStart method. Basically I want to be able to stop the service if something goes really wrong (like an unhandled exception). Currently I'm using ServiceBase.Stop() but that involves having a ServiceBase instance somewhere visible to the thread, which in turn involves having my insta...

What kind of data can apps store in the Mesh (and how)

Hi, Currently one of our applications is being deployed using ClickOnce and it creates a SQL Server Compact 3.5 database in the user profile Application Directory (roaming). I am wondering if Live Mesh would enable us to store this data in the Mesh instead? Either by storing and accessing the database file directly in/from the Mesh or ...

.NET Third Part Active Directory APIs?

Was wondering if anyone had any recommendations on a .NET (preferebly 3.5) Active Directory API wrapper around the .NET libraries? Essentially, I'm looking for a class library that could be dropped into a project or even exposed in larger part of a company-wide framework that takes a lot of the hassle of writing your own. Also, ideally...

Execute a stored procedure in Entity Framework from within an ADO.Net DataService

I am using ADO.Net DataServices to expose an Entity Data Model to Silverlight. The model has a stored procedure that returns void. I want to call this procedure from the Silverlight client. My understanding is that I should add a [WebInvoke] method to the DataService class and use DbCommand to call the stored procedure. Here is my co...

VB.NET and OOP - Shared Methods and Base Properties

If you can't use Me. in a non-instance method, how would you use properties/functions from a base class in a Shared method? For example, ClassB inherits from ClassA ClassB has a Shared Method DoWork(); ClassA has a ReadOnly Property SecurityKey How do I … Public Sub DoWork() Dim test as String = Me.SecurityKey End Sub ...

Calling Powershell Pretty Console Output from c#

Powershell has some pretty nifty formating modules for displaying objects, arrays, collections, dictionaries, and tabular data. Since Powershell is all .NET, I'm assuming there is a Assembly containing the logic for this. Who can come up with a way to call these powershell formating from .NET: I'd imagine something like this: Console...

.NET Deployment to Network Share

I have a .NET 3.5 application that I wish to install on the client's server and have workstations run it directly from the network share. I've read a bit that seems to suggest this isn't as easy as simply copying the application to the network share like I would for a native exe. Unfortunately, there seems to be a lack of documentation o...

Does the ADO.NET Entity Framework Support Compact Framework

Well does it? ...

How to get at contents of Forms Authentication ticket with PHP

I need to undo the following ASP.Net processes in PHP so I can get at the username and expiration date in a ticket. I've decrypted the 3DES encryption (step 3 below) but I'm not sure what I need to do next. Is the string that results from decryption a byte array? Should I be able to convert it to ascii? (Because it doesn't). What ASP.Ne...

How do I indicate that a method never returns a null using code contracts?

How do I indicate that a method never returns a null? Currently this is my code. Line 19 gets an Ensures not proven message, even though CreateFunction assumes that the result is not nothing. 1 <Pure()> Public Function CreateFunction(Of TArg1, TArg2, TResult)(ByVal body As Func(Of Expression, Expression, BinaryExpression)) As F...

Suspend Redraw of Windows Form

I have a windows form. It contains several datagridviews on it. At some point, the user can press a button which updates the datagridviews. When they do, they can usually sit and watch the datagridview redraw itself, one row at a time. I'd like for the control to not paint until its "done", that is, I'd like a way to tell the control...

How to detect if an aspx page was called from Server.Execute?

I have the following example page structure: Webpage.aspx Script.aspx If I call Server.Execute("Script.aspx") from Webpage.aspx, how can I detect in Script.aspx that it was called from Webpage.aspx and not directly from a web browser? I've tried checking the Referrer but this only seems to return domain and not the script. I'm usin...

How can I login to Active Directory with C#?

How can I login to AD without logout from current user and get new logged user's rights. (OS: Windows XP) Note: Not to Modify AD or something like this.Only wanna to login with another user from C# and getting new login's permissions/rights. (I wanna use this rights not only in current thread but also whole explorer. Like deleting file...

How to initialize 48bpp bitmaps from RGB?

I'm writing an interpreter in managed C++ for, among other things, the PPM image format. The image spec allows for images with up to two bytes per pixel per channel, or 48 bit per pixel color images. I'm attempting to read this format and convert it to a .Net bitmap, but im having trouble getting it working. When I have 24 bit per pix...

LINQ - Add property to results

Is there a way to add a property to the objects of a Linq query result other than the following? var query = from x in db.Courses select new { x.OldProperty1, x.OldProperty2, x.OldProperty3, NewProperty = true ...

Is it possible to determine if assembly was loaded inside a web service?

In a .Net web service is it possible to determine if the assembly was loaded inside a web service? If it is, how would such a check be made? And from such a check can the original location of the assembly be determined? It's a long story involving assemblies being shared between multiple entry points of our application on a server som...

OCR image in .NET Compact Framework

Is there any library or code samples to convert an image to text in the .net compact framework? I have seen an app on a mobile phone that you can take a picutre of a business card and it will auto fill in a contact record so I know it is possible but I was wondering how to do it. I searched google and can't seem to find anything specifi...

VS2008 - benefit of running Unit Tests for a CF Library on an emulator?

When using the VS2008 unit testing framework, I see the testrunConfig has an option to set the Host. If I change the Host from "Smart Device" to "Default" it appears like I can run the tests without deploying to an emulator. I am wanting to test a library built for use on the Compact Framework, but it has nothing to do with the UI, etc....