.net

What techniques/tools are there for discovering common phrases in chunks of text?

Lets say I have 100000 email bodies and 2000 of them contains an abitrary common string like "the quick brown fox jumps over the lazy dog" or "lorem ipsum dolor sit amet". What techniques could/should I use to "mine" these phrases? I'm not interested in mining single words or short phrases. Also I need to filter out phrases that I alread...

Best Practices Using Git with Visual Studio?

I'm considering migrating from Subversion to Git at work, and would like to get opinions about the best way to set up Git on Windows, and any problems that might arise from the combination of Visual Studio and Git. The current setup is TortoiseSVN, with Visual Studio 2008 and AnkhSVN for .NET applications. The replacement would probably...

What does the CreateMask function of BitVector32 do?

What does the CreateMask() function of BitVecto32 do? I did not get what a Mask is. Would like to understand the following lines of code. Does create mask just sets bit to true? // Creates and initializes a BitVector32 with all bit flags set to FALSE. BitVector32 myBV = new BitVector32( 0 ); // Creates masks to isolate each of the...

Windows Magnification API, .NET and matrices.

I'm trying to create a magnifier app in .net using the Windows Magnification API. I've pretty much got everything working except for actually setting the magnification level (which defaults to 100%). The problem is, I can't find any examples anywhere on the net and all the documentation for the API is C++ code. This is the particular ...

How to use flags enums in Linq to Entities queries?

Hi, I have a [Flags] enum like this: [Flags] public enum Status { None = 0, Active = 1, Inactive = 2, Unknown = 4 } A Status enum may contain two values such as: Status s = Status.Active | Status.Unknown; Now I need to create a linq query (LINQ to ADO.NET Entities) and ask for records whose status is s above, that is Acti...

Using .NET to get data from Excel as a database

I would like get data from Excel files using .NET The Excel file is being used so I can't open it. What I do is connect to it as a datasource using OleDB. The problem is that I get a cell's data but not its style. A date value in Excel changes into a datetime format in .NET and a cell set as currency in Excel is showing as an integer i...

How do I group by a property in an object collection using LINQ?

Hi, I have a collection of objects as Dim XXX As IEnumerable(Of MyObject) which has been populated. There is a property in MyObject that I want to group by, for example MyObject.MyCode. Looking through the LINQ examples it is not clear what the Group XX By INTO syntax is doing and I can't understand it. So what I'm after is the abilit...

Syntax for applying an attribute to an anonymous method?

This is related to the question about return type attributes and anonymous classes, but then for anonymous methods (or lambdas), but as far I could find this exact question does not seem to be on stackoverflow yet. In code for business entities that we generate using CodeSmith we now have [DebuggerNonUserCode] attributes, so they don't ...

Using ClickOnce to publish existing exe with developed dlls

I have an win-forms application that takes an existing exe which we do not have the source code for. We do, however, develop several Dlls that plug-in to the application to provide the core back-end functionality. I'd like to be able to configure ClickOnce to deploy this app, but I'm not sure if this is possible given that the main exe...

.Net Declarative databinding in nTier

I have an existing .Net single tier web app that is built using declarative data binding in the markup using EntityDatasource objects. I am in the process of extracting out the layers (Business Logic, Data Access) from the UI and migrating this to a ntier app. This app is using Declarative data binding. e.g.: <asp:DropDownList ID="...

.NET : How to PInvoke UpdateProcThreadAttribute

Hi All: I am trying to PInvoke UpdateProcThreadAttribute() on Windows 7 but my attempts just keep returning FALSE with a Last Win32 Error of 50. Function declaration (from MSDN) BOOL WINAPI UpdateProcThreadAttribute( __inout LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList, __in DWORD dwFlags, __in DWORD_PTR Attribute...

ABCpdf copying document properties

I'm trying to copy a PDF using ABCpdf's AddImageDoc. Doesn't look like any document properties (like "/Rotate") get copied along. It looks like I have to copy these properties manually from old document to new using SetInfo method. Like so: foreach page...{ newPdfDoc.Page = newPdfDoc.AddPage(); newPdfDoc.AddImageDoc(existingPdfD...

Event problem C# .NET UserControl

I have an UpdatePanel and in it a regular Panel. In the Panel I dynamically add simple UserControls. The Usercontrol has a Button and a Label. When I click on a button in a control it removes all controls in the Panel which I have added dynamically. Can anyone help? int controlID = 0; List<Control> cc = new List<Control>(); ...

.net: Shorten a string, store it as a new string, and later 'rehydrate'

I have an application that stores each user role as a comma-delimited string in the userData portion of the forms authentication ticket. We have run into a situation where a user was part of many roles, and those roles all have long names. There is a maximum # of characters that you can put into the userData, likely a limitation of cook...

Make an object accessible to only one other object in the same assembly?

Each business object has a matching object that contains sql calls. I'd like to restrict these sql objects in a way where they can only be used by the matching business object. How can this be achieved? Update Greg brought up the point about testability. Since the SqlObjects will contain very business-process specific sql I don't want ...

Convert DataTable to List<>

Hello, I have an strongly typed DataTable 'MyType', I'd like convert it in an List. How can I do this ? Thanks, ...

How do you delay load a managed DLL from within an unmanaged app?

I have a native c++ app, and I want to use some managed types that are in a separate managed dll. I believe that one way to do this and still keep the c++ app totally native is to use COM interop with .NET. However my problem is that my app has to initially run on machines that don't have the CLR installed, so I don't want the CLR to be ...

convert byte[] to string

How do you convert a byte array to a string? I need to get the raw content, e.g. "96=A8=FC-=A8=FE", but when I use say Encoding.UTF8.GetString(bytes), it returns "96��-��". Thanks! ...

Regex to match tags in comments.

I want to get a regex which will match a tag in a java comment so I can replace it with a .net comment. eg I have this: /** * Some method description * * @param paramName Parameter description * which may span more than 1 line * @return return value. * @throws ExceptionName some exception description * again may span...

Looping through rows in a DataView

The DataView object doesn't have a Rows property like DataTable. How do I loop through the rows of a DataView? ...