.net

WPF FlowDocument - Absolute Character Position

I have a WPF RichTextBox that I am typing some text into and then parsing the whole of the text to do processing on. During this parse, I have the absolute character positions of the start and end of each word. I would like to use these character positions to apply formatting to certain words. However, I have discovered that the FlowDoc...

.NET read binary contents of .lnk file

I want to read the binary contents of a .lnk file. As long as the target of the shortcut (lnk file) exists this works fine with IO.File.ReadAllBytes(string file). BUT If the target of the shortcut does not exist (believe me I want this) the method only returns zero's. I guess this is because the OS follows the link and if it does not e...

How to use XDocument.load / save methods on a password protected network drive?

Hi, I'm wondering what the best way is to use the XDocument.load and save methods on files located on a password protected netshare. I'm building an asp.net mvc application. ...

Dynamic field type handling

I have to do an export from DB to CSV. (.NET 2) field; fileld; field... etc Have 3 types of fields: Alpha, Numeric and Bool respresented as "alphaValue",intValue and True/False. I try to encapsulate this in a fields collection, in order to export if alpha then set "", if Bool=>True/False if numeric let as is. and try to build a CsvF...

What is assembly and what is the use of it?

Im beginner for asp.net Could you tell me what is assembly? and what is the use of it? if i have the questions regarding assemblies how to make answer? please help me. ...

String matching.

How to match the string "Net        Amount" (between Net and Amount there can be any number of spaces, including zero) with net amount? Spaces between these two words can be any whitespace and exact matching of two string should be there. But Net Amount (first string with spaces) can be part of any string like Rate Net Amount or Rate Co...

Why does GC.GetTotalMemory() report huge memory allocations?

I have been playing around with GC.GetTotalMemory(). When I create a local variable of type Titles in the example below, the consumed amount of memory increases by 6276 bytes. What's going on here? class Program { enum Titles { Mr, Ms, Mrs, Dr }; static void Main(string[] args) { GetTotalMemory(); Titles t =...

How can i restart MSDTC service on remote server from client machine

Hi, I have requirement to restart MSDTC service on a remote server throw code of my application . Could you please help me through a code example. Thanks and Regards ShaBeg ...

.NET | Persist multiple objects in minimum number of queries

I have a list of objects which needs to be persisted in a SQL Server database table, where each object gets persisted as single record. i.e. List of objects result in insertion of multiple records. Trivial way of saving the objects is to loop over the list and fire a query/stored procedure/etc. for saving that record. But this results i...

Start process from System Account with a specific User Name

Hi, I'm developing a windows service in C# .net, Account: LocalSystem, System: Windows XP SP3 I want this service to check for all currently logged users if a specific application is running and if not - start this application AS corresponding user name. I provide domain, name, password, but Start() throws Win32Exception exception "Acc...

Implementing auditing using Autofac if it support method interception?

I'm planning to use Autofac IoC for my project where I must implement auditing (Who, What is doing in application). I was already read a lot of articles on this subject (auditing). My intention was to use method interception to implement this functionality. I know that Unity support this, but I was wondering if I can use Autofac for thi...

Conversion of text to unicode strings...

I have to process JSON files that looks like this: \u0432\u043b\u0430\u0434\u043e\u043c <b>\u043f\u0443\u0442\u0438\u043c<\/b> \u043d\u0430\u0447 Unfortunately, I'm not sure how this encoding is called. I would like to convert it to .NET Unicode strings. What's the easies way to do it? Thanks in advance! ...

.net thread safety

Why is locking a type considered very bad? For example, lock(typeof(DateTime)) I understand that static methods of any class in .net is considered thread safe, and that instance members are not. So it isn't necessary to lock DateTime while you are using it. The book I am reading doesn't explain why it is bad it just says it is. Any expla...

C# event or delegate or other solution?

Looking for some help or programmng ideas or mayeb there is some pattern that would help. Have an application that needs to fire alot of events sequentially, it could up to 100 or more unique events, it will be dynamic depeneding on the situation. Trying to find the best practice for doing this. My main idea right now is to create a li...

How can i check sql server 'views' dependencies

Is there a way that i can find out what base tables are being used by views using a custom query or stored procedure? ...

C# listview clickable column and row

What I have going on is a listview inside of my windows form. How can I make so that only when you double click a row it pulls data for row X and column 3. meaning I have a listview of... A|B|C|D 1|2|3|4 @|#|$|% Bc|Dv|D#|dg so if i double clicked row thats begins with @ it will read in column 3 ($). I aleady have FullRowSelect = T...

How to restict the open file dialog box in CF.Net

How to restict the open file dialog box in the device which supports winows compact framework and also need to restict the download option in win CE browser ...

Powershell command for removing items from Appfabric cache

Are there powershell commands to: Get a list of items in the cache Remove a particular item Remove all items Change the value for a particular key I haven't come across a nice blog or tutorial for beginners to get started with Appfabric caching administration. Thanks! ...

Installing MSBuild 4.0 without Visual Studio 2010

I installed .NET 4.0 and VS 2010 RC on my laptop and MSBuild was automatically installed. I was hoping to build a continuous integration server by just installing the .NET SDK without VS 2010, so I downloaded the .NET 4.0 Framework from Microsoft at this link. Unfortunately, it doesn't appear to have installed MSBuild with this downloa...

Ping or otherwise tell if a device is on the network by MAC in C#

I'm developing a home security application. One thing I'd like to do is automatically turn it off and on based on whether or not I'm at home. I have a phone with Wifi that automatically connects to my network when I'm home. The phone connects and gets its address via DHCP. While I could configure it to use a static IP, I'd rather n...